tangled
alpha
login
or
join now
robinwobin.dev
/
witchsky.app
forked from
jollywhoppers.com/witchsky.app
0
fork
atom
Bluesky app fork with some witchin' additions 💫
0
fork
atom
overview
issues
pulls
pipelines
remove location stuff for now
Daniela Henkel
6 months ago
29dcfbb5
20cfa97b
-83
1 changed file
expand all
collapse all
unified
split
src
screens
Settings
DeerSettings.tsx
-83
src/screens/Settings/DeerSettings.tsx
···
14
14
useGatesCache,
15
15
} from '#/lib/statsig/statsig'
16
16
import {isWeb} from '#/platform/detection'
17
17
-
import {setGeolocation, useGeolocation} from '#/state/geolocation'
18
17
import * as persisted from '#/state/persisted'
19
18
import {useGoLinksEnabled, useSetGoLinksEnabled} from '#/state/preferences'
20
19
import {
···
69
68
import {Atom_Stroke2_Corner0_Rounded as DeerIcon} from '#/components/icons/Atom'
70
69
import {Bell_Stroke2_Corner0_Rounded as BellIcon} from '#/components/icons/Bell'
71
70
import {Eye_Stroke2_Corner0_Rounded as VisibilityIcon} from '#/components/icons/Eye'
72
72
-
import {Earth_Stroke2_Corner2_Rounded as GlobeIcon} from '#/components/icons/Globe'
73
71
import {Lab_Stroke2_Corner0_Rounded as BeakerIcon} from '#/components/icons/Lab'
74
72
import {PaintRoller_Stroke2_Corner2_Rounded as PaintRollerIcon} from '#/components/icons/PaintRoller'
75
73
import {RaisingHand4Finger_Stroke2_Corner0_Rounded as RaisingHandIcon} from '#/components/icons/RaisingHand'
···
81
79
82
80
type Props = NativeStackScreenProps<CommonNavigatorParams>
83
81
84
84
-
function GeolocationSettingsDialog({
85
85
-
control,
86
86
-
}: {
87
87
-
control: Dialog.DialogControlProps
88
88
-
}) {
89
89
-
const pal = usePalette('default')
90
90
-
const {_} = useLingui()
91
91
-
92
92
-
const [hasChanged, setHasChanged] = useState(false)
93
93
-
const [countryCode, setCountryCode] = useState('')
94
94
-
95
95
-
const submit = () => {
96
96
-
setGeolocation({countryCode})
97
97
-
control.close()
98
98
-
}
99
99
-
100
100
-
return (
101
101
-
<Dialog.Outer control={control} nativeOptions={{preventExpansion: true}}>
102
102
-
<Dialog.Handle />
103
103
-
<Dialog.ScrollableInner label={_(msg`Geolocation ISO 3166-1 Code`)}>
104
104
-
<View style={[a.gap_sm, a.pb_lg]}>
105
105
-
<Text style={[a.text_2xl, a.font_bold]}>
106
106
-
<Trans>Geolocation ISO 3166-1 Code</Trans>
107
107
-
</Text>
108
108
-
</View>
109
109
-
110
110
-
<View style={a.gap_lg}>
111
111
-
<Dialog.Input
112
112
-
label="Text input field"
113
113
-
autoFocus
114
114
-
style={[styles.textInput, pal.border, pal.text]}
115
115
-
value={countryCode}
116
116
-
onChangeText={value => {
117
117
-
setCountryCode(value.toUpperCase())
118
118
-
setHasChanged(true)
119
119
-
}}
120
120
-
maxLength={2}
121
121
-
placeholder="BR"
122
122
-
placeholderTextColor={pal.colors.textLight}
123
123
-
onSubmitEditing={submit}
124
124
-
accessibilityHint={_(
125
125
-
msg`Input 2 letter ISO 3166-1 country code to use as location`,
126
126
-
)}
127
127
-
/>
128
128
-
129
129
-
<View style={isWeb && [a.flex_row, a.justify_end]}>
130
130
-
<Button
131
131
-
label={hasChanged ? _(msg`Save location`) : _(msg`Done`)}
132
132
-
size="large"
133
133
-
onPress={submit}
134
134
-
variant="solid"
135
135
-
color="primary">
136
136
-
<ButtonText>
137
137
-
{hasChanged ? <Trans>Save</Trans> : <Trans>Done</Trans>}
138
138
-
</ButtonText>
139
139
-
</Button>
140
140
-
</View>
141
141
-
</View>
142
142
-
143
143
-
<Dialog.Close />
144
144
-
</Dialog.ScrollableInner>
145
145
-
</Dialog.Outer>
146
146
-
)
147
147
-
}
148
148
-
149
82
function ConstellationInstanceDialog({
150
83
control,
151
84
}: {
···
269
202
270
203
const hideFollowNotifications = useHideFollowNotifications()
271
204
const setHideFollowNotifications = useSetHideFollowNotifications()
272
272
-
273
273
-
const location = useGeolocation()
274
274
-
const setLocationControl = Dialog.useDialogControl()
275
205
276
206
const constellationInstance = useConstellationInstance()
277
207
const setConstellationInstanceControl = Dialog.useDialogControl()
···
424
354
</SettingsList.Item>
425
355
426
356
<SettingsList.Item>
427
427
-
<SettingsList.ItemIcon icon={GlobeIcon} />
428
428
-
<SettingsList.ItemText>
429
429
-
<Trans>{`ISO 3166-1 Location (currently ${
430
430
-
location.geolocation?.countryCode ?? '?'
431
431
-
})`}</Trans>
432
432
-
</SettingsList.ItemText>
433
433
-
<SettingsList.BadgeButton
434
434
-
label={_(msg`Change`)}
435
435
-
onPress={() => setLocationControl.open()}
436
436
-
/>
437
437
-
</SettingsList.Item>
438
438
-
<SettingsList.Item>
439
357
<Admonition type="info" style={[a.flex_1]}>
440
358
<Trans>
441
359
Geolocation country code informs required regional app labelers
···
602
520
</SettingsList.Item>
603
521
</SettingsList.Container>
604
522
</Layout.Content>
605
605
-
<GeolocationSettingsDialog control={setLocationControl} />
606
523
<ConstellationInstanceDialog control={setConstellationInstanceControl} />
607
524
</Layout.Screen>
608
525
)