Small cleanup
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@ import {useTheme, atoms as a} from '#/alf'
|
|||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
import * as ToggleButton from '#/components/forms/ToggleButton'
|
import * as ToggleButton from '#/components/forms/ToggleButton'
|
||||||
|
|
||||||
export function SimpleModerationLabelPref({
|
export function GlobalModerationLabelPref({
|
||||||
labelValueDefinition,
|
labelValueDefinition,
|
||||||
disabled,
|
disabled,
|
||||||
}: {
|
}: {
|
||||||
+8
-11
@@ -13,6 +13,7 @@ import {
|
|||||||
usePreferencesQuery,
|
usePreferencesQuery,
|
||||||
usePreferencesSetContentLabelMutation,
|
usePreferencesSetContentLabelMutation,
|
||||||
} from '#/state/queries/preferences'
|
} from '#/state/queries/preferences'
|
||||||
|
import {getLabelStrings} from '#/lib/moderation/useLabelInfo'
|
||||||
|
|
||||||
import {useTheme, atoms as a} from '#/alf'
|
import {useTheme, atoms as a} from '#/alf'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
@@ -30,7 +31,7 @@ export function ModerationLabelPref({
|
|||||||
labelerDid: string | undefined
|
labelerDid: string | undefined
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
}) {
|
}) {
|
||||||
const {_} = useLingui()
|
const {_, i18n} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const control = Dialog.useDialogControl()
|
const control = Dialog.useDialogControl()
|
||||||
|
|
||||||
@@ -57,16 +58,12 @@ export function ModerationLabelPref({
|
|||||||
labelValueDefinition,
|
labelValueDefinition,
|
||||||
'ignore',
|
'ignore',
|
||||||
)
|
)
|
||||||
|
const globalLabelStrings = useGlobalLabelStrings()
|
||||||
const allLabelStrings = useGlobalLabelStrings()
|
const labelStrings = getLabelStrings(
|
||||||
const labelStrings = labelValueDefinition.locales[0] // TODO look up locale
|
i18n.locale,
|
||||||
? labelValueDefinition.locales[0]
|
globalLabelStrings,
|
||||||
: labelValueDefinition.identifier in allLabelStrings
|
labelValueDefinition,
|
||||||
? allLabelStrings[labelValueDefinition.identifier]
|
)
|
||||||
: {
|
|
||||||
name: labelValueDefinition.identifier,
|
|
||||||
description: `Labeled "${labelValueDefinition.identifier}"`,
|
|
||||||
}
|
|
||||||
|
|
||||||
const canWarn = !(
|
const canWarn = !(
|
||||||
labelValueDefinition.blurs === 'none' &&
|
labelValueDefinition.blurs === 'none' &&
|
||||||
@@ -38,7 +38,7 @@ import {InlineLink, Link} from '#/components/Link'
|
|||||||
import {Loader} from '#/components/Loader'
|
import {Loader} from '#/components/Loader'
|
||||||
import {getModerationServiceTitle} from '#/lib/moderation'
|
import {getModerationServiceTitle} from '#/lib/moderation'
|
||||||
import * as ModerationServiceCard from '#/components/ModerationServiceCard'
|
import * as ModerationServiceCard from '#/components/ModerationServiceCard'
|
||||||
import {SimpleModerationLabelPref} from '#/components/ModerationLabelPref/SimpleModerationLabelPref'
|
import {GlobalModerationLabelPref} from '#/components/ModerationLabelPref/SimpleModerationLabelPref'
|
||||||
|
|
||||||
function ErrorState({error}: {error: string}) {
|
function ErrorState({error}: {error: string}) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
@@ -294,13 +294,13 @@ export function ModerationScreenInner({
|
|||||||
{adultContentEnabled && (
|
{adultContentEnabled && (
|
||||||
<>
|
<>
|
||||||
<Divider />
|
<Divider />
|
||||||
<SimpleModerationLabelPref labelValueDefinition={LABELS.porn} />
|
<GlobalModerationLabelPref labelValueDefinition={LABELS.porn} />
|
||||||
<Divider />
|
<Divider />
|
||||||
<SimpleModerationLabelPref labelValueDefinition={LABELS.sexual} />
|
<GlobalModerationLabelPref labelValueDefinition={LABELS.sexual} />
|
||||||
<Divider />
|
<Divider />
|
||||||
<SimpleModerationLabelPref labelValueDefinition={LABELS.nudity} />
|
<GlobalModerationLabelPref labelValueDefinition={LABELS.nudity} />
|
||||||
<Divider />
|
<Divider />
|
||||||
<SimpleModerationLabelPref labelValueDefinition={LABELS.gore} />
|
<GlobalModerationLabelPref labelValueDefinition={LABELS.gore} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import {Divider} from '#/components/Divider'
|
|||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
import {CenteredView, ScrollView} from '#/view/com/util/Views'
|
import {CenteredView, ScrollView} from '#/view/com/util/Views'
|
||||||
import {ErrorState} from '../ErrorState'
|
import {ErrorState} from '../ErrorState'
|
||||||
import {ModerationLabelPref} from '#/components/ModerationLabelPref'
|
import {ModerationLabelPref} from '#/components/moderation/ModerationLabelPref'
|
||||||
|
|
||||||
interface LabelsSectionProps {
|
interface LabelsSectionProps {
|
||||||
isLabelerLoading: boolean
|
isLabelerLoading: boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user