Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-18 01:43:35 +00:00
co-authored by renee-png
parent 40f57cc2b7
commit e7a6ed5d53
3 changed files with 89 additions and 21 deletions
+27 -7
View File
@@ -8,8 +8,9 @@ import { Badge } from "@/components/ui/badge";
import { supabase } from "@/integrations/supabase/client";
import { useAuth } from "@/lib/auth";
import { toast } from "sonner";
import { ArrowLeft, Edit, Trash2, Mail, Phone, MapPin, Building2, Briefcase, Users } from "lucide-react";
import { ArrowLeft, Edit, Trash2, Mail, Phone, MapPin, Building2, Briefcase, Users, Archive, ArchiveRestore } from "lucide-react";
import { ContactFormDialog, CONTACT_TYPES } from "@/components/contacts/contact-form-dialog";
import { setArchived } from "@/lib/archive";
export const Route = createFileRoute("/contacts/$contactId")({
component: () => (
@@ -87,12 +88,31 @@ function ContactDetail() {
title={contact.name}
description={[contact.title, contact.company].filter(Boolean).join(" · ") || typeLabel}
actions={
canEdit ? (
<>
<Button variant="outline" onClick={() => setEditOpen(true)}><Edit className="h-4 w-4 mr-2" /> Edit</Button>
<Button variant="outline" onClick={remove}><Trash2 className="h-4 w-4 mr-2" /> Delete</Button>
</>
) : null
<>
{contact.archived_at && (
<Badge variant="outline" className="bg-muted text-muted-foreground">
<Archive className="h-3 w-3 mr-1" /> Archived
</Badge>
)}
{canEdit && (
<>
<Button variant="outline" onClick={() => setEditOpen(true)}><Edit className="h-4 w-4 mr-2" /> Edit</Button>
<Button
variant="outline"
onClick={async () => {
if (await setArchived("contacts", contact.id, !contact.archived_at)) load();
}}
>
{contact.archived_at ? (
<><ArchiveRestore className="h-4 w-4 mr-2" /> Restore</>
) : (
<><Archive className="h-4 w-4 mr-2" /> Archive</>
)}
</Button>
<Button variant="outline" onClick={remove}><Trash2 className="h-4 w-4 mr-2" /> Delete</Button>
</>
)}
</>
}
/>