Merge pull request 'feat(ui): move desktop navigation into the topbar breadcrumb (#1880)' (#1891) from feat/topbar-nav into main
deploy / plan (push) Successful in 25s
ci/woodpecker/push/deploy Pipeline failed
deploy / gate (push) Failing after 9m22s
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped

Reviewed-on: #1891
This commit was merged in pull request #1891.
This commit is contained in:
sam committed 2026-11-12 11:34:09 +00:00
commit 37ea698a28
8 files changed
+183 -21

No files matched your search

+15 -4
View File
@@ -9,9 +9,13 @@ import ChatDock from "@/chat/ChatDock.vue";
import AlertsBell from "@/alerts/AlertsBell.vue";
import AppSidebar from "@/components/AppSidebar.vue";
import CommandPalette from "@/components/command-palette/CommandPalette.vue";
import AccountMenu from "@/components/topbar/AccountMenu.vue";
import OrgCrumb from "@/components/topbar/OrgCrumb.vue";
import SectionCrumb from "@/components/topbar/SectionCrumb.vue";
import Brand from "@/components/topbar/Brand.vue";
import Logo from "@/components/topbar/Logo.vue";
import ConnectionPill from "@/components/topbar/ConnectionPill.vue";
import { Breadcrumb, BreadcrumbItem, BreadcrumbList, BreadcrumbSeparator } from "@/components/ui/breadcrumb";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { Card } from "@/components/ui/card";
import { SidebarInset, SidebarProvider, SidebarTrigger } from "@/components/ui/sidebar";
@@ -94,13 +98,22 @@ watch(() => accounts.status?.user, (user) => {
<AppSidebar :hidden="hidden" />
<SidebarInset class="min-w-0 bg-[var(--workspace)]" :class="workflowsPage && 'max-md:h-dvh'">
<header class="bg-card border-border-strong sticky top-0 z-30 flex h-14 shrink-0 items-center gap-2 border-b px-3 shadow-[var(--shadow-sm)] sm:px-4">
<SidebarTrigger class="-ml-1" />
<SidebarTrigger class="-ml-1 md:hidden" />
<Brand />
<Breadcrumb class="max-md:hidden">
<BreadcrumbList class="flex-nowrap gap-1 sm:gap-1">
<BreadcrumbSeparator />
<BreadcrumbItem><OrgCrumb /></BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem><SectionCrumb :hidden="hidden" /></BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
<div class="ml-auto flex shrink-0 items-center gap-2">
<ConnectionPill />
<CommandPalette :hidden="hidden" @new-task="newTaskOpen = true" />
<NewTaskDialog v-if="!hidden.includes('/workflows')" v-model:open="newTaskOpen" />
<AlertsBell />
<span class="max-md:hidden"><AccountMenu /></span>
</div>
</header>
<div id="main-content" ref="main" tabindex="-1" class="scroll-mt-16 w-full flex-1 px-6 py-5 pb-[calc(var(--chat-dock-clear,6rem)+1rem)] outline-none max-lg:p-4 max-lg:pb-[calc(var(--chat-dock-clear,6rem)+1rem)]"
@@ -123,9 +136,7 @@ watch(() => accounts.status?.user, (user) => {
</RouterView>
</div>
</SidebarInset>
<!-- A later sibling of the sidebar, so peer-data tracks its width and the
dock centres over the content instead of under the sidebar. -->
<ChatDock class="md:start-(--sidebar-width) md:peer-data-[state=collapsed]:start-(--sidebar-width-icon)" />
<ChatDock />
</SidebarProvider>
<Toaster position="bottom-right" rich-colors close-button />
</TooltipProvider>
+5 -3
View File
@@ -2,13 +2,16 @@
import NavMain from "@/components/NavMain.vue";
import NavUser from "@/components/NavUser.vue";
import TeamSwitcher from "@/components/TeamSwitcher.vue";
import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarRail } from "@/components/ui/sidebar";
import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, useSidebar } from "@/components/ui/sidebar";
defineProps<{ hidden: string[] }>();
// Desktop navigation lives in the topbar; only the phone sheet remains.
const { isMobile } = useSidebar();
</script>
<template>
<Sidebar collapsible="icon" class="h-dvh">
<Sidebar v-if="isMobile" class="h-dvh">
<SidebarHeader>
<TeamSwitcher />
</SidebarHeader>
@@ -18,6 +21,5 @@ defineProps<{ hidden: string[] }>();
<SidebarFooter>
<NavUser />
</SidebarFooter>
<SidebarRail />
</Sidebar>
</template>
+1 -9
View File
@@ -1,10 +1,10 @@
<script setup lang="ts">
import { computed, watch } from "vue";
import { useRoute } from "vue-router";
import { Building2, LayoutDashboard, ListChecks, Server, Workflow, Zap, type LucideIcon } from "@lucide/vue";
import { SidebarGroup, SidebarMenu, SidebarMenuButton, SidebarMenuItem, useSidebar } from "@/components/ui/sidebar";
import { activeNavPath, navTree, type NavEntry } from "@/lib/nav";
import { navIcons as icons } from "@/lib/nav-icons";
const props = defineProps<{ hidden: string[] }>();
@@ -13,14 +13,6 @@ const { isMobile, setOpenMobile } = useSidebar();
const links = computed(() =>
navTree(props.hidden).flatMap((node): NavEntry[] => (node.kind === "link" ? [node.entry] : [])),
);
const icons: Record<string, LucideIcon> = {
"/": LayoutDashboard,
"/tasks": ListChecks,
"/workflows": Workflow,
"/events": Zap,
"/org": Building2,
"/settings": Server,
};
const activePath = computed(() => activeNavPath(route.path));
watch(() => route.path, () => { if (isMobile.value) setOpenMobile(false); });
+39
View File
@@ -0,0 +1,39 @@
<script setup lang="ts">
import { LogOut, Palette, ScrollText, UserRound } from "@lucide/vue";
import { useAccountsStore } from "@/accounts/accounts";
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
const accounts = useAccountsStore();
</script>
<template>
<DropdownMenu>
<DropdownMenuTrigger as-child>
<button type="button" aria-label="Operator menu" class="rounded-full outline-none focus-visible:ring-[3px] focus-visible:ring-ring">
<Avatar class="size-8">
<AvatarFallback>{{ accounts.status?.user?.display_name.slice(0, 1).toUpperCase() }}</AvatarFallback>
</Avatar>
</button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" class="min-w-56">
<DropdownMenuLabel class="truncate">{{ accounts.status?.user?.display_name }}</DropdownMenuLabel>
<DropdownMenuGroup>
<DropdownMenuItem as-child><RouterLink to="/account"><UserRound />Your account</RouterLink></DropdownMenuItem>
<DropdownMenuItem as-child><RouterLink to="/account/appearance"><Palette />Appearance</RouterLink></DropdownMenuItem>
<DropdownMenuItem as-child><RouterLink to="/logs"><ScrollText />Logs</RouterLink></DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuItem @select="accounts.signOut"><LogOut />Sign out</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</template>
+51
View File
@@ -0,0 +1,51 @@
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { computed, onMounted, ref } from "vue";
import { Check, ChevronDown } from "@lucide/vue";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { useOrgStore } from "@/stores/org";
const orgStore = useOrgStore();
const { homeOrg, memberOrgs, orgs } = storeToRefs(orgStore);
const failed = ref("");
onMounted(() => void orgStore.loadOrg().catch((cause) => (failed.value = String((cause as Error).message || cause))));
const choices = computed(() => orgs.value.filter((o) => memberOrgs.value.includes(o.id)));
const name = computed(() => orgs.value.find((o) => o.id === homeOrg.value)?.name ?? (failed.value ? "Organisations unavailable" : "Loading…"));
async function choose(id: string): Promise<void> {
if (id === homeOrg.value) return;
failed.value = "";
try {
await orgStore.actInOrg(id);
} catch (cause) {
failed.value = String((cause as Error).message || cause);
}
}
</script>
<template>
<DropdownMenu v-if="choices.length > 1">
<DropdownMenuTrigger as-child>
<Button variant="ghost" size="sm" class="gap-1 px-2" :aria-label="`Organisation: ${name}`" :title="failed || undefined">
<span class="max-w-40 truncate">{{ name }}</span>
<ChevronDown class="size-4" aria-hidden="true" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" class="min-w-48">
<DropdownMenuItem v-for="o in choices" :key="o.id" @select="choose(o.id)">
{{ o.name }}
<Check v-if="o.id === homeOrg" class="ml-auto" aria-label="Current" />
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
<span v-else class="max-w-40 truncate px-2 text-label font-medium" :title="failed || undefined" :aria-label="`Organisation: ${name}`">{{ name }}</span>
</template>
+60
View File
@@ -0,0 +1,60 @@
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { computed } from "vue";
import { useRoute } from "vue-router";
import { ChevronDown } from "@lucide/vue";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { activeNavPath, navTree, type NavEntry } from "@/lib/nav";
import { navIcons } from "@/lib/nav-icons";
import { attentionStatusIds } from "@/lib/task-meta";
import { useLiveResource } from "@/stores/session";
import { useTasksStore } from "@/stores/tasks";
const props = defineProps<{ hidden: string[] }>();
const route = useRoute();
const store = useTasksStore();
const { summary } = storeToRefs(store);
// The attention count has to stay current on every page, not only the dashboard.
useLiveResource("tasks", () => void store.load(), 5000);
const links = computed(() =>
navTree(props.hidden).flatMap((node): NavEntry[] => (node.kind === "link" ? [node.entry] : [])),
);
const activePath = computed(() => activeNavPath(route.path));
const current = computed(() => links.value.find((entry) => entry.path === activePath.value));
const attention = computed(() => {
const counts = summary.value?.statuses ?? {};
let total = 0;
for (const id of attentionStatusIds()) total += counts[id] ?? 0;
return total;
});
</script>
<template>
<DropdownMenu>
<DropdownMenuTrigger as-child>
<Button variant="ghost" size="sm" class="gap-1 px-2" aria-label="Sections">
<span>{{ current?.label ?? route.meta.label ?? "Sections" }}</span>
<Badge v-if="activePath !== '/' && attention" variant="warn" class="tabular-nums" :aria-label="`${attention} need attention`">{{ attention }}</Badge>
<ChevronDown class="size-4" aria-hidden="true" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" class="min-w-48">
<DropdownMenuItem v-for="entry in links" :key="entry.path" as-child :class="entry.path === activePath && 'bg-accent'">
<RouterLink :to="entry.path" :aria-current="entry.path === activePath ? 'page' : undefined">
<component :is="navIcons[entry.path]" v-if="navIcons[entry.path]" aria-hidden="true" />
{{ entry.label }}
<Badge v-if="entry.path === '/' && attention" variant="warn" class="ml-auto tabular-nums" :aria-label="`${attention} need attention`">{{ attention }}</Badge>
</RouterLink>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</template>
+2 -5
View File
@@ -1,11 +1,8 @@
import { onMounted } from "vue";
import { useLiveResource } from "@/stores/session";
import { useTasksStore } from "@/stores/tasks";
/** Owns the initial fetch and the event stream for the page's lifetime. */
/** Fetches the board when the page opens; the shell keeps it live. */
export function useDashboard(): void {
const store = useTasksStore();
useLiveResource("tasks", () => void store.load(), 5000);
onMounted(store.load);
onMounted(useTasksStore().load);
}
+10
View File
@@ -0,0 +1,10 @@
import { Building2, LayoutDashboard, ListChecks, Server, Workflow, Zap, type LucideIcon } from "@lucide/vue";
export const navIcons: Record<string, LucideIcon> = {
"/": LayoutDashboard,
"/tasks": ListChecks,
"/workflows": Workflow,
"/events": Zap,
"/org": Building2,
"/settings": Server,
};