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
+6 -32
View File
@@ -1,4 +1,5 @@
import { addDocument, deleteDocument } from "@/app/admin/clients/[id]/actions";
import { addDocument } from "@/app/admin/clients/[id]/actions";
import { DocumentRow } from "@/components/admin/DocumentRow";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
@@ -14,9 +15,9 @@ export async function DocumentsTab({ documents, clientId }: Props) {
"use server";
await addDocument(clientId, fd);
}}
className="bg-white border border-gray-200 rounded-lg p-4 space-y-3"
className="bg-white border border-[#e5e7eb] rounded-lg p-4 space-y-3"
>
<h3 className="font-medium text-gray-900">Aggiungi documento</h3>
<h3 className="font-medium text-[#1a1a1a]">Aggiungi documento</h3>
<div className="space-y-1">
<Label htmlFor="doc-label">Nome / etichetta</Label>
<Input
@@ -42,38 +43,11 @@ export async function DocumentsTab({ documents, clientId }: Props) {
</form>
{documents.length === 0 && (
<p className="text-sm text-gray-400">Nessun documento ancora.</p>
<p className="text-sm text-[#71717a]">Nessun documento ancora.</p>
)}
<div className="space-y-2">
{documents.map((doc) => (
<div
key={doc.id}
className="flex items-center justify-between bg-white border border-gray-200 rounded-lg px-4 py-3"
>
<a
href={doc.url}
target="_blank"
rel="noopener noreferrer"
className="text-sm text-blue-600 hover:underline"
>
{doc.label}
</a>
<form
action={async () => {
"use server";
await deleteDocument(doc.id, clientId);
}}
>
<Button
type="submit"
variant="ghost"
size="sm"
className="text-red-500 hover:text-red-700 text-xs"
>
Rimuovi
</Button>
</form>
</div>
<DocumentRow key={doc.id} doc={doc} clientId={clientId} />
))}
</div>
</div>