From 87bd9ff5b1ff4a8de0098938093593291fadcddc Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Tue, 25 Feb 2025 23:52:59 -0600 Subject: [PATCH] Refine admin info/insights relationships --- src/admin/AdminInfoNav.tsx | 38 ++++++++++++++++++++-------- src/admin/AdminNavClient.tsx | 3 ++- src/components/more/MoreMenuItem.tsx | 4 +-- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/admin/AdminInfoNav.tsx b/src/admin/AdminInfoNav.tsx index b1718eb6..3495440a 100644 --- a/src/admin/AdminInfoNav.tsx +++ b/src/admin/AdminInfoNav.tsx @@ -6,9 +6,11 @@ import ResponsiveText from '@/components/primitives/ResponsiveText'; import clsx from 'clsx/lite'; import ClearCacheButton from '@/admin/ClearCacheButton'; import { usePathname } from 'next/navigation'; +import { useAppState } from '@/state/AppState'; +import { FaCircle } from 'react-icons/fa6'; const ADMIN_INFO_PAGES = [{ - titleShort: 'Insights', + title: 'Insights', path: PATH_ADMIN_INSIGHTS, }, { title: 'Configuration', @@ -16,6 +18,11 @@ const ADMIN_INFO_PAGES = [{ path: PATH_ADMIN_CONFIGURATION, }]; +const ADMIN_INFO_PAGE_WITHOUT_INSIGHTS = [{ + title: 'App Configuration', + path: PATH_ADMIN_CONFIGURATION, +}] as typeof ADMIN_INFO_PAGES; + export default function AdminInfoPage({ includeInsights, }: { @@ -23,20 +30,19 @@ export default function AdminInfoPage({ }) { const pathname = usePathname(); - const pages = ADMIN_INFO_PAGES - .filter(({ titleShort }) => ( - titleShort !== 'Insights' || - includeInsights - )); + const pages = includeInsights + ? ADMIN_INFO_PAGES + : ADMIN_INFO_PAGE_WITHOUT_INSIGHTS; const hasMultiplePages = pages.length > 1; + const { insightIndicatorStatus } = useAppState(); + return (
{pages .map(({ title, titleShort, path }) => @@ -44,18 +50,30 @@ export default function AdminInfoPage({ key={path} href={path} className={clsx( + 'relative', hasMultiplePages ? pathname === path - ? 'underline underline-offset-10 decoration-2' + ? 'font-medium' : 'text-dim' : undefined, 'px-1 py-0.5 rounded-md', + 'hover:text-main', )} - loadingClassName="bg-dim" + loadingClassName="bg-gray-200/50 dark:bg-gray-700/50" > - {title ?? titleShort} + {title} + {title === 'Insights' && insightIndicatorStatus && + } )}
diff --git a/src/admin/AdminNavClient.tsx b/src/admin/AdminNavClient.tsx index 9dd61e66..fd3458b9 100644 --- a/src/admin/AdminNavClient.tsx +++ b/src/admin/AdminNavClient.tsx @@ -81,8 +81,9 @@ export default function AdminNavClient({ 'flex gap-0.5', checkPathPrefix(pathname, href) ? 'font-bold' : 'text-dim', 'px-1 py-0.5 rounded-md', + 'hover:text-main', )} - loadingClassName="bg-dim" + loadingClassName="bg-gray-200/50 dark:bg-gray-700/50" prefetch={false} > {label} diff --git a/src/components/more/MoreMenuItem.tsx b/src/components/more/MoreMenuItem.tsx index eea7f47d..d623b972 100644 --- a/src/components/more/MoreMenuItem.tsx +++ b/src/components/more/MoreMenuItem.tsx @@ -47,8 +47,8 @@ export default function MoreMenuItem({