Staff / Owner

Merged staff and owner settings
This commit is contained in:
Stefan Lazic committed 2026-08-05 16:35:52 +01:00
1 parent cf3a28f3cd
commit 3300045d9e
23 files changed
+693 -236

No files matched your search

+10 -7
View File
@@ -1,16 +1,19 @@
import { redirect } from "next/navigation";
import { auth } from "@/auth";
import { StaffShell } from "@/components/navigation/staff-shell";
import { hasPermission } from "@/lib/auth/permissions";
import { getNavRole, hasPermission } from "@/lib/auth/permissions";
import { Permission } from "@/generated/prisma/enums";
import { prisma } from "@/lib/db/prisma";
import { OWNER_NAV_ITEMS } from "@/lib/navigation/staff-nav-items";
import { getNavItems } from "@/lib/navigation/nav-config";
import { getUnreadNotificationCount } from "@/services/notifications/notification.service";
/**
* Owner is a permission on a staff account, not a separate account type
* (see docs/implementation-plan.md §3, §11) — this layout reuses the exact
* same shell/nav as (staff), and only adds a permission check on top.
* Owner and Super Administrator are permissions, not separate account
* types (see docs/implementation-plan.md §3, §11) — this layout reuses the
* exact same shell/nav as (staff), and only adds a permission check on
* top. There is no "switch to owner tools" control anywhere in the app —
* a user who can manage staff simply sees "Manage" in their one merged
* nav (see lib/navigation/nav-config.ts).
*/
export default async function OwnerLayout({ children }: { children: React.ReactNode }) {
const session = await auth();
@@ -23,12 +26,12 @@ export default async function OwnerLayout({ children }: { children: React.ReactN
redirect("/staff");
}
const role = (await getNavRole(session.user.id)) ?? "owner";
const unreadNotificationCount = await getUnreadNotificationCount(prisma, session.user.id);
return (
<StaffShell
items={OWNER_NAV_ITEMS}
footerLink={{ href: "/staff", label: "Barber Tools" }}
items={getNavItems(role)}
notificationsHref="/owner/notifications"
unreadNotificationCount={unreadNotificationCount}
>