Overhaul dashboard, notes, and tasks views for density and usability

NoteCard: add compact prop — single-row title/tags/timestamp, no body preview
TaskCard: add compact prop — single-row with status dot, priority badge,
  title, optional project breadcrumb, due date; edit button appears on hover.
  Add projectTitle prop for cross-view context.

NotesListView: auto-fill CSS grid layout (2–4 columns); compact list toggle;
  view mode persisted to localStorage.

TasksListView: compact rows throughout; group-by-project toggle with
  collapsible sections, task counts, and "Open project" links; fetches
  project list for group labels and task breadcrumbs; limit raised to 100
  in grouped mode; view mode persisted to localStorage.

HomeView dashboard: task sections use compact rows (project breadcrumb shown);
  notes column uses 2-per-row mini-grid; new "Active Projects" widget below
  main grid shows milestone progress bars for up to 6 active projects.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 18:57:57 -05:00
parent eed6aedc9e
commit 56d5268fad
5 changed files with 793 additions and 246 deletions
+267 -173
View File
@@ -12,6 +12,8 @@ import type { TaskStatus } from "@/types/task";
import { useTasksStore } from "@/stores/tasks";
import { useChatStore } from "@/stores/chat";
// ─── Task data ───────────────────────────────────────────────────────────────
const recentNotes = ref<Note[]>([]);
const overdueTasks = ref<Task[]>([]);
const dueTodayTasks = ref<Task[]>([]);
@@ -22,21 +24,70 @@ const otherTasks = ref<Task[]>([]);
const loading = ref(true);
const tasksStore = useTasksStore();
// ─── Project data ─────────────────────────────────────────────────────────────
interface MilestoneSummary {
id: number;
title: string;
status: string;
pct: number;
total: number;
completed: number;
}
interface DashProject {
id: number;
title: string;
status: string;
summary?: {
task_counts: { todo?: number; in_progress?: number; done?: number };
milestone_summary: MilestoneSummary[];
};
}
const activeProjects = ref<DashProject[]>([]);
const projectMap = ref<Map<number, string>>(new Map());
async function loadProjects() {
try {
const data = await apiGet<{ projects: DashProject[] }>("/api/projects?status=active");
const projects = data.projects.slice(0, 6);
projectMap.value = new Map(data.projects.map((p) => [p.id, p.title]));
// Fetch summaries in parallel
await Promise.allSettled(
projects.map(async (p) => {
try {
const full = await apiGet<DashProject>(`/api/projects/${p.id}`);
p.summary = full.summary;
} catch { /* non-fatal */ }
})
);
activeProjects.value = projects;
} catch { /* non-fatal */ }
}
function milestoneColor(index: number): string {
const palette = [
"var(--color-primary)",
"var(--color-success, #22c55e)",
"#c98a00",
"var(--color-danger, #e74c3c)",
"#8b5cf6",
];
return palette[index % palette.length];
}
// ─── Sorting helpers ──────────────────────────────────────────────────────────
const PRIORITY_ORDER: Record<string, number> = {
high: 3,
medium: 2,
low: 1,
none: 0,
high: 3, medium: 2, low: 1, none: 0,
};
function dateStr(offsetDays: number = 0): string {
const d = new Date();
d.setDate(d.getDate() + offsetDays);
return (
d.getFullYear() +
"-" +
String(d.getMonth() + 1).padStart(2, "0") +
"-" +
d.getFullYear() + "-" +
String(d.getMonth() + 1).padStart(2, "0") + "-" +
String(d.getDate()).padStart(2, "0")
);
}
@@ -54,19 +105,17 @@ function sortByPriorityThenDate(tasks: Task[]): Task[] {
}
function sortOtherTasks(tasks: Task[]): Task[] {
const withDate = tasks
.filter((t) => t.due_date)
.sort((a, b) => a.due_date!.localeCompare(b.due_date!));
const withoutDate = tasks
.filter((t) => !t.due_date)
.sort((a, b) => {
const pa = PRIORITY_ORDER[a.priority ?? "none"] ?? 0;
const pb = PRIORITY_ORDER[b.priority ?? "none"] ?? 0;
return pb - pa;
});
const withDate = tasks.filter((t) => t.due_date).sort((a, b) => a.due_date!.localeCompare(b.due_date!));
const withoutDate = tasks.filter((t) => !t.due_date).sort((a, b) => {
const pa = PRIORITY_ORDER[a.priority ?? "none"] ?? 0;
const pb = PRIORITY_ORDER[b.priority ?? "none"] ?? 0;
return pb - pa;
});
return [...withDate, ...withoutDate].slice(0, 10);
}
// ─── Data loading ─────────────────────────────────────────────────────────────
onMounted(async () => {
const today = dateStr(0);
const nextWeek = dateStr(7);
@@ -74,79 +123,48 @@ onMounted(async () => {
const [notesRes, overdueRes, dueSoonRes, highPriRes, inProgressRes, otherRes] =
await Promise.allSettled([
apiGet<NoteListResponse>("/api/notes?sort=updated_at&order=desc&limit=8"),
apiGet<TaskListResponse>(
`/api/tasks?due_before=${today}&sort=due_date&order=asc&limit=20`
),
apiGet<TaskListResponse>(
`/api/tasks?due_after=${today}&due_before=${nextWeek}&sort=due_date&order=asc&limit=20`
),
apiGet<TaskListResponse>(
`/api/tasks?priority=high&sort=updated_at&order=desc&limit=10`
),
apiGet<TaskListResponse>(
`/api/tasks?status=in_progress&sort=updated_at&order=desc&limit=10`
),
apiGet<TaskListResponse>(
`/api/tasks?sort=updated_at&order=desc&limit=50`
),
apiGet<TaskListResponse>(`/api/tasks?due_before=${today}&sort=due_date&order=asc&limit=20`),
apiGet<TaskListResponse>(`/api/tasks?due_after=${today}&due_before=${nextWeek}&sort=due_date&order=asc&limit=20`),
apiGet<TaskListResponse>(`/api/tasks?priority=high&sort=updated_at&order=desc&limit=10`),
apiGet<TaskListResponse>(`/api/tasks?status=in_progress&sort=updated_at&order=desc&limit=10`),
apiGet<TaskListResponse>(`/api/tasks?sort=updated_at&order=desc&limit=50`),
]);
if (notesRes.status === "fulfilled") {
recentNotes.value = notesRes.value.notes;
}
if (notesRes.status === "fulfilled") recentNotes.value = notesRes.value.notes;
// Build seen-set incrementally so each section deduplicates against all above it
const seen = new Set<number>();
if (overdueRes.status === "fulfilled") {
overdueTasks.value = sortByPriorityThenDate(
overdueRes.value.tasks.filter((t) => t.status !== "done")
);
overdueTasks.value = sortByPriorityThenDate(overdueRes.value.tasks.filter((t) => t.status !== "done"));
for (const t of overdueTasks.value) seen.add(t.id);
}
if (dueSoonRes.status === "fulfilled") {
const notDone = dueSoonRes.value.tasks.filter(
(t) => t.status !== "done" && !seen.has(t.id)
);
const todayList: Task[] = [];
const weekList: Task[] = [];
const notDone = dueSoonRes.value.tasks.filter((t) => t.status !== "done" && !seen.has(t.id));
const todayList: Task[] = [], weekList: Task[] = [];
for (const t of notDone) {
if (t.due_date === today) {
todayList.push(t);
} else {
weekList.push(t);
}
(t.due_date === today ? todayList : weekList).push(t);
}
dueTodayTasks.value = sortByPriorityThenDate(todayList);
dueThisWeekTasks.value = sortByPriorityThenDate(weekList);
for (const t of dueTodayTasks.value) seen.add(t.id);
for (const t of dueThisWeekTasks.value) seen.add(t.id);
}
if (highPriRes.status === "fulfilled") {
highPriorityTasks.value = highPriRes.value.tasks.filter(
(t) => t.status !== "done" && !seen.has(t.id)
);
highPriorityTasks.value = highPriRes.value.tasks.filter((t) => t.status !== "done" && !seen.has(t.id));
for (const t of highPriorityTasks.value) seen.add(t.id);
}
if (inProgressRes.status === "fulfilled") {
inProgressTasks.value = inProgressRes.value.tasks.filter(
(t) => !seen.has(t.id)
);
inProgressTasks.value = inProgressRes.value.tasks.filter((t) => !seen.has(t.id));
for (const t of inProgressTasks.value) seen.add(t.id);
}
if (otherRes.status === "fulfilled") {
const remaining = otherRes.value.tasks.filter(
(t) => t.status !== "done" && !seen.has(t.id)
);
otherTasks.value = sortOtherTasks(remaining);
otherTasks.value = sortOtherTasks(otherRes.value.tasks.filter((t) => t.status !== "done" && !seen.has(t.id)));
}
loading.value = false;
nextTick(() => chatInputRef.value?.focus());
// Load projects in parallel (non-blocking)
loadProjects();
});
const noTasks = computed(
@@ -160,12 +178,8 @@ const noTasks = computed(
);
const allTaskLists = [
() => overdueTasks,
() => dueTodayTasks,
() => dueThisWeekTasks,
() => highPriorityTasks,
() => inProgressTasks,
() => otherTasks,
() => overdueTasks, () => dueTodayTasks, () => dueThisWeekTasks,
() => highPriorityTasks, () => inProgressTasks, () => otherTasks,
];
function removeFromAllLists(id: number) {
@@ -183,22 +197,19 @@ function onStatusToggle(id: number, status: TaskStatus) {
for (const getList of allTaskLists) {
const list = getList();
const idx = list.value.findIndex((t) => t.id === updated.id);
if (idx !== -1) {
list.value[idx] = updated;
break;
}
if (idx !== -1) { list.value[idx] = updated; break; }
}
}
});
}
// ─── Chat widget ──────────────────────────────────────────────────────────────
const chatInputRef = ref<{ focus: () => void } | null>(null);
const chatStore = useChatStore();
chatStore.fetchStatus().then(() => {
if (chatStore.defaultModel) {
chatStore.warmModel(chatStore.defaultModel);
}
if (chatStore.defaultModel) chatStore.warmModel(chatStore.defaultModel);
});
const dashboardConvId = ref<number | null>(null);
@@ -254,7 +265,7 @@ function clearDashboardResponse() {
<template>
<main class="home">
<!-- Chat widget full width at top -->
<!-- Chat widget -->
<section class="chat-section">
<div class="quick-actions">
<button
@@ -263,39 +274,23 @@ function clearDashboardResponse() {
class="quick-action-chip"
:disabled="chatStore.streaming || !chatStore.chatReady"
@click="onQuickAction(q)"
>
{{ q }}
</button>
>{{ q }}</button>
</div>
<DashboardChatInput ref="chatInputRef" @submit="onChatSubmit" />
</section>
<!-- Inline response full width -->
<!-- Inline response -->
<div v-if="dashboardConvId" class="dashboard-response">
<div class="dashboard-response-query">{{ dashboardQuery }}</div>
<div
v-if="chatStore.streaming && chatStore.streamingToolCalls.length"
class="dashboard-tool-calls"
>
<ToolCallCard
v-for="(tc, i) in chatStore.streamingToolCalls"
:key="i"
:tool-call="tc"
/>
<div v-if="chatStore.streaming && chatStore.streamingToolCalls.length" class="dashboard-tool-calls">
<ToolCallCard v-for="(tc, i) in chatStore.streamingToolCalls" :key="i" :tool-call="tc" />
</div>
<div v-else-if="dashboardDone && dashboardFinalToolCalls.length" class="dashboard-tool-calls">
<ToolCallCard
v-for="(tc, i) in dashboardFinalToolCalls"
:key="i"
:tool-call="tc"
/>
<ToolCallCard v-for="(tc, i) in dashboardFinalToolCalls" :key="i" :tool-call="tc" />
</div>
<div v-if="chatStore.streaming" class="dashboard-response-text streaming">
<div v-if="chatStore.streamingStatus && !chatStore.streamingContent" class="dashboard-status-line">
<span class="dashboard-status-dot"></span>
{{ chatStore.streamingStatus }}
<span class="dashboard-status-dot"></span>{{ chatStore.streamingStatus }}
</div>
<span v-else-if="chatStore.streamingContent">{{ chatStore.streamingContent }}</span>
<span v-else class="thinking-dots">...</span>
@@ -303,25 +298,22 @@ function clearDashboardResponse() {
<div v-else-if="dashboardDone && dashboardFinalContent" class="dashboard-response-text">
{{ dashboardFinalContent }}
</div>
<div class="dashboard-response-actions" :class="{ conversational: isConversational }">
<router-link
:to="`/chat/${dashboardConvId}`"
class="btn-open-chat"
:class="{ prominent: isConversational }"
>
{{ isConversational ? 'Continue the conversation →' : 'Think it through in Chat →' }}
</router-link>
>{{ isConversational ? 'Continue the conversation →' : 'Think it through in Chat →' }}</router-link>
<button class="btn-clear-response" @click="clearDashboardResponse">Clear</button>
</div>
</div>
<p v-if="loading" class="loading">Loading...</p>
<!-- Two-column grid -->
<!-- Main grid: Tasks + Notes -->
<div v-else class="dashboard-grid">
<!-- Left: Tasks -->
<!-- Tasks column -->
<div class="col-tasks">
<div class="col-header">
<h2>Tasks</h2>
@@ -336,11 +328,13 @@ function clearDashboardResponse() {
<template v-else>
<section v-if="overdueTasks.length" class="section section-overdue">
<h3 class="section-title">Overdue</h3>
<div class="cards">
<div class="task-rows">
<TaskCard
v-for="task in overdueTasks"
:key="task.id"
:task="task"
compact
:project-title="task.project_id ? (projectMap.get(task.project_id) ?? undefined) : undefined"
@status-toggle="onStatusToggle"
/>
</div>
@@ -348,11 +342,13 @@ function clearDashboardResponse() {
<section v-if="dueTodayTasks.length" class="section">
<h3 class="section-title">Due Today</h3>
<div class="cards">
<div class="task-rows">
<TaskCard
v-for="task in dueTodayTasks"
:key="task.id"
:task="task"
compact
:project-title="task.project_id ? (projectMap.get(task.project_id) ?? undefined) : undefined"
@status-toggle="onStatusToggle"
/>
</div>
@@ -360,11 +356,13 @@ function clearDashboardResponse() {
<section v-if="dueThisWeekTasks.length" class="section">
<h3 class="section-title">Due This Week</h3>
<div class="cards">
<div class="task-rows">
<TaskCard
v-for="task in dueThisWeekTasks"
:key="task.id"
:task="task"
compact
:project-title="task.project_id ? (projectMap.get(task.project_id) ?? undefined) : undefined"
@status-toggle="onStatusToggle"
/>
</div>
@@ -372,11 +370,13 @@ function clearDashboardResponse() {
<section v-if="highPriorityTasks.length" class="section section-high-priority">
<h3 class="section-title">High Priority</h3>
<div class="cards">
<div class="task-rows">
<TaskCard
v-for="task in highPriorityTasks"
:key="task.id"
:task="task"
compact
:project-title="task.project_id ? (projectMap.get(task.project_id) ?? undefined) : undefined"
@status-toggle="onStatusToggle"
/>
</div>
@@ -384,11 +384,13 @@ function clearDashboardResponse() {
<section v-if="inProgressTasks.length" class="section">
<h3 class="section-title">In Progress</h3>
<div class="cards">
<div class="task-rows">
<TaskCard
v-for="task in inProgressTasks"
:key="task.id"
:task="task"
compact
:project-title="task.project_id ? (projectMap.get(task.project_id) ?? undefined) : undefined"
@status-toggle="onStatusToggle"
/>
</div>
@@ -396,11 +398,13 @@ function clearDashboardResponse() {
<section v-if="otherTasks.length" class="section">
<h3 class="section-title">Other</h3>
<div class="cards">
<div class="task-rows">
<TaskCard
v-for="task in otherTasks"
:key="task.id"
:task="task"
compact
:project-title="task.project_id ? (projectMap.get(task.project_id) ?? undefined) : undefined"
@status-toggle="onStatusToggle"
/>
</div>
@@ -408,13 +412,13 @@ function clearDashboardResponse() {
</template>
</div>
<!-- Right: Notes -->
<!-- Notes column: 2-per-row mini grid -->
<div class="col-notes">
<div class="col-header">
<h2>Recent Notes</h2>
<router-link to="/notes" class="see-all">See all</router-link>
</div>
<div v-if="recentNotes.length" class="cards">
<div v-if="recentNotes.length" class="notes-mini-grid">
<NoteCard
v-for="note in recentNotes"
:key="note.id"
@@ -428,6 +432,53 @@ function clearDashboardResponse() {
</div>
</div>
<!-- Projects widget -->
<div v-if="activeProjects.length" class="projects-section">
<div class="col-header">
<h2>Active Projects</h2>
<router-link to="/projects" class="see-all">See all</router-link>
</div>
<div class="projects-strip">
<router-link
v-for="project in activeProjects"
:key="project.id"
:to="`/projects/${project.id}`"
class="project-mini-card"
>
<div class="project-mini-title">{{ project.title }}</div>
<template v-if="project.summary?.milestone_summary?.length">
<div
v-for="(ms, i) in project.summary.milestone_summary.filter(m => m.status !== 'archived')"
: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 v-else-if="project.summary" class="project-mini-counts">
<span v-if="project.summary.task_counts.in_progress">
{{ project.summary.task_counts.in_progress }} in progress
</span>
<span v-if="project.summary.task_counts.todo">
{{ project.summary.task_counts.todo }} todo
</span>
<span v-if="!project.summary.task_counts.in_progress && !project.summary.task_counts.todo" class="muted">
No open tasks
</span>
</div>
<div v-else class="project-mini-counts muted">Loading</div>
</router-link>
</div>
</div>
</main>
</template>
@@ -438,10 +489,8 @@ function clearDashboardResponse() {
padding: 0 1rem;
}
/* Chat section */
.chat-section {
margin-bottom: 1rem;
}
/* Chat */
.chat-section { margin-bottom: 1rem; }
.quick-actions {
display: flex;
flex-wrap: wrap;
@@ -462,10 +511,7 @@ function clearDashboardResponse() {
border-color: var(--color-primary);
color: var(--color-primary);
}
.quick-action-chip:disabled {
opacity: 0.4;
cursor: default;
}
.quick-action-chip:disabled { opacity: 0.4; cursor: default; }
/* Inline response */
.dashboard-response {
@@ -490,17 +536,11 @@ function clearDashboardResponse() {
.dashboard-response-text {
font-size: 0.9rem;
line-height: 1.55;
color: var(--color-text);
white-space: pre-wrap;
word-break: break-word;
}
.dashboard-response-text.streaming {
color: var(--color-text-muted);
}
.thinking-dots {
display: inline-block;
animation: blink 1.2s infinite;
}
.dashboard-response-text.streaming { color: var(--color-text-muted); }
.thinking-dots { display: inline-block; animation: blink 1.2s infinite; }
.dashboard-status-line {
display: flex;
align-items: center;
@@ -534,9 +574,7 @@ function clearDashboardResponse() {
text-decoration: none;
font-weight: 500;
}
.btn-open-chat:hover {
text-decoration: underline;
}
.btn-open-chat:hover { text-decoration: underline; }
.btn-open-chat.prominent {
background: var(--color-primary);
color: #fff;
@@ -544,10 +582,7 @@ function clearDashboardResponse() {
border-radius: var(--radius-sm);
font-size: 0.9rem;
}
.btn-open-chat.prominent:hover {
text-decoration: none;
opacity: 0.9;
}
.btn-open-chat.prominent:hover { text-decoration: none; opacity: 0.9; }
.btn-clear-response {
font-size: 0.8rem;
color: var(--color-text-muted);
@@ -556,11 +591,9 @@ function clearDashboardResponse() {
cursor: pointer;
padding: 0;
}
.btn-clear-response:hover {
color: var(--color-text);
}
.btn-clear-response:hover { color: var(--color-text); }
/* Two-column grid */
/* Main grid */
.dashboard-grid {
display: grid;
grid-template-columns: 3fr 2fr;
@@ -573,28 +606,20 @@ function clearDashboardResponse() {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
}
.col-header h2 {
margin: 0;
font-size: 1.1rem;
font-weight: 600;
margin-bottom: 0.75rem;
}
.col-header h2 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.see-all {
color: var(--color-primary);
text-decoration: none;
font-size: 0.85rem;
}
.see-all:hover {
text-decoration: underline;
}
.see-all:hover { text-decoration: underline; }
/* Task sections */
.section {
margin-bottom: 1.5rem;
}
/* Task sections — compact rows */
.section { margin-bottom: 1.25rem; }
.section-title {
margin: 0 0 0.6rem;
margin: 0 0 0.4rem;
font-size: 0.7rem;
font-weight: 700;
text-transform: uppercase;
@@ -605,31 +630,100 @@ function clearDashboardResponse() {
border-left: 3px solid var(--color-danger, #e74c3c);
padding-left: 0.75rem;
}
.section-overdue .section-title {
color: var(--color-danger, #e74c3c);
}
.section-overdue .section-title { color: var(--color-danger, #e74c3c); }
.section-high-priority {
border-left: 3px solid var(--color-warning, #f59e0b);
padding-left: 0.75rem;
}
.cards {
.task-rows {
display: flex;
flex-direction: column;
gap: 0.6rem;
}
.loading {
color: var(--color-text-secondary);
gap: 0.2rem;
}
/* Empty states */
.empty-state {
text-align: center;
padding: 1.5rem 0;
/* Notes mini-grid: 2-per-row within the column */
.notes-mini-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 0.6rem;
}
.empty-text {
/* Projects widget */
.projects-section {
margin-top: 2rem;
}
.projects-strip {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 0.75rem;
}
.project-mini-card {
display: block;
padding: 0.75rem;
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
background: var(--color-bg-card);
text-decoration: none;
color: inherit;
transition: box-shadow 0.15s;
}
.project-mini-card:hover {
box-shadow: 0 2px 8px var(--color-shadow);
}
.project-mini-title {
font-size: 0.9rem;
font-weight: 600;
margin-bottom: 0.5rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.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);
margin: 0 0 0.75rem;
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;
}
.project-mini-counts {
font-size: 0.8rem;
color: var(--color-text-secondary);
display: flex;
flex-direction: column;
gap: 0.15rem;
}
.muted { color: var(--color-text-muted); }
.loading { color: var(--color-text-secondary); }
.empty-state { text-align: center; padding: 1.5rem 0; }
.empty-text { color: var(--color-text-muted); margin: 0 0 0.75rem; }
.btn-cta {
display: inline-block;
padding: 0.45rem 1rem;
@@ -644,8 +738,8 @@ function clearDashboardResponse() {
/* Mobile */
@media (max-width: 768px) {
.dashboard-grid {
grid-template-columns: 1fr;
}
.dashboard-grid { grid-template-columns: 1fr; }
.notes-mini-grid { grid-template-columns: 1fr; }
.projects-strip { grid-template-columns: 1fr; }
}
</style>