this repo has no description
0
fork

Configure Feed

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

[TS-147] Add internal debug field display (#9302)

* Add internal debug field display

* Update title

authored by

Eric Bailey and committed by
GitHub
339f3320 3107efb4

+98 -1
+1 -1
package.json
··· 72 72 "icons:optimize": "svgo -f ./assets/icons" 73 73 }, 74 74 "dependencies": { 75 - "@atproto/api": "^0.17.1", 75 + "@atproto/api": "^0.17.6", 76 76 "@bitdrift/react-native": "^0.6.8", 77 77 "@braintree/sanitize-url": "^6.0.2", 78 78 "@bsky.app/alf": "^0.1.5",
+74
src/components/DebugFieldDisplay.tsx
··· 1 + import {TouchableWithoutFeedback, View} from 'react-native' 2 + import * as Clipboard from 'expo-clipboard' 3 + 4 + import {atoms as a, useTheme} from '#/alf' 5 + import * as Prompt from '#/components/Prompt' 6 + import * as Toast from '#/components/Toast' 7 + import {Text} from '#/components/Typography' 8 + import {useDevMode} from '#/storage/hooks/dev-mode' 9 + 10 + /** 11 + * Internal-use component to display debug information supplied by the appview. 12 + * The `debug` field only exists on some API views, and is only visible for 13 + * internal users in dev mode. As such, none of these strings need to be 14 + * translated. 15 + * 16 + * This component can be removed at any time if we don't find it useful. 17 + */ 18 + export function DebugFieldDisplay<T extends {debug?: {[x: string]: unknown}}>({ 19 + subject, 20 + }: { 21 + subject: T 22 + }) { 23 + const t = useTheme() 24 + const [devMode] = useDevMode() 25 + const prompt = Prompt.usePromptControl() 26 + 27 + if (!devMode) return 28 + if (!subject.debug) return 29 + 30 + return ( 31 + <> 32 + <Prompt.Basic 33 + control={prompt} 34 + title="Debug" 35 + description={JSON.stringify(subject.debug, null, 2)} 36 + cancelButtonCta="Close" 37 + confirmButtonCta="Copy" 38 + onConfirm={() => { 39 + Clipboard.setStringAsync(JSON.stringify(subject.debug, null, 2)) 40 + Toast.show('Copied to clipboard', {type: 'success'}) 41 + }} 42 + /> 43 + <TouchableWithoutFeedback 44 + accessibilityRole="button" 45 + onPress={e => { 46 + e.preventDefault() 47 + e.stopPropagation() 48 + prompt.open() 49 + return false 50 + }}> 51 + <View style={[a.flex_row, a.align_center, a.gap_xs, a.pt_sm, a.pb_xs]}> 52 + <View 53 + style={[a.py_xs, a.px_sm, a.rounded_sm, t.atoms.bg_contrast_25]}> 54 + <Text 55 + style={[a.font_bold, a.text_xs, t.atoms.text_contrast_medium]}> 56 + Debug 57 + </Text> 58 + </View> 59 + <Text 60 + numberOfLines={1} 61 + style={[ 62 + a.flex_1, 63 + a.text_xs, 64 + a.leading_tight, 65 + {fontFamily: 'monospace'}, 66 + t.atoms.text_contrast_low, 67 + ]}> 68 + {JSON.stringify(subject.debug)} 69 + </Text> 70 + </View> 71 + </TouchableWithoutFeedback> 72 + </> 73 + ) 74 + }
+2
src/screens/PostThread/components/ThreadItemAnchor.tsx
··· 42 42 import {atoms as a, useTheme} from '#/alf' 43 43 import {colors} from '#/components/Admonition' 44 44 import {Button} from '#/components/Button' 45 + import {DebugFieldDisplay} from '#/components/DebugFieldDisplay' 45 46 import {CalendarClock_Stroke2_Corner0_Rounded as CalendarClockIcon} from '#/components/icons/CalendarClock' 46 47 import {Trash_Stroke2_Corner0_Rounded as TrashIcon} from '#/components/icons/Trash' 47 48 import {InlineLinkText, Link} from '#/components/Link' ··· 512 513 /> 513 514 </FeedFeedbackProvider> 514 515 </View> 516 + <DebugFieldDisplay subject={post} /> 515 517 </View> 516 518 </View> 517 519 </>
+2
src/screens/PostThread/components/ThreadItemPost.tsx
··· 30 30 REPLY_LINE_WIDTH, 31 31 } from '#/screens/PostThread/const' 32 32 import {atoms as a, useTheme} from '#/alf' 33 + import {DebugFieldDisplay} from '#/components/DebugFieldDisplay' 33 34 import {useInteractionState} from '#/components/hooks/useInteractionState' 34 35 import {Trash_Stroke2_Corner0_Rounded as TrashIcon} from '#/components/icons/Trash' 35 36 import {LabelsOnMyPost} from '#/components/moderation/LabelsOnMe' ··· 335 336 logContext="PostThreadItem" 336 337 threadgateRecord={threadgateRecord} 337 338 /> 339 + <DebugFieldDisplay subject={post} /> 338 340 </View> 339 341 </View> 340 342 </PostHider>
+2
src/screens/PostThread/components/ThreadItemTreePost.tsx
··· 29 29 TREE_INDENT, 30 30 } from '#/screens/PostThread/const' 31 31 import {atoms as a, useTheme} from '#/alf' 32 + import {DebugFieldDisplay} from '#/components/DebugFieldDisplay' 32 33 import {useInteractionState} from '#/components/hooks/useInteractionState' 33 34 import {Trash_Stroke2_Corner0_Rounded as TrashIcon} from '#/components/icons/Trash' 34 35 import {LabelsOnMyPost} from '#/components/moderation/LabelsOnMe' ··· 376 377 logContext="PostThreadItem" 377 378 threadgateRecord={threadgateRecord} 378 379 /> 380 + <DebugFieldDisplay subject={post} /> 379 381 </View> 380 382 </View> 381 383 </View>
+3
src/screens/Profile/Header/ProfileHeaderStandard.tsx
··· 26 26 import {atoms as a, platform, useBreakpoints, useTheme} from '#/alf' 27 27 import {SubscribeProfileButton} from '#/components/activity-notifications/SubscribeProfileButton' 28 28 import {Button, ButtonIcon, ButtonText} from '#/components/Button' 29 + import {DebugFieldDisplay} from '#/components/DebugFieldDisplay' 29 30 import {useDialogControl} from '#/components/Dialog' 30 31 import {MessageProfileButton} from '#/components/dms/MessageProfileButton' 31 32 import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus' ··· 320 321 )} 321 322 </View> 322 323 )} 324 + 325 + <DebugFieldDisplay subject={profile} /> 323 326 </View> 324 327 325 328 <Prompt.Basic
+14
yarn.lock
··· 84 84 tlds "^1.234.0" 85 85 zod "^3.23.8" 86 86 87 + "@atproto/api@^0.17.6": 88 + version "0.17.6" 89 + resolved "https://registry.yarnpkg.com/@atproto/api/-/api-0.17.6.tgz#1fccd939f5f1010397c4d57110b1a0d8673058a6" 90 + integrity sha512-0iYCD8+LOsHjHjwJcqGPfJN/h4b+IpU3GjOV0TSLk0XdCaxpHBKNu3wgCJVst4DhVjXcgsr2qQoRZ3Jja2LupA== 91 + dependencies: 92 + "@atproto/common-web" "^0.4.3" 93 + "@atproto/lexicon" "^0.5.1" 94 + "@atproto/syntax" "^0.4.1" 95 + "@atproto/xrpc" "^0.7.5" 96 + await-lock "^2.2.2" 97 + multiformats "^9.9.0" 98 + tlds "^1.234.0" 99 + zod "^3.23.8" 100 + 87 101 "@atproto/aws@^0.2.30": 88 102 version "0.2.30" 89 103 resolved "https://registry.yarnpkg.com/@atproto/aws/-/aws-0.2.30.tgz#17c882a2ec838fc6ff2a6c76f66a12e5f29d227e"