diff --git a/src/components/CommandKClient.tsx b/src/components/CommandKClient.tsx index bc57c87c..d84de599 100644 --- a/src/components/CommandKClient.tsx +++ b/src/components/CommandKClient.tsx @@ -209,8 +209,8 @@ export default function CommandKClient({ action, }) => null); - const showAdminPages = Boolean(session?.user?.email); + const isAdminLoggedIn = Boolean(session?.user?.email); const SECTION_TAGS: CommandKSection = { heading: 'Tags', @@ -75,7 +77,7 @@ export default async function CommandK() { const SECTION_FILM: CommandKSection = { heading: 'Film Simulations', accessory: - + , items: filmSimulations.map(({ simulation, count }) => ({ label: simulation, @@ -94,23 +96,37 @@ export default async function CommandK() { }, { label: 'Grid', path:'/grid', - }] as CommandKSection['items']).concat(showAdminPages ? [{ - label: 'Admin / Photos', - annotation: , - path: PATH_ADMIN_PHOTOS, - }, { - label: 'Admin / Uploads', - annotation: , - path: PATH_ADMIN_UPLOADS, - }, { - label: 'Admin / Tags', - annotation: , - path: PATH_ADMIN_TAGS, - }, { - label: 'Admin / Config', - annotation: , - path: PATH_ADMIN_CONFIGURATION, - }] : []), + }]), + }; + + const SECTION_ADMIN: CommandKSection = { + heading: 'Admin', + accessory: , + items: isAdminLoggedIn + ? [{ + label: 'Manage Photos', + annotation: , + path: PATH_ADMIN_PHOTOS, + }, { + label: 'Manage Uploads', + annotation: , + path: PATH_ADMIN_UPLOADS, + }, { + label: 'Manage Tags', + annotation: , + path: PATH_ADMIN_TAGS, + }, { + label: 'App Config', + annotation: , + path: PATH_ADMIN_CONFIGURATION, + }, { + label: 'Sign Out', + action: signOutAction, + }] + : [{ + label: 'Sign In', + path: PATH_SIGN_IN, + }], }; return { 'use server';