forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1import {Pressable} from 'react-native'
2import * as Clipboard from 'expo-clipboard'
3import {t} from '@lingui/macro'
4
5import {DISCOVER_DEBUG_DIDS} from '#/lib/constants'
6import {useGate} from '#/lib/statsig/statsig'
7import {useSession} from '#/state/session'
8import {atoms as a, useTheme} from '#/alf'
9import * as Toast from '#/components/Toast'
10import {Text} from '#/components/Typography'
11import {IS_INTERNAL} from '#/env'
12
13export function DiscoverDebug({
14 feedContext,
15}: {
16 feedContext: string | undefined
17}) {
18 const {currentAccount} = useSession()
19 const gate = useGate()
20 const isDiscoverDebugUser =
21 IS_INTERNAL ||
22 DISCOVER_DEBUG_DIDS[currentAccount?.did || ''] ||
23 gate('debug_show_feedcontext')
24 const theme = useTheme()
25
26 return (
27 isDiscoverDebugUser &&
28 feedContext && (
29 <Pressable
30 accessible={false}
31 hitSlop={10}
32 style={[a.absolute, {zIndex: 1000, maxWidth: 65, bottom: -4}, a.left_0]}
33 onPress={e => {
34 e.stopPropagation()
35 Clipboard.setStringAsync(feedContext)
36 Toast.show(t`Copied to clipboard`)
37 }}>
38 <Text
39 numberOfLines={1}
40 style={{
41 color: theme.palette.contrast_400,
42 fontSize: 7,
43 }}>
44 {feedContext}
45 </Text>
46 </Pressable>
47 )
48 )
49}