forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1import {type StyleProp, type ViewStyle} from 'react-native'
2import {type ModerationCause, type ModerationUI} from '@atproto/api'
3
4import {getModerationCauseKey, unique} from '#/lib/moderation'
5import * as Pills from '#/components/Pills'
6
7export function PostAlerts({
8 modui,
9 size = 'sm',
10 style,
11 additionalCauses,
12}: {
13 modui: ModerationUI
14 size?: Pills.CommonProps['size']
15 includeMute?: boolean
16 style?: StyleProp<ViewStyle>
17 additionalCauses?: ModerationCause[] | Pills.AppModerationCause[]
18}) {
19 if (!modui.alert && !modui.inform && !additionalCauses?.length) {
20 return null
21 }
22
23 return (
24 <Pills.Row size={size} style={[size === 'sm' && {marginLeft: -3}, style]}>
25 {modui.alerts.filter(unique).map(cause => (
26 <Pills.Label
27 key={getModerationCauseKey(cause)}
28 cause={cause}
29 size={size}
30 noBg={size === 'sm'}
31 />
32 ))}
33 {modui.informs.filter(unique).map(cause => (
34 <Pills.Label
35 key={getModerationCauseKey(cause)}
36 cause={cause}
37 size={size}
38 noBg={size === 'sm'}
39 />
40 ))}
41 {additionalCauses?.map(cause => (
42 <Pills.Label
43 key={getModerationCauseKey(cause)}
44 cause={cause}
45 size={size}
46 noBg={size === 'sm'}
47 />
48 ))}
49 </Pills.Row>
50 )
51}