File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load diff This file was deleted.
Original file line number Diff line number Diff line change 1+ @AGENTS .md
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ import {
5151 resolveThreadBranchUpdate ,
5252} from "./GitActionsControl.logic" ;
5353import { AnimatedHeight } from "./AnimatedHeight" ;
54+ import { StartTruncatedPath } from "./StartTruncatedPath" ;
5455import { Button } from "~/components/ui/button" ;
5556import { Checkbox } from "~/components/ui/checkbox" ;
5657import {
@@ -1923,14 +1924,13 @@ export default function GitActionsControl({
19231924 ) }
19241925 < button
19251926 type = "button"
1926- className = "flex flex-1 items-center justify-between gap-3 text-left truncate "
1927+ className = "flex min-w-0 flex-1 items-center justify-between gap-3 text-left"
19271928 onClick = { ( ) => openChangedFileInEditor ( file . path ) }
19281929 >
1929- < span
1930- className = { `truncate${ isExcluded ? " text-muted-foreground" : "" } ` }
1931- >
1932- { file . path }
1933- </ span >
1930+ < StartTruncatedPath
1931+ path = { file . path }
1932+ className = { `flex-1${ isExcluded ? " text-muted-foreground" : "" } ` }
1933+ />
19341934 < span className = "shrink-0" >
19351935 { isExcluded ? (
19361936 < span className = "text-muted-foreground" > Excluded</ span >
Original file line number Diff line number Diff line change 1+ import { renderToStaticMarkup } from "react-dom/server" ;
2+ import { describe , expect , it } from "vite-plus/test" ;
3+
4+ import { StartTruncatedPath } from "./StartTruncatedPath" ;
5+
6+ describe ( "StartTruncatedPath" , ( ) => {
7+ it ( "keeps the filename at the visible end by truncating from the start" , ( ) => {
8+ const path = "apps/desktop/src/components/very/long/CommitDialog.tsx" ;
9+
10+ const markup = renderToStaticMarkup ( < StartTruncatedPath path = { path } /> ) ;
11+
12+ expect ( markup ) . toContain ( 'dir="rtl"' ) ;
13+ expect ( markup ) . toMatch (
14+ / < b d i [ ^ > ] * > a p p s \/ d e s k t o p \/ s r c \/ c o m p o n e n t s \/ v e r y \/ l o n g \/ C o m m i t D i a l o g \. t s x < \/ b d i > / ,
15+ ) ;
16+ expect ( markup ) . toContain ( "overflow-hidden" ) ;
17+ expect ( markup ) . toContain ( "text-ellipsis" ) ;
18+ expect ( markup ) . toContain ( "whitespace-nowrap" ) ;
19+ expect ( markup ) . toContain ( "min-w-0" ) ;
20+ } ) ;
21+
22+ it ( "shows the full path in a tooltip" , ( ) => {
23+ const path = "apps/desktop/src/components/very/long/CommitDialog.tsx" ;
24+
25+ const markup = renderToStaticMarkup ( < StartTruncatedPath path = { path } /> ) ;
26+
27+ expect ( markup ) . toContain ( 'data-slot="tooltip-trigger"' ) ;
28+ expect ( markup ) . toContain ( "data-base-ui-tooltip-trigger" ) ;
29+ expect ( markup ) . toContain ( path ) ;
30+ } ) ;
31+ } ) ;
Original file line number Diff line number Diff line change 1+ import { Tooltip , TooltipPopup , TooltipTrigger } from "~/components/ui/tooltip" ;
2+ import { cn } from "~/lib/utils" ;
3+
4+ export function StartTruncatedPath ( { path, className } : { path : string ; className ?: string } ) {
5+ return (
6+ < Tooltip >
7+ < TooltipTrigger
8+ render = {
9+ < span
10+ className = { cn (
11+ "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-left" ,
12+ className ,
13+ ) }
14+ dir = "rtl"
15+ />
16+ }
17+ >
18+ < bdi > { path } </ bdi >
19+ </ TooltipTrigger >
20+ < TooltipPopup side = "top" className = "max-w-sm break-all font-mono" >
21+ { path }
22+ </ TooltipPopup >
23+ </ Tooltip >
24+ ) ;
25+ }
You can’t perform that action at this time.
0 commit comments