mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
at verify-code 54 lines 1.8 kB view raw
1import React from 'react' 2import {View} from 'react-native' 3import {AppBskyActorDefs} from '@atproto/api' 4import {Trans} from '@lingui/macro' 5 6import {Shadow} from '#/state/cache/types' 7import {isInvalidHandle} from 'lib/strings/handles' 8import {isIOS} from 'platform/detection' 9import {atoms as a, useTheme, web} from '#/alf' 10import {NewskieDialog} from '#/components/NewskieDialog' 11import {Text} from '#/components/Typography' 12 13export function ProfileHeaderHandle({ 14 profile, 15 disableTaps, 16}: { 17 profile: Shadow<AppBskyActorDefs.ProfileViewDetailed> 18 disableTaps?: boolean 19}) { 20 const t = useTheme() 21 const invalidHandle = isInvalidHandle(profile.handle) 22 const blockHide = profile.viewer?.blocking || profile.viewer?.blockedBy 23 return ( 24 <View 25 style={[a.flex_row, a.gap_xs, a.align_center]} 26 pointerEvents={disableTaps ? 'none' : isIOS ? 'auto' : 'box-none'}> 27 <NewskieDialog profile={profile} disabled={disableTaps} /> 28 {profile.viewer?.followedBy && !blockHide ? ( 29 <View style={[t.atoms.bg_contrast_25, a.rounded_xs, a.px_sm, a.py_xs]}> 30 <Text style={[t.atoms.text, a.text_sm]}> 31 <Trans>Follows you</Trans> 32 </Text> 33 </View> 34 ) : undefined} 35 <Text 36 numberOfLines={1} 37 style={[ 38 invalidHandle 39 ? [ 40 a.border, 41 a.text_xs, 42 a.px_sm, 43 a.py_xs, 44 a.rounded_xs, 45 {borderColor: t.palette.contrast_200}, 46 ] 47 : [a.text_md, a.leading_tight, t.atoms.text_contrast_medium], 48 web({wordBreak: 'break-all'}), 49 ]}> 50 {invalidHandle ? <Trans>Invalid Handle</Trans> : `@${profile.handle}`} 51 </Text> 52 </View> 53 ) 54}