Files
archie/ui/src/tasks/ChangeFileTable.vue
T
sam 94f79177a2
deploy / gate (push) Successful in 4m53s
Quality / check (push) Successful in 6m42s
deploy / archied-image (push) Successful in 3m20s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
fix(ui): adopt the type scale across components/ui and pages (#1758)
components/ui and the pages now use only the style.css scale:
text-[0.8rem]→text-label, text-[0.625rem]→text-micro, text-base/text-sm→
text-label (rows and controls), text-xs→text-caption (captions and
secondary text), text-lg/text-xl/text-2xl→text-title (panel and page
titles). Rendered markdown (ChatMarkdown/ChatInline/markdown.ts) keeps
Tailwind steps as the issue allows. 196 files, class-token swaps only.
2026-11-06 23:07:46 +11:00

88 lines
3.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { ChevronRight, FileMinus2, FilePen, FilePlus2, FileSymlink } from "@lucide/vue";
import { createReusableTemplate } from "@vueuse/core";
import { computed } from "vue";
import { Button } from "@/components/ui/button";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
import { fileStatusLabel } from "./changed-files";
import { fileTree, type FileNode } from "./file-tree";
import type { Capture } from "./task-run";
/**
* One capture's files as a folder tree. The counts beside a path are the
* diffstat the daemon recorded at the producer, not a reading of the file on
* disk now.
*/
const props = defineProps<{ capture: Capture }>();
const files = computed(() => props.capture.files || []);
const tree = computed(() => fileTree(files.value));
const total = computed(
() => Number(props.capture.totals?.files) || files.value.length,
);
const ICONS: Record<string, typeof FilePen> = {
added: FilePlus2,
deleted: FileMinus2,
renamed: FileSymlink,
};
const TONES: Record<string, string> = {
added: "text-ok",
deleted: "text-danger",
};
const [DefineNode, ReuseNode] = createReusableTemplate<{ node: FileNode }>();
</script>
<template>
<p v-if="!files.length" class="py-3 text-caption text-fg-muted">No file entries recorded{{
total
? ` (diffstat covers ${total} file${total === 1 ? "" : "s"})`
: ""
}}.</p>
<template v-else>
<DefineNode v-slot="{ node }">
<Collapsible v-if="!node.file" default-open>
<CollapsibleTrigger as-child>
<Button variant="ghost" size="sm" class="w-full justify-start font-mono text-label font-normal aria-expanded:bg-transparent aria-expanded:hover:bg-muted dark:aria-expanded:hover:bg-muted/50">
<ChevronRight class="transition-transform group-data-[state=open]/button:rotate-90" />
{{ node.name }}
</Button>
</CollapsibleTrigger>
<CollapsibleContent>
<div class="ml-4 flex flex-col border-l border-border pl-1">
<ReuseNode v-for="child in node.children" :key="child.path" :node="child" />
</div>
</CollapsibleContent>
</Collapsible>
<div
v-else
class="flex min-h-8 items-center gap-2 px-2.5 py-1 font-mono text-label"
:title="fileStatusLabel(node.file.status)"
>
<component
:is="ICONS[node.file.status ?? ''] ?? FilePen"
class="size-4 shrink-0"
:class="TONES[node.file.status ?? ''] ?? 'text-fg-muted'"
:aria-label="fileStatusLabel(node.file.status)"
/>
<span class="min-w-0 flex-1 break-all">
<span v-if="node.file.old_path" class="text-fg-muted">{{ node.file.old_path }} → </span>{{ node.name }}
<!-- binary means "no textual hunks were recorded", not "this is a
binary file on disk": the counts beside it are still real. -->
<span v-if="node.file.binary" class="ml-1 text-caption text-fg-muted">no textual hunks</span>
</span>
<span class="shrink-0 whitespace-nowrap">
<span v-if="node.file.additions" class="text-ok">+{{ node.file.additions }}</span>
<span v-if="node.file.deletions" class="ml-1.5 text-danger">−{{ node.file.deletions }}</span>
</span>
</div>
</DefineNode>
<div class="flex flex-col py-1">
<ReuseNode v-for="node in tree" :key="node.path" :node="node" />
</div>
</template>
</template>