Bluesky app fork with some witchin' additions 💫

Merge pull request #5 from TheEssem/fix/handle-links

Reimplement web links for handles

authored by

Daniela and committed by
GitHub
281ff549 2c0902a8

+23 -8
+23 -8
src/screens/Profile/Header/Handle.tsx
··· 6 6 import {isInvalidHandle, sanitizeHandle} from '#/lib/strings/handles' 7 7 import {isIOS, isNative} from '#/platform/detection' 8 8 import {type Shadow} from '#/state/cache/types' 9 + import {useShowLinkInHandle} from '#/state/preferences/show-link-in-handle.tsx' 9 10 import {atoms as a, useTheme, web} from '#/alf' 11 + import {InlineLinkText} from '#/components/Link.tsx' 10 12 import {NewskieDialog} from '#/components/NewskieDialog' 11 13 import {Text} from '#/components/Typography' 12 14 ··· 21 23 const {_} = useLingui() 22 24 const invalidHandle = isInvalidHandle(profile.handle) 23 25 const blockHide = profile.viewer?.blocking || profile.viewer?.blockedBy 26 + const isBskySocialHandle = profile.handle.endsWith('.bsky.social') 27 + const showProfileInHandle = useShowLinkInHandle() 28 + const sanitized = sanitizeHandle( 29 + profile.handle, 30 + '@', 31 + // forceLTR handled by CSS above on web 32 + isNative, 33 + ) 24 34 return ( 25 35 <View 26 36 style={[a.flex_row, a.gap_sm, a.align_center, {maxWidth: '100%'}]} ··· 53 63 unicodeBidi: 'isolate', 54 64 }), 55 65 ]}> 56 - {invalidHandle 57 - ? _(msg`⚠Invalid Handle`) 58 - : sanitizeHandle( 59 - profile.handle, 60 - '@', 61 - // forceLTR handled by CSS above on web 62 - isNative, 63 - )} 66 + {invalidHandle ? ( 67 + _(msg`⚠Invalid Handle`) 68 + ) : showProfileInHandle && !isBskySocialHandle ? ( 69 + <InlineLinkText 70 + to={`https://${profile.handle}`} 71 + label={profile.handle}> 72 + <Text style={[a.text_md, {color: t.palette.primary_500}]}> 73 + {sanitized} 74 + </Text> 75 + </InlineLinkText> 76 + ) : ( 77 + sanitized 78 + )} 64 79 </Text> 65 80 </View> 66 81 )