Small cleanup

This commit is contained in:
Paul Frazee
2024-03-05 19:15:46 -08:00
parent a84e264dae
commit 2a7af0b8c0
4 changed files with 15 additions and 18 deletions
@@ -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,
}: {
@@ -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' &&
+5 -5
View File
@@ -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 && (
<>
<Divider />
<SimpleModerationLabelPref labelValueDefinition={LABELS.porn} />
<GlobalModerationLabelPref labelValueDefinition={LABELS.porn} />
<Divider />
<SimpleModerationLabelPref labelValueDefinition={LABELS.sexual} />
<GlobalModerationLabelPref labelValueDefinition={LABELS.sexual} />
<Divider />
<SimpleModerationLabelPref labelValueDefinition={LABELS.nudity} />
<GlobalModerationLabelPref labelValueDefinition={LABELS.nudity} />
<Divider />
<SimpleModerationLabelPref labelValueDefinition={LABELS.gore} />
<GlobalModerationLabelPref labelValueDefinition={LABELS.gore} />
</>
)}
</View>
+1 -1
View File
@@ -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