Bluesky app fork with some witchin' additions 馃挮
1import {View} from 'react-native'
2import {Trans, useLingui} from '@lingui/react/macro'
3
4import {useSession} from '#/state/session'
5import {atoms as a, useTheme, web} from '#/alf'
6import {Button, ButtonText} from '#/components/Button'
7import * as Dialog from '#/components/Dialog'
8import {Bot_Filled as RobotIcon} from '#/components/icons/Bot'
9import {Text} from '#/components/Typography'
10import {navigate} from '#/Navigation'
11import type * as bsky from '#/types/bsky'
12
13export function BotAccountAlert({
14 control,
15 profile,
16}: {
17 control: Dialog.DialogControlProps
18 profile: bsky.profile.AnyProfileView
19}) {
20 const {t: l} = useLingui()
21 const t = useTheme()
22 const {currentAccount} = useSession()
23
24 const isSelf = profile.did === currentAccount?.did
25 const description = isSelf
26 ? l`You have marked this account as automated. You can remove it at any time from your account settings.`
27 : l`This account has been marked as automated by its owner.`
28
29 return (
30 <Dialog.Outer control={control} nativeOptions={{preventExpansion: true}}>
31 <Dialog.ScrollableInner
32 label={l`Automated account`}
33 style={[web({maxWidth: 320})]}>
34 <View style={[a.align_center, a.pb_md, a.shadow_sm]}>
35 <RobotIcon width={48} fill={t.atoms.text_contrast_medium.color} />
36 </View>
37 <View style={[a.align_center]}>
38 <Text
39 style={[
40 a.leading_snug,
41 a.text_center,
42 a.pb_xl,
43 a.text_md,
44 t.atoms.text_contrast_high,
45 {maxWidth: 300},
46 ]}>
47 {description}
48 </Text>
49 </View>
50 <View style={[a.w_full, a.gap_sm]}>
51 <Button
52 label={l`Okay`}
53 onPress={() => control.close()}
54 color="primary"
55 size="large">
56 <ButtonText>
57 <Trans>Okay</Trans>
58 </ButtonText>
59 </Button>
60 {isSelf ? (
61 <Button
62 label={l`Open settings`}
63 onPress={() => {
64 control.close(() => {
65 navigate('AutomationLabelSettings')
66 })
67 }}
68 color="secondary"
69 size="large">
70 <ButtonText>
71 <Trans>Open settings</Trans>
72 </ButtonText>
73 </Button>
74 ) : null}
75 </View>
76 </Dialog.ScrollableInner>
77 </Dialog.Outer>
78 )
79}