From b9baf65bf9991ccccd2492c8d511956741ff2c25 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sat, 15 Feb 2025 22:54:12 -0600 Subject: [PATCH] Hide insights when are aren't photos --- src/admin/AdminNav.tsx | 8 +++++++- src/admin/AdminNavClient.tsx | 25 ++++++++++++++----------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/admin/AdminNav.tsx b/src/admin/AdminNav.tsx index aa1110da..ceef18c9 100644 --- a/src/admin/AdminNav.tsx +++ b/src/admin/AdminNav.tsx @@ -31,6 +31,8 @@ export default async function AdminNav() { getPhotosMostRecentUpdateCached().catch(() => undefined), ]); + const includeInsights = countPhotos > 0; + // Photos const items = [{ label: 'Photos', @@ -53,6 +55,10 @@ export default async function AdminNav() { }); } return ( - + ); } diff --git a/src/admin/AdminNavClient.tsx b/src/admin/AdminNavClient.tsx index c90063c6..b112dc3e 100644 --- a/src/admin/AdminNavClient.tsx +++ b/src/admin/AdminNavClient.tsx @@ -29,6 +29,7 @@ const areTimesRecent = (dates: Date[]) => dates export default function AdminNavClient({ items, mostRecentPhotoUpdateTime, + includeInsights, }: { items: { label: string, @@ -36,6 +37,7 @@ export default function AdminNavClient({ count: number, }[] mostRecentPhotoUpdateTime?: Date + includeInsights?: boolean }) { const pathname = usePathname(); @@ -90,17 +92,18 @@ export default function AdminNavClient({ )}
- } - > - - + {includeInsights && + } + > + + }