This commit is contained in:
Eric Bailey
2024-03-10 15:37:21 -05:00
parent 5b5c3d8b50
commit 1d5068d584
3 changed files with 54 additions and 14 deletions
+38 -13
View File
@@ -52,32 +52,56 @@ export function ContentHider({
<ModerationDetailsDialog control={control} modcause={blur} /> <ModerationDetailsDialog control={control} modcause={blur} />
<Button <Button
variant="solid"
color="secondary"
size="large"
shape="default"
onPress={() => { onPress={() => {
if (!modui.noOverride) { if (!modui.noOverride) {
setOverride(v => !v) setOverride(v => !v)
} else { } else {
console.log('OPEN')
control.open() control.open()
} }
}} }}
label={desc.name} label={desc.name}
accessibilityHint={ accessibilityHint={
override ? _(msg`Hide the content`) : _(msg`Show the content`) override ? _(msg`Hide the content`) : _(msg`Show the content`)
}
style={
gtMobile ? [a.py_lg, a.px_xl, a.gap_sm] : [a.py_md, a.px_lg, a.gap_sm]
}> }>
<ButtonIcon icon={desc.icon} position="left" /> {state => (
<ButtonText style={[a.flex_1, a.text_left]}>{desc.name}</ButtonText> <View
{!modui.noOverride && ( style={[
<ButtonText> a.flex_row,
{override ? <Trans>Hide</Trans> : <Trans>Show</Trans>} a.w_full,
</ButtonText> a.justify_start,
a.align_center,
a.py_md,
a.px_lg,
a.gap_sm,
a.rounded_sm,
t.atoms.bg_contrast_25,
(state.hovered || state.pressed) && t.atoms.bg_contrast_50,
]}>
<desc.icon
size="lg"
fill={t.atoms.text_contrast_medium.color}
style={{marginLeft: -2}}
/>
<Text
style={[
a.flex_1,
a.text_left,
a.font_bold,
a.italic,
t.atoms.text_contrast_medium,
]}>
{desc.name}
</Text>
{!modui.noOverride && (
<Text style={[a.font_bold, t.atoms.text_contrast_high]}>
{override ? <Trans>Hide</Trans> : <Trans>Show</Trans>}
</Text>
)}
</View>
)} )}
</Button> </Button>
{desc.source && blur.type === 'label' && !override && ( {desc.source && blur.type === 'label' && !override && (
<Button <Button
variant="ghost" variant="ghost"
@@ -104,6 +128,7 @@ export function ContentHider({
</ButtonText> </ButtonText>
</Button> </Button>
)} )}
{override && <View style={childContainerStyle}>{children}</View>} {override && <View style={childContainerStyle}>{children}</View>}
</View> </View>
) )
@@ -5,13 +5,14 @@ import {useGlobalLabelStrings} from './useGlobalLabelStrings'
import {useLabelDefinitions} from '#/state/queries/preferences' import {useLabelDefinitions} from '#/state/queries/preferences'
import {getDefinition, getLabelStrings} from './useLabelInfo' import {getDefinition, getLabelStrings} from './useLabelInfo'
import {Props as SVGIconProps} from '#/components/icons/common'
import {Warning_Stroke2_Corner0_Rounded as Warning} from '#/components/icons/Warning' import {Warning_Stroke2_Corner0_Rounded as Warning} from '#/components/icons/Warning'
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo' import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
import {EyeSlash_Stroke2_Corner0_Rounded as EyeSlash} from '#/components/icons/EyeSlash' import {EyeSlash_Stroke2_Corner0_Rounded as EyeSlash} from '#/components/icons/EyeSlash'
import {CircleBanSign_Stroke2_Corner0_Rounded as CircleBanSign} from '#/components/icons/CircleBanSign' import {CircleBanSign_Stroke2_Corner0_Rounded as CircleBanSign} from '#/components/icons/CircleBanSign'
export interface ModerationCauseDescription { export interface ModerationCauseDescription {
icon: any icon: React.ComponentType<SVGIconProps>
name: string name: string
description: string description: string
source?: string source?: string
+14
View File
@@ -261,6 +261,10 @@ export function SettingsScreen({}: Props) {
navigation.navigate('Debug') navigation.navigate('Debug')
}, [navigation]) }, [navigation])
const onPressDebugModeration = React.useCallback(() => {
navigation.navigate('DebugMod')
}, [navigation])
const onPressSavedFeeds = React.useCallback(() => { const onPressSavedFeeds = React.useCallback(() => {
navigation.navigate('SavedFeeds') navigation.navigate('SavedFeeds')
}, [navigation]) }, [navigation])
@@ -807,6 +811,16 @@ export function SettingsScreen({}: Props) {
<Trans>Storybook</Trans> <Trans>Storybook</Trans>
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity
style={[pal.view, styles.linkCardNoIcon]}
onPress={onPressDebugModeration}
accessibilityRole="button"
accessibilityLabel={_(msg`Open storybook page`)}
accessibilityHint={_(msg`Opens the storybook page`)}>
<Text type="lg" style={pal.text}>
<Trans>Debug Moderation</Trans>
</Text>
</TouchableOpacity>
<TouchableOpacity <TouchableOpacity
style={[pal.view, styles.linkCardNoIcon]} style={[pal.view, styles.linkCardNoIcon]}
onPress={onPressResetPreferences} onPress={onPressResetPreferences}