feat(admin): items_base browser and AdminPageShell on core pages
CI / check (push) Successful in 21s
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 59s
CI / deploy (push) Failing after 9s

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-30 20:41:31 +02:00
1 parent 7138ae4445
commit 98613af875
42 files changed
+2196 -698

No files matched your search

+86 -78
View File
@@ -1,4 +1,7 @@
import { Store } from "lucide-react";
import { redirect } from "next/navigation";
import { getTranslations } from "next-intl/server";
import { AdminPageShell } from "@/components/admin/admin-page-shell";
import { CatalogTree } from "@/components/admin/catalog-tree";
import { Prisma } from "@/generated/prisma/client";
import { calcPagination, parseListParams } from "@/lib/admin-helpers";
@@ -23,6 +26,7 @@ export default async function CatalogPagesPage({
}
const canEdit = canAccess(permissions, PERMS.CATALOG_EDIT, session.user.rank);
const t = await getTranslations("pages.admin.catalog");
const params = await searchParams;
const sp = new URLSearchParams(params);
@@ -200,50 +204,52 @@ export default async function CatalogPagesPage({
}
return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<p className="text-muted-foreground">
{totalBcPages} BC pages ({enabledBcPages} enabled) &middot;{" "}
{totalBcItems} items
</p>
<div className="flex items-center gap-2">
<CatalogViewToggle currentView={viewMode} catalogType="bc" />
{canEdit && (
<CatalogManagerDialog
catalogType="bc"
canEdit={canEdit}
totals={{
totalPages: totalBcPages,
enabledPages: enabledBcPages,
totalItems: totalBcItems,
}}
initialRoots={bcRootPages.map((p) => ({
id: p.id,
caption: p.caption,
iconImage: p.iconImage,
enabled: p.enabled,
orderNum: 0,
}))}
/>
)}
{canEdit && (
<CatalogActions
catalogType="bc"
initialParentId={sp.get("newPageParent")}
/>
)}
<AdminPageShell icon={Store} title={t("title")} subtitle={t("subtitle")}>
<div className="space-y-6">
<div className="flex items-center justify-between">
<p className="text-muted-foreground">
{totalBcPages} BC pages ({enabledBcPages} enabled) &middot;{" "}
{totalBcItems} items
</p>
<div className="flex items-center gap-2">
<CatalogViewToggle currentView={viewMode} catalogType="bc" />
{canEdit && (
<CatalogManagerDialog
catalogType="bc"
canEdit={canEdit}
totals={{
totalPages: totalBcPages,
enabledPages: enabledBcPages,
totalItems: totalBcItems,
}}
initialRoots={bcRootPages.map((p) => ({
id: p.id,
caption: p.caption,
iconImage: p.iconImage,
enabled: p.enabled,
orderNum: 0,
}))}
/>
)}
{canEdit && (
<CatalogActions
catalogType="bc"
initialParentId={sp.get("newPageParent")}
/>
)}
</div>
</div>
{viewMode === "tree" ? (
<CatalogTree rootPages={bcRootPages} catalogType="bc" />
) : (
<CatalogTable
data={{ rows: bcRows, ...bcPagination }}
canEdit={canEdit}
catalogType="bc"
/>
)}
</div>
{viewMode === "tree" ? (
<CatalogTree rootPages={bcRootPages} catalogType="bc" />
) : (
<CatalogTable
data={{ rows: bcRows, ...bcPagination }}
canEdit={canEdit}
catalogType="bc"
/>
)}
</div>
</AdminPageShell>
);
}
@@ -396,43 +402,45 @@ export default async function CatalogPagesPage({
}
return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<p className="text-muted-foreground">
{totalPages} pages ({enabledPages} enabled) &middot; {totalItems}{" "}
items
</p>
<div className="flex items-center gap-2">
<CatalogViewToggle currentView={viewMode} catalogType="normal" />
{canEdit && (
<CatalogManagerDialog
catalogType="normal"
canEdit={canEdit}
totals={{
totalPages,
enabledPages,
totalItems,
}}
initialRoots={rootPages.map((p) => ({
id: p.id,
caption: p.caption,
iconImage: p.iconImage,
enabled: p.enabled,
orderNum: 0,
}))}
/>
)}
{canEdit && (
<CatalogActions initialParentId={sp.get("newPageParent")} />
)}
<AdminPageShell icon={Store} title={t("title")} subtitle={t("subtitle")}>
<div className="space-y-6">
<div className="flex items-center justify-between">
<p className="text-muted-foreground">
{totalPages} pages ({enabledPages} enabled) &middot; {totalItems}{" "}
items
</p>
<div className="flex items-center gap-2">
<CatalogViewToggle currentView={viewMode} catalogType="normal" />
{canEdit && (
<CatalogManagerDialog
catalogType="normal"
canEdit={canEdit}
totals={{
totalPages,
enabledPages,
totalItems,
}}
initialRoots={rootPages.map((p) => ({
id: p.id,
caption: p.caption,
iconImage: p.iconImage,
enabled: p.enabled,
orderNum: 0,
}))}
/>
)}
{canEdit && (
<CatalogActions initialParentId={sp.get("newPageParent")} />
)}
</div>
</div>
</div>
{viewMode === "tree" ? (
<CatalogTree rootPages={rootPages} catalogType="normal" />
) : (
<CatalogTable data={{ rows, ...pagination }} canEdit={canEdit} />
)}
</div>
{viewMode === "tree" ? (
<CatalogTree rootPages={rootPages} catalogType="normal" />
) : (
<CatalogTable data={{ rows, ...pagination }} canEdit={canEdit} />
)}
</div>
</AdminPageShell>
);
}