From 8e9753fd296078ea8b17c4ec5a869f599ae0743d Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Wed, 11 Mar 2026 00:35:12 +0200 Subject: [PATCH] feat: add copy button next to registry number in table Copies "nr. BTG-0042/2026 din 11.03.2026" to clipboard on click. Small icon, subtle until hover, green check feedback on copy. Co-Authored-By: Claude Opus 4.6 --- .../components/registry-table.tsx | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/modules/registratura/components/registry-table.tsx b/src/modules/registratura/components/registry-table.tsx index 0dc42b8..51fae21 100644 --- a/src/modules/registratura/components/registry-table.tsx +++ b/src/modules/registratura/components/registry-table.tsx @@ -12,6 +12,8 @@ import { Paperclip, Reply, CheckCircle2, + Copy, + Check, } from "lucide-react"; import { Button } from "@/shared/components/ui/button"; import { Badge } from "@/shared/components/ui/badge"; @@ -312,7 +314,10 @@ export function RegistryTable({ > {visibleCols.has("number") && ( - {entry.number} + + {entry.number} + + )} {visibleCols.has("date") && ( @@ -514,6 +519,37 @@ export function RegistryTable({ ); } +function CopyNumberButton({ entry }: { entry: RegistryEntry }) { + const [copied, setCopied] = useState(false); + + const handleCopy = (e: React.MouseEvent) => { + e.stopPropagation(); + const text = `nr. ${entry.number} din ${formatDate(entry.date)}`; + void navigator.clipboard.writeText(text).then(() => { + setCopied(true); + setTimeout(() => setCopied(false), 1500); + }); + }; + + const Icon = copied ? Check : Copy; + + return ( + + ); +} + function formatDate(iso: string): string { try { return new Date(iso).toLocaleDateString("ro-RO", {