refactor(housekeeping): split client, add loading states, URL persistence, fix dead code
Local Build and Deploy / deploy (push) Failing after 48s
Local Build and Deploy / deploy (push) Failing after 48s
- Split ManageClient into ManageSection, PresetsSection, TestSection, ImportSection, ExportSection - each tab only renders what it needs - Add loading/disabled states to preset, import, export, clear buttons - Persist search and group filter via URL searchParams (survives refresh) - Remove dead getAuditHistory export from actions - Fix testRankPermission - remove unnecessary revalidatePath with JSON result - Clean up unused errors/count variables in bulkImportPermissions - Add 'loading' translation key to housekeeping section (en/nl)
This commit is contained in:
1 parent
0a350a354e
commit
70f5e37373
7 files changed
+319
-309
No files matched your search
@@ -3,35 +3,21 @@ import { redirect } from "next/navigation";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { ManageClient } from "./client";
|
||||
import {
|
||||
ExportSection,
|
||||
ImportSection,
|
||||
ManageSection,
|
||||
PresetsSection,
|
||||
TestSection,
|
||||
} from "./client";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
const GROUPS = [
|
||||
"Core",
|
||||
"Users",
|
||||
"Rooms",
|
||||
"Bans",
|
||||
"News",
|
||||
"Logs",
|
||||
"Settings",
|
||||
"Wordfilter",
|
||||
"Catalog",
|
||||
"Shop",
|
||||
"Events",
|
||||
"Tickets",
|
||||
"Moderation",
|
||||
"Polls",
|
||||
"Analytics",
|
||||
"DevOps",
|
||||
"Prefixes",
|
||||
"Banners",
|
||||
"Radio",
|
||||
"RCON",
|
||||
"Assets",
|
||||
"Export",
|
||||
"Notifications",
|
||||
"CMS Pages",
|
||||
"Core", "Users", "Rooms", "Bans", "News", "Logs", "Settings",
|
||||
"Wordfilter", "Catalog", "Shop", "Events", "Tickets", "Moderation",
|
||||
"Polls", "Analytics", "DevOps", "Prefixes", "Banners", "Radio",
|
||||
"RCON", "Assets", "Export", "Notifications", "CMS Pages",
|
||||
];
|
||||
|
||||
export default async function AdminHousekeeping({
|
||||
@@ -241,7 +227,7 @@ export default async function AdminHousekeeping({
|
||||
)}
|
||||
|
||||
{tab === "manage" && (
|
||||
<ManageClient
|
||||
<ManageSection
|
||||
permissions={allPermissions}
|
||||
groups={allGroups}
|
||||
groupCounts={groupCounts}
|
||||
@@ -250,31 +236,17 @@ export default async function AdminHousekeeping({
|
||||
)}
|
||||
|
||||
{tab === "import" && (
|
||||
<ManageClient
|
||||
permissions={allPermissions}
|
||||
groups={allGroups}
|
||||
groupCounts={groupCounts}
|
||||
permSet={permSet}
|
||||
/>
|
||||
<>
|
||||
<ImportSection />
|
||||
<div className="mt-8">
|
||||
<ExportSection />
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{tab === "presets" && (
|
||||
<ManageClient
|
||||
permissions={allPermissions}
|
||||
groups={allGroups}
|
||||
groupCounts={groupCounts}
|
||||
permSet={permSet}
|
||||
/>
|
||||
)}
|
||||
{tab === "presets" && <PresetsSection />}
|
||||
|
||||
{tab === "test" && (
|
||||
<ManageClient
|
||||
permissions={allPermissions}
|
||||
groups={allGroups}
|
||||
groupCounts={groupCounts}
|
||||
permSet={permSet}
|
||||
/>
|
||||
)}
|
||||
{tab === "test" && <TestSection permissions={allPermissions} />}
|
||||
|
||||
{tab === "ranks" && (
|
||||
<section>
|
||||
|
||||
Reference in new issue
Block a user