mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
at tooltip 1.4 kB view raw
1import {Pressable} from 'react-native' 2import * as Clipboard from 'expo-clipboard' 3import {t} from '@lingui/macro' 4 5import {IS_INTERNAL} from '#/lib/app-info' 6import {DISCOVER_DEBUG_DIDS} from '#/lib/constants' 7import {useGate} from '#/lib/statsig/statsig' 8import {useSession} from '#/state/session' 9import * as Toast from '#/view/com/util/Toast' 10import {atoms as a, useBreakpoints, useTheme} from '#/alf' 11import {Text} from '#/components/Typography' 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 a.bottom_0, 36 {zIndex: 1000}, 37 gtMobile ? a.right_0 : a.left_0, 38 ]} 39 onPress={e => { 40 e.stopPropagation() 41 Clipboard.setStringAsync(feedContext) 42 Toast.show(t`Copied to clipboard`, 'clipboard-check') 43 }}> 44 <Text 45 style={{ 46 color: theme.palette.contrast_400, 47 fontSize: 7, 48 }}> 49 {feedContext} 50 </Text> 51 </Pressable> 52 ) 53 ) 54}