diff --git a/src/components/GradientFill.tsx b/src/components/GradientFill.tsx new file mode 100644 index 0000000000..dc14aa72b7 --- /dev/null +++ b/src/components/GradientFill.tsx @@ -0,0 +1,27 @@ +import React from 'react' +import LinearGradient from 'react-native-linear-gradient' + +import {atoms as a, tokens} from '#/alf' + +export function GradientFill({ + gradient, +}: { + gradient: + | typeof tokens.gradients.sky + | typeof tokens.gradients.midnight + | typeof tokens.gradients.sunrise + | typeof tokens.gradients.sunset + | typeof tokens.gradients.bonfire + | typeof tokens.gradients.summer + | typeof tokens.gradients.nordic +}) { + return ( + c[1])} + locations={gradient.values.map(c => c[0])} + start={{x: 0, y: 0}} + end={{x: 1, y: 1}} + style={[a.absolute, a.inset_0]} + /> + ) +} diff --git a/src/components/dialogs/ReportDialog/index.tsx b/src/components/dialogs/ReportDialog/index.tsx index b7f4851e15..7e321b5e25 100644 --- a/src/components/dialogs/ReportDialog/index.tsx +++ b/src/components/dialogs/ReportDialog/index.tsx @@ -5,14 +5,23 @@ import {useLingui} from '@lingui/react' import {LABEL_GROUPS, LabelGroupDefinition} from '@atproto/api' import {useSafeAreaInsets} from 'react-native-safe-area-context' -import {atoms as a, useTheme} from '#/alf' +import {atoms as a, useTheme, tokens, native} from '#/alf' import {Text} from '#/components/Typography' import * as Dialog from '#/components/Dialog' import {GlobalDialogProps} from '#/components/dialogs' -import {Button, useButtonContext} from '#/components/Button' +import {Button, ButtonIcon, useButtonContext} from '#/components/Button' import {Divider} from '#/components/Divider' import {useLabelGroupStrings} from '#/lib/moderation' -import {ChevronRight_Stroke2_Corner0_Rounded as ChevronRight} from '#/components/icons/Chevron' +import { + ChevronRight_Stroke2_Corner0_Rounded as ChevronRight, + ChevronLeft_Stroke2_Corner0_Rounded as ChevronLeft, +} from '#/components/icons/Chevron' +import {Check_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check' +import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus' +import * as Toggle from '#/components/forms/Toggle' +import {GradientFill} from '#/components/GradientFill' +import * as TextField from '#/components/forms/TextField' +import {CharProgress} from '#/view/com/composer/char-progress/CharProgress' export type ReportDialogProps = | { @@ -80,6 +89,167 @@ function LabelGroupButton({labelGroup}: {labelGroup: string}) { ) } +function ModServiceToggle({title}: {title: string}) { + const t = useTheme() + const ctx = Toggle.useItemContext() + + return ( + + {ctx.selected && } + + + {title} + + + + + ) +} + +function SubmitView({ + selectedLabelGroup, + goBack, +}: { + selectedLabelGroup: string + goBack: () => void +}) { + const t = useTheme() + const {_} = useLingui() + const labelGroupStrings = useLabelGroupStrings() + const groupInfoStrings = labelGroupStrings[selectedLabelGroup] + const [selectedServices, setSelectedServices] = React.useState([]) + const [details, setDetails] = React.useState('') + + return ( + + + + + + {groupInfoStrings.name} + + {groupInfoStrings.description} + + + + + + + + + Select the moderation service(s) to report to + + + + + + + + + + + + + + + + + + + Optionally provide additional information below: + + + + + + + + + + + + + + + + ) +} + /** * TODO copyright link out to DMCA * TODO add "other" option @@ -92,7 +262,8 @@ export function ReportDialog({ const {_} = useLingui() const insets = useSafeAreaInsets() const control = Dialog.useDialogControl() - const [_labelGroup, setLabelGroup] = React.useState('') + const [selectedLabelGroup, setSelectedLabelGroup] = + React.useState('nudity') const labelGroupStrings = useLabelGroupStrings() // REQUIRED CLEANUP @@ -132,30 +303,37 @@ export function ReportDialog({ - - - {i18n.title} - - {i18n.description} - - + {selectedLabelGroup ? ( + setSelectedLabelGroup('')} + /> + ) : ( + + + {i18n.title} + + {i18n.description} + + - + - - {groups.map(([name, def]) => { - const groupStrings = labelGroupStrings[name] - return ( - - ) - })} + + {groups.map(([name, def]) => { + const groupStrings = labelGroupStrings[name] + return ( + + ) + })} + - + )} ) diff --git a/src/components/forms/TextField.tsx b/src/components/forms/TextField.tsx index 67515049c9..e98c5ed9dd 100644 --- a/src/components/forms/TextField.tsx +++ b/src/components/forms/TextField.tsx @@ -12,8 +12,8 @@ import { import {HITSLOP_20} from 'lib/constants' import {isWeb} from '#/platform/detection' -import {useTheme, atoms as a, web, tokens, android} from '#/alf' -import {Text} from '#/components/Typography' +import {useTheme, atoms as a, web, tokens, android, flatten} from '#/alf' +import {Text, leading} from '#/components/Typography' import {useInteractionState} from '#/components/hooks/useInteractionState' import {Props as SVGIconProps} from '#/components/icons/common' @@ -208,10 +208,13 @@ export function createInput(Component: typeof TextInput) { paddingBottom: 2, }), { - lineHeight: a.text_md.fontSize * 1.1875, + lineHeight: rest.multiline + ? leading(a.text_md, a.leading_normal) + : a.text_md.fontSize * 1.1875, textAlignVertical: rest.multiline ? 'top' : undefined, minHeight: rest.multiline ? 60 : undefined, }, + flatten(rest.style), ]} />