import { prisma } from "@/lib/db"; import { getConsoleContext } from "@/lib/console"; import { roleAtLeast } from "@/lib/auth/roles"; import { EmptyState, PageTitle } from "@/components/ui"; import { PagePicker } from "@/components/PagePicker"; import { RulesManager } from "@/components/RulesManager"; export default async function AutoReplyPage() { const ctx = await getConsoleContext(); const page = ctx.selected; if (!page) { return ( <>
({ id, name, pictureUrl }))} />
); } const rules = await prisma.replyRule.findMany({ where: { pageId: page.id }, orderBy: [{ kind: "asc" }, { priority: "desc" }, { createdAt: "asc" }], include: { _count: { select: { logs: true } } }, }); return ( <> ({ id: r.id, name: r.name, kind: r.kind, keywords: r.keywords, reply: r.reply, imageUrl: r.imageUrl, publicAck: r.publicAck, isActive: r.isActive, priority: r.priority, sent: r._count.logs, }))} /> ); }