-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add history error * Log error * Add period
- Loading branch information
1 parent
1e484c6
commit 051e897
Showing
3 changed files
with
132 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react' | ||
import {View} from 'react-native' | ||
import {msg} from '@lingui/macro' | ||
import {useLingui} from '@lingui/react' | ||
|
||
import {ConvoError, ConvoItem} from '#/state/messages/convo' | ||
import {atoms as a, useTheme} from '#/alf' | ||
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo' | ||
import {InlineLinkText} from '#/components/Link' | ||
import {Text} from '#/components/Typography' | ||
|
||
export function MessageListError({ | ||
item, | ||
}: { | ||
item: ConvoItem & {type: 'error-recoverable'} | ||
}) { | ||
const t = useTheme() | ||
const {_} = useLingui() | ||
const message = React.useMemo(() => { | ||
return { | ||
[ConvoError.HistoryFailed]: _(msg`Failed to load past messages.`), | ||
}[item.code] | ||
}, [_, item.code]) | ||
|
||
return ( | ||
<View style={[a.py_md, a.align_center]}> | ||
<View | ||
style={[ | ||
a.align_center, | ||
a.pt_md, | ||
a.pb_lg, | ||
a.px_3xl, | ||
a.rounded_md, | ||
t.atoms.bg_contrast_25, | ||
{maxWidth: 300}, | ||
]}> | ||
<CircleInfo size="lg" fill={t.palette.negative_400} /> | ||
<Text style={[a.pt_sm, a.leading_snug]}> | ||
{message}{' '} | ||
<InlineLinkText | ||
to="#" | ||
label={_(msg`Press to retry`)} | ||
onPress={e => { | ||
e.preventDefault() | ||
item.retry() | ||
return false | ||
}}> | ||
{_(msg`Retry.`)} | ||
</InlineLinkText> | ||
</Text> | ||
</View> | ||
</View> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters