Hide insights when are aren't photos
This commit is contained in:
parent
3afafb47a4
commit
b9baf65bf9
@ -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,
|
||||
}} />
|
||||
);
|
||||
}
|
||||
|
||||
@ -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,6 +92,7 @@ export default function AdminNavClient({
|
||||
</LinkWithStatus>)}
|
||||
</div>
|
||||
<div className="flex gap-3">
|
||||
{includeInsights &&
|
||||
<LinkWithLoader
|
||||
href={PATH_ADMIN_INSIGHTS}
|
||||
className={clsx(
|
||||
@ -100,7 +103,7 @@ export default function AdminNavClient({
|
||||
loader={<Spinner className="translate-y-[1px]" />}
|
||||
>
|
||||
<AdminAppInsightsIcon />
|
||||
</LinkWithLoader>
|
||||
</LinkWithLoader>}
|
||||
<LinkWithLoader
|
||||
href={PATH_ADMIN_CONFIGURATION}
|
||||
className={isPathAdminConfiguration(pathname)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user