@@ -21,6 +21,7 @@ import type {
2121 ThreadMarkerId ,
2222} from "@synara/contracts" ;
2323import { useNavigate } from "@tanstack/react-router" ;
24+ import { type ReactNode } from "react" ;
2425
2526import { useAppSettings } from "~/appSettings" ;
2627import { SETTINGS_TARGETS } from "~/settingsNavigation" ;
@@ -73,6 +74,31 @@ export const ENVIRONMENT_DOCKED_CONTENT_INSET_PX = 312;
7374
7475const ENVIRONMENT_PANEL_OVERLAY_WRAPPER_CLASS_NAME =
7576 "pointer-events-none absolute inset-y-0 right-0 z-20 flex flex-col p-3" ;
77+ export const UPSTREAM_AMNESIA_LABEL = "Upstream information hidden" ;
78+ export const UPSTREAM_AMNESIA_HINT = "Upstream successfully forgotten. Git remembers." ;
79+
80+ export function getRepositoryLabel ( input : {
81+ githubRepository : {
82+ readonly nameWithOwner : string ;
83+ readonly url : string ;
84+ } | null ;
85+ hideUpstreamRepositoryInfo : boolean ;
86+ } ) : ReactNode {
87+ if ( ! input . hideUpstreamRepositoryInfo ) {
88+ return (
89+ < span className = "truncate" > { input . githubRepository ?. nameWithOwner ?? "Unknown repository" } </ span >
90+ ) ;
91+ }
92+
93+ return (
94+ < span className = "flex min-w-0 flex-col gap-0.5" >
95+ < span className = "truncate text-muted-foreground" > { UPSTREAM_AMNESIA_LABEL } </ span >
96+ < span className = "truncate text-[length:var(--app-font-size-ui-xs,10px)] text-muted-foreground/80" >
97+ { UPSTREAM_AMNESIA_HINT }
98+ </ span >
99+ </ span >
100+ ) ;
101+ }
76102
77103export interface EnvironmentPanelProps {
78104 /** Drives the slide-in/out transition; the panel stays mounted so CSS can interpolate. */
@@ -387,12 +413,26 @@ export function EnvironmentPanel({
387413 < EnvironmentLabeledSection label = "Repository" >
388414 < EnvironmentRow
389415 icon = { < GitHubIcon className = { ENVIRONMENT_ROW_ICON_CLASS_NAME } aria-hidden /> }
390- label = { < span className = "truncate" > { githubRepository . nameWithOwner } </ span > }
391- trailing = { < ArrowUpRightIcon className = { ENVIRONMENT_ROW_ICON_CLASS_NAME } aria-hidden /> }
392- onClick = { ( ) => {
393- onOpenGithubRepository ( githubRepository . url ) ;
394- onClose ( ) ;
395- } }
416+ label = { getRepositoryLabel ( {
417+ githubRepository,
418+ hideUpstreamRepositoryInfo : settings . hideUpstreamRepositoryInfo ,
419+ } ) }
420+ trailing = {
421+ ! settings . hideUpstreamRepositoryInfo ? (
422+ < ArrowUpRightIcon className = { ENVIRONMENT_ROW_ICON_CLASS_NAME } aria-hidden />
423+ ) : null
424+ }
425+ { ...( ! settings . hideUpstreamRepositoryInfo
426+ ? {
427+ onClick : ( ) => {
428+ onOpenGithubRepository ( githubRepository . url ) ;
429+ onClose ( ) ;
430+ } ,
431+ }
432+ : {
433+ "aria-label" : "Upstream repository identity is hidden" ,
434+ title : "Upstream repository identity is hidden" ,
435+ } ) }
396436 />
397437 </ EnvironmentLabeledSection >
398438 ) : null }
0 commit comments