Bluesky app fork with some witchin' additions 馃挮
0
fork

Configure Feed

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

at readme-update 81 lines 2.7 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, ChatListItemPortal} 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_semi_bold]}> 42 <Trans comment="Accept a chat request">Accept Request</Trans> 43 </Text> 44 </View> 45 {/* then, this gets absolutely positioned on top of the spacer */} 46 <ChatListItemPortal.Portal> 47 <View 48 style={[ 49 a.absolute, 50 a.pr_md, 51 a.w_full, 52 a.flex_row, 53 a.align_center, 54 a.gap_sm, 55 { 56 bottom: tokens.space.md, 57 paddingLeft: tokens.space.lg + 52 + tokens.space.md, 58 }, 59 ]}> 60 {!isDeletedAccount ? ( 61 <> 62 <AcceptChatButton convo={convo} currentScreen="list" /> 63 <RejectMenu 64 convo={convo} 65 profile={otherUser} 66 showDeleteConvo 67 currentScreen="list" 68 /> 69 </> 70 ) : ( 71 <> 72 <DeleteChatButton convo={convo} currentScreen="list" /> 73 <View style={a.flex_1} /> 74 </> 75 )} 76 </View> 77 </ChatListItemPortal.Portal> 78 </ChatListItem> 79 </View> 80 ) 81}