mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at tooltip 78 lines 2.4 kB view raw
1import {View} from 'react-native' 2import {type ChatBskyConvoDefs} from '@atproto/api' 3import {Trans} from '@lingui/macro' 4 5import {useModerationOpts} from '#/state/preferences/moderation-opts' 6import {useSession} from '#/state/session' 7import {atoms as a, tokens} from '#/alf' 8import {KnownFollowers} from '#/components/KnownFollowers' 9import {Text} from '#/components/Typography' 10import {ChatListItem} from './ChatListItem' 11import {AcceptChatButton, DeleteChatButton, RejectMenu} from './RequestButtons' 12 13export function RequestListItem({convo}: {convo: ChatBskyConvoDefs.ConvoView}) { 14 const {currentAccount} = useSession() 15 const moderationOpts = useModerationOpts() 16 17 const otherUser = convo.members.find( 18 member => member.did !== currentAccount?.did, 19 ) 20 21 if (!otherUser || !moderationOpts) { 22 return null 23 } 24 25 const isDeletedAccount = otherUser.handle === 'missing.invalid' 26 27 return ( 28 <View style={[a.relative, a.flex_1]}> 29 <ChatListItem convo={convo} showMenu={false}> 30 <View style={[a.pt_xs, a.pb_2xs]}> 31 <KnownFollowers 32 profile={otherUser} 33 moderationOpts={moderationOpts} 34 minimal 35 showIfEmpty 36 /> 37 </View> 38 {/* spacer, since you can't nest pressables */} 39 <View style={[a.pt_md, a.pb_xs, a.w_full, {opacity: 0}]} aria-hidden> 40 {/* Placeholder text so that it responds to the font height */} 41 <Text style={[a.text_xs, a.leading_tight, a.font_bold]}> 42 <Trans comment="Accept a chat request">Accept Request</Trans> 43 </Text> 44 </View> 45 </ChatListItem> 46 <View 47 style={[ 48 a.absolute, 49 a.pr_md, 50 a.w_full, 51 a.flex_row, 52 a.align_center, 53 a.gap_sm, 54 { 55 bottom: tokens.space.md, 56 paddingLeft: tokens.space.lg + 52 + tokens.space.md, 57 }, 58 ]}> 59 {!isDeletedAccount ? ( 60 <> 61 <AcceptChatButton convo={convo} currentScreen="list" /> 62 <RejectMenu 63 convo={convo} 64 profile={otherUser} 65 showDeleteConvo 66 currentScreen="list" 67 /> 68 </> 69 ) : ( 70 <> 71 <DeleteChatButton convo={convo} currentScreen="list" /> 72 <View style={a.flex_1} /> 73 </> 74 )} 75 </View> 76 </View> 77 ) 78}