mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
at samuel/fancy-queue 76 lines 2.2 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 {useProfileQuery} from '#/state/queries/profile' 9import {useSession} from '#/state/session' 10import {UserAvatar} from '#/view/com/util/UserAvatar' 11import {atoms as a, ios, useBreakpoints, useTheme} from '#/alf' 12import {useInteractionState} from '#/components/hooks/useInteractionState' 13import {Text} from '#/components/Typography' 14 15export function PostThreadComposePrompt({ 16 onPressCompose, 17}: { 18 onPressCompose: () => void 19}) { 20 const {currentAccount} = useSession() 21 const {data: profile} = useProfileQuery({did: currentAccount?.did}) 22 const {_} = useLingui() 23 const {gtMobile} = useBreakpoints() 24 const t = useTheme() 25 const playHaptic = useHaptics() 26 const { 27 state: hovered, 28 onIn: onHoverIn, 29 onOut: onHoverOut, 30 } = useInteractionState() 31 32 return ( 33 <PressableScale 34 accessibilityRole="button" 35 accessibilityLabel={_(msg`Compose reply`)} 36 accessibilityHint={_(msg`Opens composer`)} 37 style={[ 38 gtMobile ? a.py_xs : {paddingTop: 8, paddingBottom: 11}, 39 a.px_sm, 40 a.border_t, 41 t.atoms.border_contrast_low, 42 t.atoms.bg, 43 ]} 44 onPressIn={ios(() => playHaptic('Light'))} 45 onPress={() => { 46 onPressCompose() 47 playHaptic('Light') 48 }} 49 onLongPress={ios(() => { 50 onPressCompose() 51 playHaptic('Heavy') 52 })} 53 onHoverIn={onHoverIn} 54 onHoverOut={onHoverOut}> 55 <View 56 style={[ 57 a.flex_row, 58 a.align_center, 59 a.p_sm, 60 a.gap_sm, 61 a.rounded_full, 62 (!gtMobile || hovered) && t.atoms.bg_contrast_25, 63 a.transition_color, 64 ]}> 65 <UserAvatar 66 size={gtMobile ? 24 : 22} 67 avatar={profile?.avatar} 68 type={profile?.associated?.labeler ? 'labeler' : 'user'} 69 /> 70 <Text style={[a.text_md, t.atoms.text_contrast_medium]}> 71 <Trans>Write your reply</Trans> 72 </Text> 73 </View> 74 </PressableScale> 75 ) 76}