add header to empty chat list view (#3791)

zio/stable
Samuel Newman 2024-05-01 18:43:54 +01:00 committed by GitHub
parent 538ca8dff1
commit 8304ad91ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 4 deletions

View File

@ -72,7 +72,7 @@ export function Error({
a.text_center, a.text_center,
t.atoms.text_contrast_high, t.atoms.text_contrast_high,
{lineHeight: 1.4}, {lineHeight: 1.4},
gtMobile && {width: 450}, gtMobile ? {width: 450} : [a.w_full, a.px_lg],
]}> ]}>
{message} {message}
</Text> </Text>

View File

@ -18,6 +18,7 @@ import {List} from '#/view/com/util/List'
import {TimeElapsed} from '#/view/com/util/TimeElapsed' import {TimeElapsed} from '#/view/com/util/TimeElapsed'
import {PreviewableUserAvatar} from '#/view/com/util/UserAvatar' import {PreviewableUserAvatar} from '#/view/com/util/UserAvatar'
import {ViewHeader} from '#/view/com/util/ViewHeader' import {ViewHeader} from '#/view/com/util/ViewHeader'
import {CenteredView} from '#/view/com/util/Views'
import {atoms as a, useBreakpoints, useTheme} 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 {DialogControlProps, useDialogControl} from '#/components/Dialog' import {DialogControlProps, useDialogControl} from '#/components/Dialog'
@ -110,19 +111,36 @@ export function MessagesListScreen({navigation}: Props) {
if (conversations.length < 1) { if (conversations.length < 1) {
return ( return (
<> <View style={a.flex_1}>
{gtMobile ? (
<CenteredView sideBorders>
<DesktopHeader
newChatControl={newChatControl}
onNavigateToSettings={onNavigateToSettings}
/>
</CenteredView>
) : (
<ViewHeader
title={_(msg`Messages`)}
renderButton={renderButton}
showBorder
canGoBack={false}
/>
)}
{!isError && <NewChat onNewChat={onNewChat} control={newChatControl} />}
<ListMaybePlaceholder <ListMaybePlaceholder
isLoading={isLoading} isLoading={isLoading}
isError={isError} isError={isError}
emptyType="results" emptyType="results"
emptyTitle={_(msg`No messages yet`)}
emptyMessage={_( emptyMessage={_(
msg`You have no messages yet. Start a conversation with someone!`, msg`You have no messages yet. Start a conversation with someone!`,
)} )}
errorMessage={cleanError(error)} errorMessage={cleanError(error)}
onRetry={isError ? refetch : undefined} onRetry={isError ? refetch : undefined}
hideBackButton
/> />
{!isError && <NewChat onNewChat={onNewChat} control={newChatControl} />} </View>
</>
) )
} }