Fix build: move store import from admin-nav to layout only
Local Build and Deploy / deploy (push) Successful in 51s
Local Build and Deploy / deploy (push) Successful in 51s
admin-nav.ts was importing from store.ts (server-only), which caused build errors when admin-topbar.tsx (client component) pulled in admin-nav. Now layout.tsx directly imports from store and passes enabled state to allNavGroups().
This commit is contained in:
1 parent
127d5dcfa6
commit
c6a6653803
2 files changed
+4
-11
No files matched your search
@@ -10,7 +10,8 @@ import { AdminTopbar } from "@/components/admin/admin-topbar";
|
||||
import { LanguageSwitcher } from "@/components/language-switcher";
|
||||
import { ThemeSwitcher } from "@/components/theme-switcher";
|
||||
import { requireStaff } from "@/lib/admin/guard";
|
||||
import { allEnabledNavGroups } from "@/lib/admin-nav";
|
||||
import { allNavGroups } from "@/lib/admin-nav";
|
||||
import { getAllPluginStates } from "@/lib/plugins/store";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { siteSettings } from "@/lib/services/site-settings";
|
||||
|
||||
@@ -32,7 +33,8 @@ export default async function AdminLayout({
|
||||
if (!u?.twoFactorConfirmedAt) redirect("/settings/2fa?error=staffrequired");
|
||||
}
|
||||
|
||||
const navGroups = await allEnabledNavGroups();
|
||||
const pluginStates = await getAllPluginStates();
|
||||
const navGroups = allNavGroups(pluginStates.enabled);
|
||||
|
||||
return (
|
||||
<AdminMobileWrapper sidebar={<Sidebar staff={staff} navGroups={navGroups} />}>
|
||||
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
Wrench,
|
||||
} from "lucide-react";
|
||||
import { pluginRegistry } from "@/lib/plugins";
|
||||
import { getAllPluginStates } from "@/lib/plugins/store";
|
||||
import "@/lib/plugins/loader";
|
||||
|
||||
export interface AdminHubTab {
|
||||
@@ -411,15 +410,7 @@ export function allNavGroups(enabled?: Record<string, boolean>): AdminNavGroup[]
|
||||
];
|
||||
}
|
||||
|
||||
export async function allEnabledHubs(): Promise<AdminHubDefinition[]> {
|
||||
const states = await getAllPluginStates();
|
||||
return allHubs(states.enabled);
|
||||
}
|
||||
|
||||
export async function allEnabledNavGroups(): Promise<AdminNavGroup[]> {
|
||||
const states = await getAllPluginStates();
|
||||
return allNavGroups(states.enabled);
|
||||
}
|
||||
|
||||
function hubPrefixes(id: string): string[] {
|
||||
return ADMIN_HUBS.find((h) => h.id === id)?.prefixes ?? [];
|
||||
|
||||
Reference in new issue
Block a user