lets create another tab on the admin dashboard called "leads" where you
This commit is contained in:
@@ -23,7 +23,8 @@ import {
|
||||
LogOut,
|
||||
Code2,
|
||||
Mails,
|
||||
Send
|
||||
Send,
|
||||
ClipboardList
|
||||
} from "lucide-react"
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
||||
@@ -52,6 +53,14 @@ function AdminLayout({
|
||||
</SidebarMenuButton>
|
||||
</Link>
|
||||
</SidebarMenuItem>
|
||||
<SidebarMenuItem>
|
||||
<Link href="/admin/leads">
|
||||
<SidebarMenuButton tooltip="Leads">
|
||||
<ClipboardList />
|
||||
<span>Leads</span>
|
||||
</SidebarMenuButton>
|
||||
</Link>
|
||||
</SidebarMenuItem>
|
||||
<SidebarMenuItem>
|
||||
<Link href="/admin/embed">
|
||||
<SidebarMenuButton tooltip="Embed">
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from '@/components/ui/card';
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
import { getLeads } from '@/lib/actions/leads';
|
||||
import { format } from 'date-fns';
|
||||
|
||||
export default async function LeadsPage() {
|
||||
const leads = await getLeads();
|
||||
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold tracking-tight">Leads</h1>
|
||||
<p className="mt-2 text-muted-foreground">
|
||||
A list of all the users who have requested an estimate.
|
||||
</p>
|
||||
</div>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Captured Leads</CardTitle>
|
||||
<CardDescription>
|
||||
Potential clients who completed the estimation form.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>Name</TableHead>
|
||||
<TableHead>Email</TableHead>
|
||||
<TableHead className="text-right">Date Submitted</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{leads.length > 0 ? (
|
||||
leads.map((lead) => (
|
||||
<TableRow key={lead.id}>
|
||||
<TableCell className="font-medium">{lead.name}</TableCell>
|
||||
<TableCell>{lead.email}</TableCell>
|
||||
<TableCell className="text-right">
|
||||
{format(new Date(lead.createdAt), 'PPP p')}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))
|
||||
) : (
|
||||
<TableRow>
|
||||
<TableCell colSpan={3} className="text-center h-24">
|
||||
No leads yet.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user