refactor(ui): raw buttons, details and hr use Button, Collapsible and Separator

This commit is contained in:
sam committed 2026-10-26 20:00:57 +11:00
1 parent 57c8514d5f
commit acf9ce2cd5
32 files changed
+138 -152

No files matched your search

+2 -1
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { Button } from "@/components/ui/button";
import { computed, nextTick, onMounted, ref, watch } from "vue";
import { useRoute } from "vue-router";
@@ -49,7 +50,7 @@ watch(() => accounts.status?.user, (user) => {
</script>
<template>
<div v-if="!accounts.status" class="mx-auto max-w-md p-8" role="status"><p>{{accounts.error||'Connecting to Archie…'}}</p><button v-if="accounts.error" class="mt-3 underline" @click="accounts.load">Retry</button></div>
<div v-if="!accounts.status" class="mx-auto max-w-md p-8" role="status"><p>{{accounts.error||'Connecting to Archie…'}}</p><Button v-if="accounts.error" variant="link" class="mt-3 px-0" @click="accounts.load">Retry</Button></div>
<AccountEntry v-else-if="!accounts.status.user || accounts.status.setup_required || reauthenticate" />
<TooltipProvider v-else :delay-duration="350">
<div
+3 -2
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { Button } from "@/components/ui/button";
import { computed } from "vue";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
@@ -27,9 +28,9 @@ const title = computed(() => store.catalog.find((item) => item.kind === props.ki
<template>
<Popover v-if="problems.length && compact">
<PopoverTrigger as-child>
<button type="button" class="rounded-sm" :aria-label="`Apply status: ${applyStateLabel(problems[0]!.state, mode)}`">
<Button type="button" variant="ghost" class="h-auto rounded-sm p-0" :aria-label="`Apply status: ${applyStateLabel(problems[0]!.state, mode)}`">
<Badge :variant="applyStateTone(problems[0]!.state, mode)">{{ applyStateLabel(problems[0]!.state, mode) }}</Badge>
</button>
</Button>
</PopoverTrigger>
<PopoverContent align="end" class="w-80">
<ApplyStatusRows :kind="kind" />
+5 -5
View File
@@ -178,15 +178,15 @@ const tones = {
<TabsContent value="marketplace">
<p v-if="store.catalogueError" class="text-sm text-fg-muted">{{ store.catalogueError }}</p>
<ExtensionsMarketplace v-else :updates="updates" />
<details class="mt-3">
<summary class="cursor-pointer text-xs text-fg-muted">Install by reference</summary>
<form class="mt-2 flex flex-wrap gap-2" @submit.prevent="install">
<Collapsible class="mt-3">
<CollapsibleTrigger class="cursor-pointer text-xs text-fg-muted">Install by reference</CollapsibleTrigger>
<CollapsibleContent><form class="mt-2 flex flex-wrap gap-2" @submit.prevent="install">
<Input v-model="name" class="max-w-40" placeholder="Name" aria-label="Name" required />
<Input v-model="reference" class="max-w-80 font-mono" placeholder="registry/repo:tag" aria-label="Reference" required />
<Input v-model="digest" class="max-w-96 font-mono" placeholder="sha256:…" aria-label="Digest" required />
<Button type="submit" size="sm" :disabled="!!store.busy"><Plus data-icon="inline-start" />Install</Button>
</form>
</details>
</form></CollapsibleContent>
</Collapsible>
</TabsContent>
</Tabs>
+3 -2
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { Button } from "@/components/ui/button";
import { computed, onMounted, onUnmounted, ref } from "vue";
import { ChevronDown } from "@lucide/vue";
@@ -122,9 +123,9 @@ onUnmounted(() => clearInterval(timer));
<template v-if="row.state !== 'up'">
<Popover v-if="reasons(row).length">
<PopoverTrigger as-child>
<button type="button" class="rounded-sm" :aria-label="`Why ${row.service} is ${row.state}`">
<Button type="button" variant="ghost" class="h-auto rounded-sm p-0" :aria-label="`Why ${row.service} is ${row.state}`">
<Badge :variant="tone[row.state]">{{ stateLabel(row, table.agent) }}<ChevronDown data-icon="inline-end" /></Badge>
</button>
</Button>
</PopoverTrigger>
<PopoverContent align="start" class="w-96 max-w-[calc(100vw-2rem)] space-y-1 text-sm">
<p v-for="reason in reasons(row)" :key="reason" class="break-words">{{ reason }}</p>
+2 -1
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { Separator } from "@/components/ui/separator";
import { computed } from "vue";
import { useRoute } from "vue-router";
@@ -33,7 +34,7 @@ const items = computed(() =>
>
<ul class="flex flex-col gap-0.5 lg:sticky lg:top-20 max-lg:flex-row max-lg:gap-1">
<li v-for="(item, index) in items" :key="item.path" class="contents">
<hr v-if="item.dividerBefore === ''" class="my-4 border-border max-lg:hidden" />
<Separator v-if="item.dividerBefore === ''" class="my-4 max-lg:hidden" />
<p
v-else-if="item.dividerBefore"
:class="cn('mb-1 px-3 text-caption font-medium tracking-[0.06em] text-fg-subtle uppercase max-lg:hidden', index > 0 && 'mt-4')"
+2 -2
View File
@@ -38,11 +38,11 @@ function open(trigger: WorkflowTrigger): void {
</div>
<ul v-if="triggers.length" class="divide-y divide-border rounded-md border border-border">
<li v-for="trigger in triggers" :key="trigger.kind + trigger.label" class="text-label">
<button v-if="trigger.binding" type="button" class="flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-secondary" @click="open(trigger)">
<Button v-if="trigger.binding" type="button" variant="ghost" class="h-auto w-full justify-start gap-2 rounded-none px-3 py-2 text-label font-normal" @click="open(trigger)">
<span class="truncate">{{ trigger.label }}</span>
<Badge v-if="trigger.binding.status !== 'armed'" :variant="statusKind(trigger.binding.status)">{{ statusLabel(trigger.binding.status) }}</Badge>
<span v-if="trigger.detail" class="ml-auto truncate text-xs text-fg-subtle">{{ trigger.detail }}</span>
</button>
</Button>
<RouterLink v-else-if="trigger.kind === 'workflow' || trigger.kind === 'playbook'" :to="trigger.kind === 'workflow' ? { path: '/workflows', query: { workflow: trigger.label } } : { path: '/org/playbooks' }" class="flex items-center gap-2 px-3 py-2 hover:bg-secondary">
<span class="truncate">{{ trigger.label }}</span><span class="ml-auto truncate text-xs text-fg-subtle">{{ trigger.detail }}</span>
</RouterLink>
+1 -1
View File
@@ -425,7 +425,7 @@ onBeforeUnmount(() => yamlObserver?.disconnect());
<PopoverContent align="end" class="max-h-96 w-80 overflow-y-auto p-1">
<ul class="text-xs text-danger">
<li v-for="(error, i) in errors" :key="i">
<button v-if="error.path" type="button" class="w-full rounded px-2 py-1.5 text-left hover:bg-muted hover:underline" @click="showError(error.path)">{{ error.text }}</button>
<Button v-if="error.path" type="button" variant="ghost" class="h-auto w-full justify-start whitespace-normal px-2 py-1.5 text-left text-xs font-normal text-danger hover:underline" @click="showError(error.path)">{{ error.text }}</Button>
<p v-else class="px-2 py-1.5">{{ error.text }}</p>
</li>
</ul>