feat: unified rail shell, robust live sync, task board performance
Shell: - One shared NexusLayout for ALL routes (dashboard + pages): compact 68px icon rail with hover-expand overlay, replaces both old sidebars + topbars - Single flat nav source (railNav) — same menu everywhere incl. Settings - Removed dead shell components (AppSidebar, AppHeader, Topbar, NavGroup, NavItem, ModuleView) and dead nav routes; App.vue is now just RouterView Live updates: - Fix SSE loop in DashboardController: PeriodicTimer.WaitForNextTickAsync and ChannelReader.ReadAsync were re-invoked while pending — every published update threw InvalidOperationException and killed ALL live streams - liveSync store: treat graceful stream close as disconnect (was stuck connected=true with polling stopped -> page frozen until manual reload), fast first retry, heartbeat watchdog (65s), reconnect on online/visibility - One app-wide SSE connection owned by the layout instead of per-view connect/disconnect churn; removed duplicate live-sync.ts store Performance: - Board endpoint: drop nested childTasks duplication (counts stay) — payload 104KB -> 65KB; SSE snapshots shrink equally - nginx: gzip for JSON/JS/CSS (board 18KB, bundle 95KB over the wire); text/event-stream excluded to keep SSE unbuffered Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,139 +1,180 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* Sidebar — kompakte Icon-Rail (V2-Shell, alle Seiten)
|
||||
*
|
||||
* Collapsed 68px, expandiert bei Hover auf 232px als Overlay
|
||||
* (kein Layout-Shift im Content). Ersetzt Sidebar + Topbar.
|
||||
* Mobile: als Drawer über mobileOpen/close.
|
||||
*/
|
||||
import { computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useAuthStore } from '../../stores/auth'
|
||||
import { useAgentStore } from '../../stores/agents'
|
||||
import { useTaskStore } from '../../stores/tasks'
|
||||
import { navigation, icons } from '../../composables/icons'
|
||||
import type { NavGroupDef } from '../../composables/icons'
|
||||
import { useNotificationStore } from '../../stores/notifications'
|
||||
import { useLiveSyncStore } from '../../stores/liveSync'
|
||||
import { railNav, railFooterNav, svg } from '../../composables/icons'
|
||||
import { initials } from '../../utils/format'
|
||||
|
||||
defineProps<{
|
||||
mobileOpen?: boolean
|
||||
}>()
|
||||
|
||||
defineEmits<{
|
||||
const emit = defineEmits<{
|
||||
close: []
|
||||
}>()
|
||||
import NavGroup from './NavGroup.vue'
|
||||
import { initials } from '../../utils/format'
|
||||
|
||||
const auth = useAuthStore()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const agentStore = useAgentStore()
|
||||
const taskStore = useTaskStore()
|
||||
const notificationStore = useNotificationStore()
|
||||
const liveSync = useLiveSyncStore()
|
||||
|
||||
const ownerInitials = computed(() =>
|
||||
auth.user?.displayName ? initials(auth.user.displayName) : 'OW'
|
||||
)
|
||||
|
||||
function logout() {
|
||||
auth.logout()
|
||||
router.replace('/login')
|
||||
function isActive(itemRoute?: string): boolean {
|
||||
if (!itemRoute) return false
|
||||
if (route.path === itemRoute) return true
|
||||
// Detailrouten (/tasks/:id, /agents/:id) markieren den Hauptpunkt
|
||||
return route.path.startsWith(itemRoute + '/')
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamische Nav-Item-Counts aus den Stores.
|
||||
* Überschreibt die hartcodierten `count`-Werte im navigation-Array.
|
||||
*/
|
||||
const dynamicNavigation = computed<NavGroupDef[]>(() => {
|
||||
// Deep-clone: Jede Gruppe und jedes Item neu erstellen
|
||||
return navigation.map(group => ({
|
||||
...group,
|
||||
items: group.items.map(item => {
|
||||
let dynamicCount: string | undefined
|
||||
function navigate(itemRoute?: string) {
|
||||
if (!itemRoute) return
|
||||
emit('close')
|
||||
router.push(itemRoute)
|
||||
}
|
||||
|
||||
switch (item.label) {
|
||||
case 'Agenten':
|
||||
case 'Hosts · OpenClaw':
|
||||
dynamicCount = String(agentStore.agentList.length)
|
||||
break
|
||||
case 'Task Board':
|
||||
dynamicCount = String(taskStore.taskList.length)
|
||||
break
|
||||
case 'Kosten & Tokens':
|
||||
dynamicCount = agentStore.todayCost
|
||||
break
|
||||
case 'Docs & .md':
|
||||
dynamicCount = '0'
|
||||
break
|
||||
case 'Incidents':
|
||||
dynamicCount = '0'
|
||||
break
|
||||
}
|
||||
async function logout() {
|
||||
await auth.logout()
|
||||
await router.replace('/login')
|
||||
}
|
||||
|
||||
return {
|
||||
...item,
|
||||
count: dynamicCount ?? item.count,
|
||||
}
|
||||
}),
|
||||
}))
|
||||
const statusLabel = computed(() => {
|
||||
if (liveSync.connected) return 'Live'
|
||||
if (liveSync.connecting) return 'Verbinde…'
|
||||
return 'Polling'
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside :class="['sidebar', { open: mobileOpen }]">
|
||||
<button class="sidebar-close" @click="$emit('close')" v-html="icons.chevron_left || ''"></button>
|
||||
<aside :class="['rail', { open: mobileOpen }]">
|
||||
<!-- Brand -->
|
||||
<div class="side-top">
|
||||
<div class="brand-mark" v-html="icons.command || ''"></div>
|
||||
<div>
|
||||
<div class="brand-name">NEXUS</div>
|
||||
<div class="brand-sub">Mission Control</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="rail-brand" @click="navigate('/dashboard')">
|
||||
<span class="brand-mark" v-html="svg('command')"></span>
|
||||
<span class="rail-label brand-label">NEXUS</span>
|
||||
</button>
|
||||
|
||||
<!-- Navigation -->
|
||||
<nav class="nav">
|
||||
<NavGroup
|
||||
v-for="(group, idx) in dynamicNavigation"
|
||||
:key="idx"
|
||||
:label="group.group"
|
||||
:items="group.items"
|
||||
/>
|
||||
<nav class="rail-nav v2-scroll">
|
||||
<button
|
||||
v-for="item in railNav"
|
||||
:key="item.route"
|
||||
:class="['rail-item', { active: isActive(item.route) }]"
|
||||
:title="item.label"
|
||||
@click="navigate(item.route)"
|
||||
>
|
||||
<span class="rail-icon" v-html="svg(item.icon)"></span>
|
||||
<span
|
||||
v-if="item.route === '/notifications' && notificationStore.unreadCount > 0"
|
||||
class="rail-dot"
|
||||
></span>
|
||||
<span class="rail-label">{{ item.label }}</span>
|
||||
<span
|
||||
v-if="item.route === '/notifications' && notificationStore.unreadCount > 0"
|
||||
class="rail-count"
|
||||
>{{ notificationStore.unreadCount }}</span>
|
||||
</button>
|
||||
</nav>
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="side-foot">
|
||||
<div class="avatar">{{ ownerInitials }}</div>
|
||||
<div class="owner-info">
|
||||
<div class="owner-name">{{ auth.user?.displayName ?? 'Owner' }}</div>
|
||||
<div class="owner-role">{{ auth.user?.role ?? 'Owner' }}</div>
|
||||
<div class="rail-foot">
|
||||
<div class="rail-item static" :title="statusLabel">
|
||||
<span class="rail-icon">
|
||||
<span :class="['status-dot', liveSync.connected ? 'on' : 'off']"></span>
|
||||
</span>
|
||||
<span class="rail-label dim">{{ statusLabel }}</span>
|
||||
</div>
|
||||
|
||||
<button
|
||||
v-for="item in railFooterNav"
|
||||
:key="item.route"
|
||||
:class="['rail-item', { active: isActive(item.route) }]"
|
||||
:title="item.label"
|
||||
@click="navigate(item.route)"
|
||||
>
|
||||
<span class="rail-icon" v-html="svg(item.icon)"></span>
|
||||
<span class="rail-label">{{ item.label }}</span>
|
||||
</button>
|
||||
|
||||
<div class="rail-owner">
|
||||
<span class="avatar">{{ ownerInitials }}</span>
|
||||
<span class="rail-label owner-label">
|
||||
<span class="owner-name">{{ auth.user?.displayName ?? 'Owner' }}</span>
|
||||
<span class="owner-role">{{ auth.user?.role ?? 'Owner' }}</span>
|
||||
</span>
|
||||
<button class="logout-btn rail-label" title="Abmelden" @click="logout" v-html="svg('logout')"></button>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.sidebar {
|
||||
width: 248px;
|
||||
flex: 0 0 248px;
|
||||
height: 100vh;
|
||||
.rail {
|
||||
position: absolute;
|
||||
inset: 0 auto 0 0;
|
||||
width: 68px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: linear-gradient(180deg, rgba(14,12,32,.92), rgba(8,6,20,.92));
|
||||
background: linear-gradient(180deg, rgba(14, 12, 32, 0.92), rgba(8, 6, 20, 0.92));
|
||||
border-right: 1px solid var(--line);
|
||||
backdrop-filter: blur(14px);
|
||||
padding: 0;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
overflow: hidden;
|
||||
transition: width .18s ease, box-shadow .18s ease;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.side-top {
|
||||
.rail:hover {
|
||||
width: 232px;
|
||||
box-shadow: 24px 0 60px -30px rgba(0, 0, 0, .8);
|
||||
}
|
||||
|
||||
/* Labels: unsichtbar bis die Rail expandiert */
|
||||
.rail-label {
|
||||
opacity: 0;
|
||||
white-space: nowrap;
|
||||
transition: opacity .14s ease .04s;
|
||||
font-size: 13px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.rail:hover .rail-label,
|
||||
.rail.open .rail-label {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* ── Brand ── */
|
||||
.rail-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 11px;
|
||||
padding: 18px 18px 16px;
|
||||
gap: 13px;
|
||||
padding: 15px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.brand-mark {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
flex: 0 0 38px;
|
||||
border-radius: 11px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: var(--grad);
|
||||
box-shadow: var(--glow-purple);
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.brand-mark :deep(svg) {
|
||||
@@ -142,108 +183,154 @@ const dynamicNavigation = computed<NavGroupDef[]>(() => {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.brand-name {
|
||||
.brand-label {
|
||||
font-family: 'Space Grotesk', sans-serif;
|
||||
font-weight: 700;
|
||||
font-size: 17px;
|
||||
font-size: 16px;
|
||||
letter-spacing: .14em;
|
||||
line-height: 1;
|
||||
color: var(--tx);
|
||||
}
|
||||
|
||||
.brand-sub {
|
||||
font-size: 10.5px;
|
||||
color: var(--tx-3);
|
||||
letter-spacing: .05em;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.nav {
|
||||
/* ── Nav ── */
|
||||
.rail-nav {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 6px 12px 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
gap: 3px;
|
||||
padding: 6px 12px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.side-foot {
|
||||
padding: 12px;
|
||||
border-top: 1px solid var(--line);
|
||||
.rail-item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
gap: 13px;
|
||||
height: 42px;
|
||||
padding: 0 13px;
|
||||
flex: 0 0 auto;
|
||||
border: none;
|
||||
border-radius: 11px;
|
||||
background: transparent;
|
||||
color: var(--tx-2);
|
||||
font-family: 'Manrope', sans-serif;
|
||||
font-weight: 500;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
transition: background .15s;
|
||||
transition: background .15s, color .15s;
|
||||
}
|
||||
|
||||
.side-foot:hover {
|
||||
background: rgba(124,108,255,.06);
|
||||
.rail-item:not(.static):hover {
|
||||
background: rgba(124, 108, 255, .08);
|
||||
color: var(--tx);
|
||||
}
|
||||
|
||||
.sidebar-close {
|
||||
display: none;
|
||||
.rail-item.active {
|
||||
color: #fff;
|
||||
background: linear-gradient(90deg, rgba(124, 108, 255, .22), rgba(124, 108, 255, .04));
|
||||
box-shadow: inset 0 0 0 1px rgba(124, 108, 255, .25);
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.sidebar {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
height: 100vh;
|
||||
width: 280px;
|
||||
transform: translateX(-100%);
|
||||
transition: transform 0.25s ease;
|
||||
}
|
||||
.rail-item.static {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.sidebar.open {
|
||||
transform: translateX(0);
|
||||
}
|
||||
.rail-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
flex: 0 0 18px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
opacity: .9;
|
||||
}
|
||||
|
||||
.sidebar-close {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
top: 18px;
|
||||
right: 12px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 8px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--tx-2);
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
}
|
||||
.rail-icon :deep(svg) {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.sidebar-close:hover {
|
||||
background: rgba(124,108,255,.1);
|
||||
color: var(--tx);
|
||||
}
|
||||
.rail-item .rail-label {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.sidebar-close :deep(svg) {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
/* Ungelesen-Punkt am Icon (collapsed sichtbar) */
|
||||
.rail-dot {
|
||||
position: absolute;
|
||||
left: 24px;
|
||||
top: 9px;
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
background: var(--st-block);
|
||||
box-shadow: 0 0 8px rgba(251, 113, 133, .8);
|
||||
}
|
||||
|
||||
.rail-count {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 10.5px;
|
||||
font-weight: 600;
|
||||
padding: 1px 8px;
|
||||
border-radius: 20px;
|
||||
background: rgba(251, 113, 133, .16);
|
||||
border: 1px solid rgba(251, 113, 133, .35);
|
||||
color: var(--st-block);
|
||||
}
|
||||
|
||||
/* ── Footer ── */
|
||||
.rail-foot {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
padding: 6px 12px 10px;
|
||||
border-top: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.status-dot.on {
|
||||
background: var(--st-work);
|
||||
animation: pulse-work 1.8s infinite;
|
||||
}
|
||||
|
||||
.status-dot.off {
|
||||
background: var(--st-idle);
|
||||
}
|
||||
|
||||
.rail-label.dim {
|
||||
color: var(--tx-3);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.rail-owner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 13px;
|
||||
padding: 7px 5px 2px;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
flex: 0 0 34px;
|
||||
border-radius: 10px;
|
||||
background: var(--grad-soft);
|
||||
border: 1px solid var(--line-2);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
font-weight: 700;
|
||||
font-size: 13px;
|
||||
font-size: 12px;
|
||||
color: var(--tx);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.owner-info {
|
||||
min-width: 0;
|
||||
.owner-label {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.owner-name {
|
||||
@@ -258,7 +345,41 @@ const dynamicNavigation = computed<NavGroupDef[]>(() => {
|
||||
.owner-role {
|
||||
font-size: 10px;
|
||||
color: var(--tx-3);
|
||||
margin-top: 1px;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--tx-3);
|
||||
cursor: pointer;
|
||||
padding: 6px;
|
||||
border-radius: 8px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.logout-btn:hover {
|
||||
color: var(--st-block);
|
||||
background: rgba(251, 113, 133, .1);
|
||||
}
|
||||
|
||||
.logout-btn :deep(svg) {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
/* ── Mobile: Drawer ── */
|
||||
@media (max-width: 767px) {
|
||||
.rail {
|
||||
position: fixed;
|
||||
width: 232px;
|
||||
transform: translateX(-100%);
|
||||
transition: transform .22s ease;
|
||||
}
|
||||
|
||||
.rail.open {
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user