Phase 1 MVP - Complete implementation

- Login with JWT and refresh token rotation
- Dashboard with projects cards
- ProjectView with TreeView navigation
- DocumentView with markdown editor and auto-save
- Tag management (create, assign, remove)
- Dark mode CSS variables
- Security fixes applied (logout to backend, createDocument endpoint)
This commit is contained in:
Motoko
2026-03-30 15:17:29 +00:00
commit c9cb07dbfc
1341 changed files with 1084068 additions and 0 deletions

View File

@@ -0,0 +1,260 @@
<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
const router = useRouter()
const authStore = useAuthStore()
const searchQuery = ref('')
const showUserMenu = ref(false)
function handleSearch() {
if (searchQuery.value.trim()) {
router.push({ name: 'dashboard', query: { q: searchQuery.value } })
}
}
function logout() {
authStore.logout()
router.push('/login')
}
</script>
<template>
<header class="header">
<div class="header__left">
<router-link to="/dashboard" class="header__logo">
<svg width="28" height="28" viewBox="0 0 28 28" fill="none">
<rect width="28" height="28" rx="6" fill="var(--accent)"/>
<path d="M8 10h12M8 14h8M8 18h10" stroke="white" stroke-width="2" stroke-linecap="round"/>
</svg>
<span class="header__title">Claudia Docs</span>
</router-link>
</div>
<div class="header__center">
<form class="header__search" @submit.prevent="handleSearch">
<svg class="header__search-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8"/>
<path d="m21 21-4.35-4.35"/>
</svg>
<input
v-model="searchQuery"
type="text"
placeholder="Search documents..."
class="header__search-input"
/>
<kbd class="header__kbd">K</kbd>
</form>
</div>
<div class="header__right">
<div class="header__user" @click="showUserMenu = !showUserMenu">
<div class="header__avatar">
{{ authStore.user?.username?.charAt(0).toUpperCase() || 'U' }}
</div>
<span class="header__username">{{ authStore.user?.username || 'User' }}</span>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="m6 9 6 6 6-6"/>
</svg>
<Transition name="fade">
<div v-if="showUserMenu" class="header__dropdown">
<div class="header__dropdown-item header__dropdown-item--info">
<span>{{ authStore.user?.username }}</span>
<small>{{ authStore.user?.role }}</small>
</div>
<hr class="header__dropdown-divider" />
<button class="header__dropdown-item" @click="logout">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/>
<polyline points="16 17 21 12 16 7"/>
<line x1="21" y1="12" x2="9" y2="12"/>
</svg>
Logout
</button>
</div>
</Transition>
</div>
</div>
</header>
</template>
<style scoped>
.header {
display: flex;
align-items: center;
justify-content: space-between;
height: 56px;
padding: 0 1.5rem;
background: var(--bg-primary);
border-bottom: 1px solid var(--border);
}
.header__left {
flex: 1;
}
.header__logo {
display: flex;
align-items: center;
gap: 0.75rem;
text-decoration: none;
}
.header__title {
font-size: 1.125rem;
font-weight: 600;
color: var(--text-primary);
}
.header__center {
flex: 2;
max-width: 480px;
}
.header__search {
position: relative;
display: flex;
align-items: center;
}
.header__search-icon {
position: absolute;
left: 0.75rem;
color: var(--text-secondary);
}
.header__search-input {
width: 100%;
padding: 0.5rem 4rem 0.5rem 2.25rem;
background: var(--bg-secondary);
border: 1px solid var(--border);
border-radius: 8px;
font-size: 0.875rem;
color: var(--text-primary);
outline: none;
transition: border-color 0.15s, box-shadow 0.15s;
}
.header__search-input::placeholder {
color: var(--text-secondary);
}
.header__search-input:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.header__kbd {
position: absolute;
right: 0.75rem;
padding: 0.125rem 0.375rem;
background: var(--bg-tertiary);
border: 1px solid var(--border);
border-radius: 4px;
font-size: 0.75rem;
color: var(--text-secondary);
}
.header__right {
flex: 1;
display: flex;
justify-content: flex-end;
}
.header__user {
position: relative;
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.375rem 0.75rem 0.375rem 0.375rem;
border-radius: 8px;
cursor: pointer;
transition: background 0.15s;
}
.header__user:hover {
background: var(--bg-secondary);
}
.header__avatar {
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
background: var(--accent);
border-radius: 6px;
color: white;
font-weight: 600;
font-size: 0.875rem;
}
.header__username {
font-size: 0.875rem;
color: var(--text-primary);
}
.header__dropdown {
position: absolute;
top: 100%;
right: 0;
margin-top: 0.5rem;
min-width: 180px;
background: var(--bg-primary);
border: 1px solid var(--border);
border-radius: 8px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
overflow: hidden;
z-index: 100;
}
.header__dropdown-item {
display: flex;
align-items: center;
gap: 0.5rem;
width: 100%;
padding: 0.75rem 1rem;
background: none;
border: none;
font-size: 0.875rem;
color: var(--text-primary);
cursor: pointer;
text-align: left;
text-decoration: none;
}
.header__dropdown-item:hover {
background: var(--bg-secondary);
}
.header__dropdown-item--info {
flex-direction: column;
align-items: flex-start;
gap: 0.125rem;
}
.header__dropdown-item--info small {
color: var(--text-secondary);
font-size: 0.75rem;
}
.header__dropdown-divider {
margin: 0.25rem 0;
border: none;
border-top: 1px solid var(--border);
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.15s, transform 0.15s;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
transform: translateY(-4px);
}
</style>