From 18d6c2191ce42a5010659d55fb98ac19b67b0c38 Mon Sep 17 00:00:00 2001 From: David Hill Date: Tue, 27 Jan 2026 16:59:07 +0000 Subject: [PATCH] fix(app): align filetree change styling --- packages/app/src/components/file-tree.tsx | 102 +++++++++++++++------- 1 file changed, 70 insertions(+), 32 deletions(-) diff --git a/packages/app/src/components/file-tree.tsx b/packages/app/src/components/file-tree.tsx index 24b15483e..e150c1d41 100644 --- a/packages/app/src/components/file-tree.tsx +++ b/packages/app/src/components/file-tree.tsx @@ -71,9 +71,11 @@ export default function FileTree(props: { const marks = createMemo(() => { if (props._marks) return props._marks - const modified = props.modified ?? (props.kinds ? Array.from(props.kinds.keys()) : undefined) - if (!modified || modified.length === 0) return - return new Set(modified) + const out = new Set() + for (const item of props.modified ?? []) out.add(item) + for (const item of props.kinds?.keys() ?? []) out.add(item) + if (out.size === 0) return + return out }) const kinds = createMemo(() => { @@ -146,7 +148,7 @@ export default function FileTree(props: { {local.children} - - {local.node.name} - {(() => { - if (local.node.type !== "file") return null + const kind = kinds()?.get(local.node.path) + const marked = marks()?.has(local.node.path) ?? false + const active = !!kind && marked && !local.node.ignored + const color = + kind === "add" + ? "color: var(--icon-diff-add-base)" + : kind === "del" + ? "color: var(--icon-diff-delete-base)" + : kind === "mix" + ? "color: var(--icon-diff-modified-base)" + : undefined + return ( + + {local.node.name} + + ) + })()} + {(() => { + const kind = kinds()?.get(local.node.path) + if (!kind) return null if (!marks()?.has(local.node.path)) return null - const kind = kinds()?.get(local.node.path) - return ( -
- ) + if (local.node.type === "file") { + const text = kind === "add" ? "A" : kind === "del" ? "D" : "M" + const color = + kind === "add" + ? "color: var(--icon-diff-add-base)" + : kind === "del" + ? "color: var(--icon-diff-delete-base)" + : "color: var(--icon-diff-modified-base)" + + return ( + + {text} + + ) + } + + if (local.node.type === "directory") { + const color = + kind === "add" + ? "background-color: var(--icon-diff-add-base)" + : kind === "del" + ? "background-color: var(--icon-diff-delete-base)" + : "background-color: var(--icon-diff-modified-base)" + + return
+ } + + return null })()} ) @@ -228,9 +259,8 @@ export default function FileTree(props: { const head = parts.slice(0, -1).join("/") const prefix = head ? `${head}/` : "" - const kind = () => (node.type === "file" ? kinds()?.get(node.path) : undefined) + const kind = () => kinds()?.get(node.path) const label = () => { - if (!marks()?.has(node.path)) return const k = kind() if (!k) return if (k === "add") return "Additions" @@ -238,6 +268,8 @@ export default function FileTree(props: { return "Modifications" } + const ignored = () => node.type === "directory" && node.ignored + return ( )} + + <> + + Ignored + +
} >