From 4ae6fbd3c8e8be9d47d0bd959aeac380f7bf67ce Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 15 Nov 2022 12:07:41 -0600 Subject: Better loading screens --- src/view/com/util/UserInfoText.tsx | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'src/view/com/util/UserInfoText.tsx') diff --git a/src/view/com/util/UserInfoText.tsx b/src/view/com/util/UserInfoText.tsx index f4dbd1fa4..d1292cc70 100644 --- a/src/view/com/util/UserInfoText.tsx +++ b/src/view/com/util/UserInfoText.tsx @@ -2,6 +2,7 @@ import React, {useState, useEffect} from 'react' import * as GetProfile from '../../../third-party/api/src/client/types/app/bsky/actor/getProfile' import {StyleProp, Text, TextStyle} from 'react-native' import {Link} from './Link' +import {LoadingPlaceholder} from './LoadingPlaceholder' import {useStores} from '../../../state' export function UserInfoText({ @@ -48,26 +49,31 @@ export function UserInfoText({ } }, [did, store.api.app.bsky]) + let inner + if (didFail) { + inner = {failed} + } else if (profile) { + inner = {`${prefix || ''}${profile[attr]}`} + } else { + inner = ( + + ) + } + if (asLink) { const title = profile?.displayName || profile?.handle || 'User' return ( - - {didFail - ? failed - : profile - ? `${prefix || ''}${profile[attr]}` - : loading} - + {inner} ) } - return ( - - {didFail ? failed : profile ? `${prefix || ''}${profile[attr]}` : loading} - - ) + return inner } -- cgit 1.4.1