import {Keyboard, View} from 'react-native' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import { ADULT_CONTENT_LABELS, type AdultSelfLabel, OTHER_SELF_LABELS, type OtherSelfLabel, type SelfLabel, } from '#/lib/moderation' import {isWeb} from '#/platform/detection' import {atoms as a, native, useTheme, web} from '#/alf' import {Button, ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import * as Toggle from '#/components/forms/Toggle' import {Check_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check' import {Shield_Stroke2_Corner0_Rounded} from '#/components/icons/Shield' import {Text} from '#/components/Typography' export function LabelsBtn({ labels, onChange, }: { labels: SelfLabel[] onChange: (v: SelfLabel[]) => void }) { const control = Dialog.useDialogControl() const {_} = useLingui() const hasLabel = labels.length > 0 const updateAdultLabels = (newLabels: AdultSelfLabel[]) => { const newLabel = newLabels[newLabels.length - 1] const filtered = labels.filter(l => !ADULT_CONTENT_LABELS.includes(l)) onChange([ ...new Set([...filtered, newLabel].filter(Boolean) as SelfLabel[]), ]) } const updateOtherLabels = (newLabels: OtherSelfLabel[]) => { const newLabel = newLabels[newLabels.length - 1] const filtered = labels.filter(l => !OTHER_SELF_LABELS.includes(l)) onChange([ ...new Set([...filtered, newLabel].filter(Boolean) as SelfLabel[]), ]) } return ( <> ) } function DialogInner({ labels, updateAdultLabels, updateOtherLabels, }: { labels: string[] updateAdultLabels: (labels: AdultSelfLabel[]) => void updateOtherLabels: (labels: OtherSelfLabel[]) => void }) { const {_} = useLingui() const control = Dialog.useDialogContext() const t = useTheme() return ( Add a content warning Please add any content warning labels that are applicable for the media you are posting. Adult Content { updateAdultLabels(values as AdultSelfLabel[]) }}> Suggestive Nudity Adult {labels.includes('sexual') || labels.includes('nudity') || labels.includes('porn') ? ( {labels.includes('sexual') ? ( Pictures meant for adults. ) : labels.includes('nudity') ? ( Artistic or non-erotic nudity. ) : labels.includes('porn') ? ( Sexual activity or erotic nudity. ) : ( '' )} ) : null} Other { updateOtherLabels(values as OtherSelfLabel[]) }}> Graphic Media {labels.includes('graphic-media') ? ( Media that may be disturbing or inappropriate for some audiences. ) : null} ) }