feat(09-02): create AdminLayout.vue and AdminSidebar.vue
- AdminLayout: flex h-screen shell with AdminSidebar + main content area (p-8 max-w-5xl mx-auto router-view)
- AdminSidebar: 5 nav links in D-07 order (Overview/Users/Quotas/AI Config/Audit Log) with SVG icons
- Admin badge subtitle ("Admin" in indigo-500 per D-05) replaces "Document Manager"
- No Back-to-app link (D-06 applied)
- User identity footer + sign-out reused verbatim from AppSidebar.vue pattern
- Scoped nav-link/nav-link-active CSS identical to AppSidebar.vue
This commit is contained in:
@@ -0,0 +1,119 @@
|
|||||||
|
<template>
|
||||||
|
<aside class="w-64 bg-white border-r border-gray-200 flex flex-col h-full shrink-0">
|
||||||
|
<!-- Logo -->
|
||||||
|
<div class="px-6 py-5 border-b border-gray-100">
|
||||||
|
<h1 class="text-lg font-bold text-indigo-600 tracking-tight">DocuVault</h1>
|
||||||
|
<p class="text-xs text-indigo-500 font-semibold mt-0.5">Admin</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Nav -->
|
||||||
|
<nav class="flex-1 px-3 py-4 overflow-y-auto">
|
||||||
|
<!-- Overview -->
|
||||||
|
<router-link
|
||||||
|
to="/admin"
|
||||||
|
class="nav-link"
|
||||||
|
:class="{ 'nav-link-active': $route.path === '/admin' }"
|
||||||
|
>
|
||||||
|
<svg class="w-4 h-4 mr-2 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||||
|
d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
|
||||||
|
</svg>
|
||||||
|
Overview
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<!-- Users -->
|
||||||
|
<router-link
|
||||||
|
to="/admin/users"
|
||||||
|
class="nav-link"
|
||||||
|
:class="{ 'nav-link-active': $route.path.startsWith('/admin/users') }"
|
||||||
|
>
|
||||||
|
<svg class="w-4 h-4 mr-2 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||||
|
d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" />
|
||||||
|
</svg>
|
||||||
|
Users
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<!-- Quotas -->
|
||||||
|
<router-link
|
||||||
|
to="/admin/quotas"
|
||||||
|
class="nav-link"
|
||||||
|
:class="{ 'nav-link-active': $route.path.startsWith('/admin/quotas') }"
|
||||||
|
>
|
||||||
|
<svg class="w-4 h-4 mr-2 shrink-0" 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>
|
||||||
|
Quotas
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<!-- AI Config -->
|
||||||
|
<router-link
|
||||||
|
to="/admin/ai"
|
||||||
|
class="nav-link"
|
||||||
|
:class="{ 'nav-link-active': $route.path.startsWith('/admin/ai') }"
|
||||||
|
>
|
||||||
|
<svg class="w-4 h-4 mr-2 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||||
|
d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" />
|
||||||
|
</svg>
|
||||||
|
AI Config
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<!-- Audit Log -->
|
||||||
|
<router-link
|
||||||
|
to="/admin/audit"
|
||||||
|
class="nav-link"
|
||||||
|
:class="{ 'nav-link-active': $route.path.startsWith('/admin/audit') }"
|
||||||
|
>
|
||||||
|
<svg class="w-4 h-4 mr-2 shrink-0" 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-3 7h3m-3 4h3m-6-4h.01M9 16h.01" />
|
||||||
|
</svg>
|
||||||
|
Audit Log
|
||||||
|
</router-link>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<!-- User identity footer -->
|
||||||
|
<div class="px-3 py-4 border-t border-gray-100">
|
||||||
|
<div v-if="authStore.user" class="flex items-center gap-3 px-4 py-3 border-t border-gray-100 mt-2 -mx-3">
|
||||||
|
<div class="bg-indigo-100 text-indigo-700 text-xs font-semibold rounded-full w-8 h-8 flex items-center justify-center shrink-0">
|
||||||
|
{{ authStore.user.email ? authStore.user.email[0].toUpperCase() : '?' }}
|
||||||
|
</div>
|
||||||
|
<span class="text-xs text-gray-600 truncate flex-1">{{ authStore.user.email }}</span>
|
||||||
|
<button
|
||||||
|
@click="signOut"
|
||||||
|
aria-label="Sign out"
|
||||||
|
class="text-gray-400 hover:text-gray-600 transition-colors"
|
||||||
|
>
|
||||||
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||||
|
d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import { useAuthStore } from '../../stores/auth.js'
|
||||||
|
|
||||||
|
const authStore = useAuthStore()
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
async function signOut() {
|
||||||
|
await authStore.logout()
|
||||||
|
router.push('/login')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.nav-link {
|
||||||
|
@apply flex items-center px-3 py-2 rounded-lg text-gray-600 hover:bg-gray-100 hover:text-gray-900 transition-colors text-sm font-medium;
|
||||||
|
}
|
||||||
|
.nav-link-active {
|
||||||
|
@apply bg-indigo-50 text-indigo-700;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<template>
|
||||||
|
<div class="flex h-screen overflow-hidden">
|
||||||
|
<AdminSidebar />
|
||||||
|
<main class="flex-1 overflow-y-auto">
|
||||||
|
<div class="p-8 max-w-5xl mx-auto">
|
||||||
|
<router-view />
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import AdminSidebar from '../components/admin/AdminSidebar.vue'
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user