- Clone import: defer FurnitureData.json writes and append all entries in a single batched write instead of one read-modify-write per item, removing the main serialization bottleneck for large batches. - Clone import: raise SSE batch concurrency cap from 5 to 10 and bump the clone client/route default from 2 to 6. - Add a flush hook to runSseBatch so callers can batch deferred work before batch_complete is emitted, and surface flush errors as an error event. - Enable Next.js Cache Components (instant: false opt-out) and silence the related build warnings in next.config.ts. - Switch isomorphic-dompurify to dompurify and refresh dependencies.
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
import { ListOrdered } from "lucide-react";
|
|
import { redirect } from "next/navigation";
|
|
import { getTranslations } from "next-intl/server";
|
|
import { AdminPageShell } from "@/components/admin/admin-page-shell";
|
|
import { ADMIN_NAV_GROUPS } from "@/lib/admin-nav";
|
|
import {
|
|
ADMIN_NAV_CONFIG_KEY,
|
|
parseAdminNavConfig,
|
|
} from "@/lib/admin-nav-config";
|
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
|
import { siteSettings } from "@/lib/services/site-settings";
|
|
import { AdminMenuEditor } from "./admin-menu-editor";
|
|
|
|
// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
|
|
// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
|
|
export const instant = false;
|
|
|
|
export const metadata = { title: "Admin menu" };
|
|
|
|
export default async function AdminMenuPage() {
|
|
const { session, permissions } = await getAdminContext();
|
|
if (!canAccess(permissions, PERMS.SETTINGS_VIEW, session.user.rank)) {
|
|
redirect("/admin");
|
|
}
|
|
const canEdit = canAccess(
|
|
permissions,
|
|
PERMS.SETTINGS_EDIT,
|
|
session.user.rank,
|
|
);
|
|
const t = await getTranslations("pages.admin.menu");
|
|
|
|
const catalog = ADMIN_NAV_GROUPS.map((g) => ({
|
|
labelKey: g.labelKey,
|
|
items: g.items.map((i) => ({ href: i.href, labelKey: i.labelKey })),
|
|
}));
|
|
const initialConfig = parseAdminNavConfig(
|
|
await siteSettings.get(ADMIN_NAV_CONFIG_KEY, ""),
|
|
);
|
|
|
|
return (
|
|
<AdminPageShell
|
|
icon={ListOrdered}
|
|
title={t("title")}
|
|
subtitle={t("subtitle")}
|
|
>
|
|
<AdminMenuEditor
|
|
catalog={catalog}
|
|
initialConfig={initialConfig}
|
|
canEdit={canEdit}
|
|
/>
|
|
</AdminPageShell>
|
|
);
|
|
}
|