feat(14-02): add LeadsSearch, rewire leads pages, surface tags in LeadDetail (CRM-08/09)
- New LeadsSearch.tsx: client-side instant filter across name/email/ company/status/tags (mirrors CatalogSearch.tsx) - page.tsx: fetch via getLeadsWithTags()/getLeadFieldOptions(), render LeadsSearch + CreateLeadModal, revalidate=0 - [id]/page.tsx: fetch getLeadsWithTags()/getLeadFieldOptions(), find lead by id, pass tags/tagOptions to LeadDetail - LeadDetail.tsx: add OptionMultiSelect for lead tags in the "Profilo" card, wired to addLeadTag/removeLeadTag/renameLeadTag with error display
This commit is contained in:
@@ -1,25 +1,23 @@
|
||||
import { Suspense } from "react";
|
||||
import { getAllLeads } from "@/lib/lead-service";
|
||||
import { LeadTable } from "@/components/admin/leads/LeadTable";
|
||||
import { getLeadsWithTags, getLeadFieldOptions } from "@/lib/admin-queries";
|
||||
import { LeadsSearch } from "./LeadsSearch";
|
||||
import { CreateLeadModal } from "@/components/admin/leads/LeadForm";
|
||||
|
||||
async function LeadsList() {
|
||||
const leads = await getAllLeads();
|
||||
export const revalidate = 0;
|
||||
|
||||
export default async function LeadsPage() {
|
||||
const [leads, options] = await Promise.all([
|
||||
getLeadsWithTags(),
|
||||
getLeadFieldOptions(),
|
||||
]);
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="flex justify-between items-center">
|
||||
<h1 className="text-3xl font-bold">Lead Pipeline</h1>
|
||||
<h1 className="text-2xl font-bold text-[#1a1a1a]">Lead Pipeline</h1>
|
||||
<CreateLeadModal />
|
||||
</div>
|
||||
|
||||
<Suspense fallback={<div className="animate-pulse">Loading...</div>}>
|
||||
<LeadTable leads={leads} />
|
||||
</Suspense>
|
||||
<LeadsSearch leads={leads} options={options} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function LeadsPage() {
|
||||
return <LeadsList />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user