Something went wrong. Try again.
Mirror — see github.com/blacksky-algorithms/blacksky.community
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778import {View} from 'react-native'import {type AppBskyActorDefs} from '@atproto/api'import {msg} from '@lingui/core/macro'import {useLingui} from '@lingui/react'import {Trans} from '@lingui/react/macro'
import {isInvalidHandle, sanitizeHandle} from '#/lib/strings/handles'import {sanitizePronouns} from '#/lib/strings/pronouns'import {type Shadow} from '#/state/cache/types'import {atoms as a, useTheme, web} from '#/alf'import {NewskieDialog} from '#/components/NewskieDialog'import {Text} from '#/components/Typography'import {IS_IOS, IS_NATIVE} from '#/env'
export function ProfileHeaderHandle({ profile, disableTaps,}: { profile: Shadow<AppBskyActorDefs.ProfileViewDetailed> disableTaps?: boolean}) { const t = useTheme() const {_} = useLingui() const invalidHandle = isInvalidHandle(profile.handle) const blockHide = profile.viewer?.blocking || profile.viewer?.blockedBy const pronouns = profile.pronouns return ( <View style={[a.flex_row, a.gap_sm, a.align_center, {maxWidth: '100%'}]} pointerEvents={disableTaps ? 'none' : IS_IOS ? 'auto' : 'box-none'}> <NewskieDialog profile={profile} disabled={disableTaps} /> {profile.viewer?.followedBy && !blockHide ? ( <View style={[t.atoms.bg_contrast_50, a.rounded_xs, a.px_sm, a.py_xs]}> <Text style={[t.atoms.text, a.text_sm]}> <Trans>Follows you</Trans> </Text> </View> ) : undefined} <View style={[a.flex_row, a.flex_wrap, {gap: 6}]}> <Text emoji numberOfLines={1} style={[ invalidHandle ? [ a.border, a.text_xs, a.px_sm, a.py_xs, a.rounded_xs, {borderColor: t.palette.contrast_200}, ] : [a.text_md, a.leading_snug, t.atoms.text_contrast_medium], web({ wordBreak: 'break-all', direction: 'ltr', unicodeBidi: 'isolate', }), ]}> {invalidHandle ? _(msg`⚠Invalid Handle`) : sanitizeHandle( profile.handle, '@', // forceLTR handled by CSS above on web IS_NATIVE, )} </Text> {sanitizePronouns(pronouns ?? '', IS_NATIVE) && ( <Text style={[t.atoms.text_contrast_low, a.text_md, a.leading_snug]}> {sanitizePronouns(pronouns ?? '', IS_NATIVE)} </Text> )} </View> </View> )}