Rename LabelsOnMeDialog, fix close

This commit is contained in:
Eric Bailey
2024-02-26 18:52:28 -06:00
parent 763fd5bc93
commit 6b9e3764b3
3 changed files with 26 additions and 11 deletions
+1 -1
View File
@@ -95,7 +95,7 @@ export function Outer({
style={[ style={[
web(a.fixed), web(a.fixed),
a.inset_0, a.inset_0,
{opacity: 0.5, backgroundColor: t.palette.black}, {opacity: 0.8, backgroundColor: t.palette.black},
]} ]}
/> />
)} )}
@@ -4,10 +4,11 @@ import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
import {ComAtprotoLabelDefs} from '@atproto/api' import {ComAtprotoLabelDefs} from '@atproto/api'
import {atoms as a, useBreakpoints} from '#/alf' import {atoms as a, useBreakpoints, useTheme} from '#/alf'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
import * as Dialog from '#/components/Dialog' import * as Dialog from '#/components/Dialog'
import {Button} from '#/components/Button' import {Button} from '#/components/Button'
import {capitalize} from '#/lib/strings/capitalize'
export {useDialogControl as useLabelsOnMeDialogControl} from '#/components/Dialog' export {useDialogControl as useLabelsOnMeDialogControl} from '#/components/Dialog'
@@ -27,8 +28,8 @@ export interface LabelsOnMeDialogProps {
} }
export function LabelsOnMeDialogInner(props: LabelsOnMeDialogProps) { export function LabelsOnMeDialogInner(props: LabelsOnMeDialogProps) {
const t = useTheme()
const {_} = useLingui() const {_} = useLingui()
const control = Dialog.useDialogControl()
const {gtMobile} = useBreakpoints() const {gtMobile} = useBreakpoints()
const {subject, labels} = props const {subject, labels} = props
const isAccount = 'did' in subject const isAccount = 'did' in subject
@@ -57,24 +58,37 @@ export function LabelsOnMeDialogInner(props: LabelsOnMeDialogProps) {
<Dialog.ScrollableInner <Dialog.ScrollableInner
accessibilityDescribedBy="dialog-description" accessibilityDescribedBy="dialog-description"
accessibilityLabelledBy="dialog-title"> accessibilityLabelledBy="dialog-title">
<Text nativeID="dialog-title" style={[a.text_2xl, a.font_bold]}> <Text
<Trans>Labels on my {isAccount ? 'account' : 'content'}</Trans> nativeID="dialog-title"
style={[a.text_2xl, a.font_bold, a.pb_md, a.leading_tight]}>
<Trans>
The following labels were applied to your{' '}
{isAccount ? 'account' : 'content'}
</Trans>
</Text> </Text>
<Text nativeID="dialog-description" style={[a.text_sm]}> <Text nativeID="dialog-description" style={[a.text_md, a.leading_snug]}>
<Trans> <Trans>
You may appeal these labels if you feel they were placed in error. You may appeal these labels if you feel they were placed in error.
</Trans> </Trans>
</Text> </Text>
{labels.map(label => (
<Text key={`${label.src}-${label.val}`}>{label.val} TODO</Text> <View style={[a.py_lg, a.gap_md]}>
))} {labels.map(label => (
<View
key={`${label.src}-${label.val}`}
style={[a.p_md, a.rounded_sm, t.atoms.bg_contrast_25]}>
<Text>{capitalize(label.val)}</Text>
</View>
))}
</View>
<View style={gtMobile && [a.flex_row, a.justify_end]}> <View style={gtMobile && [a.flex_row, a.justify_end]}>
<Button <Button
testID="doneBtn" testID="doneBtn"
variant="outline" variant="outline"
color="primary" color="primary"
size="small" size="small"
onPress={() => control.close()} onPress={() => props.control.close()}
label={_(msg`Done`)}> label={_(msg`Done`)}>
{_(msg`Done`)} {_(msg`Done`)}
</Button> </Button>
+2 -1
View File
@@ -11,7 +11,7 @@ import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/ico
import { import {
LabelsOnMeDialog, LabelsOnMeDialog,
useLabelsOnMeDialogControl, useLabelsOnMeDialogControl,
} from '#/components/LabelsOnMe' } from '#/components/LabelsOnMeDialog'
export function LabelsOnMe({ export function LabelsOnMe({
details, details,
@@ -49,6 +49,7 @@ export function LabelsOnMe({
size={size || 'small'} size={size || 'small'}
label={_(msg`View information about these labels`)} label={_(msg`View information about these labels`)}
onPress={() => { onPress={() => {
console.log('open')
control.open() control.open()
}}> }}>
<ButtonIcon position="left" icon={CircleInfo} /> <ButtonIcon position="left" icon={CircleInfo} />