From b10493629cb2fb8983137c4315a33c432dc24c75 Mon Sep 17 00:00:00 2001 From: Andres Date: Fri, 11 Jul 2025 12:58:19 +0200 Subject: [PATCH] add admin header links --- src/app/_components/header.tsx | 56 ++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/src/app/_components/header.tsx b/src/app/_components/header.tsx index 93b02c7..9a8ff3a 100644 --- a/src/app/_components/header.tsx +++ b/src/app/_components/header.tsx @@ -8,12 +8,11 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' -import { auth } from '@/server/auth' import { ThemeToggle } from 'fumadocs-ui/components/layout/theme-toggle' import type { HomeLayoutProps } from 'fumadocs-ui/layouts/home' import type { LinkItemType } from 'fumadocs-ui/layouts/links' import { replaceOrDefault } from 'fumadocs-ui/layouts/shared' -import { LogIn, LogOut, Settings, Tv, User } from 'lucide-react' +import { LogIn, LogOut, Settings, Shield, Tv, User } from 'lucide-react' import { signIn, signOut, useSession } from 'next-auth/react' import Link from 'next/link' import { Fragment } from 'react' @@ -37,6 +36,7 @@ export function Header({ }) { const { data: session, status } = useSession() const isAuthenticated = status === 'authenticated' + const isAdmin = isAuthenticated && session?.user?.role === 'admin' const navItems = finalLinks.filter((item) => ['nav', 'all'].includes(item.on ?? 'all') ) @@ -59,6 +59,36 @@ export function Header({ .map((item, i) => ( ))} + {isAdmin && ( + + +
+ + Admin +
+
+ + +

Logs

+

+ View and manage logs +

+
+ +

Releases

+

+ Manage releases +

+
+ +

OBS Control Panel

+

+ Stream widget controls +

+
+
+
+ )}
{enableSearch ? ( @@ -164,6 +194,28 @@ export function Header({ .map((item, i) => ( ))} + {isAdmin && ( +
+
+ + Admin +
+
+ + Logs + + + Releases + + + OBS Control Panel + +
+
+ )}
{menuItems.filter(isSecondary).map((item, i) => (