Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
fix(web): show filenames when commit dialog paths overflow (#6392)
Francisco Arredondo4c1d99d7f3e7
diff --git a/apps/web/src/components/GitActionsControl.tsx b/apps/web/src/components/GitActionsControl.tsxindex 7b824370b..d448a720e 100644--- a/apps/web/src/components/GitActionsControl.tsx+++ b/apps/web/src/components/GitActionsControl.tsx@@ -51,6 +51,7 @@ import {resolveThreadBranchUpdate,} from "./GitActionsControl.logic";import { AnimatedHeight } from "./AnimatedHeight";+import { StartTruncatedPath } from "./StartTruncatedPath";import { Button } from "~/components/ui/button";import { Checkbox } from "~/components/ui/checkbox";import {@@ -1923,14 +1924,13 @@ export default function GitActionsControl({)}<buttontype="button"- className="flex flex-1 items-center justify-between gap-3 text-left truncate"+ className="flex min-w-0 flex-1 items-center justify-between gap-3 text-left"onClick={() => openChangedFileInEditor(file.path)}>- <span- className={`truncate${isExcluded ? " text-muted-foreground" : ""}`}- >- {file.path}- </span>+ <StartTruncatedPath+ path={file.path}+ className={`flex-1${isExcluded ? " text-muted-foreground" : ""}`}+ /><span className="shrink-0">{isExcluded ? (<span className="text-muted-foreground">Excluded</span>diff --git a/apps/web/src/components/StartTruncatedPath.test.tsx b/apps/web/src/components/StartTruncatedPath.test.tsxnew file mode 100644index 000000000..1f7b158bc--- /dev/null+++ b/apps/web/src/components/StartTruncatedPath.test.tsx@@ -0,0 +1,31 @@+import { renderToStaticMarkup } from "react-dom/server";+import { describe, expect, it } from "vite-plus/test";++import { StartTruncatedPath } from "./StartTruncatedPath";++describe("StartTruncatedPath", () => {+ it("keeps the filename at the visible end by truncating from the start", () => {+ const path = "apps/desktop/src/components/very/long/CommitDialog.tsx";++ const markup = renderToStaticMarkup(<StartTruncatedPath path={path} />);++ expect(markup).toContain('dir="rtl"');+ expect(markup).toMatch(+ /<bdi[^>]*>apps\/desktop\/src\/components\/very\/long\/CommitDialog\.tsx<\/bdi>/,+ );+ expect(markup).toContain("overflow-hidden");+ expect(markup).toContain("text-ellipsis");+ expect(markup).toContain("whitespace-nowrap");+ expect(markup).toContain("min-w-0");+ });++ it("shows the full path in a tooltip", () => {+ const path = "apps/desktop/src/components/very/long/CommitDialog.tsx";++ const markup = renderToStaticMarkup(<StartTruncatedPath path={path} />);++ expect(markup).toContain('data-slot="tooltip-trigger"');+ expect(markup).toContain("data-base-ui-tooltip-trigger");+ expect(markup).toContain(path);+ });+});diff --git a/apps/web/src/components/StartTruncatedPath.tsx b/apps/web/src/components/StartTruncatedPath.tsxnew file mode 100644index 000000000..b467d141a--- /dev/null+++ b/apps/web/src/components/StartTruncatedPath.tsx@@ -0,0 +1,25 @@+import { Tooltip, TooltipPopup, TooltipTrigger } from "~/components/ui/tooltip";+import { cn } from "~/lib/utils";++export function StartTruncatedPath({ path, className }: { path: string; className?: string }) {+ return (+ <Tooltip>+ <TooltipTrigger+ render={+ <span+ className={cn(+ "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-left",+ className,+ )}+ dir="rtl"+ />+ }+ >+ <bdi>{path}</bdi>+ </TooltipTrigger>+ <TooltipPopup side="top" className="max-w-sm break-all font-mono">+ {path}+ </TooltipPopup>+ </Tooltip>+ );+}