Bluesky app fork with some witchin' additions 馃挮 witchsky.app
bluesky fork client
119
fork

Configure Feed

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

at d42a2808ba53a049fc38f559feeddaa5a335f93f 113 lines 3.6 kB view raw
1import {msg} from '@lingui/core/macro' 2import {useLingui} from '@lingui/react' 3 4import {useRequireAuth, useSession} from '#/state/session' 5import {EventStopper} from '#/view/com/util/EventStopper' 6import {useTheme} from '#/alf' 7import {CloseQuote_Stroke2_Corner1_Rounded as Quote} from '#/components/icons/Quote' 8import {Repost_Stroke2_Corner2_Rounded as Repost} from '#/components/icons/Repost' 9import * as Menu from '#/components/Menu' 10import { 11 PostControlButton, 12 PostControlButtonIcon, 13 PostControlButtonText, 14} from './PostControlButton' 15import {useFormatPostStatCount} from './util' 16 17interface Props { 18 isReposted: boolean 19 repostCount?: number 20 onRepost: () => void 21 onQuote: () => void 22 big?: boolean 23 embeddingDisabled: boolean 24} 25 26export const RepostButton = ({ 27 isReposted, 28 repostCount, 29 onRepost, 30 onQuote, 31 big, 32 embeddingDisabled, 33}: Props) => { 34 const t = useTheme() 35 const {_} = useLingui() 36 const {hasSession} = useSession() 37 const requireAuth = useRequireAuth() 38 const formatPostStatCount = useFormatPostStatCount() 39 40 return hasSession ? ( 41 <EventStopper onKeyDown={false}> 42 <Menu.Root> 43 <Menu.Trigger label={_(msg`Repost or quote post`)}> 44 {({props}) => { 45 return ( 46 <PostControlButton 47 testID="repostBtn" 48 active={isReposted} 49 activeColor={t.palette.positive_500} 50 label={props.accessibilityLabel} 51 big={big} 52 {...props}> 53 <PostControlButtonIcon icon={Repost} /> 54 {typeof repostCount !== 'undefined' && repostCount > 0 && ( 55 <PostControlButtonText testID="repostCount"> 56 {formatPostStatCount(repostCount)} 57 </PostControlButtonText> 58 )} 59 </PostControlButton> 60 ) 61 }} 62 </Menu.Trigger> 63 <Menu.Outer style={{minWidth: 170}}> 64 <Menu.Item 65 label={ 66 isReposted 67 ? _(msg`Undo repost`) 68 : _(msg({message: `Repost`, context: `action`})) 69 } 70 testID="repostDropdownRepostBtn" 71 onPress={onRepost}> 72 <Menu.ItemText> 73 {isReposted 74 ? _(msg`Undo repost`) 75 : _(msg({message: `Repost`, context: `action`}))} 76 </Menu.ItemText> 77 <Menu.ItemIcon icon={Repost} position="right" /> 78 </Menu.Item> 79 <Menu.Item 80 disabled={embeddingDisabled} 81 label={ 82 embeddingDisabled 83 ? _(msg`Quote posts disabled`) 84 : _(msg`Quote post`) 85 } 86 testID="repostDropdownQuoteBtn" 87 onPress={onQuote}> 88 <Menu.ItemText> 89 {embeddingDisabled 90 ? _(msg`Quote posts disabled`) 91 : _(msg`Quote post`)} 92 </Menu.ItemText> 93 <Menu.ItemIcon icon={Quote} position="right" /> 94 </Menu.Item> 95 </Menu.Outer> 96 </Menu.Root> 97 </EventStopper> 98 ) : ( 99 <PostControlButton 100 onPress={() => requireAuth(() => {})} 101 active={isReposted} 102 activeColor={t.palette.positive_500} 103 label={_(msg`Repost or quote post`)} 104 big={big}> 105 <PostControlButtonIcon icon={Repost} /> 106 {typeof repostCount !== 'undefined' && repostCount > 0 && ( 107 <PostControlButtonText testID="repostCount"> 108 {formatPostStatCount(repostCount)} 109 </PostControlButtonText> 110 )} 111 </PostControlButton> 112 ) 113}