From 6c8d34edde31dafe35e8eff86c341cf35d0d4203 Mon Sep 17 00:00:00 2001 From: Andymick Date: Thu, 16 Jul 2026 20:31:22 +0100 Subject: [PATCH] Add admin menu link to header when authenticated - Check isAdminAuthenticated() in Header component - Show 'Admin' link to /admin/orders when user is logged in as admin - Allows quick navigation to admin section after login Co-Authored-By: Claude Haiku 4.5 --- src/components/Header.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 98f3ed0..5eb428a 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -8,15 +8,17 @@ import CurrencySelector from './CurrencySelector'; import MobileNav from './MobileNav'; import { prisma } from '@/lib/prisma'; import { getCurrentCustomer } from '@/lib/auth'; +import { isAdminAuthenticated } from '@/lib/adminAuth'; export default async function Header() { - const [categories, collections, customer] = await Promise.all([ + const [categories, collections, customer, isAdmin] = await Promise.all([ prisma.category.findMany({ where: { showOnPersonalised: true }, orderBy: { name: 'asc' }, }), prisma.collection.findMany({ orderBy: { name: 'asc' } }), getCurrentCustomer(), + isAdminAuthenticated(), ]); const personalisedLinks = [ { href: '/made-to-order', label: 'Shop all' }, @@ -69,6 +71,11 @@ export default async function Header() {
+ {isAdmin && ( + + Admin + + )}