feat(#145): switch dashboard to show last-activity documents
Some checks failed
CI / Unit & Component Tests (push) Has been cancelled
CI / Backend Unit Tests (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Unit & Component Tests (pull_request) Failing after 1m57s
CI / Backend Unit Tests (pull_request) Failing after 2m19s
CI / E2E Tests (pull_request) Failing after 3h14m27s

Replace recent-by-creation fetch with GET /api/documents/recent-activity
(sorted by updatedAt) in the dashboard. Update DashboardRecentDocuments
component to use doc.updatedAt, update i18n heading to "Zuletzt aktiv" /
"Recent Activity" / "Actividad reciente", and regenerate API types.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-29 11:30:08 +02:00
parent 6976daa910
commit 2171c3702a
7 changed files with 49 additions and 11 deletions

View File

@@ -318,7 +318,7 @@
"dashboard_notification_replied": "hat geantwortet",
"dashboard_needs_metadata_heading": "Metadaten fehlen",
"dashboard_needs_metadata_show_all": "Alle anzeigen",
"dashboard_recent_heading": "Zuletzt hinzugefügt",
"dashboard_recent_heading": "Zuletzt aktiv",
"dashboard_resume_label": "Zuletzt geöffnet:",
"dashboard_resume_fallback": "Unbekanntes Dokument"
}

View File

@@ -318,7 +318,7 @@
"dashboard_notification_replied": "replied",
"dashboard_needs_metadata_heading": "Missing Metadata",
"dashboard_needs_metadata_show_all": "Show all",
"dashboard_recent_heading": "Recently Added",
"dashboard_recent_heading": "Recent Activity",
"dashboard_resume_label": "Last opened:",
"dashboard_resume_fallback": "Unknown document"
}

View File

@@ -318,7 +318,7 @@
"dashboard_notification_replied": "respondió",
"dashboard_needs_metadata_heading": "Metadatos incompletos",
"dashboard_needs_metadata_show_all": "Ver todos",
"dashboard_recent_heading": "Añadidos recientemente",
"dashboard_recent_heading": "Actividad reciente",
"dashboard_resume_label": "Último abierto:",
"dashboard_resume_fallback": "Documento desconocido"
}

View File

@@ -5,7 +5,7 @@ import { getLocale } from '$lib/paraglide/runtime.js';
type Document = {
id: string;
title: string;
createdAt?: string;
updatedAt?: string;
sender?: { id: string; firstName: string; lastName: string };
};
@@ -37,12 +37,12 @@ function formatDate(dateStr: string): string {
>
{doc.title}
</a>
{#if doc.createdAt}
{#if doc.updatedAt}
<span
data-testid="doc-date-{doc.id}"
class="ml-2 shrink-0 font-sans text-xs text-gray-400"
>
{formatDate(doc.createdAt)}
{formatDate(doc.updatedAt)}
</span>
{/if}
</div>

View File

@@ -9,12 +9,12 @@ afterEach(cleanup);
type Document = {
id: string;
title: string;
createdAt?: string;
updatedAt?: string;
sender?: { id: string; firstName: string; lastName: string };
};
function makeDoc(id: string, title: string, createdAt?: string): Document {
return { id, title, createdAt };
function makeDoc(id: string, title: string, updatedAt?: string): Document {
return { id, title, updatedAt };
}
describe('DashboardRecentDocuments', () => {

View File

@@ -628,6 +628,22 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/documents/recent-activity": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get: operations["getRecentActivity"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/documents/incomplete": {
parameters: {
query?: never;
@@ -2328,6 +2344,28 @@ export interface operations {
};
};
};
getRecentActivity: {
parameters: {
query?: {
size?: number;
};
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"*/*": components["schemas"]["Document"][];
};
};
};
};
getIncomplete: {
parameters: {
query?: {

View File

@@ -60,7 +60,7 @@ export async function load({ url, fetch }) {
const [mentionsResult, incompleteResult, recentResult] = await Promise.allSettled([
api.GET('/api/notifications', { params: { query: { size: 5 } } }),
api.GET('/api/documents/incomplete', { params: { query: { size: 5 } } }),
api.GET('/api/documents/search', { params: { query: {} } })
api.GET('/api/documents/recent-activity', { params: { query: { size: 5 } } })
]);
if (mentionsResult.status === 'fulfilled' && mentionsResult.value.response.ok) {
@@ -70,7 +70,7 @@ export async function load({ url, fetch }) {
incompleteDocs = incompleteResult.value.data ?? [];
}
if (recentResult.status === 'fulfilled' && recentResult.value.response.ok) {
recentDocs = (recentResult.value.data ?? []).slice(0, 5);
recentDocs = recentResult.value.data ?? [];
}
}