feat(FN-903): add middle truncation utility for file paths in dashboard

- Add truncatePath utility function with configurable segments and placeholder
- Apply middle truncation to file paths in ChangedFilesModal sidebar
- Apply middle truncation to file paths in TaskChangesTab
- Remove unused CSS truncation styles replaced by the new utility
- Add comprehensive test suite for truncatePath (106 tests)
This commit is contained in:
gsxdsm
2026-04-04 16:55:02 -07:00
parent f0cd1ca9e3
commit 3b796714d7
5 changed files with 185 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ import {
} from "lucide-react";
import { useChangedFiles } from "../hooks/useChangedFiles";
import { highlightDiff } from "../utils/highlightDiff";
import { truncateMiddle } from "../utils/truncatePath";
import type { TaskFileDiff } from "../api";
const MOBILE_BREAKPOINT = 768;
@@ -237,7 +238,7 @@ export function ChangedFilesModal({
onClick={() => handleSelectFile(file)}
>
<span className="file-node-icon">{getStatusIcon(file.status)}</span>
<span className="file-node-name">{file.path}</span>
<span className="file-node-name" title={file.path}>{truncateMiddle(file.path)}</span>
<span className={`detail-column-badge changed-files-badge changed-files-badge--${file.status}`}>
{getStatusLabel(file.status)}
</span>

View File

@@ -3,6 +3,7 @@ import { FileCode, ChevronDown, ChevronRight, AlertCircle, GitCommit } from "luc
import type { MergeDetails, Column } from "@fusion/core";
import { fetchTaskDiff, type TaskDiff } from "../api";
import { highlightDiff } from "../utils/highlightDiff";
import { truncateMiddle } from "../utils/truncatePath";
interface TaskChangesTabProps {
taskId: string;
@@ -214,7 +215,7 @@ export function TaskChangesTab({ taskId, worktree, projectId, column, mergeDetai
{getStatusLabel(file.status)}
</span>
<span className="changes-file-path" title={file.path}>
{file.path}
{truncateMiddle(file.path)}
</span>
<span
className="changes-file-stat"