forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1import {View} from 'react-native'
2import {useLingui} from '@lingui/react/macro'
3
4import {type ConvoItem} from '#/state/messages/convo/types'
5import {atoms as a, useTheme} from '#/alf'
6import {getSystemMessageInfo} from '#/components/dms/getSystemMessageInfo'
7import {Text} from '#/components/Typography'
8
9export function SystemMessageItem({
10 item,
11}: {
12 item: ConvoItem & {type: 'system-message'}
13}) {
14 const t = useTheme()
15 const {i18n} = useLingui()
16
17 const info = getSystemMessageInfo(item.message.data, item.relatedProfiles)
18 if (!info) return null
19
20 const {Icon, message} = info
21
22 return (
23 <View
24 style={[
25 a.w_full,
26 a.flex_row,
27 a.align_center,
28 a.justify_center,
29 a.px_md,
30 a.mt_md,
31 ]}>
32 <Icon size="xs" style={[a.mr_2xs, t.atoms.text_contrast_medium]} />
33 <Text
34 style={[
35 a.text_xs,
36 a.text_center,
37 t.atoms.text_contrast_medium,
38 {includeFontPadding: false, textAlignVertical: 'center'},
39 ]}>
40 {i18n._(message)}
41 </Text>
42 </View>
43 )
44}