Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export const FileRow = memo(function FileRow({
onOpenFile,
onOpenInEditor,
}: FileRowProps) {
const { dir: fullDir, basename } = splitPath(file.path);
const dir = hideDir ? "" : fullDir;
const { basename } = splitPath(file.path);
const displayPath = hideDir ? basename : file.path;
const oldBasename =
file.oldPath && (file.status === "renamed" || file.status === "copied")
? splitPath(file.oldPath).basename
Expand Down Expand Up @@ -108,15 +108,17 @@ export const FileRow = memo(function FileRow({
>
<FileIcon fileName={basename} className="size-3.5 shrink-0" />
<span className="flex min-w-0 flex-1 items-baseline overflow-hidden">
{dir && <span className="truncate text-muted-foreground">{dir}</span>}
{oldBasename && (
<span className="truncate text-muted-foreground">
<span className="shrink-0 text-muted-foreground">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The old filename label is set to shrink-0, which can hide the new filename/path for long rename entries. Allow this segment to shrink and truncate so the current path remains visible.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/FileRow/FileRow.tsx, line 112:

<comment>The old filename label is set to `shrink-0`, which can hide the new filename/path for long rename entries. Allow this segment to shrink and truncate so the current path remains visible.</comment>

<file context>
@@ -108,22 +108,17 @@ export const FileRow = memo(function FileRow({
-					)}
 					{oldBasename && (
-						<span className="truncate text-muted-foreground">
+						<span className="shrink-0 text-muted-foreground">
 							{oldBasename}
 							<span className="px-1">→</span>
</file context>
Suggested change
<span className="shrink-0 text-muted-foreground">
<span className="min-w-0 truncate text-muted-foreground">

Tip: Review your code locally with the cubic CLI to iterate faster.

{oldBasename}
<span className="px-1">→</span>
</span>
)}
<span className="min-w-[120px] truncate font-medium text-foreground">
{basename}
<span
className="min-w-0 flex-1 truncate text-foreground"
style={{ direction: "rtl", textAlign: "left" }}
>
<bdi>{displayPath}</bdi>
</span>
</span>
<span className="ml-auto flex shrink-0 items-center gap-1.5 group-hover:invisible">
Expand Down Expand Up @@ -216,7 +218,9 @@ export const FileRow = memo(function FileRow({
<ContextMenuTrigger asChild>
<TooltipTrigger asChild>{rowButton}</TooltipTrigger>
</ContextMenuTrigger>
<TooltipContent side="right">{policy.hint}</TooltipContent>
<TooltipContent side="right">
<span className="font-mono text-[10px]">{file.path}</span>
</TooltipContent>
</Tooltip>
<ContextMenuContent className="w-64">
<ContextMenuItem onSelect={() => onSelect?.(file.path)}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ export function DiffFileHeader({
const { copyToClipboard, copied } = useCopyToClipboard();
const policy = useSidebarFilePolicy();

// Split into directory + basename so the basename stays visible when the
// header is narrow — the directory truncates with ellipsis first, and the
// basename truncates only as a fallback (very narrow pane or no directory).
const lastSlash = path.lastIndexOf("/");
const dir = lastSlash >= 0 ? path.slice(0, lastSlash + 1) : "";
const name = lastSlash >= 0 ? path.slice(lastSlash + 1) : path;

return (
<div className="group/diff-file-header @container/diff-file-header sticky top-0 z-10 flex min-w-0 flex-nowrap items-center gap-1 bg-card px-3 py-2">
<button
Expand Down Expand Up @@ -80,18 +73,16 @@ export function DiffFileHeader({
className="flex h-6 min-w-0 flex-1 items-center gap-1.5 rounded px-1 text-left transition-colors hover:bg-accent disabled:pointer-events-none disabled:opacity-60"
>
<FileIcon fileName={path} className="size-3.5 shrink-0" />
<span className="flex min-w-0 items-baseline font-mono text-xs">
{dir && (
<span className="min-w-0 shrink-[1000] truncate text-muted-foreground">
{dir}
</span>
)}
<span className="min-w-0 truncate text-foreground">{name}</span>
<span
className="min-w-0 flex-1 truncate font-mono text-xs text-foreground"
style={{ direction: "rtl", textAlign: "left" }}
>
<bdi>{path}</bdi>
</span>
</button>
</TooltipTrigger>
<TooltipContent side="bottom" showArrow={false}>
{policy.hint}
<span className="font-mono text-[10px]">{path}</span>
</TooltipContent>
</Tooltip>
<Tooltip>
Expand Down
7 changes: 5 additions & 2 deletions apps/desktop/src/renderer/stores/changes/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ interface ChangesState {
const initialState = {
selectedFiles: {} as Record<string, SelectedFileState | null>,
activeTab: "diffs" as ChangesSidebarTab,
viewMode: "side-by-side" as DiffViewMode,
viewMode: "inline" as DiffViewMode,
fileListViewMode: "grouped" as FileListViewMode,
expandedSections: {
"against-base": true,
Expand Down Expand Up @@ -231,7 +231,7 @@ export const useChangesStore = create<ChangesState>()(
}),
{
name: "changes-store",
version: 5,
version: 6,
migrate: (persisted, version) => {
const state = persisted as Record<string, unknown>;
if (version < 2) {
Expand All @@ -246,6 +246,9 @@ export const useChangesStore = create<ChangesState>()(
if (version < 5) {
state.activeTab = "diffs";
}
if (version < 6) {
state.viewMode = "inline";
}
state.sectionOrder = normalizeChangeSectionOrder(
state.sectionOrder as ChangeCategory[] | undefined,
);
Expand Down
14 changes: 12 additions & 2 deletions apps/desktop/src/renderer/stores/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,20 @@ interface SettingsStore extends Settings {
export const useSettings = create<SettingsStore>()(
persist(
(set) => ({
diffStyle: "split",
diffStyle: "unified",
showDiffComments: true,
update: (key, value) => set({ [key]: value }),
}),
{ name: "settings" },
{
name: "settings",
version: 1,
migrate: (persisted, version) => {
const state = (persisted ?? {}) as Record<string, unknown>;
if (version < 1) {
state.diffStyle = "unified";
}
return state as unknown as SettingsStore;
},
},
),
);
Loading