mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
at verify-intent 72 lines 2.0 kB view raw
1import React from 'react' 2import {View} from 'react-native' 3import {msg, Trans} from '@lingui/macro' 4import {useLingui} from '@lingui/react' 5 6import {PressableScale} from '#/lib/custom-animations/PressableScale' 7import {useHaptics} from '#/lib/haptics' 8import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries' 9import {useHapticsDisabled} from '#/state/preferences' 10import {useProfileQuery} from '#/state/queries/profile' 11import {useSession} from '#/state/session' 12import {UserAvatar} from '#/view/com/util/UserAvatar' 13import {atoms as a, useTheme} from '#/alf' 14import {Text} from '#/components/Typography' 15 16export function PostThreadComposePrompt({ 17 onPressCompose, 18}: { 19 onPressCompose: () => void 20}) { 21 const {currentAccount} = useSession() 22 const {data: profile} = useProfileQuery({did: currentAccount?.did}) 23 const {_} = useLingui() 24 const {isTabletOrDesktop} = useWebMediaQueries() 25 const t = useTheme() 26 const playHaptics = useHaptics() 27 const isHapticsDisabled = useHapticsDisabled() 28 29 const onPress = () => { 30 playHaptics('Light') 31 setTimeout( 32 () => { 33 onPressCompose() 34 }, 35 isHapticsDisabled ? 0 : 75, 36 ) 37 } 38 39 return ( 40 <PressableScale 41 accessibilityRole="button" 42 accessibilityLabel={_(msg`Compose reply`)} 43 accessibilityHint={_(msg`Opens composer`)} 44 style={[ 45 {paddingTop: 8, paddingBottom: isTabletOrDesktop ? 8 : 11}, 46 a.px_sm, 47 a.border_t, 48 t.atoms.border_contrast_low, 49 t.atoms.bg, 50 ]} 51 onPress={onPress}> 52 <View 53 style={[ 54 a.flex_row, 55 a.align_center, 56 a.p_sm, 57 a.gap_sm, 58 a.rounded_full, 59 t.atoms.bg_contrast_25, 60 ]}> 61 <UserAvatar 62 size={22} 63 avatar={profile?.avatar} 64 type={profile?.associated?.labeler ? 'labeler' : 'user'} 65 /> 66 <Text style={[a.text_md, t.atoms.text_contrast_medium]}> 67 <Trans>Write your reply</Trans> 68 </Text> 69 </View> 70 </PressableScale> 71 ) 72}