Hide insights when are aren't photos

This commit is contained in:
Sam Becker 2025-02-15 22:54:12 -06:00
parent 3afafb47a4
commit b9baf65bf9
2 changed files with 21 additions and 12 deletions

View File

@ -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 (
<AdminNavClient {...{ items, mostRecentPhotoUpdateTime }} />
<AdminNavClient {...{
items,
mostRecentPhotoUpdateTime,
includeInsights,
}} />
);
}

View File

@ -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({
</LinkWithStatus>)}
</div>
<div className="flex gap-3">
<LinkWithLoader
href={PATH_ADMIN_INSIGHTS}
className={clsx(
'translate-y-[-2px]',
isPathAdminInsights(pathname)
? 'font-bold'
: 'text-dim')}
loader={<Spinner className="translate-y-[1px]" />}
>
<AdminAppInsightsIcon />
</LinkWithLoader>
{includeInsights &&
<LinkWithLoader
href={PATH_ADMIN_INSIGHTS}
className={clsx(
'translate-y-[-2px]',
isPathAdminInsights(pathname)
? 'font-bold'
: 'text-dim')}
loader={<Spinner className="translate-y-[1px]" />}
>
<AdminAppInsightsIcon />
</LinkWithLoader>}
<LinkWithLoader
href={PATH_ADMIN_CONFIGURATION}
className={isPathAdminConfiguration(pathname)