diff --git a/src/components/ModerationLabelPref/SimpleModerationLabelPref.tsx b/src/components/moderation/GlobalModerationLabelPref.tsx similarity index 98% rename from src/components/ModerationLabelPref/SimpleModerationLabelPref.tsx rename to src/components/moderation/GlobalModerationLabelPref.tsx index d44a801711..8c22cf9e37 100644 --- a/src/components/ModerationLabelPref/SimpleModerationLabelPref.tsx +++ b/src/components/moderation/GlobalModerationLabelPref.tsx @@ -14,7 +14,7 @@ import {useTheme, atoms as a} from '#/alf' import {Text} from '#/components/Typography' import * as ToggleButton from '#/components/forms/ToggleButton' -export function SimpleModerationLabelPref({ +export function GlobalModerationLabelPref({ labelValueDefinition, disabled, }: { diff --git a/src/components/ModerationLabelPref/index.tsx b/src/components/moderation/ModerationLabelPref.tsx similarity index 93% rename from src/components/ModerationLabelPref/index.tsx rename to src/components/moderation/ModerationLabelPref.tsx index a73bfd9d2c..e021ee86c5 100644 --- a/src/components/ModerationLabelPref/index.tsx +++ b/src/components/moderation/ModerationLabelPref.tsx @@ -13,6 +13,7 @@ import { usePreferencesQuery, usePreferencesSetContentLabelMutation, } from '#/state/queries/preferences' +import {getLabelStrings} from '#/lib/moderation/useLabelInfo' import {useTheme, atoms as a} from '#/alf' import {Text} from '#/components/Typography' @@ -30,7 +31,7 @@ export function ModerationLabelPref({ labelerDid: string | undefined disabled?: boolean }) { - const {_} = useLingui() + const {_, i18n} = useLingui() const t = useTheme() const control = Dialog.useDialogControl() @@ -57,16 +58,12 @@ export function ModerationLabelPref({ labelValueDefinition, 'ignore', ) - - const allLabelStrings = useGlobalLabelStrings() - const labelStrings = labelValueDefinition.locales[0] // TODO look up locale - ? labelValueDefinition.locales[0] - : labelValueDefinition.identifier in allLabelStrings - ? allLabelStrings[labelValueDefinition.identifier] - : { - name: labelValueDefinition.identifier, - description: `Labeled "${labelValueDefinition.identifier}"`, - } + const globalLabelStrings = useGlobalLabelStrings() + const labelStrings = getLabelStrings( + i18n.locale, + globalLabelStrings, + labelValueDefinition, + ) const canWarn = !( labelValueDefinition.blurs === 'none' && diff --git a/src/screens/Moderation/index.tsx b/src/screens/Moderation/index.tsx index 05edeecb89..11bbb7188b 100644 --- a/src/screens/Moderation/index.tsx +++ b/src/screens/Moderation/index.tsx @@ -38,7 +38,7 @@ import {InlineLink, Link} from '#/components/Link' import {Loader} from '#/components/Loader' import {getModerationServiceTitle} from '#/lib/moderation' import * as ModerationServiceCard from '#/components/ModerationServiceCard' -import {SimpleModerationLabelPref} from '#/components/ModerationLabelPref/SimpleModerationLabelPref' +import {GlobalModerationLabelPref} from '#/components/ModerationLabelPref/SimpleModerationLabelPref' function ErrorState({error}: {error: string}) { const t = useTheme() @@ -294,13 +294,13 @@ export function ModerationScreenInner({ {adultContentEnabled && ( <> - + - + - + - + )} diff --git a/src/screens/Profile/Sections/Labels.tsx b/src/screens/Profile/Sections/Labels.tsx index 42ffb623ca..11691e8818 100644 --- a/src/screens/Profile/Sections/Labels.tsx +++ b/src/screens/Profile/Sections/Labels.tsx @@ -25,7 +25,7 @@ import {Divider} from '#/components/Divider' import {Button, ButtonText} from '#/components/Button' import {CenteredView, ScrollView} from '#/view/com/util/Views' import {ErrorState} from '../ErrorState' -import {ModerationLabelPref} from '#/components/ModerationLabelPref' +import {ModerationLabelPref} from '#/components/moderation/ModerationLabelPref' interface LabelsSectionProps { isLabelerLoading: boolean