An ATproto social media client -- with an independent Appview.
at main 2.5 kB view raw
1import React from 'react' 2import {StyleSheet, View} from 'react-native' 3import Svg, {Circle, Line} from 'react-native-svg' 4import {AtUri} from '@atproto/api' 5import {msg} from '@lingui/macro' 6import {useLingui} from '@lingui/react' 7 8import {makeProfileLink} from '#/lib/routes/links' 9import {useTheme} from '#/alf' 10import {useColorModeTheme} from '#/alf/util/useColorModeTheme' 11import {useInteractionState} from '#/components/hooks/useInteractionState' 12import {SubtleWebHover} from '#/components/SubtleWebHover' 13import {Link} from '../util/Link' 14import {Text} from '../util/text/Text' 15 16export function ViewFullThread({uri}: {uri: string}) { 17 const { 18 state: hover, 19 onIn: onHoverIn, 20 onOut: onHoverOut, 21 } = useInteractionState() 22 const theme = useTheme() 23 const colorMode = useColorModeTheme() 24 const itemHref = React.useMemo(() => { 25 const urip = new AtUri(uri) 26 return makeProfileLink({did: urip.hostname, handle: ''}, 'post', urip.rkey) 27 }, [uri]) 28 const {_} = useLingui() 29 30 return ( 31 <Link 32 style={[styles.viewFullThread]} 33 href={itemHref} 34 asAnchor 35 noFeedback 36 onPointerEnter={onHoverIn} 37 onPointerLeave={onHoverOut}> 38 <SubtleWebHover 39 hover={hover} 40 // adjust position for visual alignment - the actual box has lots of top padding and not much bottom padding -sfn 41 style={{top: 8, bottom: -5}} 42 /> 43 <View style={styles.viewFullThreadDots}> 44 <Svg width="4" height="40"> 45 <Line 46 x1="2" 47 y1="0" 48 x2="2" 49 y2="15" 50 stroke={ 51 colorMode === 'light' 52 ? theme.palette.contrast_100 53 : theme.palette.contrast_200 54 } 55 strokeWidth="2" 56 /> 57 <Circle cx="2" cy="22" r="1.5" fill={theme.palette.contrast_200} /> 58 <Circle cx="2" cy="28" r="1.5" fill={theme.palette.contrast_200} /> 59 <Circle cx="2" cy="34" r="1.5" fill={theme.palette.contrast_200} /> 60 </Svg> 61 </View> 62 63 <Text 64 type="md" 65 style={[ 66 {color: theme.palette.primary_500}, 67 {paddingTop: 18, paddingBottom: 4}, 68 ]}> 69 {/* HACKFIX: Trans isn't working after SDK 53 upgrade -sfn */} 70 {_(msg`View full thread`)} 71 </Text> 72 </Link> 73 ) 74} 75 76const styles = StyleSheet.create({ 77 viewFullThread: { 78 flexDirection: 'row', 79 gap: 10, 80 paddingLeft: 18, 81 }, 82 viewFullThreadDots: { 83 width: 42, 84 alignItems: 'center', 85 }, 86})