Улучшить мобильное меню и форму заявки, добавить номер лида и заменить middleware на proxy
All checks were successful
Auto Deploy / deploy (push) Successful in 22s

This commit is contained in:
deonisii
2026-04-18 00:20:24 +03:00
parent 9b86175929
commit 45ae26e213
9 changed files with 571 additions and 322 deletions

View File

@@ -1,5 +1,6 @@
import { prisma } from "@/lib/prisma";
import LeadStatusSelect from "@/components/lead-status-select";
import { LeadStatus } from "@prisma/client";
export const dynamic = "force-dynamic";
@@ -8,6 +9,8 @@ type SearchParams = Promise<{
status?: string;
}>;
const leadStatuses = Object.values(LeadStatus);
function formatLeadNumber(id: string, createdAt: Date) {
const date = new Date(createdAt);
const y = date.getFullYear();
@@ -24,7 +27,10 @@ export default async function AdminLeadsPage({
}) {
const params = await searchParams;
const q = params.q?.trim() || "";
const status = params.status?.trim() || "";
const statusParam = params.status?.trim() || "";
const status = leadStatuses.includes(statusParam as LeadStatus)
? (statusParam as LeadStatus)
: undefined;
const leads = await prisma.lead.findMany({
where: {
@@ -39,7 +45,7 @@ export default async function AdminLeadsPage({
],
}
: {},
status ? { status: status as any } : {},
status ? { status } : {},
],
},
orderBy: { createdAt: "desc" },