Backend: - Add AI assistant service with gap detection, anomaly analysis, Anthropic tool_use streaming - Add assistant router (chat SSE, history, flags CRUD, session categorization) - Fix agentic loop: text+tool_use in single assistant message per Anthropic spec - Migrate logging from stdlib to structlog in assistant modules - Fix migration 0005: UUID type for ai_flags/assistant_messages FKs Frontend: - Fix vite base path → /cc-dashboard/static/ to match FastAPI StaticFiles mount - Redesign Sidebar: gradient background, amber gradient active state, 44px touch targets, user avatar - Redesign KpiCard: corner decorations, ring border, trend icon, baseline bar (21st.dev pattern) - Redesign TopBar: backdrop-blur, sticky, gradient user avatar, sign-out button - Improve AssistantWidget: fix setInterval leak, aria-labels, proper markdown block parser - Fix AssistantWidget renderMarkdown: line-by-line parser for correct list/header nesting Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
138 lines
8.5 KiB
Vue
138 lines
8.5 KiB
Vue
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
import { useRoute } from 'vue-router'
|
|
import { useAuthStore } from '@/stores/auth'
|
|
|
|
const route = useRoute()
|
|
const authStore = useAuthStore()
|
|
|
|
const emit = defineEmits<{ close: [] }>()
|
|
|
|
interface NavItem {
|
|
name: string
|
|
path: string
|
|
icon: string
|
|
adminOnly?: boolean
|
|
}
|
|
|
|
const navItems: NavItem[] = [
|
|
{ name: 'Dashboard', path: '/', icon: 'grid' },
|
|
{ name: 'Calendar', path: '/calendar', icon: 'calendar' },
|
|
{ name: 'Planner', path: '/planner', icon: 'check-square' },
|
|
{ name: 'Projects', path: '/projects', icon: 'folder' },
|
|
{ name: 'Live Feed', path: '/live', icon: 'activity' },
|
|
{ name: 'Reports', path: '/reports', icon: 'file-text' },
|
|
{ name: 'Keys', path: '/keys', icon: 'key' },
|
|
{ name: 'Settings', path: '/settings', icon: 'settings' },
|
|
{ name: 'Admin', path: '/admin', icon: 'shield', adminOnly: true },
|
|
]
|
|
|
|
const visibleItems = computed(() =>
|
|
navItems.filter((item) => !item.adminOnly || authStore.isAdmin)
|
|
)
|
|
|
|
function isActive(path: string): boolean {
|
|
if (path === '/') return route.path === '/'
|
|
return route.path.startsWith(path)
|
|
}
|
|
|
|
const userInitials = computed(() => {
|
|
const name = authStore.user?.username ?? authStore.user?.email ?? '?'
|
|
return name.slice(0, 2).toUpperCase()
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<aside class="flex flex-col h-full bg-gradient-to-b from-slate-900 via-slate-900 to-slate-950 border-r border-slate-800">
|
|
<!-- Logo -->
|
|
<div class="h-14 flex items-center px-4 border-b border-slate-800 shrink-0">
|
|
<div class="flex items-center gap-3">
|
|
<div class="h-8 w-8 rounded-lg bg-gradient-to-br from-amber-400 to-amber-600 flex items-center justify-center shadow-lg shadow-amber-900/30">
|
|
<svg class="h-4 w-4 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
|
|
</svg>
|
|
</div>
|
|
<div>
|
|
<p class="font-bold text-sm text-white leading-none">CC Dashboard</p>
|
|
<p class="text-[10px] text-slate-500 mt-0.5">Oliver Agency</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Navigation -->
|
|
<nav class="flex-1 px-2 py-3 space-y-0.5 overflow-y-auto">
|
|
<RouterLink
|
|
v-for="item in visibleItems"
|
|
:key="item.path"
|
|
:to="item.path"
|
|
:class="[
|
|
'relative flex items-center gap-3 px-3 h-11 rounded-lg text-sm font-medium transition-all duration-200 group',
|
|
isActive(item.path)
|
|
? 'bg-gradient-to-r from-amber-500/20 to-amber-600/10 text-amber-400 shadow-sm border border-amber-500/20'
|
|
: 'text-slate-400 hover:bg-slate-800/60 hover:text-slate-100',
|
|
]"
|
|
@click="emit('close')"
|
|
>
|
|
<!-- Active left bar -->
|
|
<span
|
|
v-if="isActive(item.path)"
|
|
class="absolute left-0 top-1/2 -translate-y-1/2 w-0.5 h-5 bg-amber-400 rounded-r-full"
|
|
/>
|
|
|
|
<!-- Icons -->
|
|
<svg
|
|
v-if="item.icon === 'grid'"
|
|
:class="['h-4 w-4 shrink-0 transition-colors', isActive(item.path) ? 'text-amber-400' : 'text-slate-500 group-hover:text-slate-300']"
|
|
fill="none" stroke="currentColor" viewBox="0 0 24 24"
|
|
>
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z" />
|
|
</svg>
|
|
<svg v-else-if="item.icon === 'calendar'" :class="['h-4 w-4 shrink-0', isActive(item.path) ? 'text-amber-400' : 'text-slate-500 group-hover:text-slate-300']" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
|
</svg>
|
|
<svg v-else-if="item.icon === 'check-square'" :class="['h-4 w-4 shrink-0', isActive(item.path) ? 'text-amber-400' : 'text-slate-500 group-hover:text-slate-300']" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4" />
|
|
</svg>
|
|
<svg v-else-if="item.icon === 'folder'" :class="['h-4 w-4 shrink-0', isActive(item.path) ? 'text-amber-400' : 'text-slate-500 group-hover:text-slate-300']" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7a2 2 0 012-2h3.586a1 1 0 01.707.293l1.414 1.414A1 1 0 0011.414 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V7z" />
|
|
</svg>
|
|
<svg v-else-if="item.icon === 'activity'" :class="['h-4 w-4 shrink-0', isActive(item.path) ? 'text-amber-400' : 'text-slate-500 group-hover:text-slate-300']" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
|
|
</svg>
|
|
<svg v-else-if="item.icon === 'file-text'" :class="['h-4 w-4 shrink-0', isActive(item.path) ? 'text-amber-400' : 'text-slate-500 group-hover:text-slate-300']" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
|
</svg>
|
|
<svg v-else-if="item.icon === 'key'" :class="['h-4 w-4 shrink-0', isActive(item.path) ? 'text-amber-400' : 'text-slate-500 group-hover:text-slate-300']" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z" />
|
|
</svg>
|
|
<svg v-else-if="item.icon === 'settings'" :class="['h-4 w-4 shrink-0', isActive(item.path) ? 'text-amber-400' : 'text-slate-500 group-hover:text-slate-300']" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
|
</svg>
|
|
<svg v-else-if="item.icon === 'shield'" :class="['h-4 w-4 shrink-0', isActive(item.path) ? 'text-amber-400' : 'text-slate-500 group-hover:text-slate-300']" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />
|
|
</svg>
|
|
|
|
<span>{{ item.name }}</span>
|
|
</RouterLink>
|
|
</nav>
|
|
|
|
<!-- User info at bottom -->
|
|
<div class="p-3 border-t border-slate-800 shrink-0">
|
|
<div class="flex items-center gap-3 px-2 py-2 rounded-lg hover:bg-slate-800/50 transition-colors">
|
|
<div class="h-7 w-7 rounded-full bg-gradient-to-br from-amber-400 to-amber-600 flex items-center justify-center text-[10px] font-bold text-white shrink-0">
|
|
{{ userInitials }}
|
|
</div>
|
|
<div class="flex-1 min-w-0">
|
|
<p class="text-xs font-medium text-slate-300 truncate">{{ authStore.user?.username ?? authStore.user?.email }}</p>
|
|
<div class="flex items-center gap-1 mt-0.5">
|
|
<div class="h-1.5 w-1.5 rounded-full bg-emerald-500"></div>
|
|
<span class="text-[10px] text-slate-500">Online</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</aside>
|
|
</template>
|