mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
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 * as Toast from '#/view/com/util/Toast'
9import {atoms as a, useBreakpoints, useTheme} from '#/alf'
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 {gtMobile} = useBreakpoints()
20 const gate = useGate()
21 const isDiscoverDebugUser =
22 IS_INTERNAL ||
23 DISCOVER_DEBUG_DIDS[currentAccount?.did || ''] ||
24 gate('debug_show_feedcontext')
25 const theme = useTheme()
26
27 return (
28 isDiscoverDebugUser &&
29 feedContext && (
30 <Pressable
31 accessible={false}
32 hitSlop={10}
33 style={[
34 a.absolute,
35 {zIndex: 1000, maxWidth: 65, bottom: -4},
36 gtMobile ? a.right_0 : a.left_0,
37 ]}
38 onPress={e => {
39 e.stopPropagation()
40 Clipboard.setStringAsync(feedContext)
41 Toast.show(t`Copied to clipboard`, 'clipboard-check')
42 }}>
43 <Text
44 numberOfLines={1}
45 style={{
46 color: theme.palette.contrast_400,
47 fontSize: 7,
48 }}>
49 {feedContext}
50 </Text>
51 </Pressable>
52 )
53 )
54}