Update to the latest APIs
This commit is contained in:
parent
8ae6e67eea
commit
f333a90fab
165 changed files with 2963 additions and 4747 deletions
|
@ -12,14 +12,14 @@ const GRADIENTS = [
|
|||
export function UserAvatar({
|
||||
size,
|
||||
displayName,
|
||||
name,
|
||||
handle,
|
||||
}: {
|
||||
size: number
|
||||
displayName: string | undefined
|
||||
name: string
|
||||
handle: string
|
||||
}) {
|
||||
const initials = getInitials(displayName || name)
|
||||
const gi = cyrb53(name) % GRADIENTS.length
|
||||
const initials = getInitials(displayName || handle)
|
||||
const gi = cyrb53(handle) % GRADIENTS.length
|
||||
return (
|
||||
<Svg width={size} height={size} viewBox="0 0 100 100">
|
||||
<Defs>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, {useState, useEffect} from 'react'
|
||||
import * as AppBskyGetProfile from '../../../third-party/api/src/types/app/bsky/getProfile'
|
||||
import * as GetProfile from '../../../third-party/api/src/client/types/app/bsky/actor/getProfile'
|
||||
import {StyleProp, Text, TextStyle} from 'react-native'
|
||||
import {useStores} from '../../../state'
|
||||
|
||||
|
@ -12,26 +12,26 @@ export function UserInfoText({
|
|||
style,
|
||||
}: {
|
||||
did: string
|
||||
attr?: keyof AppBskyGetProfile.OutputSchema
|
||||
attr?: keyof GetProfile.OutputSchema
|
||||
loading?: string
|
||||
failed?: string
|
||||
prefix?: string
|
||||
style?: StyleProp<TextStyle>
|
||||
}) {
|
||||
attr = attr || 'name'
|
||||
attr = attr || 'handle'
|
||||
loading = loading || '...'
|
||||
failed = failed || 'user'
|
||||
|
||||
const store = useStores()
|
||||
const [profile, setProfile] = useState<
|
||||
undefined | AppBskyGetProfile.OutputSchema
|
||||
>(undefined)
|
||||
const [profile, setProfile] = useState<undefined | GetProfile.OutputSchema>(
|
||||
undefined,
|
||||
)
|
||||
const [didFail, setFailed] = useState<boolean>(false)
|
||||
|
||||
useEffect(() => {
|
||||
let aborted = false
|
||||
// TODO use caching to reduce loads
|
||||
store.api.app.bsky.getProfile({user: did}).then(
|
||||
store.api.app.bsky.actor.getProfile({user: did}).then(
|
||||
v => {
|
||||
if (aborted) return
|
||||
setProfile(v.data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue