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 {useDiscoverContextEnabled} from '#/state/preferences/discover-context-enabled'
7import {useSession} from '#/state/session'
8import {atoms as a, useTheme} from '#/alf'
9import * as Toast from '#/components/Toast'
10import {Text} from '#/components/Typography'
11import {useAnalytics} from '#/analytics'
12import {IS_INTERNAL} from '#/env'
13
14export function DiscoverDebug({
15 feedContext,
16}: {
17 feedContext: string | undefined
18}) {
19 const ax = useAnalytics()
20 const {currentAccount} = useSession()
21 const discoverContextEnabled = useDiscoverContextEnabled()
22 const isDiscoverDebugUser =
23 IS_INTERNAL ||
24 DISCOVER_DEBUG_DIDS[currentAccount?.did || ''] ||
25 ax.features.enabled(ax.features.DebugFeedContext) ||
26 discoverContextEnabled
27 const theme = useTheme()
28
29 return (
30 isDiscoverDebugUser &&
31 feedContext && (
32 <Pressable
33 accessible={false}
34 hitSlop={10}
35 style={[a.absolute, {zIndex: 1000, maxWidth: 65, bottom: -4}, a.left_0]}
36 onPress={e => {
37 e.stopPropagation()
38 Clipboard.setStringAsync(feedContext)
39 Toast.show(t`Copied to clipboard`)
40 }}>
41 <Text
42 numberOfLines={1}
43 style={{
44 color: theme.palette.contrast_400,
45 fontSize: 7,
46 }}>
47 {feedContext}
48 </Text>
49 </Pressable>
50 )
51 )
52}