feat(documents): hub page with tabs, filters, and live counts

Replaces /documents with the Phase A hub: tabs (All/Awaiting them/
Awaiting me/Completed/Expired) backed by per-tab counts via a new
hub-counts endpoint, signature-only chip, type filter, expandable
signer rows, and real-time invalidation across the eight document
socket events. listDocuments grew tab/watcher/signatureOnly/sent-window
filters; the legacy file browser moved to /documents/files where the
sidebar already linked.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt Ciaccio
2026-04-28 02:35:36 +02:00
parent 398d6322f1
commit da7262f18f
9 changed files with 718 additions and 146 deletions

View File

@@ -0,0 +1,16 @@
import { NextResponse } from 'next/server';
import { withAuth, withPermission } from '@/lib/api/helpers';
import { errorResponse } from '@/lib/errors';
import { getHubTabCounts } from '@/lib/services/documents.service';
export const GET = withAuth(
withPermission('documents', 'view', async (_req, ctx) => {
try {
const counts = await getHubTabCounts(ctx.portId, ctx.user.email);
return NextResponse.json({ data: counts });
} catch (error) {
return errorResponse(error);
}
}),
);

View File

@@ -10,7 +10,9 @@ export const GET = withAuth(
withPermission('documents', 'view', async (req, ctx) => {
try {
const query = parseQuery(req, listDocumentsSchema);
const result = await listDocuments(ctx.portId, query);
const result = await listDocuments(ctx.portId, query, {
currentUserEmail: ctx.user.email,
});
const { page, limit } = query;
const totalPages = Math.ceil(result.total / limit);