diff --git a/src/screens/ProfileModerationService/PreferenceRow.tsx b/src/screens/ProfileModerationService/PreferenceRow.tsx index 46f90cfda6..c235917389 100644 --- a/src/screens/ProfileModerationService/PreferenceRow.tsx +++ b/src/screens/ProfileModerationService/PreferenceRow.tsx @@ -3,23 +3,17 @@ import {View} from 'react-native' import {useLingui} from '@lingui/react' import {msg} from '@lingui/macro' -import { - CONFIGURABLE_LABEL_GROUPS, - ConfigurableLabelGroup, -} from '#/state/queries/preferences' +import {useLabelGroupStrings} from '#/lib/moderation' import {useTheme, atoms as a} from '#/alf' import {Text} from '#/components/Typography' import * as ToggleButton from '#/components/forms/ToggleButton' -export function PreferenceRow({ - labelGroup, -}: { - labelGroup: ConfigurableLabelGroup -}) { +export function PreferenceRow({labelGroup}: {labelGroup: string}) { const t = useTheme() const {_} = useLingui() - const groupInfo = CONFIGURABLE_LABEL_GROUPS[labelGroup] + const labelGroupStrings = useLabelGroupStrings() + const groupInfoStrings = labelGroupStrings[labelGroup] const labels = { hide: _(msg`Hide`), @@ -38,15 +32,15 @@ export function PreferenceRow({ a.align_center, ]}> - {groupInfo.title} + {groupInfoStrings.name} - {groupInfo.subtitle} + {groupInfoStrings.description} {}}> diff --git a/src/screens/ProfileModerationService/index.tsx b/src/screens/ProfileModerationService/index.tsx index f46a0e62f4..1283d7d0af 100644 --- a/src/screens/ProfileModerationService/index.tsx +++ b/src/screens/ProfileModerationService/index.tsx @@ -1,9 +1,10 @@ import React from 'react' import {Dimensions, View} from 'react-native' import {NativeStackScreenProps} from '@react-navigation/native-stack' -import {AppBskyModerationDefs} from '@atproto/api' +import {AppBskyModerationDefs, LabelGroupDefinition} from '@atproto/api' import {Trans, msg} from '@lingui/macro' import {useLingui} from '@lingui/react' +import {LABEL_GROUPS} from '@atproto/api' import {usePalette} from '#/lib/hooks/usePalette' import {CommonNavigatorParams} from '#/lib/routes/types' @@ -136,6 +137,11 @@ export function ProfileModserviceScreenInner({ const [likeUri, setLikeUri] = React.useState( modInfo.viewer?.like || '', ) + const groups = React.useMemo< + [keyof typeof LABEL_GROUPS, LabelGroupDefinition][] + >(() => { + return Object.entries(LABEL_GROUPS).filter(([, def]) => def.configurable) + }, []) const isLiked = !!likeUri // const isSaved = false // TODO @@ -249,15 +255,17 @@ export function ProfileModserviceScreenInner({ - - - - - - + {groups.map(([name, def]) => { + return ( + + + + + ) + })} - + ) }