/* Shared icons, FileIcon, GitPanel, FileTree */ const { useState, useEffect, useRef, useMemo, useCallback } = React; /* ---- minimal geometric icons ---- */ const Icon = { search: (p) => (), branch: (p) => (), close: (p) => (), copy: (p) => (), terminal: (p) => (), spark: (p) => (), file: (p) => (), reveal: (p) => (), diff: (p) => (), plus: (p) => (), minus: (p) => (), check: (p) => (), discard: (p) => (), }; const Chevron = ({ open }) => ( ); const FolderIcon = ({ open }) => ( ); function FileIcon({ path }) { const ic = HL.iconFor(path); return {ic.t}; } /* ============ Git / Source Control panel ============ */ function GitRow({ c, staged, activePath, onOpen, onContext, onToggleStage }) { const name = c.path.split("/").pop(); const dir = c.path.split("/").slice(0, -1).join("/"); return (
onOpen(c.path, { diff: true })} onContextMenu={(e) => onContext(e, { path: c.path, kind: "git", staged })} title={c.path}> {c.status} {name} {dir && {dir}/} {c.add > 0 && +{c.add}} {c.del > 0 && -{c.del}}
); } function GitPanel({ changes, staged, committed, commitMsg, setCommitMsg, onStage, onUnstage, onStageAll, onUnstageAll, onCommit, onOpen, onContext, activePath }) { const visible = changes.filter((c) => !committed.has(c.path)); const stagedList = visible.filter((c) => staged.has(c.path)); const changesList = visible.filter((c) => !staged.has(c.path)); const totals = visible.reduce((a, c) => ({ add: a.add + c.add, del: a.del + c.del }), { add: 0, del: 0 }); const canCommit = stagedList.length > 0 && commitMsg.trim().length > 0; return (
{Icon.branch({})}Source Control {visible.length}