Add profile loading shim (#1940)

This commit is contained in:
dan 2023-11-16 23:23:58 +00:00 committed by GitHub
parent 22df70b3cc
commit f89dc63801
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 22 deletions

View file

@ -53,8 +53,8 @@ import {useSession} from '#/state/session'
import {Shadow} from '#/state/cache/types'
interface Props {
profile: Shadow<AppBskyActorDefs.ProfileViewDetailed>
moderation: ProfileModeration
profile: Shadow<AppBskyActorDefs.ProfileViewDetailed> | null
moderation: ProfileModeration | null
hideBackButton?: boolean
isProfilePreview?: boolean
}
@ -69,7 +69,7 @@ export function ProfileHeader({
// loading
// =
if (!profile) {
if (!profile || !moderation) {
return (
<View style={pal.view}>
<LoadingPlaceholder width="100%" height={153} />
@ -81,11 +81,6 @@ export function ProfileHeader({
<View style={[styles.buttonsLine]}>
<LoadingPlaceholder width={167} height={31} style={styles.br50} />
</View>
<View>
<Text type="title-2xl" style={[pal.text, styles.title]}>
<Trans>Loading...</Trans>
</Text>
</View>
</View>
</View>
)
@ -103,12 +98,19 @@ export function ProfileHeader({
)
}
interface LoadedProps {
profile: Shadow<AppBskyActorDefs.ProfileViewDetailed>
moderation: ProfileModeration
hideBackButton?: boolean
isProfilePreview?: boolean
}
function ProfileHeaderLoaded({
profile,
moderation,
hideBackButton = false,
isProfilePreview,
}: Props) {
}: LoadedProps) {
const pal = usePalette('default')
const palInverted = usePalette('inverted')
const {currentAccount} = useSession()