Files
archie/ui/src/tasks/PlanDocument.vue
T
sam f156150a8b
ci/woodpecker/pr/quality Pipeline failed
Quality / check (pull_request) Canceled after 0s
fix(ui): size page layouts by container width, not viewport (#1892)
2026-11-12 23:05:31 +11:00

76 lines
2.7 KiB
Vue

<script setup lang="ts">
import ChatMarkdown from "@/chat/ChatMarkdown.vue";
import { Alert, AlertTitle } from "@/components/ui/alert";
import { Badge } from "@/components/ui/badge";
import { MetadataList } from "@/components/ui/metadata-list";
import type { PlanDocument } from "./task-run";
/**
* A plan written as structured fields, laid out for a decision. The plan text
* the next workflow reads is rendered from the same fields on the server.
*/
defineProps<{ doc: PlanDocument }>();
const changeVariant: Record<string, "ok" | "info" | "danger"> = {
added: "ok",
modified: "info",
deleted: "danger",
};
</script>
<template>
<div class="flex min-w-0 flex-col gap-5">
<MetadataList
v-if="doc.diff_estimate"
:rows="[{ label: 'Estimated diff', value: doc.diff_estimate }]"
/>
<Alert v-if="doc.risks?.length" variant="warn">
<AlertTitle>Risks</AlertTitle>
<ul class="list-disc space-y-1 pl-5 text-label">
<li v-for="(risk, i) in doc.risks" :key="i">{{ risk }}</li>
</ul>
</Alert>
<section class="flex min-w-0 flex-col gap-2">
<h3 class="text-title font-semibold">Problem</h3>
<ChatMarkdown :text="doc.problem" />
</section>
<section class="flex min-w-0 flex-col gap-2">
<h3 class="text-title font-semibold">Proposed solution</h3>
<ChatMarkdown :text="doc.solution" />
</section>
<section v-if="doc.files?.length" class="flex min-w-0 flex-col gap-2">
<h3 class="text-title font-semibold">Files</h3>
<ul class="flex flex-col gap-1.5 text-label">
<li
v-for="file in doc.files"
:key="file.path"
class="flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5"
>
<Badge :variant="changeVariant[file.change] ?? 'idle'">{{ file.change }}</Badge>
<code class="font-mono text-caption [overflow-wrap:anywhere]">{{ file.path }}</code>
<span v-if="file.note" class="text-fg-muted">{{ file.note }}</span>
</li>
</ul>
</section>
<div class="grid gap-5 @xl:grid-cols-2">
<section v-if="doc.acceptance?.length" class="flex min-w-0 flex-col gap-2">
<h3 class="text-title font-semibold">Acceptance criteria</h3>
<ul class="list-disc space-y-1 pl-5 text-label">
<li v-for="(item, i) in doc.acceptance" :key="i">{{ item }}</li>
</ul>
</section>
<section v-if="doc.non_goals?.length" class="flex min-w-0 flex-col gap-2">
<h3 class="text-title font-semibold">Non-goals</h3>
<ul class="list-disc space-y-1 pl-5 text-label">
<li v-for="(item, i) in doc.non_goals" :key="i">{{ item }}</li>
</ul>
</section>
</div>
</div>
</template>