forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1import {useMemo} from 'react'
2import {View} from 'react-native'
3import {msg} from '@lingui/macro'
4import {useLingui} from '@lingui/react'
5
6import {getTerminology, TERMINOLOGY} from '#/lib/strings/terminology'
7import {useTerminologyPreference} from '#/state/preferences'
8import {LINEAR_AVI_WIDTH, OUTER_SPACE} from '#/screens/PostThread/const'
9import {atoms as a, useTheme} from '#/alf'
10import {PersonX_Stroke2_Corner0_Rounded as PersonXIcon} from '#/components/icons/Person'
11import {Trash_Stroke2_Corner0_Rounded as TrashIcon} from '#/components/icons/Trash'
12import {Text} from '#/components/Typography'
13
14export type ThreadItemPostTombstoneProps = {
15 type: 'not-found' | 'blocked'
16}
17
18export function ThreadItemPostTombstone({type}: ThreadItemPostTombstoneProps) {
19 const t = useTheme()
20 const {_} = useLingui()
21 const terminologyPreference = useTerminologyPreference()
22 const {copy, Icon} = useMemo(() => {
23 switch (type) {
24 case 'blocked':
25 return {copy: _(getTerminology(terminologyPreference, TERMINOLOGY.blocked)), Icon: PersonXIcon}
26 case 'not-found':
27 default:
28 return {copy: _(getTerminology(terminologyPreference, TERMINOLOGY.notFound)), Icon: TrashIcon}
29 }
30 }, [_, type, terminologyPreference])
31
32 return (
33 <View
34 style={[
35 a.mb_xs,
36 {
37 paddingHorizontal: OUTER_SPACE,
38 paddingTop: OUTER_SPACE / 1.2,
39 },
40 ]}>
41 <View
42 style={[
43 a.flex_row,
44 a.align_center,
45 a.rounded_sm,
46 t.atoms.bg_contrast_25,
47 {paddingVertical: OUTER_SPACE / 1.2},
48 ]}>
49 <View style={[a.flex_row, a.justify_center, {width: LINEAR_AVI_WIDTH}]}>
50 <Icon style={[t.atoms.text_contrast_medium]} />
51 </View>
52 <Text
53 style={[a.text_md, a.font_semi_bold, t.atoms.text_contrast_medium]}>
54 {copy}
55 </Text>
56 </View>
57 </View>
58 )
59}