MCPcopy
hub / github.com/codeaashu/claude-code / FileInfoBar

Function FileInfoBar

web/components/file-viewer/FileInfoBar.tsx:54–98  ·  view source on GitHub ↗
({ tab }: FileInfoBarProps)

Source from the content-addressed store, hash-verified

52];
53
54export function FileInfoBar({ tab }: FileInfoBarProps) {
55 const { setMode } = useFileViewerStore();
56
57 const lineCount = tab.content.split("\n").length;
58 const byteSize = new TextEncoder().encode(tab.content).length;
59 const langLabel = LANGUAGE_LABELS[tab.language] ?? tab.language;
60
61 return (
62 <div className="flex items-center justify-between px-3 py-1 border-t border-surface-800 bg-surface-950 text-xs text-surface-500">
63 {/* Left: file stats */}
64 <div className="flex items-center gap-3">
65 <span className="text-surface-400">{langLabel}</span>
66 <span>UTF-8</span>
67 <span>{lineCount.toLocaleString()} lines</span>
68 <span>{formatBytes(byteSize)}</span>
69 {tab.isDirty && (
70 <span className="text-yellow-500">● Unsaved changes</span>
71 )}
72 </div>
73
74 {/* Right: mode switcher */}
75 {!tab.isImage && (
76 <div className="flex items-center gap-0.5 bg-surface-900 rounded px-1 py-0.5">
77 {VIEW_MODES.map(({ mode, label, icon: Icon }) => (
78 <button
79 key={mode}
80 onClick={() => setMode(tab.id, mode)}
81 className={cn(
82 "flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] transition-colors",
83 tab.mode === mode
84 ? "bg-surface-700 text-surface-100"
85 : "text-surface-500 hover:text-surface-300"
86 )}
87 disabled={mode === "diff" && !tab.diff}
88 title={mode === "diff" && !tab.diff ? "No diff available" : label}
89 >
90 <Icon className="w-3 h-3" />
91 {label}
92 </button>
93 ))}
94 </div>
95 )}
96 </div>
97 );
98}

Callers

nothing calls this directly

Calls 2

cnFunction · 0.90
formatBytesFunction · 0.85

Tested by

no test coverage detected