skeletons for chat list (#7907)
This commit is contained in:
@@ -20,7 +20,8 @@ import {useLeftConvos} from '#/state/queries/messages/leave-conversation'
|
|||||||
import {useListConvosQuery} from '#/state/queries/messages/list-conversations'
|
import {useListConvosQuery} from '#/state/queries/messages/list-conversations'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {List, ListRef} from '#/view/com/util/List'
|
import {List, ListRef} from '#/view/com/util/List'
|
||||||
import {atoms as a, useBreakpoints, useTheme, web} from '#/alf'
|
import {ChatListLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder'
|
||||||
|
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
|
||||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||||
import {DialogControlProps, useDialogControl} from '#/components/Dialog'
|
import {DialogControlProps, useDialogControl} from '#/components/Dialog'
|
||||||
import {NewChat} from '#/components/dms/dialogs/NewChatDialog'
|
import {NewChat} from '#/components/dms/dialogs/NewChatDialog'
|
||||||
@@ -33,7 +34,6 @@ import {SettingsSliderVertical_Stroke2_Corner0_Rounded as SettingsSlider} from '
|
|||||||
import * as Layout from '#/components/Layout'
|
import * as Layout from '#/components/Layout'
|
||||||
import {Link} from '#/components/Link'
|
import {Link} from '#/components/Link'
|
||||||
import {ListFooter} from '#/components/Lists'
|
import {ListFooter} from '#/components/Lists'
|
||||||
import {Loader} from '#/components/Loader'
|
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
import {ChatListItem} from './components/ChatListItem'
|
import {ChatListItem} from './components/ChatListItem'
|
||||||
import {InboxPreview} from './components/InboxPreview'
|
import {InboxPreview} from './components/InboxPreview'
|
||||||
@@ -211,10 +211,12 @@ export function MessagesScreen({navigation, route}: Props) {
|
|||||||
<Layout.Screen>
|
<Layout.Screen>
|
||||||
<Header newChatControl={newChatControl} />
|
<Header newChatControl={newChatControl} />
|
||||||
<Layout.Center>
|
<Layout.Center>
|
||||||
|
<InboxPreview
|
||||||
|
count={inboxPreviewConvos.length}
|
||||||
|
profiles={inboxPreviewConvos}
|
||||||
|
/>
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<View style={[a.align_center, a.pt_3xl, web({paddingTop: '10vh'})]}>
|
<ChatListLoadingPlaceholder />
|
||||||
<Loader size="xl" />
|
|
||||||
</View>
|
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{isError ? (
|
{isError ? (
|
||||||
@@ -255,10 +257,6 @@ export function MessagesScreen({navigation, route}: Props) {
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<InboxPreview
|
|
||||||
count={inboxPreviewConvos.length}
|
|
||||||
profiles={inboxPreviewConvos}
|
|
||||||
/>
|
|
||||||
<View style={[a.pt_3xl, a.align_center]}>
|
<View style={[a.pt_3xl, a.align_center]}>
|
||||||
<Message width={48} fill={t.palette.primary_500} />
|
<Message width={48} fill={t.palette.primary_500} />
|
||||||
<Text style={[a.pt_md, a.pb_sm, a.text_2xl, a.font_bold]}>
|
<Text style={[a.pt_md, a.pb_sm, a.text_2xl, a.font_bold]}>
|
||||||
|
|||||||
@@ -23,8 +23,9 @@ import {useListConvosQuery} from '#/state/queries/messages/list-conversations'
|
|||||||
import {useUpdateAllRead} from '#/state/queries/messages/update-all-read'
|
import {useUpdateAllRead} from '#/state/queries/messages/update-all-read'
|
||||||
import {FAB} from '#/view/com/util/fab/FAB'
|
import {FAB} from '#/view/com/util/fab/FAB'
|
||||||
import {List} from '#/view/com/util/List'
|
import {List} from '#/view/com/util/List'
|
||||||
|
import {ChatListLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder'
|
||||||
import * as Toast from '#/view/com/util/Toast'
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
import {atoms as a, useBreakpoints, useTheme, web} from '#/alf'
|
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
|
||||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||||
import {useRefreshOnFocus} from '#/components/hooks/useRefreshOnFocus'
|
import {useRefreshOnFocus} from '#/components/hooks/useRefreshOnFocus'
|
||||||
import {ArrowLeft_Stroke2_Corner0_Rounded as ArrowLeftIcon} from '#/components/icons/Arrow'
|
import {ArrowLeft_Stroke2_Corner0_Rounded as ArrowLeftIcon} from '#/components/icons/Arrow'
|
||||||
@@ -34,7 +35,6 @@ import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfoIcon} from '#/components
|
|||||||
import {Message_Stroke2_Corner0_Rounded as MessageIcon} from '#/components/icons/Message'
|
import {Message_Stroke2_Corner0_Rounded as MessageIcon} from '#/components/icons/Message'
|
||||||
import * as Layout from '#/components/Layout'
|
import * as Layout from '#/components/Layout'
|
||||||
import {ListFooter} from '#/components/Lists'
|
import {ListFooter} from '#/components/Lists'
|
||||||
import {Loader} from '#/components/Loader'
|
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
import {RequestListItem} from './components/RequestListItem'
|
import {RequestListItem} from './components/RequestListItem'
|
||||||
|
|
||||||
@@ -157,9 +157,7 @@ function RequestList({
|
|||||||
return (
|
return (
|
||||||
<Layout.Center>
|
<Layout.Center>
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<View style={[a.align_center, a.pt_3xl, web({paddingTop: '10vh'})]}>
|
<ChatListLoadingPlaceholder />
|
||||||
<Loader size="xl" />
|
|
||||||
</View>
|
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{isError ? (
|
{isError ? (
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import {useMemo} from 'react'
|
||||||
import {
|
import {
|
||||||
DimensionValue,
|
DimensionValue,
|
||||||
StyleProp,
|
StyleProp,
|
||||||
@@ -282,6 +283,47 @@ export function FeedFeedLoadingPlaceholder() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function ChatListItemLoadingPlaceholder({
|
||||||
|
style,
|
||||||
|
}: {
|
||||||
|
style?: StyleProp<ViewStyle>
|
||||||
|
}) {
|
||||||
|
const t = useTheme_NEW()
|
||||||
|
const random = useMemo(() => Math.random(), [])
|
||||||
|
return (
|
||||||
|
<View style={[a.flex_row, a.gap_md, a.px_lg, a.mt_lg, t.atoms.bg, style]}>
|
||||||
|
<LoadingPlaceholder width={52} height={52} style={a.rounded_full} />
|
||||||
|
<View>
|
||||||
|
<LoadingPlaceholder width={140} height={12} style={a.mt_xs} />
|
||||||
|
<LoadingPlaceholder width={120} height={8} style={a.mt_sm} />
|
||||||
|
<LoadingPlaceholder
|
||||||
|
width={80 + random * 100}
|
||||||
|
height={8}
|
||||||
|
style={a.mt_sm}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ChatListLoadingPlaceholder() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ChatListItemLoadingPlaceholder />
|
||||||
|
<ChatListItemLoadingPlaceholder />
|
||||||
|
<ChatListItemLoadingPlaceholder />
|
||||||
|
<ChatListItemLoadingPlaceholder />
|
||||||
|
<ChatListItemLoadingPlaceholder />
|
||||||
|
<ChatListItemLoadingPlaceholder />
|
||||||
|
<ChatListItemLoadingPlaceholder />
|
||||||
|
<ChatListItemLoadingPlaceholder />
|
||||||
|
<ChatListItemLoadingPlaceholder />
|
||||||
|
<ChatListItemLoadingPlaceholder />
|
||||||
|
<ChatListItemLoadingPlaceholder />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
loadingPlaceholder: {
|
loadingPlaceholder: {
|
||||||
borderRadius: 6,
|
borderRadius: 6,
|
||||||
|
|||||||
Reference in New Issue
Block a user