Hide mod settings if underage or age restricted

This commit is contained in:
Eric Bailey
2025-07-16 18:33:28 -05:00
parent b025f107d4
commit c9e1161688
+131 -114
View File
@@ -304,127 +304,144 @@ export function ModerationScreenInner({
</Link> </Link>
</View> </View>
<Text {declaredAge === undefined && (
style={[ <>
a.pt_2xl, <Text
a.pb_md, style={[
a.text_md, a.pt_2xl,
a.font_bold, a.pb_md,
t.atoms.text_contrast_high, a.text_md,
]}> a.font_bold,
<Trans>Content filters</Trans> t.atoms.text_contrast_high,
</Text> ]}>
<Trans>Content filters</Trans>
</Text>
<AgeAssuranceAdmonition style={[a.pb_md]}> <Button
<Trans> label={_(msg`Confirm your birthdate`)}
You must complete age assurance in order to access the settings below. size="small"
</Trans> variant="solid"
</AgeAssuranceAdmonition> color="secondary"
onPress={() => {
birthdateDialogControl.open()
}}
style={[a.justify_between, a.rounded_md, a.px_lg, a.py_lg]}>
<ButtonText>
<Trans>Confirm your age:</Trans>
</ButtonText>
<ButtonText>
<Trans>Set birthdate</Trans>
</ButtonText>
</Button>
<View style={[a.gap_md]}> <BirthDateSettingsDialog control={birthdateDialogControl} />
{declaredAge === undefined && ( </>
<> )}
<Button
label={_(msg`Confirm your birthdate`)}
size="small"
variant="solid"
color="secondary"
onPress={() => {
birthdateDialogControl.open()
}}
style={[a.justify_between, a.rounded_md, a.px_lg, a.py_lg]}>
<ButtonText>
<Trans>Confirm your age:</Trans>
</ButtonText>
<ButtonText>
<Trans>Set birthdate</Trans>
</ButtonText>
</Button>
<BirthDateSettingsDialog control={birthdateDialogControl} /> {!isDeclaredUnderage && (
</> <>
)} <Text
<View style={[
style={[ a.pt_2xl,
a.w_full, a.pb_md,
a.rounded_md, a.text_md,
a.overflow_hidden, a.font_bold,
t.atoms.bg_contrast_25, t.atoms.text_contrast_high,
]}> ]}>
{!isDeclaredUnderage && !isAgeRestricted && ( <Trans>Content filters</Trans>
<> </Text>
<View
style={[
a.py_lg,
a.px_lg,
a.flex_row,
a.align_center,
a.justify_between,
disabledOnIOS && {opacity: 0.5},
]}>
<Text style={[a.font_bold, t.atoms.text_contrast_high]}>
<Trans>Enable adult content</Trans>
</Text>
<Toggle.Item
label={_(msg`Toggle to enable or disable adult content`)}
disabled={disabledOnIOS}
name="adultContent"
value={adultContentEnabled}
onChange={onToggleAdultContentEnabled}>
<View style={[a.flex_row, a.align_center, a.gap_sm]}>
<Text style={[t.atoms.text_contrast_medium]}>
{adultContentEnabled ? (
<Trans>Enabled</Trans>
) : (
<Trans>Disabled</Trans>
)}
</Text>
<Toggle.Switch />
</View>
</Toggle.Item>
</View>
{disabledOnIOS && (
<View style={[a.pb_lg, a.px_lg]}>
<Text>
<Trans>
Adult content can only be enabled via the Web at{' '}
<InlineLinkText
label={_(msg`The Bluesky web application`)}
to=""
onPress={evt => {
evt.preventDefault()
Linking.openURL('https://bsky.app/')
return false
}}>
bsky.app
</InlineLinkText>
.
</Trans>
</Text>
</View>
)}
<Divider />
{adultContentEnabled && ( <AgeAssuranceAdmonition style={[a.pb_md]}>
<Trans>
You must complete age assurance in order to access the settings
below.
</Trans>
</AgeAssuranceAdmonition>
<View style={[a.gap_md]}>
<View
style={[
a.w_full,
a.rounded_md,
a.overflow_hidden,
t.atoms.bg_contrast_25,
]}>
{!isDeclaredUnderage && (
<> <>
<GlobalLabelPreference labelDefinition={LABELS.porn} /> <View
<Divider /> style={[
<GlobalLabelPreference labelDefinition={LABELS.sexual} /> a.py_lg,
<Divider /> a.px_lg,
<GlobalLabelPreference a.flex_row,
labelDefinition={LABELS['graphic-media']} a.align_center,
/> a.justify_between,
<Divider /> disabledOnIOS && {opacity: 0.5},
]}>
<Text style={[a.font_bold, t.atoms.text_contrast_high]}>
<Trans>Enable adult content</Trans>
</Text>
<Toggle.Item
label={_(msg`Toggle to enable or disable adult content`)}
disabled={disabledOnIOS || isAgeRestricted}
name="adultContent"
value={adultContentEnabled}
onChange={onToggleAdultContentEnabled}>
<View style={[a.flex_row, a.align_center, a.gap_sm]}>
<Text style={[t.atoms.text_contrast_medium]}>
{adultContentEnabled ? (
<Trans>Enabled</Trans>
) : (
<Trans>Disabled</Trans>
)}
</Text>
<Toggle.Switch />
</View>
</Toggle.Item>
</View>
{disabledOnIOS && (
<View style={[a.pb_lg, a.px_lg]}>
<Text>
<Trans>
Adult content can only be enabled via the Web at{' '}
<InlineLinkText
label={_(msg`The Bluesky web application`)}
to=""
onPress={evt => {
evt.preventDefault()
Linking.openURL('https://bsky.app/')
return false
}}>
bsky.app
</InlineLinkText>
.
</Trans>
</Text>
</View>
)}
{adultContentEnabled && (
<>
<Divider />
<GlobalLabelPreference labelDefinition={LABELS.porn} />
<Divider />
<GlobalLabelPreference labelDefinition={LABELS.sexual} />
<Divider />
<GlobalLabelPreference
labelDefinition={LABELS['graphic-media']}
/>
<Divider />
<GlobalLabelPreference
disabled={isDeclaredUnderage || isAgeRestricted}
labelDefinition={LABELS.nudity}
/>
</>
)}
</> </>
)} )}
</> </View>
)} </View>
<GlobalLabelPreference </>
disabled={isDeclaredUnderage || isAgeRestricted} )}
labelDefinition={LABELS.nudity}
/>
</View>
</View>
<Text <Text
style={[ style={[