feat: document edit inline + client dashboard sidebar layout

- actions.ts: add updateDocument server action (label + url, Zod validated)
- DocumentRow: Client Component with hover-reveal edit/remove buttons,
  inline edit form with pre-filled fields and cancel/save
- DocumentsTab: use DocumentRow, remove variant dependency
- client-dashboard: two-column layout (sidebar left on lg+):
  sidebar = payments + documents + notes (sticky top)
  main = brief + phases toggle (timeline / kanban)
  mobile: main first, sidebar below (order-1/order-2)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Simone Cavalli
2026-05-16 12:24:49 +02:00
parent 7af917fe80
commit 3582e26970
4 changed files with 199 additions and 84 deletions
+17
View File
@@ -117,6 +117,23 @@ export async function addDocument(clientId: string, formData: FormData) {
revalidatePath(`/admin/clients/${clientId}`);
}
export async function updateDocument(
documentId: string,
clientId: string,
formData: FormData
) {
const parsed = docSchema.safeParse({
label: formData.get("label"),
url: formData.get("url"),
});
if (!parsed.success) throw new Error(parsed.error.issues[0].message);
await db
.update(documents)
.set(parsed.data)
.where(eq(documents.id, documentId));
revalidatePath(`/admin/clients/${clientId}`);
}
export async function deleteDocument(documentId: string, clientId: string) {
await db.delete(documents).where(eq(documents.id, documentId));
revalidatePath(`/admin/clients/${clientId}`);