diff options
author | dan <dan.abramov@gmail.com> | 2024-05-28 16:56:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-28 16:56:06 +0100 |
commit | adbbded003206f8005b680203c45bc1810be6537 (patch) | |
tree | 9b809e3e2abb2ea94938dde5cc09fc997198e433 /src/screens/Onboarding/StepModeration/ModerationOption.tsx | |
parent | 9bd411c15159609803c4e8c3e352a9db32ea527c (diff) | |
download | voidsky-adbbded003206f8005b680203c45bc1810be6537.tar.zst |
Remove old onboarding (#4224)
* Hardcode onboarding_v2 to true, rm dead code * Rm initialState, use initialStateReduced * Rm dead code * Drop *reduced prefix in code * Prettier
Diffstat (limited to 'src/screens/Onboarding/StepModeration/ModerationOption.tsx')
-rw-r--r-- | src/screens/Onboarding/StepModeration/ModerationOption.tsx | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/src/screens/Onboarding/StepModeration/ModerationOption.tsx b/src/screens/Onboarding/StepModeration/ModerationOption.tsx deleted file mode 100644 index d6334e6bd..000000000 --- a/src/screens/Onboarding/StepModeration/ModerationOption.tsx +++ /dev/null @@ -1,99 +0,0 @@ -import React from 'react' -import {View} from 'react-native' -import {InterpretedLabelValueDefinition, LabelPreference} from '@atproto/api' -import {msg, Trans} from '@lingui/macro' -import {useLingui} from '@lingui/react' - -import {useGlobalLabelStrings} from '#/lib/moderation/useGlobalLabelStrings' -import { - usePreferencesQuery, - usePreferencesSetContentLabelMutation, -} from '#/state/queries/preferences' -import {atoms as a, useTheme} from '#/alf' -import * as ToggleButton from '#/components/forms/ToggleButton' -import {Text} from '#/components/Typography' - -export function ModerationOption({ - labelValueDefinition, - disabled, -}: { - labelValueDefinition: InterpretedLabelValueDefinition - disabled?: boolean -}) { - const {_} = useLingui() - const t = useTheme() - const {data: preferences} = usePreferencesQuery() - const {mutate, variables} = usePreferencesSetContentLabelMutation() - const label = labelValueDefinition.identifier - const visibility = - variables?.visibility ?? preferences?.moderationPrefs.labels?.[label] - - const allLabelStrings = useGlobalLabelStrings() - const labelStrings = - labelValueDefinition.identifier in allLabelStrings - ? allLabelStrings[labelValueDefinition.identifier] - : { - name: labelValueDefinition.identifier, - description: `Labeled "${labelValueDefinition.identifier}"`, - } - - const onChange = React.useCallback( - (vis: string[]) => { - mutate({ - label, - visibility: vis[0] as LabelPreference, - labelerDid: undefined, - }) - }, - [mutate, label], - ) - - const labels = { - hide: _(msg`Hide`), - warn: _(msg`Warn`), - show: _(msg`Show`), - } - - return ( - <View - style={[ - a.flex_row, - a.justify_between, - a.gap_sm, - a.py_xs, - a.px_xs, - a.align_center, - ]}> - <View style={[a.gap_xs, a.flex_1]}> - <Text style={[a.font_bold]}>{labelStrings.name}</Text> - <Text style={[t.atoms.text_contrast_medium, a.leading_snug]}> - {labelStrings.description} - </Text> - </View> - <View style={[a.justify_center, {minHeight: 40}]}> - {disabled ? ( - <Text style={[a.font_bold]}> - <Trans>Hide</Trans> - </Text> - ) : ( - <ToggleButton.Group - label={_( - msg`Configure content filtering setting for category: ${labelStrings.name.toLowerCase()}`, - )} - values={[visibility ?? 'hide']} - onChange={onChange}> - <ToggleButton.Button name="ignore" label={labels.show}> - <ToggleButton.ButtonText>{labels.show}</ToggleButton.ButtonText> - </ToggleButton.Button> - <ToggleButton.Button name="warn" label={labels.warn}> - <ToggleButton.ButtonText>{labels.warn}</ToggleButton.ButtonText> - </ToggleButton.Button> - <ToggleButton.Button name="hide" label={labels.hide}> - <ToggleButton.ButtonText>{labels.hide}</ToggleButton.ButtonText> - </ToggleButton.Button> - </ToggleButton.Group> - )} - </View> - </View> - ) -} |