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

+73
View File
@@ -0,0 +1,73 @@
import { Package } from "lucide-react";
import { getTranslations } from "next-intl/server";
import { AdminPageShell } from "@/components/admin/admin-page-shell";
import { fetchAdminList } from "@/lib/admin-list";
import { canAccess, PERMS } from "@/lib/permissions";
import { type ItemsBaseRow, ItemsTable } from "./items-table";
export default async function ItemsBasePage({
params: paramsPromise,
searchParams,
}: {
params: Promise<{ locale: string }>;
searchParams: Promise<Record<string, string>>;
}) {
const result = await fetchAdminList<ItemsBaseRow>(
{
permission: PERMS.CATALOG_VIEW,
model: "itemsBase",
searchFields: ["itemName", "publicName"],
defaultSort: { id: "desc" },
select: {
id: true,
spriteId: true,
publicName: true,
itemName: true,
type: true,
interactionType: true,
width: true,
length: true,
},
filterMap: {
filter_type: (v) => ({ type: v }),
},
mapRow: (r) => ({
id: r.id as number,
spriteId: r.spriteId as number,
publicName: (r.publicName as string) || "",
itemName: (r.itemName as string) || "",
type: (r.type as string) || "s",
interactionType: (r.interactionType as string) || "default",
width: r.width as number,
length: r.length as number,
}),
},
paramsPromise,
searchParams,
);
const t = await getTranslations("pages.admin.items");
const canEdit = canAccess(
result.permissions,
PERMS.CATALOG_EDIT,
result.rank,
);
return (
<AdminPageShell icon={Package} title={t("title")} subtitle={t("subtitle")}>
<p className="text-muted-foreground m-0">
{t("total", { count: result.total })}
</p>
<ItemsTable
data={{
rows: result.rows,
total: result.total,
page: result.page,
perPage: result.perPage,
lastPage: result.lastPage,
}}
canEdit={canEdit}
/>
</AdminPageShell>
);
}