Add notice to labeler card, show all labelers

This commit is contained in:
Eric Bailey
2024-09-20 13:48:37 -05:00
parent bd4514035d
commit 2adce3ff8a
2 changed files with 65 additions and 71 deletions
+24 -4
View File
@@ -9,6 +9,7 @@ import {sanitizeHandle} from '#/lib/strings/handles'
import {useLabelerInfoQuery} from '#/state/queries/labeler' import {useLabelerInfoQuery} from '#/state/queries/labeler'
import {UserAvatar} from '#/view/com/util/UserAvatar' import {UserAvatar} from '#/view/com/util/UserAvatar'
import {atoms as a, useTheme, ViewStyleProp} from '#/alf' import {atoms as a, useTheme, ViewStyleProp} from '#/alf'
import {Flag_Stroke2_Corner0_Rounded as Flag} from '#/components/icons/Flag'
import {Link as InternalLink, LinkProps} from '#/components/Link' import {Link as InternalLink, LinkProps} from '#/components/Link'
import {RichText} from '#/components/RichText' import {RichText} from '#/components/RichText'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
@@ -43,21 +44,40 @@ export function Avatar({avatar}: {avatar?: string}) {
} }
export function Title({value}: {value: string}) { export function Title({value}: {value: string}) {
return <Text style={[a.text_md, a.font_bold]}>{value}</Text> return <Text style={[a.text_md, a.font_bold, a.leading_tight]}>{value}</Text>
} }
export function Description({value, handle}: {value?: string; handle: string}) { export function Description({value, handle}: {value?: string; handle: string}) {
return value ? ( return value ? (
<Text numberOfLines={2}> <Text numberOfLines={2}>
<RichText value={value} style={[]} /> <RichText value={value} style={[a.leading_snug]} />
</Text> </Text>
) : ( ) : (
<Text> <Text style={[a.leading_snug]}>
<Trans>By {sanitizeHandle(handle, '@')}</Trans> <Trans>By {sanitizeHandle(handle, '@')}</Trans>
</Text> </Text>
) )
} }
export function RegionalNotice() {
const t = useTheme()
return (
<View
style={[
a.flex_row,
a.align_center,
a.gap_xs,
a.pt_2xs,
{marginLeft: -2},
]}>
<Flag fill={t.atoms.text_contrast_low.color} size="sm" />
<Text style={[a.italic, a.leading_snug]}>
<Trans>Required in your region</Trans>
</Text>
</View>
)
}
export function LikeCount({count}: {count: number}) { export function LikeCount({count}: {count: number}) {
const t = useTheme() const t = useTheme()
return ( return (
@@ -85,7 +105,7 @@ export function Content({children}: React.PropsWithChildren<{}>) {
a.align_center, a.align_center,
a.justify_between, a.justify_between,
]}> ]}>
<View style={[a.gap_xs, a.flex_1]}>{children}</View> <View style={[a.gap_2xs, a.flex_1]}>{children}</View>
<ChevronRight size="md" style={[a.z_10, t.atoms.text_contrast_low]} /> <ChevronRight size="md" style={[a.z_10, t.atoms.text_contrast_low]} />
</View> </View>
+5 -31
View File
@@ -39,7 +39,6 @@ import {ChevronRight_Stroke2_Corner0_Rounded as ChevronRight} from '#/components
import {CircleBanSign_Stroke2_Corner0_Rounded as CircleBanSign} from '#/components/icons/CircleBanSign' import {CircleBanSign_Stroke2_Corner0_Rounded as CircleBanSign} from '#/components/icons/CircleBanSign'
import {Props as SVGIconProps} from '#/components/icons/common' import {Props as SVGIconProps} from '#/components/icons/common'
import {Filter_Stroke2_Corner0_Rounded as Filter} from '#/components/icons/Filter' import {Filter_Stroke2_Corner0_Rounded as Filter} from '#/components/icons/Filter'
import {Flag_Stroke2_Corner0_Rounded as Flag} from '#/components/icons/Flag'
import {Group3_Stroke2_Corner0_Rounded as Group} from '#/components/icons/Group' import {Group3_Stroke2_Corner0_Rounded as Group} from '#/components/icons/Group'
import {Person_Stroke2_Corner0_Rounded as Person} from '#/components/icons/Person' import {Person_Stroke2_Corner0_Rounded as Person} from '#/components/icons/Person'
import * as LabelingService from '#/components/LabelingServiceCard' import * as LabelingService from '#/components/LabelingServiceCard'
@@ -425,12 +424,7 @@ export function ModerationScreenInner({
</View> </View>
) : ( ) : (
<View style={[a.rounded_sm, t.atoms.bg_contrast_25]}> <View style={[a.rounded_sm, t.atoms.bg_contrast_25]}>
{labelers {labelers.map((labeler, i) => {
.filter(
labeler =>
!isNonConfigurableModerationAuthority(labeler.creator.did),
)
.map((labeler, i) => {
return ( return (
<React.Fragment key={labeler.creator.did}> <React.Fragment key={labeler.creator.did}>
{i !== 0 && <Divider />} {i !== 0 && <Divider />}
@@ -450,9 +444,7 @@ export function ModerationScreenInner({
t.atoms.bg_contrast_50, t.atoms.bg_contrast_50,
], ],
]}> ]}>
<LabelingService.Avatar <LabelingService.Avatar avatar={labeler.creator.avatar} />
avatar={labeler.creator.avatar}
/>
<LabelingService.Content> <LabelingService.Content>
<LabelingService.Title <LabelingService.Title
value={getLabelingServiceTitle({ value={getLabelingServiceTitle({
@@ -464,6 +456,9 @@ export function ModerationScreenInner({
value={labeler.creator.description} value={labeler.creator.description}
handle={labeler.creator.handle} handle={labeler.creator.handle}
/> />
{isNonConfigurableModerationAuthority(
labeler.creator.did,
) && <LabelingService.RegionalNotice />}
</LabelingService.Content> </LabelingService.Content>
</LabelingService.Outer> </LabelingService.Outer>
)} )}
@@ -474,27 +469,6 @@ export function ModerationScreenInner({
</View> </View>
)} )}
{labelers?.some(
labeler => !isNonConfigurableModerationAuthority(labeler.creator.did),
) && (
<View
style={[
a.p_lg,
a.mb_md,
a.flex_row,
a.align_center,
a.justify_center,
a.gap_sm,
]}>
<Flag fill={t.atoms.text_contrast_low.color} size="sm" />
<Text style={[a.italic]}>
<Trans>Additional moderation may apply in your region.</Trans>
</Text>
</View>
)}
<Divider />
<Text <Text
style={[ style={[
a.text_md, a.text_md,