feat(ui): marketplace grouped by surface, searchable, with install state
The marketplace was one long list of filled Install buttons with the raw surface name beside each version. Packages now group under Forges, Channels, Secret engines and the rest, as cards in a two-column grid with a search box. Installed packages stay listed, marked installed or offering their update.
This commit is contained in:
1 parent
6c2ab54f65
commit
59e3de62db
4 files changed
+208
-118
No files matched your search
@@ -0,0 +1,105 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, type Component } from "vue";
|
||||
import { BookOpen, GitPullRequest, KeyRound, MessageSquare, Package, Plus, Search, UserCog, Workflow, Zap } from "@lucide/vue";
|
||||
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
|
||||
import { Item, ItemActions, ItemContent, ItemDescription, ItemMedia, ItemTitle } from "@/components/ui/item";
|
||||
import { useExtensionsStore, type CatalogueEntry } from "@/stores/extensions";
|
||||
|
||||
/**
|
||||
* The catalogue, grouped by what each package extends. Installed packages stay
|
||||
* listed so the catalogue reads whole; they offer an update when one exists.
|
||||
*/
|
||||
const props = defineProps<{ updates: Map<string, CatalogueEntry> }>();
|
||||
const store = useExtensionsStore();
|
||||
|
||||
// Surfaces in the order an operator sets archie up: where work comes from and
|
||||
// goes, then credentials, then what agents do.
|
||||
const SURFACES: { id: string; label: string; icon: Component }[] = [
|
||||
{ id: "forge", label: "Forges", icon: GitPullRequest },
|
||||
{ id: "channels", label: "Channels", icon: MessageSquare },
|
||||
{ id: "secret-engines", label: "Secret engines", icon: KeyRound },
|
||||
{ id: "workflows", label: "Workflows", icon: Workflow },
|
||||
{ id: "playbooks", label: "Playbooks", icon: Zap },
|
||||
{ id: "skills", label: "Skills", icon: BookOpen },
|
||||
{ id: "profiles", label: "Agent profiles", icon: UserCog },
|
||||
];
|
||||
|
||||
const query = ref("");
|
||||
const groups = computed(() => {
|
||||
const q = query.value.trim().toLowerCase();
|
||||
const matching = store.catalogue.filter(
|
||||
(entry) => !q || entry.name.toLowerCase().includes(q) || entry.description.toLowerCase().includes(q),
|
||||
);
|
||||
const known = new Set(SURFACES.map((s) => s.id));
|
||||
const other = { id: "other", label: "Other", icon: Package };
|
||||
return [...SURFACES, other]
|
||||
.map((surface) => ({
|
||||
...surface,
|
||||
entries: matching.filter((e) => (surface.id === "other" ? !known.has(e.surface) : e.surface === surface.id)),
|
||||
}))
|
||||
.filter((group) => group.entries.length > 0);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-6">
|
||||
<InputGroup class="max-w-sm">
|
||||
<InputGroupAddon><Search /></InputGroupAddon>
|
||||
<InputGroupInput v-model="query" type="search" placeholder="Search extensions" aria-label="Search extensions" />
|
||||
</InputGroup>
|
||||
|
||||
<section v-for="group in groups" :key="group.id" :aria-labelledby="`surface-${group.id}`">
|
||||
<h2 :id="`surface-${group.id}`" class="mb-2 flex items-center gap-2 text-label font-semibold">
|
||||
<component :is="group.icon" class="size-4 text-fg-subtle" aria-hidden="true" />
|
||||
{{ group.label }}
|
||||
<span class="font-normal text-fg-subtle">{{ group.entries.length }}</span>
|
||||
</h2>
|
||||
<ul class="grid gap-2 lg:grid-cols-2">
|
||||
<li v-for="entry in group.entries" :key="entry.name" class="flex">
|
||||
<Item variant="outline" class="h-full flex-nowrap items-start bg-card">
|
||||
<ItemMedia class="mt-0.5 size-8 rounded-md bg-muted">
|
||||
<component :is="group.icon" class="size-4 text-fg-muted" aria-hidden="true" />
|
||||
</ItemMedia>
|
||||
<ItemContent class="min-w-0">
|
||||
<ItemTitle>
|
||||
{{ entry.name }}
|
||||
<span class="font-mono text-caption font-normal text-fg-subtle">{{ entry.version }}</span>
|
||||
</ItemTitle>
|
||||
<ItemDescription class="text-xs" :title="entry.description">{{ entry.description }}</ItemDescription>
|
||||
</ItemContent>
|
||||
<ItemActions class="self-center">
|
||||
<Button
|
||||
v-if="props.updates.has(entry.name)"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
:disabled="!!store.busy"
|
||||
@click="store.update(entry.name)"
|
||||
>Update to {{ entry.version }}</Button
|
||||
>
|
||||
<Badge v-else-if="entry.installed" variant="ok">Installed</Badge>
|
||||
<Button
|
||||
v-else
|
||||
variant="outline"
|
||||
size="sm"
|
||||
:disabled="!!store.busy"
|
||||
:aria-label="`Install ${entry.name}`"
|
||||
@click="store.installFromCatalogue(entry.name)"
|
||||
><Plus data-icon="inline-start" />Install</Button
|
||||
>
|
||||
</ItemActions>
|
||||
</Item>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<Empty v-if="!groups.length" class="py-6">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>{{ store.catalogue.length ? "No extensions match" : "The catalogue is empty" }}</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
</div>
|
||||
</template>
|
||||
@@ -23,6 +23,7 @@ import { Section } from "@/components/ui/section";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { grants, stage, useExtensionsStore, type Extension } from "@/stores/extensions";
|
||||
import ApplyStatusRows from "./ApplyStatusRows.vue";
|
||||
import ExtensionsMarketplace from "./ExtensionsMarketplace.vue";
|
||||
|
||||
const KIND = "extension-settings";
|
||||
const store = useExtensionsStore();
|
||||
@@ -32,7 +33,6 @@ onMounted(async () => {
|
||||
loading.value = false;
|
||||
});
|
||||
|
||||
const available = computed(() => store.catalogue.filter((entry) => !entry.installed));
|
||||
// The catalogue entry an installed package would move to on Update, when the
|
||||
// catalogue pins a different digest than the one installed.
|
||||
const updates = computed(() => {
|
||||
@@ -176,22 +176,7 @@ const tones = {
|
||||
</TabsContent>
|
||||
<TabsContent value="marketplace">
|
||||
<p v-if="store.catalogueError" class="text-sm text-fg-muted">{{ store.catalogueError }}</p>
|
||||
<Section v-else>
|
||||
<ul class="divide-y divide-border">
|
||||
<li v-for="entry in available" :key="entry.name" class="flex flex-wrap items-center gap-3 py-3 first:pt-0 last:pb-0">
|
||||
<div class="min-w-0 flex-1">
|
||||
<p class="truncate text-sm font-medium">
|
||||
{{ entry.name }}
|
||||
<span class="font-mono text-xs text-fg-subtle">{{ entry.surface }} {{ entry.version }}</span>
|
||||
</p>
|
||||
<p class="text-xs text-fg-subtle">{{ entry.description }}</p>
|
||||
</div>
|
||||
<Button size="sm" :disabled="!!store.busy" @click="store.installFromCatalogue(entry.name)">
|
||||
<Plus data-icon="inline-start" /> Install</Button>
|
||||
</li>
|
||||
<li v-if="!available.length" class="py-3 text-sm text-fg-muted">Everything listed is installed.</li>
|
||||
</ul>
|
||||
</Section>
|
||||
<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">
|
||||
|
||||
Reference in new issue
Block a user