refactor(ui): Phase 7 — strip chat/voice/journal/workspace/home surfaces
Frontend deletion phase of the MCP-first pivot. All in-app
conversational surfaces are gone — Claude/MCP is the assistant now.
Deleted views:
ChatView, JournalView, WorkspaceView, HomeView
Deleted components:
ChatPanel, ChatInputBar, ChatMessage, ChatStreamingBubble,
ToolCallCard, ToolConfirmCard, WorkspaceChatWidget
Deleted composables + store:
useVoiceRecorder, useVoiceAudio, useStreamingTts, stores/chat
Router changes:
- / now redirects to /knowledge (was /journal)
- dropped /chat, /chat/:id, /journal, /workspace/:projectId
- /tasks still redirects to / (→ /knowledge)
- /notes still redirects to /knowledge
KnowledgeView:
- removed ChatPanel + ChatInputBar embeds
- removed minichat floating widget + state + handlers
- removed Chat link from today bar
- removed `chatStore` driven auto-refresh-on-tool-call watch
App.vue:
- removed useChatStore + startStatusPolling/stopStatusPolling
- removed VAD ONNX preloader (voice subsystem dead)
- removed visibilitychange listener (only did voice status re-check)
- removed `c` single-key shortcut (focus chat / goto chat)
- removed `g+c` two-key sequence (goto chat)
- removed Chat section from shortcuts overlay
- removed `.chat-page` / `.workspace-root` CSS overflow rule
AppHeader.vue:
- removed useChatStore + status indicator (Ollama model status)
- removed Chat / Journal nav links (desktop + mobile)
SettingsView.vue (4598 → 4079 lines):
- removed Voice tab entirely
- Notifications tab: dropped Push Notifications + Chat History
+ About sections (kept Email Notifications)
- General tab: dropped Assistant (name + model pickers) +
Model Management sections (kept Tasks + Timezone)
- Profile tab: dropped Journal + Observations sections
- VALID_TABS + tab list array no longer include "voice"
- removed `loadVoiceTab()` activation trigger
Service worker (frontend/public/sw.js):
- dropped push and notificationclick handlers (push subsystem
only fired on internal generation completion, which is gone)
- kept empty fetch handler as PWA installability shell
Script-level dead code (state refs, helper functions referencing
removed APIs) remains in SettingsView and stores/push.ts and
stores/settings.ts for now — Phase 8 backend deletion will clean
those up alongside the matching backend route removals.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,839 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onUnmounted, ref, computed, watch, nextTick } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useChatStore } from "@/stores/chat";
|
||||
import { apiGet } from "@/api/client";
|
||||
import ChatPanel from "@/components/ChatPanel.vue";
|
||||
import { MoreVertical, Menu, Paperclip, Trash2 } from "lucide-vue-next";
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const store = useChatStore();
|
||||
|
||||
const summarizing = ref(false);
|
||||
const sidebarOpen = ref(false);
|
||||
const convSearchQuery = ref("");
|
||||
const headerKebabOpen = ref(false);
|
||||
const sidebarKebabOpen = ref(false);
|
||||
|
||||
// ── RAG scope chip ────────────────────────────────────────────────────────────
|
||||
const projects = ref<{ id: number; title: string }[]>([]);
|
||||
const scopeDropdownOpen = ref(false);
|
||||
const scopePulse = ref(false);
|
||||
|
||||
const scopeLabel = computed(() => {
|
||||
const id = store.ragProjectId;
|
||||
if (id === -1) return "All notes";
|
||||
if (id === null) return "Orphan notes";
|
||||
return projects.value.find((p) => p.id === id)?.title ?? `Project ${id}`;
|
||||
});
|
||||
|
||||
async function loadProjects() {
|
||||
try {
|
||||
const data = await apiGet<{ projects: { id: number; title: string }[] }>(
|
||||
"/api/projects?status=active"
|
||||
);
|
||||
projects.value = data.projects ?? [];
|
||||
} catch {
|
||||
projects.value = [];
|
||||
}
|
||||
}
|
||||
|
||||
async function onScopeSelect(value: number | null) {
|
||||
scopeDropdownOpen.value = false;
|
||||
const id = store.currentConversation?.id;
|
||||
if (!id) return;
|
||||
await store.updateRagScope(id, value);
|
||||
scopePulse.value = true;
|
||||
setTimeout(() => { scopePulse.value = false; }, 600);
|
||||
}
|
||||
|
||||
watch(
|
||||
() => store.ragProjectId,
|
||||
() => {
|
||||
scopePulse.value = true;
|
||||
setTimeout(() => { scopePulse.value = false; }, 600);
|
||||
}
|
||||
);
|
||||
|
||||
let prevConvId: number | null = null;
|
||||
|
||||
const convId = computed(() => {
|
||||
const id = route.params.id;
|
||||
return id ? Number(id) : null;
|
||||
});
|
||||
|
||||
function formatConvDate(dateStr: string): string {
|
||||
const date = new Date(dateStr);
|
||||
const now = new Date();
|
||||
const diffMs = now.getTime() - date.getTime();
|
||||
const diffMin = Math.floor(diffMs / 60_000);
|
||||
const diffHrs = Math.floor(diffMs / 3_600_000);
|
||||
|
||||
if (diffMin < 1) return "Just now";
|
||||
if (diffMin < 60) return `${diffMin}m ago`;
|
||||
if (diffHrs < 10) return `${diffHrs}h ago`;
|
||||
if (date.getFullYear() === now.getFullYear()) {
|
||||
return date.toLocaleDateString(undefined, { month: "short", day: "numeric" });
|
||||
}
|
||||
return date.toLocaleDateString(undefined, { month: "short", day: "numeric", year: "numeric" });
|
||||
}
|
||||
|
||||
interface ConvGroup { label: string; convs: typeof store.conversations }
|
||||
|
||||
const groupedConversations = computed((): ConvGroup[] => {
|
||||
const now = new Date();
|
||||
const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||
const startOfYesterday = new Date(startOfToday.getTime() - 86_400_000);
|
||||
const startOfWeek = new Date(startOfToday.getTime() - 6 * 86_400_000);
|
||||
const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||
|
||||
const buckets: Record<string, typeof store.conversations> = {};
|
||||
const order: string[] = [];
|
||||
|
||||
const q = convSearchQuery.value.trim().toLowerCase();
|
||||
const filtered = q
|
||||
? store.conversations.filter((c) => (c.title || "").toLowerCase().includes(q))
|
||||
: store.conversations;
|
||||
|
||||
for (const conv of filtered) {
|
||||
const d = new Date(conv.updated_at);
|
||||
let key: string;
|
||||
if (d >= startOfToday) {
|
||||
key = "Today";
|
||||
} else if (d >= startOfYesterday) {
|
||||
key = "Yesterday";
|
||||
} else if (d >= startOfWeek) {
|
||||
key = "This week";
|
||||
} else if (d >= startOfMonth) {
|
||||
key = "This month";
|
||||
} else {
|
||||
key = d.toLocaleDateString(undefined, { month: "long", year: "numeric" });
|
||||
}
|
||||
if (!buckets[key]) { buckets[key] = []; order.push(key); }
|
||||
buckets[key].push(conv);
|
||||
}
|
||||
|
||||
return order.map((label) => ({ label, convs: buckets[label] }));
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
document.addEventListener("keydown", onGlobalKeydown);
|
||||
document.addEventListener("mousedown", onDocumentMousedown);
|
||||
loadProjects();
|
||||
await store.fetchConversations();
|
||||
if (convId.value) {
|
||||
if (store.currentConversation?.id !== convId.value) {
|
||||
await store.fetchConversation(convId.value);
|
||||
}
|
||||
store.reconnectIfGenerating(convId.value);
|
||||
} else {
|
||||
await startNewConversation();
|
||||
}
|
||||
nextTick(() => chatPanelRef.value?.focus());
|
||||
});
|
||||
|
||||
watch(convId, async (newId) => {
|
||||
if (prevConvId && prevConvId !== newId) {
|
||||
const prev = store.conversations.find((c) => c.id === prevConvId);
|
||||
if (prev && prev.message_count === 0) {
|
||||
store.deleteConversation(prevConvId);
|
||||
}
|
||||
}
|
||||
prevConvId = newId ?? null;
|
||||
|
||||
if (newId) {
|
||||
if (store.currentConversation?.id !== newId && !store.isStreamingConv(newId)) {
|
||||
await store.fetchConversation(newId);
|
||||
}
|
||||
store.reconnectIfGenerating(newId);
|
||||
} else {
|
||||
await startNewConversation();
|
||||
}
|
||||
nextTick(() => chatPanelRef.value?.focus());
|
||||
});
|
||||
|
||||
function toggleSidebar() {
|
||||
sidebarOpen.value = !sidebarOpen.value;
|
||||
}
|
||||
|
||||
async function selectConversation(id: number) {
|
||||
sidebarOpen.value = false;
|
||||
router.push(`/chat/${id}`);
|
||||
}
|
||||
|
||||
async function startNewConversation() {
|
||||
const conv = await store.createConversation();
|
||||
router.push(`/chat/${conv.id}`);
|
||||
}
|
||||
|
||||
async function newConversation() {
|
||||
await startNewConversation();
|
||||
}
|
||||
|
||||
// ── Bulk selection ────────────────────────────────────────────────────────────
|
||||
const selectMode = ref(false);
|
||||
const selectedIds = ref<Set<number>>(new Set());
|
||||
const bulkConfirm = ref(false);
|
||||
const bulkDeleting = ref(false);
|
||||
|
||||
function toggleSelectMode() {
|
||||
selectMode.value = !selectMode.value;
|
||||
selectedIds.value = new Set();
|
||||
bulkConfirm.value = false;
|
||||
}
|
||||
|
||||
function toggleSelectConv(id: number) {
|
||||
if (selectedIds.value.has(id)) {
|
||||
selectedIds.value.delete(id);
|
||||
} else {
|
||||
selectedIds.value.add(id);
|
||||
}
|
||||
selectedIds.value = new Set(selectedIds.value);
|
||||
}
|
||||
|
||||
function selectAll() {
|
||||
selectedIds.value = new Set(store.conversations.map((c) => c.id));
|
||||
}
|
||||
|
||||
function clearSelection() {
|
||||
selectedIds.value = new Set();
|
||||
bulkConfirm.value = false;
|
||||
}
|
||||
|
||||
async function bulkDelete() {
|
||||
if (!bulkConfirm.value) { bulkConfirm.value = true; return; }
|
||||
bulkDeleting.value = true;
|
||||
try {
|
||||
const ids = [...selectedIds.value];
|
||||
await store.bulkDeleteConversations(ids);
|
||||
if (ids.includes(convId.value ?? -1)) router.push("/chat");
|
||||
selectedIds.value = new Set();
|
||||
bulkConfirm.value = false;
|
||||
selectMode.value = false;
|
||||
} finally {
|
||||
bulkDeleting.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function removeConversation(id: number) {
|
||||
await store.deleteConversation(id);
|
||||
if (convId.value === id) {
|
||||
router.push("/chat");
|
||||
}
|
||||
}
|
||||
|
||||
// ── Summarize ─────────────────────────────────────────────────────────────────
|
||||
async function handleSummarize() {
|
||||
if (!store.currentConversation || summarizing.value) return;
|
||||
summarizing.value = true;
|
||||
try {
|
||||
await store.summarizeAsNote(store.currentConversation.id);
|
||||
const { useToastStore } = await import("@/stores/toast");
|
||||
useToastStore().show("Conversation summarized and saved as note");
|
||||
} catch {
|
||||
const { useToastStore } = await import("@/stores/toast");
|
||||
useToastStore().show("Failed to summarize", "error");
|
||||
} finally {
|
||||
summarizing.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
const chatPanelRef = ref<InstanceType<typeof ChatPanel> | null>(null);
|
||||
|
||||
const contextCount = computed(() => chatPanelRef.value?.contextCount ?? 0);
|
||||
const contextSidebarOpen = computed(() => chatPanelRef.value?.sidebarOpen ?? false);
|
||||
function toggleContextSidebar() {
|
||||
chatPanelRef.value?.toggleContextSidebar();
|
||||
}
|
||||
|
||||
// ── Kebab dismissal ───────────────────────────────────────────────────────────
|
||||
function onDocumentMousedown(e: MouseEvent) {
|
||||
const target = e.target as HTMLElement | null;
|
||||
if (headerKebabOpen.value && !target?.closest(".header-kebab-wrapper")) {
|
||||
headerKebabOpen.value = false;
|
||||
}
|
||||
if (sidebarKebabOpen.value && !target?.closest(".sidebar-kebab-wrapper")) {
|
||||
sidebarKebabOpen.value = false;
|
||||
}
|
||||
if (scopeDropdownOpen.value && !target?.closest(".scope-chip-wrapper")) {
|
||||
scopeDropdownOpen.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Keyboard ──────────────────────────────────────────────────────────────────
|
||||
function onGlobalKeydown(e: KeyboardEvent) {
|
||||
if (e.key !== "Escape") return;
|
||||
if (headerKebabOpen.value || sidebarKebabOpen.value || scopeDropdownOpen.value) {
|
||||
headerKebabOpen.value = false;
|
||||
sidebarKebabOpen.value = false;
|
||||
scopeDropdownOpen.value = false;
|
||||
return;
|
||||
}
|
||||
if (sidebarOpen.value) {
|
||||
sidebarOpen.value = false;
|
||||
return;
|
||||
}
|
||||
router.push("/");
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
document.removeEventListener("keydown", onGlobalKeydown);
|
||||
document.removeEventListener("mousedown", onDocumentMousedown);
|
||||
if (prevConvId) {
|
||||
const conv = store.conversations.find((c) => c.id === prevConvId);
|
||||
if (conv && conv.message_count === 0) {
|
||||
store.deleteConversation(prevConvId);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="chat-page">
|
||||
<div
|
||||
v-if="sidebarOpen"
|
||||
class="sidebar-overlay"
|
||||
@click="sidebarOpen = false"
|
||||
></div>
|
||||
<aside class="chat-sidebar" :class="{ open: sidebarOpen }">
|
||||
<div class="sidebar-top-bar">
|
||||
<button class="btn-new-conv btn-new-conv--full" @click="newConversation">+ New Chat</button>
|
||||
<div class="sidebar-search-row">
|
||||
<input
|
||||
v-model="convSearchQuery"
|
||||
class="conv-search-input"
|
||||
type="search"
|
||||
placeholder="Search conversations…"
|
||||
aria-label="Search conversations"
|
||||
/>
|
||||
<div class="sidebar-kebab-wrapper">
|
||||
<button
|
||||
class="btn-kebab"
|
||||
:class="{ active: sidebarKebabOpen }"
|
||||
@click="sidebarKebabOpen = !sidebarKebabOpen"
|
||||
aria-label="List actions"
|
||||
title="List actions"
|
||||
>
|
||||
<MoreVertical :size="16" />
|
||||
</button>
|
||||
<div v-if="sidebarKebabOpen" class="kebab-menu">
|
||||
<button
|
||||
class="kebab-item"
|
||||
@click="sidebarKebabOpen = false; toggleSelectMode()"
|
||||
>{{ selectMode ? "Exit select mode" : "Select conversations" }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="selectMode" class="bulk-bar">
|
||||
<span class="bulk-count">{{ selectedIds.size }} selected</span>
|
||||
<button class="bulk-link" @click="selectAll">All</button>
|
||||
<button class="bulk-link" @click="clearSelection">None</button>
|
||||
<button
|
||||
v-if="selectedIds.size"
|
||||
class="bulk-delete-btn"
|
||||
:class="{ confirm: bulkConfirm }"
|
||||
:disabled="bulkDeleting"
|
||||
@click="bulkDelete"
|
||||
>
|
||||
<Trash2 :size="16" />
|
||||
{{ bulkDeleting ? '...' : bulkConfirm ? `Delete ${selectedIds.size}?` : `Delete (${selectedIds.size})` }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="conv-list">
|
||||
<template v-for="group in groupedConversations" :key="group.label">
|
||||
<div class="conv-group-label">{{ group.label }}</div>
|
||||
<div
|
||||
v-for="conv in group.convs"
|
||||
:key="conv.id"
|
||||
class="conv-item"
|
||||
:class="{ active: convId === conv.id, selected: selectedIds.has(conv.id) }"
|
||||
@click="selectMode ? toggleSelectConv(conv.id) : selectConversation(conv.id)"
|
||||
>
|
||||
<input
|
||||
v-if="selectMode"
|
||||
type="checkbox"
|
||||
class="conv-checkbox"
|
||||
:checked="selectedIds.has(conv.id)"
|
||||
@click.stop="toggleSelectConv(conv.id)"
|
||||
/>
|
||||
<div class="conv-info">
|
||||
<span class="conv-title">{{ conv.title || "Untitled" }}</span>
|
||||
<span class="conv-date">{{ formatConvDate(conv.updated_at) }}</span>
|
||||
</div>
|
||||
<button
|
||||
v-if="!selectMode"
|
||||
class="btn-delete-conv"
|
||||
@click.stop="removeConversation(conv.id)"
|
||||
title="Delete conversation"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
<p v-if="!store.conversations.length" class="empty-msg">
|
||||
No conversations yet
|
||||
</p>
|
||||
<p
|
||||
v-else-if="convSearchQuery && !groupedConversations.length"
|
||||
class="empty-msg"
|
||||
>No matches for “{{ convSearchQuery }}”</p>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<section class="chat-main">
|
||||
<template v-if="store.currentConversation">
|
||||
<div class="chat-header">
|
||||
<button class="btn-sidebar-toggle hide-desktop" aria-label="Toggle sidebar" @click="toggleSidebar">
|
||||
<Menu :size="24" />
|
||||
</button>
|
||||
<h2>{{ store.currentConversation.title || "New Chat" }}</h2>
|
||||
|
||||
<div class="scope-chip-wrapper">
|
||||
<button
|
||||
class="scope-chip"
|
||||
:class="{ pulse: scopePulse }"
|
||||
@click="scopeDropdownOpen = !scopeDropdownOpen"
|
||||
title="Change RAG scope"
|
||||
>
|
||||
<span class="scope-dot">⊙</span> {{ scopeLabel }}
|
||||
</button>
|
||||
<div v-if="scopeDropdownOpen" class="scope-dropdown">
|
||||
<button
|
||||
class="scope-option"
|
||||
:class="{ active: store.ragProjectId === null }"
|
||||
@click="onScopeSelect(null)"
|
||||
>Orphan notes only</button>
|
||||
<button
|
||||
v-for="p in projects"
|
||||
:key="p.id"
|
||||
class="scope-option"
|
||||
:class="{ active: store.ragProjectId === p.id }"
|
||||
@click="onScopeSelect(p.id)"
|
||||
>{{ p.title }}</button>
|
||||
<button
|
||||
class="scope-option"
|
||||
:class="{ active: store.ragProjectId === -1 }"
|
||||
@click="onScopeSelect(-1)"
|
||||
>All notes</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
v-if="contextCount > 0"
|
||||
class="btn-context-toggle"
|
||||
:class="{ active: contextSidebarOpen }"
|
||||
@click="toggleContextSidebar"
|
||||
:title="contextSidebarOpen ? 'Hide context panel' : 'Show context panel'"
|
||||
>
|
||||
<Paperclip class="context-icon" :size="16" />
|
||||
<span class="context-label">Context</span>
|
||||
<span class="context-count-badge">{{ contextCount }}</span>
|
||||
</button>
|
||||
|
||||
<div class="header-kebab-wrapper">
|
||||
<button
|
||||
class="btn-kebab"
|
||||
:class="{ active: headerKebabOpen }"
|
||||
@click="headerKebabOpen = !headerKebabOpen"
|
||||
aria-label="Conversation actions"
|
||||
title="Conversation actions"
|
||||
>
|
||||
<MoreVertical :size="16" />
|
||||
</button>
|
||||
<div v-if="headerKebabOpen" class="kebab-menu kebab-menu--right">
|
||||
<button
|
||||
class="kebab-item"
|
||||
:disabled="!store.currentConversation.messages.length || summarizing || store.streaming"
|
||||
@click="headerKebabOpen = false; handleSummarize()"
|
||||
>{{ summarizing ? "Summarizing…" : "Summarize as Note" }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ChatPanel
|
||||
ref="chatPanelRef"
|
||||
variant="full"
|
||||
:auto-focus="true"
|
||||
class="chat-panel-fill"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<div v-else class="no-conversation">
|
||||
<button class="btn-sidebar-toggle no-conv-toggle hide-desktop" @click="toggleSidebar">
|
||||
<Menu :size="24" />
|
||||
</button>
|
||||
<p>Select a conversation or start a new chat.</p>
|
||||
<button class="btn-new-conv" @click="newConversation">
|
||||
+ New Chat
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.chat-page {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.chat-sidebar {
|
||||
width: var(--sidebar-width);
|
||||
min-width: 200px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--color-bg-secondary);
|
||||
}
|
||||
|
||||
.sidebar-top-bar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.btn-new-conv {
|
||||
padding: 0.5rem;
|
||||
background: var(--color-primary);
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: var(--radius-sm);
|
||||
cursor: pointer;
|
||||
font-size: 0.9rem;
|
||||
transition: box-shadow 0.15s, opacity 0.15s;
|
||||
}
|
||||
.btn-new-conv--full { width: 100%; }
|
||||
.btn-new-conv:hover {
|
||||
opacity: 0.9;
|
||||
box-shadow: 0 0 14px rgba(91, 74, 138, 0.35);
|
||||
}
|
||||
|
||||
.sidebar-search-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
.conv-search-input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 0.4rem 0.6rem;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--color-bg);
|
||||
color: var(--color-text);
|
||||
font-size: 0.85rem;
|
||||
outline: none;
|
||||
font-family: inherit;
|
||||
}
|
||||
.conv-search-input:focus { border-color: var(--color-primary); }
|
||||
.conv-search-input::placeholder { color: var(--color-text-muted); }
|
||||
|
||||
.bulk-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.3rem 0.75rem;
|
||||
background: color-mix(in srgb, var(--color-primary) 6%, var(--color-bg-secondary));
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
flex-shrink: 0;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.bulk-count { font-size: 0.75rem; color: var(--color-text-muted); flex-shrink: 0; }
|
||||
.bulk-link {
|
||||
background: none; border: none; color: var(--color-text-secondary);
|
||||
font-size: 0.75rem; cursor: pointer; padding: 0; text-decoration: underline;
|
||||
}
|
||||
.bulk-link:hover { color: var(--color-text); }
|
||||
|
||||
/* Destructive action — Oxblood per Hybrid rule, paired with Trash2 icon */
|
||||
.bulk-delete-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
margin-left: auto;
|
||||
background: none;
|
||||
border: 1px solid var(--color-action-destructive);
|
||||
color: var(--color-action-destructive);
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
padding: 0.2rem 0.55rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
.bulk-delete-btn:hover:not(:disabled) { background: var(--color-action-destructive); color: #fff; }
|
||||
.bulk-delete-btn:disabled { opacity: 0.5; cursor: default; }
|
||||
.bulk-delete-btn.confirm { background: var(--color-action-destructive-hover); color: #fff; border-color: var(--color-action-destructive-hover); }
|
||||
|
||||
.conv-checkbox {
|
||||
flex-shrink: 0;
|
||||
accent-color: var(--color-primary);
|
||||
cursor: pointer;
|
||||
width: 0.9rem;
|
||||
height: 0.9rem;
|
||||
}
|
||||
.conv-item.selected {
|
||||
background: color-mix(in srgb, var(--color-primary) 8%, var(--color-bg-secondary));
|
||||
}
|
||||
|
||||
.conv-list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 0 0.5rem 0.5rem;
|
||||
}
|
||||
.conv-group-label {
|
||||
font-size: 0.68rem;
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
color: var(--color-text-muted);
|
||||
padding: 0.6rem 0.75rem 0.2rem;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: var(--color-surface);
|
||||
z-index: 1;
|
||||
}
|
||||
.conv-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-radius: var(--radius-sm);
|
||||
cursor: pointer;
|
||||
margin-bottom: 0.25rem;
|
||||
border-left: 3px solid transparent;
|
||||
transition: background 0.15s, border-color 0.15s;
|
||||
}
|
||||
.conv-item:hover { background: rgba(91, 74, 138,0.05); border-left-color: var(--color-primary); }
|
||||
.conv-item.active {
|
||||
background: color-mix(in srgb, var(--color-primary) 15%, transparent);
|
||||
color: var(--color-primary);
|
||||
border-left-color: var(--color-primary);
|
||||
}
|
||||
.conv-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
||||
.conv-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
|
||||
.conv-date { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 1px; }
|
||||
.btn-delete-conv {
|
||||
background: none; border: none; color: var(--color-text-muted);
|
||||
cursor: pointer; font-size: 1.2rem; padding: 0 0.25rem; line-height: 1;
|
||||
}
|
||||
.btn-delete-conv:hover { color: var(--color-action-destructive); }
|
||||
|
||||
.chat-main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* ChatPanel fills the remaining space in chat-main. Layout (grid vs
|
||||
* flex) is owned by ChatPanel's own .chat-full root — don't force a
|
||||
* display here or it overrides the grid. */
|
||||
.chat-panel-fill {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.chat-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.75rem 1rem;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.chat-header h2 {
|
||||
margin: 0;
|
||||
font-size: 1.1rem;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* Kebab button + dropdown menu — shared by header and sidebar */
|
||||
.btn-kebab {
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
color: var(--color-text-muted);
|
||||
padding: 0.25rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: var(--radius-sm);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.btn-kebab:hover { color: var(--color-text); background: var(--color-bg-secondary); }
|
||||
.btn-kebab.active { color: var(--color-primary); }
|
||||
|
||||
.header-kebab-wrapper,
|
||||
.sidebar-kebab-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* RAG scope chip (header) */
|
||||
.scope-chip-wrapper { position: relative; flex-shrink: 0; }
|
||||
.scope-chip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
background: none;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 20px;
|
||||
padding: 0.2rem 0.65rem;
|
||||
font-size: 0.75rem;
|
||||
color: var(--color-text-muted);
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s, color 0.15s;
|
||||
}
|
||||
.scope-chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
|
||||
.scope-chip.pulse { animation: pulse-chip 0.6s ease; }
|
||||
@keyframes pulse-chip {
|
||||
0%, 100% { border-color: var(--color-border); }
|
||||
50% {
|
||||
border-color: var(--color-primary);
|
||||
color: var(--color-primary);
|
||||
box-shadow: 0 0 6px rgba(91, 74, 138, 0.4);
|
||||
}
|
||||
}
|
||||
.scope-dot { font-size: 0.6rem; }
|
||||
.scope-dropdown {
|
||||
position: absolute;
|
||||
top: calc(100% + 4px);
|
||||
right: 0;
|
||||
min-width: 200px;
|
||||
background: var(--color-bg-card);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-md);
|
||||
box-shadow: 0 4px 16px var(--color-shadow);
|
||||
z-index: 20;
|
||||
overflow: hidden;
|
||||
}
|
||||
.scope-option {
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 0.45rem 0.75rem;
|
||||
text-align: left;
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 0.85rem;
|
||||
color: var(--color-text);
|
||||
cursor: pointer;
|
||||
}
|
||||
.scope-option:hover { background: var(--color-bg-secondary); }
|
||||
.scope-option.active { color: var(--color-primary); font-weight: 500; }
|
||||
|
||||
/* Context toggle button (header) */
|
||||
.btn-context-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
background: none;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 20px;
|
||||
padding: 0.2rem 0.55rem;
|
||||
font-size: 0.75rem;
|
||||
color: var(--color-text-muted);
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
transition: border-color 0.15s, color 0.15s, background 0.15s;
|
||||
font-family: inherit;
|
||||
}
|
||||
.btn-context-toggle:hover { border-color: var(--color-primary); color: var(--color-primary); }
|
||||
.btn-context-toggle.active {
|
||||
background: color-mix(in srgb, var(--color-primary) 10%, transparent);
|
||||
border-color: var(--color-primary);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
.context-icon { font-size: 0.85rem; line-height: 1; }
|
||||
.context-count-badge {
|
||||
font-size: 0.65rem;
|
||||
font-weight: 500;
|
||||
background: var(--color-bg);
|
||||
padding: 0.05rem 0.35rem;
|
||||
border-radius: 8px;
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.kebab-menu {
|
||||
position: absolute;
|
||||
top: calc(100% + 4px);
|
||||
left: 0;
|
||||
min-width: 180px;
|
||||
background: var(--color-bg-card);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-md);
|
||||
box-shadow: 0 4px 20px var(--color-shadow);
|
||||
padding: 0.25rem;
|
||||
z-index: 20;
|
||||
}
|
||||
.kebab-menu--right { left: auto; right: 0; }
|
||||
.kebab-item {
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--color-text);
|
||||
font-size: 0.85rem;
|
||||
padding: 0.45rem 0.65rem;
|
||||
border-radius: var(--radius-sm);
|
||||
cursor: pointer;
|
||||
}
|
||||
.kebab-item:hover:not(:disabled) { background: var(--color-bg-secondary); color: var(--color-primary); }
|
||||
.kebab-item:disabled { opacity: 0.4; cursor: default; }
|
||||
|
||||
.no-conversation {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 1rem;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
.no-conversation .btn-new-conv {
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.empty-msg {
|
||||
color: var(--color-text-muted);
|
||||
font-size: 0.9rem;
|
||||
text-align: center;
|
||||
padding: 2rem 1rem;
|
||||
}
|
||||
|
||||
.btn-sidebar-toggle {
|
||||
background: none; border: none; cursor: pointer;
|
||||
color: var(--color-text-muted); padding: 0.2rem;
|
||||
display: flex; align-items: center;
|
||||
}
|
||||
.btn-sidebar-toggle:hover { color: var(--color-text); }
|
||||
|
||||
.sidebar-overlay {
|
||||
position: fixed; inset: 0; background: var(--color-overlay); z-index: 99;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.hide-desktop { display: none; }
|
||||
.chat-sidebar { position: relative; transform: none !important; }
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.chat-sidebar {
|
||||
position: fixed; left: 0; top: 0; bottom: 0;
|
||||
z-index: 100; transform: translateX(-100%);
|
||||
transition: transform 0.25s ease;
|
||||
box-shadow: 4px 0 16px rgba(0,0,0,0.2);
|
||||
}
|
||||
.chat-sidebar.open { transform: translateX(0); }
|
||||
}
|
||||
</style>
|
||||
@@ -1,942 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onUnmounted } from "vue";
|
||||
import { apiGet, listEvents } from "@/api/client";
|
||||
import { useBackgroundRefresh } from "@/composables/useBackgroundRefresh";
|
||||
import { milestoneColor } from "@/utils/palette";
|
||||
import { fmtRelativeDateTime } from "@/utils/dateFormat";
|
||||
import type { Note } from "@/types/note";
|
||||
import type { Task, TaskListResponse, TaskStatus } from "@/types/task";
|
||||
import type { EventEntry } from "@/api/client";
|
||||
import NoteCard from "@/components/NoteCard.vue";
|
||||
import TaskCard from "@/components/TaskCard.vue";
|
||||
import StatusBadge from "@/components/StatusBadge.vue";
|
||||
import PriorityBadge from "@/components/PriorityBadge.vue";
|
||||
import ChatPanel from "@/components/ChatPanel.vue";
|
||||
import EventSlideOver from "@/components/EventSlideOver.vue";
|
||||
import { useTasksStore } from "@/stores/tasks";
|
||||
import { useChatStore } from "@/stores/chat";
|
||||
|
||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||
|
||||
interface MilestoneSummary {
|
||||
id: number;
|
||||
title: string;
|
||||
status: string;
|
||||
pct: number;
|
||||
total: number;
|
||||
completed: number;
|
||||
}
|
||||
|
||||
interface DashProject {
|
||||
id: number;
|
||||
title: string;
|
||||
status: string;
|
||||
updated_at: string;
|
||||
summary?: {
|
||||
task_counts: { todo?: number; in_progress?: number; done?: number };
|
||||
milestone_summary: MilestoneSummary[];
|
||||
};
|
||||
}
|
||||
|
||||
// A recent item from the hero project (note or task — both come from /api/notes?all=true)
|
||||
interface RecentItem {
|
||||
id: number;
|
||||
title: string;
|
||||
status: string | null;
|
||||
project_id: number | null;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
// ─── State ────────────────────────────────────────────────────────────────────
|
||||
|
||||
const loading = ref(true);
|
||||
const tasksStore = useTasksStore();
|
||||
|
||||
// Hero project — most recently active project
|
||||
const heroProject = ref<DashProject | null>(null);
|
||||
const heroRecentItems = ref<RecentItem[]>([]);
|
||||
const heroNextUp = ref<Task | null>(null);
|
||||
|
||||
// All other active projects (hero excluded)
|
||||
const activeProjects = ref<DashProject[]>([]);
|
||||
|
||||
// Orphaned items (no project_id)
|
||||
const orphanTasks = ref<Task[]>([]);
|
||||
const orphanNotes = ref<Note[]>([]);
|
||||
const inboxOpen = ref(true);
|
||||
|
||||
// Upcoming events (today + next 7 days)
|
||||
const upcomingEvents = ref<EventEntry[]>([]);
|
||||
const eventSlideOverOpen = ref(false);
|
||||
const editingEvent = ref<EventEntry | null>(null);
|
||||
|
||||
// ─── Background refresh (no-flicker) ─────────────────────────────────────────
|
||||
// Never touches `loading` so existing content stays on screen while fetching.
|
||||
|
||||
function _dateRange() {
|
||||
const today = new Date()
|
||||
const nextWeek = new Date(today)
|
||||
nextWeek.setDate(today.getDate() + 7)
|
||||
// Use full ISO strings so the server sees the correct UTC equivalent of
|
||||
// local midnight / end-of-day rather than a naive UTC-midnight guess.
|
||||
return {
|
||||
todayStr: today.toISOString(),
|
||||
nextWeekStr: nextWeek.toISOString(),
|
||||
}
|
||||
}
|
||||
|
||||
function _backgroundRefresh() {
|
||||
if (document.hidden || loading.value) return
|
||||
const { todayStr, nextWeekStr } = _dateRange()
|
||||
Promise.allSettled([
|
||||
listEvents(todayStr, nextWeekStr),
|
||||
apiGet<TaskListResponse>('/api/tasks?no_project=true&sort=updated_at&order=desc&limit=8'),
|
||||
apiGet<{ notes: Note[] }>('/api/notes?type=note&no_project=true&sort=updated_at&order=desc&limit=6'),
|
||||
]).then(([eventsRes, tasksRes, notesRes]) => {
|
||||
if (eventsRes.status === 'fulfilled') upcomingEvents.value = eventsRes.value
|
||||
if (tasksRes.status === 'fulfilled') orphanTasks.value = tasksRes.value.tasks
|
||||
if (notesRes.status === 'fulfilled') orphanNotes.value = notesRes.value.notes
|
||||
})
|
||||
if (heroProject.value) {
|
||||
apiGet<TaskListResponse>(
|
||||
`/api/tasks?project_id=${heroProject.value.id}&status=todo&sort=updated_at&order=desc&limit=1`
|
||||
)
|
||||
.then((r) => { heroNextUp.value = r.tasks[0] ?? null })
|
||||
.catch(() => {})
|
||||
}
|
||||
}
|
||||
|
||||
// ─── Data loading ─────────────────────────────────────────────────────────────
|
||||
|
||||
onMounted(async () => {
|
||||
// Phase 1: projects list + cross-project recent items + orphaned items + events — all parallel
|
||||
const { todayStr, nextWeekStr } = _dateRange();
|
||||
|
||||
const [projectsRes, recentRes, orphanTasksRes, orphanNotesRes, eventsRes] =
|
||||
await Promise.allSettled([
|
||||
apiGet<{ projects: DashProject[] }>("/api/projects?status=active"),
|
||||
apiGet<{ notes: RecentItem[] }>(
|
||||
"/api/notes?all=true&sort=updated_at&order=desc&limit=30"
|
||||
),
|
||||
apiGet<TaskListResponse>(
|
||||
"/api/tasks?no_project=true&sort=updated_at&order=desc&limit=8"
|
||||
),
|
||||
apiGet<{ notes: Note[] }>(
|
||||
"/api/notes?type=note&no_project=true&sort=updated_at&order=desc&limit=6"
|
||||
),
|
||||
listEvents(todayStr, nextWeekStr),
|
||||
]);
|
||||
|
||||
// Determine hero project: the project whose item was most recently touched
|
||||
let heroId: number | null = null;
|
||||
if (recentRes.status === "fulfilled") {
|
||||
const withProject = recentRes.value.notes.find(
|
||||
(n) => n.project_id != null
|
||||
);
|
||||
heroId = withProject?.project_id ?? null;
|
||||
}
|
||||
|
||||
if (projectsRes.status === "fulfilled") {
|
||||
const all = projectsRes.value.projects;
|
||||
const hero = all.find((p) => p.id === heroId) ?? all[0] ?? null;
|
||||
heroProject.value = hero;
|
||||
activeProjects.value = all.filter((p) => p.id !== hero?.id);
|
||||
}
|
||||
|
||||
if (orphanTasksRes.status === "fulfilled")
|
||||
orphanTasks.value = orphanTasksRes.value.tasks;
|
||||
if (orphanNotesRes.status === "fulfilled")
|
||||
orphanNotes.value = orphanNotesRes.value.notes;
|
||||
if (eventsRes.status === "fulfilled")
|
||||
upcomingEvents.value = eventsRes.value;
|
||||
|
||||
loading.value = false;
|
||||
|
||||
// Focus chat input after data loads
|
||||
chatPanelRef.value?.focus();
|
||||
loadProjects();
|
||||
|
||||
});
|
||||
|
||||
useBackgroundRefresh(_backgroundRefresh, 90_000, () => !loading.value);
|
||||
|
||||
async function loadProjects() {
|
||||
if (!heroProject.value) return;
|
||||
const hid = heroProject.value.id;
|
||||
|
||||
// Phase 2: hero details + all project summaries — parallel
|
||||
const [recentItemsRes, nextUpRes, heroSummaryRes] = await Promise.allSettled([
|
||||
apiGet<{ notes: RecentItem[] }>(
|
||||
`/api/notes?all=true&project_id=${hid}&sort=updated_at&order=desc&limit=5`
|
||||
),
|
||||
apiGet<TaskListResponse>(
|
||||
`/api/tasks?project_id=${hid}&status=todo&sort=updated_at&order=desc&limit=1`
|
||||
),
|
||||
apiGet<DashProject>(`/api/projects/${hid}`),
|
||||
]);
|
||||
|
||||
if (recentItemsRes.status === "fulfilled")
|
||||
heroRecentItems.value = recentItemsRes.value.notes;
|
||||
if (nextUpRes.status === "fulfilled")
|
||||
heroNextUp.value = nextUpRes.value.tasks[0] ?? null;
|
||||
if (heroSummaryRes.status === "fulfilled")
|
||||
heroProject.value = { ...heroProject.value!, ...heroSummaryRes.value };
|
||||
|
||||
// Load summaries for remaining projects
|
||||
await Promise.allSettled(
|
||||
activeProjects.value.map(async (p) => {
|
||||
try {
|
||||
const full = await apiGet<DashProject>(`/api/projects/${p.id}`);
|
||||
const idx = activeProjects.value.findIndex((x) => x.id === p.id);
|
||||
if (idx !== -1)
|
||||
activeProjects.value[idx] = { ...activeProjects.value[idx], ...full };
|
||||
} catch {
|
||||
/* non-fatal */
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// ─── Status toggle (orphaned tasks) ──────────────────────────────────────────
|
||||
|
||||
function onStatusToggle(id: number, status: TaskStatus) {
|
||||
tasksStore.patchStatus(id, status).then((updated) => {
|
||||
if (updated.status === "done") {
|
||||
orphanTasks.value = orphanTasks.value.filter((t) => t.id !== id);
|
||||
} else {
|
||||
const idx = orphanTasks.value.findIndex((t) => t.id === id);
|
||||
if (idx !== -1) orphanTasks.value[idx] = updated;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ─── Chat widget ──────────────────────────────────────────────────────────────
|
||||
|
||||
const chatPanelRef = ref<InstanceType<typeof ChatPanel> | null>(null);
|
||||
|
||||
function onFocusChatShortcut() {
|
||||
chatPanelRef.value?.focus();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
document.addEventListener("shortcut:focus-chat", onFocusChatShortcut);
|
||||
});
|
||||
onUnmounted(() => {
|
||||
document.removeEventListener("shortcut:focus-chat", onFocusChatShortcut);
|
||||
});
|
||||
|
||||
const chatStore = useChatStore();
|
||||
|
||||
chatStore.fetchStatus().then(() => {
|
||||
if (chatStore.defaultModel) chatStore.warmModel(chatStore.defaultModel);
|
||||
});
|
||||
|
||||
const QUICK_ACTIONS = [
|
||||
"What's due today?",
|
||||
"Events this week?",
|
||||
"Any overdue tasks?",
|
||||
"My high priority tasks?",
|
||||
];
|
||||
|
||||
async function onQuickAction(query: string) {
|
||||
await chatPanelRef.value?.send(query);
|
||||
}
|
||||
|
||||
// ─── Upcoming events slide-over ───────────────────────────────────────────────
|
||||
|
||||
function openEvent(event: EventEntry) {
|
||||
editingEvent.value = event;
|
||||
eventSlideOverOpen.value = true;
|
||||
}
|
||||
|
||||
function onEventUpdated(event: EventEntry) {
|
||||
const idx = upcomingEvents.value.findIndex((e) => e.id === event.id);
|
||||
if (idx !== -1) upcomingEvents.value[idx] = event;
|
||||
eventSlideOverOpen.value = false;
|
||||
}
|
||||
|
||||
function onEventDeleted(id: number) {
|
||||
upcomingEvents.value = upcomingEvents.value.filter((e) => e.id !== id);
|
||||
eventSlideOverOpen.value = false;
|
||||
}
|
||||
|
||||
function formatUpcomingTime(event: EventEntry): string {
|
||||
if (!event.start_dt) return "";
|
||||
return fmtRelativeDateTime(event.start_dt, event.all_day);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="home">
|
||||
|
||||
<!-- ── Chat widget ─────────────────────────────────────────── -->
|
||||
<section class="chat-section">
|
||||
<div class="quick-actions">
|
||||
<button
|
||||
v-for="q in QUICK_ACTIONS"
|
||||
:key="q"
|
||||
class="quick-action-chip"
|
||||
:disabled="chatStore.streaming || !chatStore.chatReady"
|
||||
@click="onQuickAction(q)"
|
||||
>{{ q }}</button>
|
||||
</div>
|
||||
<ChatPanel ref="chatPanelRef" variant="widget" />
|
||||
</section>
|
||||
|
||||
<!-- ── Upcoming events ────────────────────────────────────── -->
|
||||
<div v-if="!loading && upcomingEvents.length" class="upcoming-events-section">
|
||||
<div class="section-header">
|
||||
<h2>Upcoming</h2>
|
||||
<router-link to="/calendar" class="see-all">Calendar →</router-link>
|
||||
</div>
|
||||
<div class="upcoming-events-list">
|
||||
<button
|
||||
v-for="ev in upcomingEvents.slice(0, 6)"
|
||||
:key="ev.id"
|
||||
class="upcoming-event-card"
|
||||
@click="openEvent(ev)"
|
||||
>
|
||||
<span class="upcoming-event-dot" :style="ev.color ? { background: ev.color } : {}"></span>
|
||||
<span class="upcoming-event-body">
|
||||
<span class="upcoming-event-title">{{ ev.title }}</span>
|
||||
<span class="upcoming-event-time">{{ formatUpcomingTime(ev) }}</span>
|
||||
<span v-if="ev.location" class="upcoming-event-loc">{{ ev.location }}</span>
|
||||
</span>
|
||||
</button>
|
||||
<div v-if="upcomingEvents.length > 6" class="upcoming-events-more">
|
||||
+{{ upcomingEvents.length - 6 }} more —
|
||||
<router-link to="/calendar" class="see-all-inline">view all</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── Skeleton while loading ─────────────────────────────── -->
|
||||
<template v-if="loading">
|
||||
<div class="skeleton-hero"></div>
|
||||
<div class="skeleton-grid">
|
||||
<div class="skeleton-card" v-for="i in 3" :key="i"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
|
||||
<!-- ── Hero: Last Active Project ──────────────────────── -->
|
||||
<div v-if="heroProject" class="hero-card">
|
||||
<div class="hero-top">
|
||||
<div class="hero-identity">
|
||||
<span class="hero-label">Last active</span>
|
||||
<router-link :to="`/projects/${heroProject.id}`" class="hero-title">
|
||||
{{ heroProject.title }}
|
||||
</router-link>
|
||||
</div>
|
||||
<router-link :to="`/workspace/${heroProject.id}`" class="btn-workspace-hero">
|
||||
▶ Open Workspace
|
||||
</router-link>
|
||||
</div>
|
||||
|
||||
<!-- Milestone bars -->
|
||||
<div
|
||||
v-if="heroProject.summary?.milestone_summary?.length"
|
||||
class="hero-milestones"
|
||||
>
|
||||
<div
|
||||
v-for="(ms, i) in heroProject.summary.milestone_summary
|
||||
.filter((m) => m.status !== 'archived')
|
||||
.slice(0, 3)"
|
||||
:key="ms.id"
|
||||
class="ms-row"
|
||||
>
|
||||
<span class="ms-label">{{ ms.title }}</span>
|
||||
<div class="ms-track">
|
||||
<div
|
||||
class="ms-fill"
|
||||
:style="{ width: ms.pct + '%', background: milestoneColor(i) }"
|
||||
></div>
|
||||
</div>
|
||||
<span class="ms-pct">{{ Math.round(ms.pct) }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Recent items -->
|
||||
<div v-if="heroRecentItems.length" class="hero-recent">
|
||||
<span class="hero-section-label">Recent</span>
|
||||
<div class="hero-items">
|
||||
<router-link
|
||||
v-for="item in heroRecentItems"
|
||||
:key="item.id"
|
||||
:to="item.status != null ? `/tasks/${item.id}` : `/notes/${item.id}`"
|
||||
class="hero-item"
|
||||
>
|
||||
<span class="hero-item-icon">{{ item.status != null ? '◉' : '◈' }}</span>
|
||||
<span class="hero-item-title">{{ item.title || 'Untitled' }}</span>
|
||||
<StatusBadge
|
||||
v-if="item.status"
|
||||
:status="(item.status as TaskStatus)"
|
||||
class="hero-item-badge"
|
||||
/>
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Next up -->
|
||||
<div v-if="heroNextUp" class="hero-next-up">
|
||||
<span class="hero-section-label">Next up</span>
|
||||
<router-link :to="`/tasks/${heroNextUp.id}`" class="hero-next-link">
|
||||
<PriorityBadge :priority="heroNextUp.priority ?? 'none'" />
|
||||
{{ heroNextUp.title }}
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── Active Projects grid ────────────────────────────── -->
|
||||
<div v-if="activeProjects.length" class="projects-section">
|
||||
<div class="section-header">
|
||||
<h2>Projects</h2>
|
||||
<router-link to="/projects" class="see-all">See all →</router-link>
|
||||
</div>
|
||||
<div class="projects-grid">
|
||||
<div
|
||||
v-for="project in activeProjects"
|
||||
:key="project.id"
|
||||
class="project-card"
|
||||
>
|
||||
<div class="project-card-top">
|
||||
<router-link
|
||||
:to="`/projects/${project.id}`"
|
||||
class="project-card-title"
|
||||
>
|
||||
{{ project.title }}
|
||||
</router-link>
|
||||
<router-link
|
||||
:to="`/workspace/${project.id}`"
|
||||
class="btn-workspace-sm"
|
||||
title="Open Workspace"
|
||||
>▶</router-link>
|
||||
</div>
|
||||
|
||||
<!-- Urgency badges -->
|
||||
<div class="project-urgency">
|
||||
<span
|
||||
v-if="(project.summary?.task_counts?.in_progress ?? 0) > 0"
|
||||
class="urgency-badge urgency-in-progress"
|
||||
>{{ project.summary!.task_counts.in_progress }} in progress</span>
|
||||
<span
|
||||
v-if="(project.summary?.task_counts?.todo ?? 0) > 0"
|
||||
class="urgency-badge urgency-todo"
|
||||
>{{ project.summary!.task_counts.todo }} todo</span>
|
||||
<span
|
||||
v-if="project.summary && !project.summary.task_counts.in_progress && !project.summary.task_counts.todo"
|
||||
class="urgency-badge urgency-clear"
|
||||
>All clear</span>
|
||||
<span v-if="!project.summary" class="urgency-badge urgency-loading">Loading…</span>
|
||||
</div>
|
||||
|
||||
<!-- Milestone bars (up to 2) -->
|
||||
<template v-if="project.summary?.milestone_summary?.length">
|
||||
<div
|
||||
v-for="(ms, i) in project.summary.milestone_summary
|
||||
.filter((m) => m.status !== 'archived')
|
||||
.slice(0, 2)"
|
||||
:key="ms.id"
|
||||
class="ms-row"
|
||||
>
|
||||
<span class="ms-label">{{ ms.title }}</span>
|
||||
<div class="ms-track">
|
||||
<div
|
||||
class="ms-fill"
|
||||
:style="{ width: ms.pct + '%', background: milestoneColor(i) }"
|
||||
></div>
|
||||
</div>
|
||||
<span class="ms-pct">{{ Math.round(ms.pct) }}%</span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── Inbox: orphaned items ───────────────────────────── -->
|
||||
<div
|
||||
v-if="orphanTasks.length || orphanNotes.length"
|
||||
class="inbox-section"
|
||||
>
|
||||
<button class="inbox-header" @click="inboxOpen = !inboxOpen">
|
||||
<span class="inbox-toggle">{{ inboxOpen ? '▼' : '▶' }}</span>
|
||||
<h2>
|
||||
Inbox
|
||||
<span class="inbox-count">{{ orphanTasks.length + orphanNotes.length }}</span>
|
||||
</h2>
|
||||
<span class="inbox-sub">Notes and tasks without a project</span>
|
||||
</button>
|
||||
<div v-if="inboxOpen" class="inbox-items">
|
||||
<TaskCard
|
||||
v-for="task in orphanTasks"
|
||||
:key="task.id"
|
||||
:task="task"
|
||||
compact
|
||||
@status-toggle="onStatusToggle"
|
||||
/>
|
||||
<NoteCard
|
||||
v-for="note in orphanNotes"
|
||||
:key="note.id"
|
||||
:note="note"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
</main>
|
||||
|
||||
<!-- Event slide-over -->
|
||||
<EventSlideOver
|
||||
v-if="eventSlideOverOpen"
|
||||
:event="editingEvent"
|
||||
initial-date=""
|
||||
@close="eventSlideOverOpen = false"
|
||||
@created="eventSlideOverOpen = false"
|
||||
@updated="onEventUpdated"
|
||||
@deleted="onEventDeleted"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.home {
|
||||
max-width: var(--page-max-width);
|
||||
margin: 2rem auto;
|
||||
padding: 0 var(--page-padding-x);
|
||||
}
|
||||
|
||||
/* ─── Chat widget ────────────────────────────────────────────── */
|
||||
.chat-section {
|
||||
max-width: 720px;
|
||||
margin: 0 auto 1.5rem;
|
||||
}
|
||||
.quick-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 0.4rem;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
.quick-action-chip {
|
||||
padding: 0.3rem 0.75rem;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 999px;
|
||||
background: var(--color-bg-secondary);
|
||||
color: var(--color-text);
|
||||
font-size: 0.8rem;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s, color 0.15s, background 0.15s;
|
||||
}
|
||||
.quick-action-chip:hover:not(:disabled) {
|
||||
border-color: var(--color-primary);
|
||||
color: var(--color-primary);
|
||||
background: color-mix(in srgb, var(--color-primary) 8%, transparent);
|
||||
}
|
||||
.quick-action-chip:disabled { opacity: 0.4; cursor: default; }
|
||||
|
||||
/* ─── Skeleton loading ───────────────────────────────────────── */
|
||||
.skeleton-hero {
|
||||
height: 180px;
|
||||
border-radius: var(--radius-lg);
|
||||
background: linear-gradient(90deg, var(--color-bg-secondary) 25%, var(--color-border) 50%, var(--color-bg-secondary) 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: skeleton-shimmer 1.4s ease infinite;
|
||||
margin-bottom: 1.75rem;
|
||||
}
|
||||
.skeleton-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
||||
gap: 0.75rem;
|
||||
margin-bottom: 1.75rem;
|
||||
}
|
||||
.skeleton-card {
|
||||
height: 120px;
|
||||
border-radius: var(--radius-md);
|
||||
background: linear-gradient(90deg, var(--color-bg-secondary) 25%, var(--color-border) 50%, var(--color-bg-secondary) 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: skeleton-shimmer 1.4s ease infinite;
|
||||
}
|
||||
@keyframes skeleton-shimmer {
|
||||
0% { background-position: 200% 0; }
|
||||
100% { background-position: -200% 0; }
|
||||
}
|
||||
|
||||
/* ─── Hero card ──────────────────────────────────────────────── */
|
||||
.hero-card {
|
||||
background: var(--color-bg-card);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 1.25rem 1.5rem;
|
||||
margin-bottom: 1.75rem;
|
||||
box-shadow: 0 2px 16px rgba(91, 74, 138, 0.08), 0 1px 4px rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
.hero-top {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.hero-identity {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.2rem;
|
||||
}
|
||||
.hero-label {
|
||||
font-size: 0.7rem;
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
.hero-title {
|
||||
font-size: 1.4rem;
|
||||
font-weight: 500;
|
||||
color: var(--color-text);
|
||||
text-decoration: none;
|
||||
letter-spacing: -0.02em;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.hero-title:hover { color: var(--color-primary); }
|
||||
|
||||
.btn-workspace-hero {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
padding: 0.55rem 1.1rem;
|
||||
background: var(--gradient-cta);
|
||||
color: #fff;
|
||||
border-radius: var(--radius-sm);
|
||||
text-decoration: none;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
box-shadow: 0 1px 6px rgba(91, 74, 138, 0.3);
|
||||
transition: opacity 0.15s, box-shadow 0.15s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.btn-workspace-hero:hover {
|
||||
opacity: 0.9;
|
||||
box-shadow: 0 3px 14px rgba(91, 74, 138, 0.45);
|
||||
}
|
||||
|
||||
.hero-milestones { margin-bottom: 0.75rem; }
|
||||
|
||||
.hero-section-label {
|
||||
font-size: 0.68rem;
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.07em;
|
||||
color: var(--color-text-muted);
|
||||
display: block;
|
||||
margin-bottom: 0.4rem;
|
||||
}
|
||||
|
||||
.hero-recent { margin-bottom: 0.75rem; }
|
||||
.hero-items {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.2rem;
|
||||
}
|
||||
.hero-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.3rem 0.5rem;
|
||||
border-radius: var(--radius-sm);
|
||||
text-decoration: none;
|
||||
color: var(--color-text-secondary);
|
||||
font-size: 0.88rem;
|
||||
transition: background 0.12s, color 0.12s;
|
||||
}
|
||||
.hero-item:hover {
|
||||
background: color-mix(in srgb, var(--color-primary) 6%, transparent);
|
||||
color: var(--color-text);
|
||||
}
|
||||
.hero-item-icon { opacity: 0.45; font-size: 0.75rem; flex-shrink: 0; }
|
||||
.hero-item-title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.hero-item-badge { flex-shrink: 0; }
|
||||
|
||||
.hero-next-up {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.hero-next-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
color: var(--color-text);
|
||||
text-decoration: none;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
.hero-next-link:hover { color: var(--color-primary); }
|
||||
|
||||
/* ─── Projects grid ──────────────────────────────────────────── */
|
||||
.projects-section { margin-bottom: 1.75rem; }
|
||||
.section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
.section-header h2 { margin: 0; font-size: 1rem; font-weight: 500; }
|
||||
.see-all { font-size: 0.85rem; color: var(--color-primary); text-decoration: none; }
|
||||
.see-all:hover { text-decoration: underline; }
|
||||
|
||||
.projects-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
||||
gap: 0.75rem;
|
||||
}
|
||||
.project-card {
|
||||
background: var(--color-bg-card);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-md);
|
||||
padding: 0.85rem 1rem;
|
||||
transition: box-shadow 0.18s, border-color 0.15s, transform 0.18s;
|
||||
}
|
||||
.project-card:hover {
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
|
||||
border-color: var(--color-primary);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
.project-card-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 0.5rem;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.project-card-title {
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
color: var(--color-text);
|
||||
text-decoration: none;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.project-card-title:hover { color: var(--color-primary); }
|
||||
.btn-workspace-sm {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
background: color-mix(in srgb, var(--color-primary) 12%, transparent);
|
||||
color: var(--color-primary);
|
||||
border-radius: var(--radius-sm);
|
||||
text-decoration: none;
|
||||
font-size: 0.75rem;
|
||||
flex-shrink: 0;
|
||||
transition: background 0.15s, color 0.15s;
|
||||
}
|
||||
.btn-workspace-sm:hover {
|
||||
background: var(--color-primary);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.project-urgency {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.3rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.urgency-badge {
|
||||
font-size: 0.72rem;
|
||||
padding: 0.1rem 0.45rem;
|
||||
border-radius: var(--radius-pill);
|
||||
font-weight: 500;
|
||||
}
|
||||
.urgency-in-progress {
|
||||
background: color-mix(in srgb, #5B4A8A 15%, transparent);
|
||||
color: #5B4A8A;
|
||||
}
|
||||
.urgency-todo {
|
||||
background: color-mix(in srgb, var(--color-text-muted) 12%, transparent);
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
.urgency-clear {
|
||||
background: color-mix(in srgb, #22c55e 12%, transparent);
|
||||
color: #16a34a;
|
||||
}
|
||||
.urgency-loading { color: var(--color-text-muted); }
|
||||
|
||||
/* ─── Inbox ──────────────────────────────────────────────────── */
|
||||
.inbox-section {
|
||||
background: var(--color-bg-card);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-md);
|
||||
overflow: hidden;
|
||||
margin-bottom: 1.75rem;
|
||||
}
|
||||
.inbox-header {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
padding: 0.75rem 1rem;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
color: var(--color-text);
|
||||
transition: background 0.15s;
|
||||
}
|
||||
.inbox-header:hover { background: var(--color-bg-secondary); }
|
||||
.inbox-toggle { font-size: 0.75rem; color: var(--color-text-muted); }
|
||||
.inbox-header h2 {
|
||||
margin: 0;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 500;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
.inbox-count {
|
||||
background: color-mix(in srgb, var(--color-text-muted) 15%, transparent);
|
||||
color: var(--color-text-muted);
|
||||
font-size: 0.75rem;
|
||||
padding: 0.05rem 0.4rem;
|
||||
border-radius: var(--radius-pill);
|
||||
}
|
||||
.inbox-sub {
|
||||
font-size: 0.8rem;
|
||||
color: var(--color-text-muted);
|
||||
margin-left: auto;
|
||||
}
|
||||
.inbox-items {
|
||||
padding: 0.5rem 0.75rem 0.75rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
/* ─── Shared: milestone bars ─────────────────────────────────── */
|
||||
.ms-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
margin-bottom: 0.3rem;
|
||||
}
|
||||
.ms-label {
|
||||
font-size: 0.72rem;
|
||||
color: var(--color-text-muted);
|
||||
width: 5rem;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.ms-track {
|
||||
flex: 1;
|
||||
height: 5px;
|
||||
background: var(--color-bg-secondary);
|
||||
border-radius: 999px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.ms-fill {
|
||||
height: 100%;
|
||||
border-radius: 999px;
|
||||
transition: width 0.3s;
|
||||
}
|
||||
.ms-pct {
|
||||
font-size: 0.7rem;
|
||||
color: var(--color-text-muted);
|
||||
width: 2.2rem;
|
||||
text-align: right;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* ─── Mobile ─────────────────────────────────────────────────── */
|
||||
@media (max-width: 680px) {
|
||||
.home { padding: 0 var(--page-padding-x); margin: 1rem auto; }
|
||||
.hero-top { flex-direction: column; align-items: flex-start; }
|
||||
.btn-workspace-hero { width: 100%; justify-content: center; }
|
||||
.projects-grid { grid-template-columns: 1fr; }
|
||||
.inbox-sub { display: none; }
|
||||
}
|
||||
|
||||
/* ─── Upcoming events ────────────────────────────────────────── */
|
||||
.upcoming-events-section {
|
||||
margin-bottom: 1.75rem;
|
||||
}
|
||||
.upcoming-events-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.upcoming-event-card {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 0.5rem;
|
||||
padding: 0.55rem 0.75rem;
|
||||
background: var(--color-bg-card);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-md);
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
font-family: inherit;
|
||||
transition: border-color 0.15s, background 0.15s;
|
||||
width: 100%;
|
||||
}
|
||||
.upcoming-event-card:hover {
|
||||
border-color: var(--color-primary);
|
||||
background: color-mix(in srgb, var(--color-primary) 6%, var(--color-bg-card));
|
||||
}
|
||||
.upcoming-event-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: var(--color-primary);
|
||||
flex-shrink: 0;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.upcoming-event-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.1rem;
|
||||
min-width: 0;
|
||||
}
|
||||
.upcoming-event-title {
|
||||
font-size: 0.85rem;
|
||||
font-weight: 500;
|
||||
color: var(--color-text);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.upcoming-event-time {
|
||||
font-size: 0.75rem;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
.upcoming-event-loc {
|
||||
font-size: 0.72rem;
|
||||
color: var(--color-text-muted);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.upcoming-events-more {
|
||||
font-size: 0.8rem;
|
||||
color: var(--color-text-muted);
|
||||
padding: 0.25rem 0;
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
.see-all-inline {
|
||||
color: var(--color-primary);
|
||||
text-decoration: none;
|
||||
}
|
||||
.see-all-inline:hover { text-decoration: underline; }
|
||||
</style>
|
||||
@@ -1,948 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { useBackgroundRefresh } from '@/composables/useBackgroundRefresh'
|
||||
import { useChatStore } from '@/stores/chat'
|
||||
import ChatPanel from '@/components/ChatPanel.vue'
|
||||
import WeatherCard from '@/components/WeatherCard.vue'
|
||||
import { RotateCcw, Sparkles, Check, X } from 'lucide-vue-next'
|
||||
import {
|
||||
apiGet,
|
||||
apiPost,
|
||||
getJournalToday,
|
||||
getJournalDay,
|
||||
getJournalDays,
|
||||
triggerJournalPrep,
|
||||
listEvents,
|
||||
listJournalMoments,
|
||||
runJournalCurator,
|
||||
listPendingActions,
|
||||
approvePendingAction,
|
||||
rejectPendingAction,
|
||||
type EventEntry,
|
||||
type JournalMoment,
|
||||
type PendingCuratorAction,
|
||||
} from '@/api/client'
|
||||
import { useToastStore } from '@/stores/toast'
|
||||
|
||||
interface WeatherDay {
|
||||
day: string
|
||||
condition: string
|
||||
high: number
|
||||
low: number
|
||||
precip_probability: number | null
|
||||
precip_mm: number | null
|
||||
windspeed_max: number
|
||||
}
|
||||
interface WeatherData {
|
||||
location: string
|
||||
fetched_at: string
|
||||
current_temp: number
|
||||
condition: string
|
||||
today_high: number | null
|
||||
today_low: number | null
|
||||
yesterday_high: number | null
|
||||
yesterday_low: number | null
|
||||
wind_unit?: string
|
||||
forecast: WeatherDay[]
|
||||
}
|
||||
interface CurrentConditions {
|
||||
temperature: number | null
|
||||
windspeed: number | null
|
||||
description: string
|
||||
precip_next_3h: number[]
|
||||
temp_unit: string
|
||||
location: string
|
||||
}
|
||||
|
||||
const chatStore = useChatStore()
|
||||
const toastStore = useToastStore()
|
||||
|
||||
// ── Day picker + conversation state ──────────────────────────────────────────
|
||||
const days = ref<string[]>([])
|
||||
const todayDate = ref<string | null>(null)
|
||||
const selectedDay = ref<string | null>(null)
|
||||
const dayConvId = ref<number | null>(null)
|
||||
const isToday = computed(() => selectedDay.value !== null && selectedDay.value === todayDate.value)
|
||||
|
||||
// ── Curator + captures panel (Phase 1b) ──────────────────────────────────────
|
||||
// The journal chat model has no tools — moments / tasks land via a curator
|
||||
// pass (services/curator.py). The "Process captures now" button triggers
|
||||
// a pass manually; the captures panel shows everything captured for the
|
||||
// selected day.
|
||||
const moments = ref<JournalMoment[]>([])
|
||||
const momentsLoading = ref(false)
|
||||
const curatorRunning = ref(false)
|
||||
|
||||
// Needs Review queue — curator-proposed mutations awaiting user approval.
|
||||
// Visible only when count > 0; sits above the Captures panel in the rail.
|
||||
const pendingActions = ref<PendingCuratorAction[]>([])
|
||||
const pendingLoading = ref(false)
|
||||
const reviewingIds = ref<Set<number>>(new Set())
|
||||
|
||||
async function loadPendingActions() {
|
||||
pendingLoading.value = true
|
||||
try {
|
||||
const res = await listPendingActions()
|
||||
pendingActions.value = res.pending
|
||||
} catch {
|
||||
/* silent — pending feature may not be deployed yet */
|
||||
} finally {
|
||||
pendingLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function approvePending(action: PendingCuratorAction) {
|
||||
if (reviewingIds.value.has(action.id)) return
|
||||
reviewingIds.value.add(action.id)
|
||||
try {
|
||||
const result = await approvePendingAction(action.id)
|
||||
if ((result as { error?: string }).error) {
|
||||
toastStore.show(`Approve failed: ${(result as { error: string }).error}`, 'error')
|
||||
} else {
|
||||
toastStore.show(`Applied: ${action.action_type}`, 'success')
|
||||
}
|
||||
await Promise.all([loadPendingActions(), loadMoments()])
|
||||
} catch (e) {
|
||||
const msg = e instanceof Error ? e.message : 'Approve failed'
|
||||
toastStore.show(msg, 'error')
|
||||
} finally {
|
||||
reviewingIds.value.delete(action.id)
|
||||
}
|
||||
}
|
||||
|
||||
async function rejectPending(action: PendingCuratorAction) {
|
||||
if (reviewingIds.value.has(action.id)) return
|
||||
reviewingIds.value.add(action.id)
|
||||
try {
|
||||
await rejectPendingAction(action.id)
|
||||
toastStore.show(`Rejected: ${action.action_type}`, 'success')
|
||||
await loadPendingActions()
|
||||
} catch (e) {
|
||||
const msg = e instanceof Error ? e.message : 'Reject failed'
|
||||
toastStore.show(msg, 'error')
|
||||
} finally {
|
||||
reviewingIds.value.delete(action.id)
|
||||
}
|
||||
}
|
||||
|
||||
// Human-readable subject for the card header.
|
||||
function pendingTitle(a: PendingCuratorAction): string {
|
||||
const verb = a.action_type.startsWith('delete_') ? 'Delete'
|
||||
: a.action_type.startsWith('update_') ? 'Update'
|
||||
: a.action_type
|
||||
const target = a.target_label || (a.target_type ?? 'item')
|
||||
return `${verb} ${target}`
|
||||
}
|
||||
|
||||
// Compute the field-level diff between current snapshot and proposed payload.
|
||||
// Returns [{field, before, after}] only for fields the curator wants to change.
|
||||
interface DiffRow { field: string; before: unknown; after: unknown }
|
||||
function pendingDiff(a: PendingCuratorAction): DiffRow[] {
|
||||
const snap = a.current_snapshot || {}
|
||||
const payload = a.payload || {}
|
||||
const rows: DiffRow[] = []
|
||||
// Map payload param names → snapshot key names where they differ.
|
||||
// update_note uses `query` (the lookup) but we diff the target's own
|
||||
// fields — skip `query` itself from the diff.
|
||||
const skip = new Set(['query', 'task', 'project', 'milestone', 'confirmed'])
|
||||
for (const [key, after] of Object.entries(payload)) {
|
||||
if (skip.has(key)) continue
|
||||
if (after === null || after === undefined || after === '') continue
|
||||
const before = (snap as Record<string, unknown>)[key]
|
||||
if (JSON.stringify(before) === JSON.stringify(after)) continue
|
||||
rows.push({ field: key, before, after })
|
||||
}
|
||||
return rows
|
||||
}
|
||||
|
||||
function formatDiffValue(v: unknown): string {
|
||||
if (v === null || v === undefined) return '—'
|
||||
if (Array.isArray(v)) return v.length ? v.join(', ') : '—'
|
||||
if (typeof v === 'object') return JSON.stringify(v)
|
||||
return String(v)
|
||||
}
|
||||
|
||||
async function loadMoments() {
|
||||
if (!selectedDay.value) {
|
||||
moments.value = []
|
||||
return
|
||||
}
|
||||
momentsLoading.value = true
|
||||
try {
|
||||
// /api/journal/moments takes date_from + date_to (NOT `date`).
|
||||
// Passing a single ISO date for both bounds gives us the moments
|
||||
// recorded on that calendar day, which is what the captures panel
|
||||
// means by "today".
|
||||
moments.value = await listJournalMoments({
|
||||
date_from: selectedDay.value,
|
||||
date_to: selectedDay.value,
|
||||
limit: 100,
|
||||
})
|
||||
} catch {
|
||||
/* silent — moments may not exist yet */
|
||||
} finally {
|
||||
momentsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function triggerCurator() {
|
||||
if (curatorRunning.value || !dayConvId.value) return
|
||||
curatorRunning.value = true
|
||||
try {
|
||||
const result = await runJournalCurator(dayConvId.value)
|
||||
if (result.error) {
|
||||
toastStore.show(`Curator error: ${result.error}`, 'error')
|
||||
} else {
|
||||
const captured = result.tools_succeeded
|
||||
const total = result.tools_attempted
|
||||
const detail = captured === total
|
||||
? `${captured} tool calls`
|
||||
: `${captured}/${total} tool calls`
|
||||
// toastStore only supports success/error/warning; use success for
|
||||
// both "captured something" and the no-op case (success in the
|
||||
// sense that the curator ran cleanly).
|
||||
toastStore.show(
|
||||
captured > 0
|
||||
? `Captured ${detail} (${result.duration_ms}ms)`
|
||||
: `Nothing new to capture (${result.duration_ms}ms)`,
|
||||
'success',
|
||||
)
|
||||
}
|
||||
await Promise.all([loadMoments(), loadPendingActions()])
|
||||
} catch (e) {
|
||||
const msg = e instanceof Error ? e.message : 'Curator failed'
|
||||
toastStore.show(`Curator failed: ${msg}`, 'error')
|
||||
} finally {
|
||||
curatorRunning.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function formatMomentTime(iso: string): string {
|
||||
try {
|
||||
return new Date(iso).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
|
||||
} catch {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
// ── Weather panel ────────────────────────────────────────────────────────────
|
||||
const weatherData = ref<WeatherData[]>([])
|
||||
const selectedWeatherIdx = ref(0)
|
||||
const tempUnit = ref<string>('C')
|
||||
const currentConditions = ref<CurrentConditions | null>(null)
|
||||
let currentWeatherTimer: ReturnType<typeof setInterval> | null = null
|
||||
|
||||
async function loadCurrentConditions() {
|
||||
try {
|
||||
currentConditions.value = await apiGet<CurrentConditions>('/api/journal/weather/current')
|
||||
if (currentConditions.value?.temperature != null && weatherData.value.length > 0) {
|
||||
weatherData.value[0] = { ...weatherData.value[0], current_temp: currentConditions.value.temperature }
|
||||
}
|
||||
} catch { /* silent */ }
|
||||
}
|
||||
|
||||
async function loadWeather() {
|
||||
try {
|
||||
const data = await apiGet<{ locations: WeatherData[]; temp_unit: string }>('/api/journal/weather')
|
||||
weatherData.value = data.locations ?? []
|
||||
tempUnit.value = data.temp_unit ?? 'C'
|
||||
} catch { /* silent */ }
|
||||
}
|
||||
|
||||
const refreshingWeather = ref(false)
|
||||
async function refreshWeather() {
|
||||
refreshingWeather.value = true
|
||||
try {
|
||||
const data = await apiPost<{ locations: WeatherData[]; temp_unit: string }>('/api/journal/weather/refresh', {})
|
||||
weatherData.value = data.locations ?? []
|
||||
tempUnit.value = data.temp_unit ?? 'C'
|
||||
} catch { /* silent */ }
|
||||
finally { refreshingWeather.value = false }
|
||||
}
|
||||
|
||||
// ── Upcoming events ──────────────────────────────────────────────────────────
|
||||
const upcomingEvents = ref<EventEntry[]>([])
|
||||
|
||||
interface GroupedDay {
|
||||
label: string
|
||||
dateKey: string
|
||||
events: EventEntry[]
|
||||
}
|
||||
|
||||
const groupedEvents = computed<GroupedDay[]>(() => {
|
||||
const groups = new Map<string, EventEntry[]>()
|
||||
const today = new Date()
|
||||
today.setHours(0, 0, 0, 0)
|
||||
for (const ev of upcomingEvents.value) {
|
||||
const d = new Date(ev.start_dt)
|
||||
const key = d.toISOString().slice(0, 10)
|
||||
if (!groups.has(key)) groups.set(key, [])
|
||||
groups.get(key)!.push(ev)
|
||||
}
|
||||
const result: GroupedDay[] = []
|
||||
for (const [key, events] of groups) {
|
||||
const d = new Date(key + 'T00:00:00')
|
||||
const diff = Math.round((d.getTime() - today.getTime()) / 86_400_000)
|
||||
let label: string
|
||||
if (diff === 0) label = 'Today'
|
||||
else if (diff === 1) label = 'Tomorrow'
|
||||
else label = d.toLocaleDateString(undefined, { weekday: 'short', month: 'short', day: 'numeric' })
|
||||
result.push({ label, dateKey: key, events })
|
||||
}
|
||||
return result
|
||||
})
|
||||
|
||||
function formatEventTime(ev: EventEntry): string {
|
||||
if (ev.all_day) return 'All day'
|
||||
const d = new Date(ev.start_dt)
|
||||
return d.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' })
|
||||
}
|
||||
|
||||
async function loadEvents() {
|
||||
try {
|
||||
// Window: today 00:00 → 14 days out. Matches the prep's framing — events
|
||||
// earlier today (already past) still surface here, grouped under "Today",
|
||||
// so the right rail aligns with what the prep references.
|
||||
const start = new Date()
|
||||
start.setHours(0, 0, 0, 0)
|
||||
const end = new Date(start)
|
||||
end.setDate(end.getDate() + 14)
|
||||
end.setHours(23, 59, 59, 999)
|
||||
upcomingEvents.value = await listEvents(start.toISOString(), end.toISOString())
|
||||
} catch { /* silent */ }
|
||||
}
|
||||
|
||||
// ── Day load + switch ────────────────────────────────────────────────────────
|
||||
async function loadDay(iso: string) {
|
||||
const payload = iso === todayDate.value ? await getJournalToday() : await getJournalDay(iso)
|
||||
if (payload.conversation) {
|
||||
dayConvId.value = payload.conversation.id
|
||||
await chatStore.fetchConversation(payload.conversation.id)
|
||||
} else {
|
||||
dayConvId.value = null
|
||||
}
|
||||
}
|
||||
|
||||
async function loadAll() {
|
||||
try {
|
||||
const today = await getJournalToday()
|
||||
todayDate.value = today.day_date
|
||||
selectedDay.value = today.day_date
|
||||
if (today.conversation) {
|
||||
dayConvId.value = today.conversation.id
|
||||
await chatStore.fetchConversation(today.conversation.id)
|
||||
}
|
||||
} catch { /* silent */ }
|
||||
|
||||
try {
|
||||
days.value = await getJournalDays()
|
||||
if (todayDate.value && !days.value.includes(todayDate.value)) {
|
||||
days.value = [todayDate.value, ...days.value]
|
||||
}
|
||||
} catch { /* silent */ }
|
||||
|
||||
await Promise.all([
|
||||
loadWeather(),
|
||||
loadCurrentConditions(),
|
||||
loadEvents(),
|
||||
loadMoments(),
|
||||
loadPendingActions(),
|
||||
])
|
||||
}
|
||||
|
||||
watch(selectedDay, async (iso) => {
|
||||
if (!iso) return
|
||||
// For non-today dates, loadDay handles its own day-data fetch; in both
|
||||
// cases we want the captures panel to reflect the selected day.
|
||||
try {
|
||||
if (iso !== todayDate.value) await loadDay(iso)
|
||||
await loadMoments()
|
||||
} catch { /* silent */ }
|
||||
})
|
||||
|
||||
// ── Manual prep regeneration ─────────────────────────────────────────────────
|
||||
const triggering = ref(false)
|
||||
async function triggerPrep() {
|
||||
if (triggering.value) return
|
||||
triggering.value = true
|
||||
try {
|
||||
await triggerJournalPrep()
|
||||
if (_mounted) await loadAll()
|
||||
} finally {
|
||||
if (_mounted) triggering.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function dayLabel(iso: string): string {
|
||||
if (iso === todayDate.value) return 'Today'
|
||||
const d = new Date(iso + 'T00:00:00')
|
||||
return d.toLocaleDateString(undefined, { weekday: 'short', month: 'short', day: 'numeric' })
|
||||
}
|
||||
|
||||
const todayBadge = computed(() => {
|
||||
return new Date().toLocaleDateString(undefined, { weekday: 'long', month: 'long', day: 'numeric' })
|
||||
})
|
||||
|
||||
// ── Background refresh ───────────────────────────────────────────────────────
|
||||
async function _backgroundRefreshMessages() {
|
||||
try {
|
||||
if (!_mounted || !isToday.value || !dayConvId.value) return
|
||||
await chatStore.fetchConversation(dayConvId.value)
|
||||
} catch { /* silent */ }
|
||||
}
|
||||
|
||||
useBackgroundRefresh(
|
||||
_backgroundRefreshMessages,
|
||||
60_000,
|
||||
() => !chatStore.streaming && isToday.value && !!dayConvId.value,
|
||||
)
|
||||
|
||||
let _mounted = true
|
||||
onUnmounted(() => {
|
||||
_mounted = false
|
||||
if (currentWeatherTimer) clearInterval(currentWeatherTimer)
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await loadAll()
|
||||
currentWeatherTimer = setInterval(loadCurrentConditions, 30 * 60 * 1000)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="journal-root">
|
||||
<div class="journal-shell">
|
||||
<header class="journal-header">
|
||||
<div class="journal-header-left">
|
||||
<h1 class="journal-title">Journal</h1>
|
||||
<span class="journal-today-badge">{{ todayBadge }}</span>
|
||||
</div>
|
||||
<div class="journal-header-right">
|
||||
<select v-if="days.length" v-model="selectedDay" class="journal-day-select">
|
||||
<option v-for="d in days" :key="d" :value="d">{{ dayLabel(d) }}</option>
|
||||
</select>
|
||||
<button
|
||||
class="btn-trigger"
|
||||
@click="triggerPrep"
|
||||
:disabled="triggering || !isToday"
|
||||
title="Regenerate today's daily prep"
|
||||
>{{ triggering ? '…' : 'Refresh prep' }}</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Center: chat (prep is the first assistant message inside) -->
|
||||
<div class="journal-center">
|
||||
<ChatPanel
|
||||
variant="full"
|
||||
briefingMode
|
||||
:readOnly="!isToday"
|
||||
placeholder="Tell your journal…"
|
||||
class="journal-chat-panel"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Right: Weather + Events + News -->
|
||||
<div class="journal-right">
|
||||
<div class="weather-section" v-if="weatherData.length">
|
||||
<div class="weather-section-header">
|
||||
<div class="weather-tabs" v-if="weatherData.length > 1">
|
||||
<button
|
||||
v-for="(loc, i) in weatherData"
|
||||
:key="(loc as WeatherData).location"
|
||||
class="weather-tab"
|
||||
:class="{ active: selectedWeatherIdx === i }"
|
||||
@click="selectedWeatherIdx = i"
|
||||
>{{ (loc as WeatherData).location }}</button>
|
||||
</div>
|
||||
<button
|
||||
class="weather-refresh-btn"
|
||||
:class="{ spinning: refreshingWeather }"
|
||||
:disabled="refreshingWeather"
|
||||
@click="refreshWeather"
|
||||
title="Refresh weather"
|
||||
>
|
||||
<RotateCcw :size="16" />
|
||||
</button>
|
||||
</div>
|
||||
<WeatherCard
|
||||
:weather="weatherData[selectedWeatherIdx]"
|
||||
:temp-unit="tempUnit"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Needs Review panel: curator-proposed mutations awaiting user
|
||||
approval (update_note, delete_note, update_milestone, etc.).
|
||||
Hidden when nothing is pending so the rail stays calm. -->
|
||||
<div v-if="pendingActions.length > 0" class="review-section">
|
||||
<div class="panel-label-row">
|
||||
<div class="panel-label review-panel-label">
|
||||
Needs Review <span class="review-count">{{ pendingActions.length }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="review-list">
|
||||
<li v-for="a in pendingActions" :key="a.id" class="review-row">
|
||||
<div class="review-header">
|
||||
<span class="review-action-type">{{ a.action_type }}</span>
|
||||
<span class="review-title">{{ pendingTitle(a) }}</span>
|
||||
</div>
|
||||
<div v-if="a.action_type.startsWith('delete_')" class="review-delete-warn">
|
||||
Permanent delete — the entry will be gone.
|
||||
</div>
|
||||
<ul v-else-if="pendingDiff(a).length" class="review-diff">
|
||||
<li v-for="row in pendingDiff(a)" :key="row.field" class="review-diff-row">
|
||||
<span class="review-diff-field">{{ row.field }}</span>
|
||||
<span class="review-diff-before">{{ formatDiffValue(row.before) }}</span>
|
||||
<span class="review-diff-arrow">→</span>
|
||||
<span class="review-diff-after">{{ formatDiffValue(row.after) }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<div v-else class="review-diff-empty">
|
||||
No visible change preview; review payload via DB if needed.
|
||||
</div>
|
||||
<div class="review-actions">
|
||||
<button
|
||||
class="review-btn review-btn--approve"
|
||||
:disabled="reviewingIds.has(a.id)"
|
||||
@click="approvePending(a)"
|
||||
title="Apply the proposed change"
|
||||
>
|
||||
<Check :size="14" /> Approve
|
||||
</button>
|
||||
<button
|
||||
class="review-btn review-btn--reject"
|
||||
:disabled="reviewingIds.has(a.id)"
|
||||
@click="rejectPending(a)"
|
||||
title="Discard the proposal"
|
||||
>
|
||||
<X :size="14" /> Reject
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Captures panel: shows moments extracted by the curator for the
|
||||
selected day. The chat model is tools=[]; the curator pass
|
||||
(manual button below, scheduler in phase 2) populates this. -->
|
||||
<div class="captures-section">
|
||||
<div class="panel-label-row">
|
||||
<div class="panel-label">Captures</div>
|
||||
<button
|
||||
class="captures-trigger-btn"
|
||||
:class="{ spinning: curatorRunning }"
|
||||
:disabled="curatorRunning || !dayConvId || !isToday"
|
||||
:title="isToday ? 'Run curator on this conversation' : 'Curator only runs on the current day'"
|
||||
@click="triggerCurator"
|
||||
>
|
||||
<Sparkles :size="14" />
|
||||
{{ curatorRunning ? 'Working…' : 'Process captures' }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="momentsLoading && !moments.length" class="captures-empty">
|
||||
Loading…
|
||||
</div>
|
||||
<div v-else-if="!moments.length" class="captures-empty">
|
||||
No captures yet for {{ isToday ? 'today' : 'this day' }}.
|
||||
<span v-if="isToday">Talk in the journal, then press "Process captures".</span>
|
||||
</div>
|
||||
<ul v-else class="captures-list">
|
||||
<li v-for="m in moments" :key="m.id" class="capture-row">
|
||||
<div class="capture-time">{{ formatMomentTime(m.occurred_at) }}</div>
|
||||
<div class="capture-body">
|
||||
<div class="capture-content">{{ m.content }}</div>
|
||||
<div v-if="m.people.length || m.places.length || m.task_ids.length || m.note_ids.length" class="capture-meta">
|
||||
<span v-if="m.people.length" class="capture-chip">
|
||||
{{ m.people.map(p => p.title).join(', ') }}
|
||||
</span>
|
||||
<span v-if="m.places.length" class="capture-chip">
|
||||
@ {{ m.places.map(p => p.title).join(', ') }}
|
||||
</span>
|
||||
<span v-if="m.task_ids.length" class="capture-chip capture-chip--task">
|
||||
{{ m.task_ids.length }} task{{ m.task_ids.length === 1 ? '' : 's' }}
|
||||
</span>
|
||||
<span v-if="m.note_ids.length" class="capture-chip capture-chip--note">
|
||||
{{ m.note_ids.length }} note{{ m.note_ids.length === 1 ? '' : 's' }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="events-section" v-if="groupedEvents.length">
|
||||
<div class="panel-label-row">
|
||||
<div class="panel-label">Upcoming</div>
|
||||
<router-link to="/calendar" class="events-cal-link">Calendar →</router-link>
|
||||
</div>
|
||||
<div class="events-list">
|
||||
<div v-for="group in groupedEvents" :key="group.dateKey" class="events-day-group">
|
||||
<div class="events-day-label">{{ group.label }}</div>
|
||||
<div v-for="ev in group.events" :key="ev.id" class="event-row">
|
||||
<span class="event-dot" :style="ev.color ? { background: ev.color } : {}"></span>
|
||||
<span class="event-body">
|
||||
<span class="event-title">{{ ev.title }}</span>
|
||||
<span class="event-time">{{ formatEventTime(ev) }}</span>
|
||||
<span v-if="ev.location" class="event-loc">{{ ev.location }}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.journal-root {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.journal-shell {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr minmax(320px, 35%);
|
||||
grid-template-rows: auto 1fr;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.journal-header {
|
||||
grid-column: 1 / -1;
|
||||
grid-row: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 1.25rem 1rem 1rem;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
flex-shrink: 0;
|
||||
gap: 1rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.journal-header-left { display: flex; align-items: baseline; gap: 0.75rem; }
|
||||
.journal-title {
|
||||
/* h1 inherits Fraunces from theme.css; weight 500 follows the doc's "two weights only" rule */
|
||||
font-size: 1.3rem;
|
||||
margin: 0;
|
||||
color: var(--color-text);
|
||||
}
|
||||
.journal-today-badge { font-size: 0.82rem; color: var(--color-text-muted); }
|
||||
.journal-header-right { display: flex; align-items: center; gap: 0.5rem; }
|
||||
|
||||
.journal-day-select {
|
||||
padding: 0.35rem 0.6rem;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 6px;
|
||||
background: var(--color-bg-card);
|
||||
color: var(--color-text);
|
||||
font-size: 0.82rem;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.btn-trigger {
|
||||
padding: 0.35rem 0.8rem;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 6px;
|
||||
background: var(--color-bg-card);
|
||||
color: var(--color-text-muted);
|
||||
font-size: 0.8rem;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
transition: all 0.15s;
|
||||
font-family: inherit;
|
||||
}
|
||||
.btn-trigger:hover:not(:disabled) { border-color: var(--color-primary); color: var(--color-primary); }
|
||||
.btn-trigger:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
|
||||
/* ── Center column: prep card + chat ──────────────────────────────────────── */
|
||||
.journal-center {
|
||||
grid-column: 1;
|
||||
grid-row: 2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.journal-chat-panel { flex: 1; min-height: 0; }
|
||||
|
||||
/* ── Right column ─────────────────────────────────────────────────────────── */
|
||||
.journal-right {
|
||||
grid-column: 2;
|
||||
grid-row: 2;
|
||||
border-left: 1px solid var(--color-border);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.weather-section { flex-shrink: 0; padding: 1rem 1rem 0.5rem; }
|
||||
.weather-section :deep(.weather-card) { margin-bottom: 0; }
|
||||
.weather-section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.weather-refresh-btn {
|
||||
background: none;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 6px;
|
||||
color: var(--color-text-muted);
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
padding: 0.2rem 0.45rem;
|
||||
line-height: 1;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
.weather-refresh-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
|
||||
.weather-refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
.weather-refresh-btn.spinning { animation: spin 0.8s linear infinite; }
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
.weather-tabs { display: flex; gap: 0.25rem; }
|
||||
.weather-tab {
|
||||
padding: 0.3rem 0.7rem;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 6px;
|
||||
background: none;
|
||||
color: var(--color-text-muted);
|
||||
font-size: 0.78rem;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
.weather-tab:hover { border-color: var(--color-primary); color: var(--color-primary); }
|
||||
.weather-tab.active {
|
||||
background: color-mix(in srgb, var(--color-primary) 12%, transparent);
|
||||
border-color: var(--color-primary);
|
||||
color: var(--color-primary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.events-section { padding: 0.75rem 1rem; border-top: 1px solid var(--color-border); }
|
||||
.events-cal-link { font-size: 0.75rem; color: var(--color-text-muted); text-decoration: none; }
|
||||
.events-cal-link:hover { color: var(--color-primary); }
|
||||
.events-list { display: flex; flex-direction: column; gap: 0.6rem; }
|
||||
.events-day-group { display: flex; flex-direction: column; gap: 0.2rem; }
|
||||
.events-day-label {
|
||||
font-size: 0.72rem;
|
||||
font-weight: 500;
|
||||
color: var(--color-text-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
.event-row { display: flex; align-items: flex-start; gap: 0.4rem; padding: 0.25rem 0.4rem; border-radius: 6px; }
|
||||
.event-row:hover { background: color-mix(in srgb, var(--color-primary) 6%, transparent); }
|
||||
.event-dot {
|
||||
width: 7px; height: 7px; border-radius: 50%;
|
||||
background: var(--color-primary);
|
||||
flex-shrink: 0; margin-top: 5px;
|
||||
}
|
||||
.event-body { display: flex; flex-direction: column; gap: 0.05rem; min-width: 0; }
|
||||
.event-title { font-size: 0.82rem; font-weight: 500; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.event-time { font-size: 0.72rem; color: var(--color-text-muted); }
|
||||
.event-loc { font-size: 0.7rem; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
|
||||
.panel-label {
|
||||
font-size: 0.72rem;
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
color: var(--color-primary);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.panel-label-row { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
|
||||
|
||||
/* Needs Review panel — curator-proposed mutations awaiting approval.
|
||||
Sits above Captures; visible only when there are pending items. */
|
||||
.review-section {
|
||||
padding: 0.75rem 1rem;
|
||||
border-top: 1px solid var(--color-border);
|
||||
background: color-mix(in srgb, var(--color-warning, #b88a2c) 6%, transparent);
|
||||
}
|
||||
.review-panel-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
color: var(--color-warning, #b88a2c);
|
||||
}
|
||||
.review-count {
|
||||
background: color-mix(in srgb, var(--color-warning, #b88a2c) 20%, transparent);
|
||||
color: var(--color-warning, #b88a2c);
|
||||
border-radius: 999px;
|
||||
padding: 0.05rem 0.5rem;
|
||||
font-size: 0.7rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
.review-list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
|
||||
.review-row {
|
||||
padding: 0.6rem;
|
||||
border-radius: 8px;
|
||||
background: var(--color-bg, #111);
|
||||
border: 1px solid color-mix(in srgb, var(--color-warning, #b88a2c) 25%, transparent);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
.review-header { display: flex; align-items: baseline; gap: 0.5rem; }
|
||||
.review-action-type {
|
||||
font-family: var(--font-mono, monospace);
|
||||
font-size: 0.7rem;
|
||||
padding: 0.1rem 0.4rem;
|
||||
border-radius: 4px;
|
||||
background: color-mix(in srgb, var(--color-text-muted) 12%, transparent);
|
||||
color: var(--color-text-muted);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.review-title { font-size: 0.88rem; font-weight: 500; color: var(--color-text); }
|
||||
.review-delete-warn {
|
||||
font-size: 0.78rem;
|
||||
color: var(--color-danger, #d04848);
|
||||
font-style: italic;
|
||||
padding: 0.3rem 0.5rem;
|
||||
background: color-mix(in srgb, var(--color-danger, #d04848) 8%, transparent);
|
||||
border-radius: 4px;
|
||||
}
|
||||
.review-diff { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
|
||||
.review-diff-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(70px, max-content) 1fr auto 1fr;
|
||||
gap: 0.4rem;
|
||||
align-items: baseline;
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
.review-diff-field {
|
||||
font-family: var(--font-mono, monospace);
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
.review-diff-before {
|
||||
color: var(--color-text-muted);
|
||||
text-decoration: line-through;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.review-diff-arrow { color: var(--color-text-muted); }
|
||||
.review-diff-after {
|
||||
color: var(--color-text);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.review-diff-empty { font-size: 0.76rem; color: var(--color-text-muted); font-style: italic; }
|
||||
.review-actions { display: flex; gap: 0.5rem; }
|
||||
.review-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
font-size: 0.75rem;
|
||||
padding: 0.3rem 0.65rem;
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--color-border);
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s, color 0.15s, border-color 0.15s;
|
||||
}
|
||||
.review-btn:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
.review-btn--approve { color: var(--color-success, #22c55e); border-color: color-mix(in srgb, var(--color-success, #22c55e) 50%, transparent); }
|
||||
.review-btn--approve:hover:not(:disabled) { background: color-mix(in srgb, var(--color-success, #22c55e) 12%, transparent); }
|
||||
.review-btn--reject { color: var(--color-text-muted); }
|
||||
.review-btn--reject:hover:not(:disabled) { background: color-mix(in srgb, var(--color-text-muted) 12%, transparent); color: var(--color-text); }
|
||||
|
||||
/* Captures panel — moments extracted by the curator (services/curator.py).
|
||||
Sits above the events panel; the chat is in the center column. */
|
||||
.captures-section { padding: 0.75rem 1rem; border-top: 1px solid var(--color-border); }
|
||||
.captures-trigger-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
font-size: 0.72rem;
|
||||
padding: 0.3rem 0.6rem;
|
||||
border-radius: 999px;
|
||||
border: 1px solid var(--color-border);
|
||||
background: transparent;
|
||||
color: var(--color-text-muted);
|
||||
cursor: pointer;
|
||||
transition: background 0.15s, color 0.15s, border-color 0.15s;
|
||||
}
|
||||
.captures-trigger-btn:hover:not(:disabled) {
|
||||
background: color-mix(in srgb, var(--color-primary) 8%, transparent);
|
||||
color: var(--color-primary);
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
.captures-trigger-btn:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
.captures-trigger-btn.spinning :first-child {
|
||||
animation: captures-spin 1.2s linear infinite;
|
||||
}
|
||||
@keyframes captures-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
|
||||
|
||||
.captures-empty {
|
||||
font-size: 0.78rem;
|
||||
color: var(--color-text-muted);
|
||||
font-style: italic;
|
||||
padding: 0.75rem 0;
|
||||
line-height: 1.45;
|
||||
}
|
||||
.captures-list {
|
||||
list-style: none;
|
||||
margin: 0.5rem 0 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.55rem;
|
||||
max-height: 380px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.capture-row {
|
||||
display: flex;
|
||||
gap: 0.6rem;
|
||||
padding: 0.4rem 0.5rem;
|
||||
border-radius: 8px;
|
||||
border-left: 2px solid color-mix(in srgb, var(--color-primary) 35%, transparent);
|
||||
background: color-mix(in srgb, var(--color-primary) 3%, transparent);
|
||||
}
|
||||
.capture-time {
|
||||
font-size: 0.7rem;
|
||||
color: var(--color-text-muted);
|
||||
flex-shrink: 0;
|
||||
padding-top: 0.1rem;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.capture-body { min-width: 0; flex: 1; }
|
||||
.capture-content {
|
||||
font-size: 0.85rem;
|
||||
line-height: 1.4;
|
||||
color: var(--color-text);
|
||||
}
|
||||
.capture-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.3rem;
|
||||
margin-top: 0.3rem;
|
||||
}
|
||||
.capture-chip {
|
||||
font-size: 0.68rem;
|
||||
padding: 0.1rem 0.45rem;
|
||||
border-radius: 999px;
|
||||
background: color-mix(in srgb, var(--color-text-muted) 12%, transparent);
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
.capture-chip--task { background: color-mix(in srgb, var(--color-primary) 14%, transparent); color: var(--color-primary); }
|
||||
.capture-chip--note { background: color-mix(in srgb, var(--color-warning, #b88a2c) 14%, transparent); color: var(--color-warning, #b88a2c); }
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.journal-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
|
||||
.journal-center { grid-column: 1; grid-row: 2; }
|
||||
.journal-right {
|
||||
grid-column: 1; grid-row: 3;
|
||||
border-left: none;
|
||||
border-top: 1px solid var(--color-border);
|
||||
max-height: 300px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -3,10 +3,7 @@ import { ref, computed, watch, onMounted, onUnmounted, nextTick } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { apiGet, apiPatch, listEvents } from "@/api/client";
|
||||
import { fmtCompact } from "@/utils/dateFormat";
|
||||
import { useChatStore } from "@/stores/chat";
|
||||
import GraphView from "@/views/GraphView.vue";
|
||||
import ChatPanel from "@/components/ChatPanel.vue";
|
||||
import ChatInputBar from "@/components/ChatInputBar.vue";
|
||||
import {
|
||||
FileText,
|
||||
CheckSquare,
|
||||
@@ -17,13 +14,10 @@ import {
|
||||
Share2,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
ChevronUp,
|
||||
ChevronDown,
|
||||
X,
|
||||
} from "lucide-vue-next";
|
||||
|
||||
const router = useRouter();
|
||||
const chatStore = useChatStore();
|
||||
|
||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -254,56 +248,6 @@ function toggleGraphExpand() {
|
||||
localStorage.setItem(_GRAPH_EXP_KEY, String(graphExpanded.value))
|
||||
}
|
||||
|
||||
// ─── Mini-chat widget ─────────────────────────────────────────────────────────
|
||||
|
||||
const chatOpen = ref(false);
|
||||
const chatCollapsed = ref(false);
|
||||
const chatConvId = ref<number | null>(null);
|
||||
async function onMinichatSubmit(payload: { content: string; contextNoteId?: number }) {
|
||||
if (!chatConvId.value) {
|
||||
const conv = await chatStore.createConversation();
|
||||
chatConvId.value = conv.id;
|
||||
await chatStore.fetchConversation(conv.id);
|
||||
} else if (chatStore.currentConversation?.id !== chatConvId.value) {
|
||||
await chatStore.fetchConversation(chatConvId.value);
|
||||
}
|
||||
chatOpen.value = true;
|
||||
chatCollapsed.value = false;
|
||||
await chatStore.sendMessage(payload.content, payload.contextNoteId, undefined, false);
|
||||
}
|
||||
|
||||
// ─── Auto-refresh cards when chat creates/edits notes or tasks ───────────────
|
||||
|
||||
const processedToolCalls = ref(0);
|
||||
|
||||
watch(
|
||||
() => chatStore.streamingToolCalls,
|
||||
(calls) => {
|
||||
for (let i = processedToolCalls.value; i < calls.length; i++) {
|
||||
const tc = calls[i];
|
||||
if (
|
||||
['create_note', 'update_note', 'create_task', 'update_task'].includes(tc.function) &&
|
||||
tc.status === 'success'
|
||||
) {
|
||||
reset();
|
||||
fetchTags();
|
||||
break;
|
||||
}
|
||||
}
|
||||
processedToolCalls.value = calls.length;
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
watch(() => chatStore.streaming, (streaming) => {
|
||||
if (!streaming) processedToolCalls.value = 0;
|
||||
});
|
||||
|
||||
function closeChat() {
|
||||
chatOpen.value = false;
|
||||
chatConvId.value = null;
|
||||
}
|
||||
|
||||
// ─── List item toggle ─────────────────────────────────────────────────────────
|
||||
|
||||
async function toggleListItem(item: KnowledgeItem, index: number) {
|
||||
@@ -424,7 +368,6 @@ onUnmounted(() => {
|
||||
<router-link v-if="overdueCount > 0" to="/tasks" class="overdue-badge">
|
||||
{{ overdueCount }} overdue
|
||||
</router-link>
|
||||
<router-link to="/chat" class="today-link">Chat</router-link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -656,41 +599,6 @@ onUnmounted(() => {
|
||||
|
||||
</div><!-- end knowledge-layout -->
|
||||
|
||||
<!-- Floating mini-chat -->
|
||||
<div class="minichat" :class="{ 'minichat--open': chatOpen }">
|
||||
<!-- Header with controls — only when chat is open -->
|
||||
<div v-if="chatOpen" class="minichat-header">
|
||||
<span class="minichat-title">Chat</span>
|
||||
<div class="minichat-header-actions">
|
||||
<button
|
||||
class="btn-icon-sm"
|
||||
@click="chatCollapsed = !chatCollapsed"
|
||||
:title="chatCollapsed ? 'Expand' : 'Collapse'"
|
||||
>
|
||||
<ChevronUp v-if="chatCollapsed" :size="16" />
|
||||
<ChevronDown v-else :size="16" />
|
||||
</button>
|
||||
<button class="btn-icon-sm" @click="closeChat" title="Close chat">
|
||||
<X :size="16" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Full ChatPanel — when open, not collapsed, conversation exists -->
|
||||
<div v-if="chatOpen && !chatCollapsed && chatConvId" class="minichat-chat-panel">
|
||||
<ChatPanel variant="full" placeholder="Ask anything…" />
|
||||
</div>
|
||||
|
||||
<!-- Standalone input bar — when closed or collapsed -->
|
||||
<div v-if="!chatOpen || chatCollapsed" class="minichat-input-row">
|
||||
<ChatInputBar
|
||||
placeholder="Ask anything…"
|
||||
@submit="onMinichatSubmit"
|
||||
@abort="chatStore.cancelGeneration()"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1294,71 +1202,4 @@ onUnmounted(() => {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* ── Mini-chat ───────────────────────────────────────────── */
|
||||
.minichat {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: var(--sidebar-width); /* align with content area past filter panel */
|
||||
right: 0;
|
||||
max-width: var(--page-max-width);
|
||||
margin-inline: auto;
|
||||
z-index: 20;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--color-bg-secondary);
|
||||
border-radius: 16px 16px 0 0;
|
||||
box-shadow: 0 -8px 32px rgba(0,0,0,0.35), 0 -1px 0 rgba(255,255,255,0.05);
|
||||
transition: height 0.2s ease;
|
||||
}
|
||||
.minichat--open {
|
||||
height: 500px;
|
||||
}
|
||||
.knowledge-root.graph-open .minichat {
|
||||
right: 500px;
|
||||
transition: right 0.2s ease;
|
||||
}
|
||||
.knowledge-root.graph-open.graph-expanded .minichat {
|
||||
right: min(960px, 60vw);
|
||||
}
|
||||
|
||||
/* Header row (collapse / close buttons) */
|
||||
.minichat-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 8px 14px;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.06);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.minichat-title {
|
||||
font-size: 0.82rem;
|
||||
font-weight: 500;
|
||||
color: var(--color-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
.minichat-header-actions {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* ChatPanel body — fills remaining space */
|
||||
.minichat-chat-panel {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.minichat-chat-panel :deep(.chat-body) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* Standalone input row (closed / collapsed state) */
|
||||
.minichat-input-row {
|
||||
padding: 10px 14px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -82,7 +82,7 @@ const appVersion = ref('dev');
|
||||
const restoreFileInput = ref<HTMLInputElement | null>(null);
|
||||
|
||||
// Migrate stored "admin" → "config"; unknown tabs fall back to "general"
|
||||
const VALID_TABS = new Set(["general", "account", "profile", "notifications", "integrations", "data", "voice", "apikeys", "config", "users", "logs", "groups"]);
|
||||
const VALID_TABS = new Set(["general", "account", "profile", "notifications", "integrations", "data", "apikeys", "config", "users", "logs", "groups"]);
|
||||
const _stored = localStorage.getItem("settings_tab") ?? "general";
|
||||
const activeTab = ref(VALID_TABS.has(_stored) ? (_stored === "admin" ? "config" : _stored) : "general");
|
||||
|
||||
@@ -92,7 +92,6 @@ function _loadTabContent(tab: string) {
|
||||
else if (tab === "logs") loadLogsPanel();
|
||||
else if (tab === "groups") loadGroupsPanel();
|
||||
}
|
||||
if (tab === "voice") loadVoiceTab();
|
||||
if (tab === "apikeys") { fetchApiKeys(); }
|
||||
}
|
||||
|
||||
@@ -1482,7 +1481,7 @@ function formatUserDate(iso: string): string {
|
||||
<div class="sidebar-group">
|
||||
<div class="sidebar-group-label">User</div>
|
||||
<button
|
||||
v-for="tab in ['general', 'account', 'profile', 'notifications', 'integrations', 'data', 'voice', 'apikeys']"
|
||||
v-for="tab in ['general', 'account', 'profile', 'notifications', 'integrations', 'data', 'apikeys']"
|
||||
:key="tab"
|
||||
:class="['sidebar-item', { active: activeTab === tab }]"
|
||||
@click="activeTab = tab"
|
||||
@@ -1506,59 +1505,6 @@ function formatUserDate(iso: string): string {
|
||||
|
||||
<!-- ── General ── -->
|
||||
<div v-show="activeTab === 'general'" class="settings-grid">
|
||||
<section class="settings-section full-width">
|
||||
<h2>Assistant</h2>
|
||||
<div class="assistant-grid">
|
||||
<div class="field">
|
||||
<label for="assistant-name">Assistant Name</label>
|
||||
<input
|
||||
id="assistant-name"
|
||||
v-model="assistantName"
|
||||
type="text"
|
||||
placeholder="Fable"
|
||||
class="input"
|
||||
/>
|
||||
<p class="field-hint">The name used in chat messages and LLM context.</p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="default-model">Chat & Voice Model</label>
|
||||
<select id="default-model" v-model="defaultModel" class="input">
|
||||
<option value="">Default ({{ defaultChatModel || "qwen3:latest" }})</option>
|
||||
<option v-for="m in installedModels" :key="m" :value="m">{{ m }}</option>
|
||||
</select>
|
||||
<p class="field-hint">
|
||||
Powers the journal conversation (typed or voice-driven) AND small conversational automations: note-title generation, tag suggestions.
|
||||
Pick a small fast model (e.g. <code>qwen3:8b</code>, <code>llama3.2:3b</code>) — speed and responsiveness matter more than depth.
|
||||
Ideally runs on GPU.
|
||||
<br><br>
|
||||
<strong>Tip for snappy chat:</strong> set <code>OLLAMA_NUM_PARALLEL=2</code> (or higher) on your Ollama server so background automations (tags, titles) get their own KV-cache slot and don't evict the chat model's working state. With <code>NUM_PARALLEL=1</code>, every background call pauses the chat and re-warms the prompt on the next user turn.
|
||||
</p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="background-model">Curator Model</label>
|
||||
<select id="background-model" v-model="backgroundModel" class="input">
|
||||
<option value="">Default (qwen3:latest)</option>
|
||||
<option v-for="m in installedModels" :key="m" :value="m">{{ m }}</option>
|
||||
</select>
|
||||
<p class="field-hint">
|
||||
Powers the journal curator (capture moments, propose updates) and other heavy async work: daily prep generation, end-of-day closeout, task body consolidation, project summaries, profile observation processing.
|
||||
Pick a smart model — latency doesn't matter, quality does. Often runs on CPU with system RAM (e.g. <code>qwen3:32b</code>, <code>qwen3:30b-a3b</code>, <code>llama3.1:70b</code>).
|
||||
<br><br>
|
||||
<strong>Serialized:</strong> the app enforces one curator pass at a time globally, regardless of <code>OLLAMA_NUM_PARALLEL</code>. Manual triggers fired while the curator is busy return a "try again" response rather than spawning a second instance. This matters most for large CPU models where a second KV-cache slot would waste system RAM.
|
||||
<span v-if="backgroundModel && backgroundModel === (defaultModel || defaultChatModel)" class="field-hint-warn">
|
||||
⚠ Using the same model for both means curator passes compete with chat for the same KV cache. Pick different models so both can stay loaded simultaneously (<code>OLLAMA_MAX_LOADED_MODELS = 2</code>+).
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button class="btn-save" @click="saveAssistant" :disabled="saving">
|
||||
{{ saving ? "Saving..." : "Save" }}
|
||||
</button>
|
||||
<span v-if="saved" class="saved-msg">Saved!</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Tasks -->
|
||||
<section class="settings-section full-width">
|
||||
<h2>Tasks</h2>
|
||||
@@ -1608,68 +1554,6 @@ function formatUserDate(iso: string): string {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Model Management -->
|
||||
<section class="settings-section full-width">
|
||||
<div class="model-mgmt-header">
|
||||
<div>
|
||||
<h2>Model Management</h2>
|
||||
<p class="section-desc">Install and remove Ollama models without leaving the app. Search <a href="https://ollama.com/library" target="_blank" rel="noopener">ollama.com/library</a> for available models.</p>
|
||||
</div>
|
||||
<button class="btn-secondary" @click="loadOllamaModels" title="Refresh list">↺ Refresh</button>
|
||||
</div>
|
||||
|
||||
<!-- Installed models -->
|
||||
<div v-if="ollamaModels.length" class="model-list">
|
||||
<div v-for="m in ollamaModels" :key="m.name" class="model-row">
|
||||
<div class="model-row-info">
|
||||
<span class="model-name">{{ m.name }}</span>
|
||||
<span v-if="m.loaded" class="model-badge model-badge--loaded">in VRAM</span>
|
||||
<span v-if="m.name === (defaultModel || defaultChatModel)" class="model-badge model-badge--default">default</span>
|
||||
</div>
|
||||
<div class="model-row-right">
|
||||
<span class="model-size">{{ formatBytes(m.size) }}</span>
|
||||
<button
|
||||
class="model-delete-btn"
|
||||
:disabled="deletingModel === m.name"
|
||||
@click="deleteModel(m.name)"
|
||||
:title="`Remove ${m.name}`"
|
||||
>{{ deletingModel === m.name ? '…' : '✕' }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p v-else class="field-hint">No models installed, or Ollama is unreachable.</p>
|
||||
|
||||
<!-- Pull a model -->
|
||||
<div class="model-pull-form">
|
||||
<input
|
||||
v-model="pullModelName"
|
||||
class="input"
|
||||
placeholder="e.g. qwen3:7b"
|
||||
:disabled="pulling"
|
||||
@keydown.enter="pullModel"
|
||||
/>
|
||||
<button class="btn-secondary" @click="pullModel" :disabled="pulling || !pullModelName.trim()">
|
||||
{{ pulling ? 'Pulling…' : 'Pull' }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="model-suggestions">
|
||||
<span class="suggestions-label">Suggestions:</span>
|
||||
<button v-for="s in ['qwen3:7b','qwen3:14b','qwen3:4b','llama3.1:8b','nomic-embed-text']"
|
||||
:key="s" class="suggestion-chip"
|
||||
:disabled="pulling || ollamaModels.some(m => m.name === s)"
|
||||
@click="pullModelName = s"
|
||||
>{{ s }}</button>
|
||||
</div>
|
||||
|
||||
<!-- Pull progress -->
|
||||
<div v-if="pullProgress" class="model-pull-progress">
|
||||
<div class="pull-status">{{ pullProgress.status }}</div>
|
||||
<div class="pull-bar-track" v-if="pullProgress.pct !== null">
|
||||
<div class="pull-bar-fill" :style="{ width: pullProgress.pct + '%' }"></div>
|
||||
</div>
|
||||
<div v-else class="pull-bar-indeterminate"></div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- ── Account ── -->
|
||||
@@ -1946,109 +1830,6 @@ function formatUserDate(iso: string): string {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="settings-section full-width">
|
||||
<h2>Journal</h2>
|
||||
<p class="section-desc">Controls when the daily journal prep generates and how the day is framed.</p>
|
||||
<div class="field">
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" v-model="journalConfig.prep_enabled" />
|
||||
Generate daily prep automatically
|
||||
</label>
|
||||
<p class="field-hint">When enabled, the journal generates a morning briefing at the time below. When off, the journal still works — just without the auto-generated daily prep.</p>
|
||||
</div>
|
||||
<div class="assistant-grid">
|
||||
<div class="field">
|
||||
<label>Prep generates at</label>
|
||||
<div class="time-row">
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
max="23"
|
||||
v-model.number="journalConfig.prep_hour"
|
||||
class="input time-input"
|
||||
:disabled="!journalConfig.prep_enabled"
|
||||
/>
|
||||
<span class="time-sep">:</span>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
max="59"
|
||||
step="5"
|
||||
v-model.number="journalConfig.prep_minute"
|
||||
class="input time-input"
|
||||
:disabled="!journalConfig.prep_enabled"
|
||||
/>
|
||||
</div>
|
||||
<p class="field-hint">24-hour. Generates each morning at this local time.</p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Day rolls over at</label>
|
||||
<div class="time-row">
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
max="23"
|
||||
v-model.number="journalConfig.day_rollover_hour"
|
||||
class="input time-input"
|
||||
/>
|
||||
<span class="time-sep time-sep--quiet">:00</span>
|
||||
</div>
|
||||
<p class="field-hint">Hour when the journal switches to a new day. Default 4am — late-night entries (1–3am) still count as the previous day.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button class="btn-save" @click="saveJournalCfg" :disabled="journalConfigSaving">{{ journalConfigSaving ? 'Saving…' : 'Save' }}</button>
|
||||
<span v-if="journalConfigSaved" class="saved-msg">Saved!</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="settings-section full-width">
|
||||
<h2>What the Assistant Has Learned</h2>
|
||||
<p class="section-desc">
|
||||
The assistant observes patterns from your journal and chat conversations and builds a summary over time. The summary is included in the journal's system prompt so the daily prep can reference what it knows about you.
|
||||
<span v-if="profile.observations_count > 0"> {{ profile.observations_count }} raw observation{{ profile.observations_count !== 1 ? 's' : '' }} stored.</span>
|
||||
</p>
|
||||
|
||||
<label class="toggle-row" style="display:flex;align-items:center;gap:0.6rem;margin:0.5rem 0 0.75rem">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="journalConfig.closeout_enabled !== false"
|
||||
@change="onToggleCloseout(($event.target as HTMLInputElement).checked)"
|
||||
/>
|
||||
<span>
|
||||
<strong>Nightly closeout</strong>
|
||||
<small style="display:block;color:var(--color-text-muted)">Extracts patterns from yesterday's journal at your day-rollover hour.</small>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<div v-if="profile.learned_summary" class="learned-summary">{{ profile.learned_summary }}</div>
|
||||
<div v-else class="learned-empty">No learned summary yet. Observations accumulate from journal and chat conversations.</div>
|
||||
|
||||
<div class="observations-panel" style="margin-top:0.75rem">
|
||||
<button class="btn-secondary" @click="toggleObservations" :disabled="profile.observations_count === 0">
|
||||
{{ observationsExpanded ? '▾' : '▸' }} Recent observations ({{ profile.observations_count }})
|
||||
</button>
|
||||
<div v-if="observationsExpanded" class="observations-list" style="margin-top:0.5rem;padding:0.5rem 0.75rem;border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-bg-elev-1)">
|
||||
<div v-if="observationsLoading">Loading…</div>
|
||||
<div v-else-if="observations.length === 0">No observations yet.</div>
|
||||
<div v-else>
|
||||
<div v-for="entry in observations" :key="entry.date" style="margin-bottom:0.75rem">
|
||||
<div style="font-weight:600;font-size:0.875rem;color:var(--color-text-muted)">{{ entry.date }}</div>
|
||||
<div style="white-space:pre-wrap;font-size:0.9rem">{{ entry.bullets }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions" style="gap:0.5rem;flex-wrap:wrap">
|
||||
<button class="btn-secondary" @click="runConsolidate" :disabled="consolidating || profile.observations_count === 0">
|
||||
{{ consolidating ? 'Consolidating…' : 'Consolidate Now' }}
|
||||
</button>
|
||||
<button class="btn-danger-outline" @click="clearObservations" :disabled="clearingObs">
|
||||
{{ clearingObs ? 'Clearing…' : 'Reset Learned Data' }}
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div v-show="activeTab === 'notifications'" class="settings-grid">
|
||||
@@ -2080,103 +1861,6 @@ function formatUserDate(iso: string): string {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="settings-section">
|
||||
<h2>Push Notifications</h2>
|
||||
<p class="section-desc">
|
||||
Receive browser push notifications when a response is ready. Requires HTTPS.
|
||||
</p>
|
||||
<template v-if="!pushStore.isSupported">
|
||||
<p class="push-unsupported">Push notifications are not supported in this browser or connection (requires HTTPS).</p>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="push-status-row">
|
||||
<span class="push-status-label">Permission:</span>
|
||||
<span
|
||||
:class="['push-permission-badge', {
|
||||
'perm-granted': pushStore.permission === 'granted',
|
||||
'perm-denied': pushStore.permission === 'denied',
|
||||
'perm-default': pushStore.permission === 'default',
|
||||
}]"
|
||||
>
|
||||
{{ pushStore.permission === 'granted' ? 'Granted' : pushStore.permission === 'denied' ? 'Denied' : 'Not asked' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="push-status-row">
|
||||
<span class="push-status-label">Status:</span>
|
||||
<span :class="['push-sub-badge', { 'sub-active': pushStore.isSubscribed }]">
|
||||
{{ pushStore.isSubscribed ? 'Subscribed' : 'Not subscribed' }}
|
||||
</span>
|
||||
</div>
|
||||
<p v-if="pushStore.error" class="push-error">{{ pushStore.error }}</p>
|
||||
<div class="actions" style="margin-top: 0.75rem;">
|
||||
<button
|
||||
v-if="!pushStore.isSubscribed"
|
||||
class="btn-save"
|
||||
@click="pushStore.subscribe()"
|
||||
:disabled="pushStore.loading || pushStore.permission === 'denied'"
|
||||
>
|
||||
{{ pushStore.loading ? 'Enabling...' : 'Enable Notifications' }}
|
||||
</button>
|
||||
<button
|
||||
v-else
|
||||
class="btn-secondary"
|
||||
@click="pushStore.unsubscribe()"
|
||||
:disabled="pushStore.loading"
|
||||
>
|
||||
{{ pushStore.loading ? 'Disabling...' : 'Disable Notifications' }}
|
||||
</button>
|
||||
</div>
|
||||
<p v-if="pushStore.permission === 'denied'" class="field-hint" style="margin-top: 0.5rem;">
|
||||
Notifications are blocked. Allow them in your browser site settings to re-enable.
|
||||
</p>
|
||||
</template>
|
||||
<template v-if="authStore.isAdmin">
|
||||
<div class="field-divider" style="margin: 1rem 0;" />
|
||||
<p class="section-desc">
|
||||
If push notifications fail due to a corrupted or misformatted VAPID key, regenerate
|
||||
the key pair here. All existing subscriptions will be cleared — you will need to
|
||||
re-enable notifications in this browser afterwards.
|
||||
</p>
|
||||
<div class="actions" style="margin-top: 0.5rem;">
|
||||
<button class="btn-danger" :disabled="vapidResetting" @click="resetVapidKeys">
|
||||
{{ vapidResetting ? 'Regenerating…' : 'Regenerate VAPID Keys' }}
|
||||
</button>
|
||||
</div>
|
||||
<p v-if="vapidResetMsg" :class="vapidResetError ? 'field-error' : 'field-hint'" style="margin-top: 0.5rem;">
|
||||
{{ vapidResetMsg }}
|
||||
</p>
|
||||
</template>
|
||||
</section>
|
||||
|
||||
<section class="settings-section">
|
||||
<h2>Chat History</h2>
|
||||
<p class="section-desc">
|
||||
Conversations older than this many days are automatically deleted when you load the chat.
|
||||
Set to <strong>0</strong> to keep conversations forever.
|
||||
</p>
|
||||
<div class="field retention-field">
|
||||
<label class="field-label">Retention period (days)</label>
|
||||
<div class="retention-row">
|
||||
<input
|
||||
v-model.number="chatRetentionDays"
|
||||
type="number"
|
||||
min="0"
|
||||
max="3650"
|
||||
class="input retention-input"
|
||||
/>
|
||||
<button class="btn-primary" :disabled="savingRetention" @click="saveRetention">
|
||||
{{ savingRetention ? 'Saving...' : 'Save' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="settings-section full-width">
|
||||
<h2>About</h2>
|
||||
<p class="version-line">Fabled Scribe <span class="version-badge">{{ appVersion }}</span></p>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ── Integrations ── -->
|
||||
<div v-show="activeTab === 'integrations'" class="settings-grid">
|
||||
@@ -2307,198 +1991,6 @@ function formatUserDate(iso: string): string {
|
||||
|
||||
</div>
|
||||
|
||||
<div v-show="activeTab === 'voice'" class="settings-grid">
|
||||
|
||||
<section class="settings-section full-width">
|
||||
<h2>Voice</h2>
|
||||
<p class="section-desc">
|
||||
Configure text-to-speech and speech-to-text for voice conversations.
|
||||
Requires <code>VOICE_ENABLED=true</code> on the server.
|
||||
</p>
|
||||
|
||||
<!-- Status indicator -->
|
||||
<div v-if="voiceStatusLoading" class="field-hint">Loading voice status…</div>
|
||||
<div v-else-if="voiceStatus === null" class="field-hint">Voice status unavailable.</div>
|
||||
<div v-else class="voice-status-row">
|
||||
<span :class="['status-badge', voiceStatus.enabled ? 'status-on' : 'status-off']">
|
||||
{{ voiceStatus.enabled ? 'Enabled' : 'Disabled' }}
|
||||
</span>
|
||||
<span v-if="voiceStatus.enabled" class="status-badge" :class="voiceStatus.stt ? 'status-on' : 'status-off'">
|
||||
STT {{ voiceStatus.stt ? 'ready' : 'loading…' }}
|
||||
</span>
|
||||
<span v-if="voiceStatus.enabled" class="status-badge" :class="voiceStatus.tts ? 'status-on' : 'status-off'">
|
||||
TTS {{ voiceStatus.tts ? 'ready' : 'loading…' }}
|
||||
</span>
|
||||
<span v-if="voiceStatus.stt_model" class="field-hint" style="margin-left:0.5rem;">
|
||||
Model: {{ voiceStatus.stt_model }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div v-if="!voiceStatus?.enabled" class="field-hint" style="margin-top:0.75rem;">
|
||||
Voice is disabled. An administrator can enable it under
|
||||
<strong>Admin → Config → Voice</strong>.
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="voiceStatus?.enabled" class="settings-section full-width">
|
||||
<h2>Speech Style</h2>
|
||||
<p class="section-desc">Controls how the assistant phrases spoken responses.</p>
|
||||
|
||||
<div class="field-group">
|
||||
<label class="field-label">Style</label>
|
||||
<div class="radio-group">
|
||||
<label v-for="opt in [
|
||||
{ value: 'conversational', label: 'Conversational', hint: 'Warm and natural, like speaking to a friend' },
|
||||
{ value: 'concise', label: 'Concise', hint: 'Short and to the point' },
|
||||
{ value: 'detailed', label: 'Detailed', hint: 'Thorough explanations spoken aloud' },
|
||||
]" :key="opt.value" class="radio-option">
|
||||
<input type="radio" v-model="voiceSpeechStyle" :value="opt.value" />
|
||||
<span>
|
||||
<strong>{{ opt.label }}</strong>
|
||||
<span class="field-hint">{{ opt.hint }}</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="voiceStatus?.enabled" class="settings-section full-width">
|
||||
<h2>Voice & Speed</h2>
|
||||
<p class="section-desc">Choose the TTS voice and playback speed.</p>
|
||||
|
||||
<div class="field-group">
|
||||
<label class="field-label" for="voice-select">Voice</label>
|
||||
<select id="voice-select" class="input" v-model="voiceTtsVoice" :disabled="availableVoices.length === 0">
|
||||
<option v-if="availableVoices.length === 0" value="af_heart">af_heart (default)</option>
|
||||
<option v-for="v in availableVoices" :key="v.id" :value="v.id">{{ v.label }}</option>
|
||||
</select>
|
||||
<p class="field-hint">Voice character and accent. Applies to all voice conversations.</p>
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<label class="field-label" for="voice-speed">
|
||||
Speed: {{ voiceTtsSpeed.toFixed(1) }}×
|
||||
</label>
|
||||
<input
|
||||
id="voice-speed"
|
||||
type="range"
|
||||
min="0.7"
|
||||
max="1.3"
|
||||
step="0.05"
|
||||
v-model.number="voiceTtsSpeed"
|
||||
class="range-input"
|
||||
/>
|
||||
<div class="range-labels">
|
||||
<span>0.7× (slow)</span>
|
||||
<span>1.0× (normal)</span>
|
||||
<span>1.3× (fast)</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button class="btn-secondary" @click="previewVoice" :disabled="voicePreviewing || !voiceStatus?.tts">
|
||||
{{ voicePreviewing ? 'Generating…' : '▶ Preview' }}
|
||||
</button>
|
||||
<button class="btn-save" @click="saveVoiceSettings" :disabled="savingVoice">
|
||||
{{ voiceSaved ? 'Saved ✓' : savingVoice ? 'Saving…' : 'Save Voice Settings' }}
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Voice Blend section removed with the kokoro → piper migration
|
||||
(2026-05-22). Piper has no voice-blending equivalent. -->
|
||||
|
||||
<!-- Voice Library (admin only) — browse + install piper voices.
|
||||
Voices land in /data/voices and are immediately available to
|
||||
every user's voice picker. Bundled voices in /opt/piper-voices
|
||||
are read-only and show a "bundled" badge instead of a delete. -->
|
||||
<section v-if="authStore.isAdmin && voiceStatus?.enabled" class="settings-section full-width">
|
||||
<div class="voice-library-header">
|
||||
<h2>Voice Library</h2>
|
||||
<button
|
||||
class="btn-secondary"
|
||||
type="button"
|
||||
@click="voiceLibraryExpanded = !voiceLibraryExpanded; if (voiceLibraryExpanded && voiceLibrary.length === 0) loadVoiceLibrary()"
|
||||
>
|
||||
{{ voiceLibraryExpanded ? 'Hide' : 'Browse voices' }}
|
||||
</button>
|
||||
</div>
|
||||
<p class="section-desc">
|
||||
Download additional piper voices from the
|
||||
<a href="https://huggingface.co/rhasspy/piper-voices" target="_blank" rel="noopener">piper-voices catalog</a>.
|
||||
Installed voices appear in every user's voice picker after a page reload.
|
||||
</p>
|
||||
|
||||
<template v-if="voiceLibraryExpanded">
|
||||
<div class="voice-library-toolbar">
|
||||
<input
|
||||
v-model="voiceLibraryFilter"
|
||||
type="search"
|
||||
class="input"
|
||||
placeholder="Filter by language, country, or name (e.g. 'en', 'fr_FR', 'amy')…"
|
||||
/>
|
||||
<button
|
||||
class="btn-secondary"
|
||||
type="button"
|
||||
:disabled="voiceLibraryLoading"
|
||||
@click="loadVoiceLibrary(true)"
|
||||
title="Re-fetch catalog from HuggingFace"
|
||||
>
|
||||
{{ voiceLibraryLoading ? 'Loading…' : 'Refresh' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p v-if="voiceLibraryError" class="field-hint-warn">
|
||||
{{ voiceLibraryError }}
|
||||
</p>
|
||||
|
||||
<div v-if="voiceLibraryLoading && voiceLibrary.length === 0" class="voice-library-empty">
|
||||
Loading catalog…
|
||||
</div>
|
||||
|
||||
<ul v-else-if="filteredVoiceLibrary.length > 0" class="voice-library-list">
|
||||
<li v-for="v in filteredVoiceLibrary" :key="v.id" class="voice-library-row">
|
||||
<div class="voice-library-meta">
|
||||
<div class="voice-library-id">{{ v.id }}</div>
|
||||
<div class="voice-library-sub">
|
||||
{{ v.language_name || v.language_code }}
|
||||
<span v-if="v.country"> · {{ v.country }}</span>
|
||||
· {{ v.quality }}
|
||||
<span v-if="v.num_speakers > 1"> · {{ v.num_speakers }} speakers</span>
|
||||
· {{ formatVoiceSize(v.size_bytes) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="voice-library-actions">
|
||||
<span v-if="v.installed && v.installed_source === 'bundled'" class="voice-badge voice-badge--bundled">
|
||||
bundled
|
||||
</span>
|
||||
<button
|
||||
v-else-if="v.installed && v.installed_source === 'user'"
|
||||
class="btn-danger btn-sm"
|
||||
:disabled="uninstallingVoiceIds.has(v.id)"
|
||||
@click="uninstallLibraryVoice(v.id)"
|
||||
>
|
||||
{{ uninstallingVoiceIds.has(v.id) ? 'Removing…' : 'Remove' }}
|
||||
</button>
|
||||
<button
|
||||
v-else
|
||||
class="btn-secondary btn-sm"
|
||||
:disabled="installingVoiceIds.has(v.id)"
|
||||
@click="installLibraryVoice(v.id)"
|
||||
>
|
||||
{{ installingVoiceIds.has(v.id) ? 'Installing…' : 'Install' }}
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div v-else-if="!voiceLibraryLoading" class="voice-library-empty">
|
||||
No voices match the filter.
|
||||
</div>
|
||||
</template>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ── MCP Access ── -->
|
||||
<div v-show="activeTab === 'apikeys'" class="settings-grid">
|
||||
|
||||
@@ -1,240 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import { apiGet } from "@/api/client";
|
||||
import { useToastStore } from "@/stores/toast";
|
||||
import WorkspaceTaskPanel from "@/components/WorkspaceTaskPanel.vue";
|
||||
import WorkspaceNoteEditor from "@/components/WorkspaceNoteEditor.vue";
|
||||
import WorkspaceChatWidget from "@/components/WorkspaceChatWidget.vue";
|
||||
|
||||
const route = useRoute();
|
||||
const toast = useToastStore();
|
||||
|
||||
const projectId = computed(() => Number(route.params.projectId));
|
||||
|
||||
interface Project {
|
||||
id: number;
|
||||
title: string;
|
||||
goal?: string;
|
||||
}
|
||||
|
||||
const project = ref<Project | null>(null);
|
||||
const taskPanelRef = ref<InstanceType<typeof WorkspaceTaskPanel> | null>(null);
|
||||
const noteEditorRef = ref<InstanceType<typeof WorkspaceNoteEditor> | null>(null);
|
||||
const activeNoteId = ref<number | null>(null);
|
||||
|
||||
// Panel collapse state — persisted per project (tasks + notes only; chat is now a widget)
|
||||
function _panelKey(pid: number) { return `workspace_panels_${pid}`; }
|
||||
|
||||
function _loadPanelState(pid: number) {
|
||||
try {
|
||||
const raw = localStorage.getItem(_panelKey(pid));
|
||||
if (raw) {
|
||||
const saved = JSON.parse(raw) as Partial<{ tasks: boolean; notes: boolean }>;
|
||||
const tasks = saved.tasks ?? true;
|
||||
const notes = saved.notes ?? true;
|
||||
// Guard: at least one panel must be open
|
||||
if (!tasks && !notes) return { tasks: true, notes: true };
|
||||
return { tasks, notes };
|
||||
}
|
||||
} catch { /* ignore */ }
|
||||
return { tasks: true, notes: true };
|
||||
}
|
||||
|
||||
const panelOpen = ref<{ tasks: boolean; notes: boolean }>({ tasks: true, notes: true });
|
||||
|
||||
const gridColumns = computed(() => {
|
||||
return [
|
||||
panelOpen.value.tasks ? "minmax(0, 0.85fr)" : "0px",
|
||||
panelOpen.value.notes ? "minmax(0, 2.15fr)" : "0px",
|
||||
].join(" ");
|
||||
});
|
||||
|
||||
function togglePanel(panel: keyof typeof panelOpen.value) {
|
||||
const open = panelOpen.value;
|
||||
const openCount = [open.tasks, open.notes].filter(Boolean).length;
|
||||
if (open[panel] && openCount <= 1) return;
|
||||
panelOpen.value[panel] = !panelOpen.value[panel];
|
||||
localStorage.setItem(_panelKey(projectId.value), JSON.stringify(panelOpen.value));
|
||||
}
|
||||
|
||||
function onNoteChanged(noteId: number) {
|
||||
activeNoteId.value = noteId;
|
||||
noteEditorRef.value?.reload();
|
||||
}
|
||||
|
||||
function onTaskChanged() {
|
||||
taskPanelRef.value?.reload();
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
panelOpen.value = _loadPanelState(projectId.value);
|
||||
|
||||
try {
|
||||
project.value = await apiGet<Project>(`/api/projects/${projectId.value}`);
|
||||
} catch {
|
||||
toast.show("Failed to load project", "error");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="workspace-root">
|
||||
<!-- Header -->
|
||||
<header class="ws-header">
|
||||
<router-link :to="project ? `/projects/${project.id}` : '/projects'" class="ws-back">
|
||||
← {{ project?.title ?? "Project" }}
|
||||
</router-link>
|
||||
<span class="ws-title">{{ project?.goal ?? '' }}</span>
|
||||
<div class="ws-panel-toggles">
|
||||
<button
|
||||
:class="['panel-toggle', { active: panelOpen.tasks }]"
|
||||
title="Toggle Tasks panel"
|
||||
@click="togglePanel('tasks')"
|
||||
>
|
||||
Tasks
|
||||
</button>
|
||||
<button
|
||||
:class="['panel-toggle', { active: panelOpen.notes }]"
|
||||
title="Toggle Notes panel"
|
||||
@click="togglePanel('notes')"
|
||||
>
|
||||
Notes
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Two-panel body -->
|
||||
<div class="ws-body" :style="{ gridTemplateColumns: gridColumns }">
|
||||
<!-- Left: Tasks -->
|
||||
<div v-show="panelOpen.tasks" class="ws-panel">
|
||||
<Transition name="panel-fade">
|
||||
<div v-if="panelOpen.tasks" class="panel-inner">
|
||||
<WorkspaceTaskPanel
|
||||
v-if="project"
|
||||
ref="taskPanelRef"
|
||||
:project-id="project.id"
|
||||
/>
|
||||
</div>
|
||||
</Transition>
|
||||
</div>
|
||||
|
||||
<!-- Right: Note Editor -->
|
||||
<div v-show="panelOpen.notes" class="ws-panel ws-panel-notes">
|
||||
<Transition name="panel-fade">
|
||||
<div v-if="panelOpen.notes" class="panel-inner">
|
||||
<WorkspaceNoteEditor
|
||||
v-if="project"
|
||||
ref="noteEditorRef"
|
||||
:project-id="project.id"
|
||||
:active-note-id="activeNoteId"
|
||||
/>
|
||||
</div>
|
||||
</Transition>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Floating chat widget -->
|
||||
<WorkspaceChatWidget
|
||||
v-if="project"
|
||||
:project-id="projectId"
|
||||
@note-changed="onNoteChanged"
|
||||
@task-changed="onTaskChanged"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.workspace-root {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
background: var(--color-bg);
|
||||
}
|
||||
|
||||
.ws-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
height: 44px;
|
||||
padding: 0 1rem;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
background: var(--color-surface);
|
||||
flex-shrink: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.ws-back {
|
||||
color: var(--color-primary);
|
||||
text-decoration: none;
|
||||
font-size: 0.875rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ws-back:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.ws-title {
|
||||
font-size: 0.78rem;
|
||||
color: var(--color-text-muted);
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ws-panel-toggles {
|
||||
display: flex;
|
||||
gap: 0.3rem;
|
||||
}
|
||||
|
||||
.panel-toggle {
|
||||
background: none;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 5px;
|
||||
padding: 0.2rem 0.6rem;
|
||||
font-size: 0.78rem;
|
||||
cursor: pointer;
|
||||
color: var(--color-text-muted);
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
.panel-toggle.active {
|
||||
background: color-mix(in srgb, var(--color-primary) 12%, transparent);
|
||||
border-color: var(--color-primary);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.ws-body {
|
||||
display: grid;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
transition: grid-template-columns 0.2s ease;
|
||||
}
|
||||
|
||||
.ws-panel {
|
||||
overflow: hidden;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.ws-panel-notes {
|
||||
border-left: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.panel-inner {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.panel-fade-enter-active,
|
||||
.panel-fade-leave-active {
|
||||
transition: opacity 0.18s ease;
|
||||
}
|
||||
.panel-fade-enter-from,
|
||||
.panel-fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user