diff --git a/src/admin/AdminInfoNav.tsx b/src/admin/AdminInfoNav.tsx index a3f821d5..4da02174 100644 --- a/src/admin/AdminInfoNav.tsx +++ b/src/admin/AdminInfoNav.tsx @@ -1,13 +1,13 @@ 'use client'; import { PATH_ADMIN_CONFIGURATION, PATH_ADMIN_INSIGHTS } from '@/app/paths'; -import LinkWithStatus from '@/components/LinkWithStatus'; 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 InsightsIndicatorDot from './insights/InsightsIndicatorDot'; +import LinkWithLoaderBadge from '@/components/LinkWithLoaderBadge'; const ADMIN_INFO_PAGES = [{ title: 'App Insights', @@ -47,7 +47,7 @@ export default function AdminInfoPage({ )}> {pages .map(({ title, titleShort, path }) => - {title} @@ -71,7 +69,7 @@ export default function AdminInfoPage({ top={4} right={-2} />} - )} + )} diff --git a/src/admin/AdminNavClient.tsx b/src/admin/AdminNavClient.tsx index b8bbe0e0..2a5d6923 100644 --- a/src/admin/AdminNavClient.tsx +++ b/src/admin/AdminNavClient.tsx @@ -1,6 +1,6 @@ 'use client'; -import LinkWithLoader from '@/components/LinkWithLoader'; +import LinkWithIconLoader from '@/components/LinkWithIconLoader'; import Note from '@/components/Note'; import AppGrid from '@/components/AppGrid'; import Spinner from '@/components/Spinner'; @@ -21,7 +21,7 @@ import AdminAppInfoIcon from './AdminAppInfoIcon'; import AdminInfoNav from './AdminInfoNav'; import LinkWithLoaderBadge from '@/components/LinkWithLoaderBadge'; -// Updates considered recent if they occurred in past 5 minutes +// Updates from past 5 minutes considered recent const areTimesRecent = (dates: Date[]) => dates .some(date => differenceInMinutes(new Date(), date) < 5); @@ -89,17 +89,16 @@ export default function AdminNavClient({ ({count})} )} - } loader={} - > - - + /> {shouldShowBanner && }> diff --git a/src/components/LinkWithLoader.tsx b/src/components/LinkWithIconLoader.tsx similarity index 63% rename from src/components/LinkWithLoader.tsx rename to src/components/LinkWithIconLoader.tsx index c9312f75..39294a11 100644 --- a/src/components/LinkWithLoader.tsx +++ b/src/components/LinkWithIconLoader.tsx @@ -1,25 +1,28 @@ import { ComponentProps, ReactNode } from 'react'; import LinkWithStatus from './LinkWithStatus'; import clsx from 'clsx/lite'; -import Link from 'next/link'; -export default function LinkWithLoader({ +export default function LinkWithIconLoader({ + className, + icon, loader, - children, debugLoading, ...props -}: ComponentProps & { +}: Omit, 'children'> & { + icon: ReactNode loader: ReactNode - debugLoading?: boolean }) { return ( - + {({ isLoading }) => <> - {children} + {icon} {(isLoading || debugLoading) && ) { +}: ComponentProps & { + offsetPadding?: boolean +}) { return ( () => clearTimeouts(), [clearTimeouts]); return , - }}> - {renderIcon()} - + }} /> :
{renderIcon()}
diff --git a/src/components/primitives/EntityLink.tsx b/src/components/primitives/EntityLink.tsx index 8e9a38f6..0ea09ff1 100644 --- a/src/components/primitives/EntityLink.tsx +++ b/src/components/primitives/EntityLink.tsx @@ -68,7 +68,7 @@ export default function EntityLink({ return ( {/* Meta */} -
-
- {hasTitle && (showTitleAsH1 - ?

{renderPhotoLink}

- : renderPhotoLink)} -
- -
+
+
+
+ {hasTitle && (showTitleAsH1 + ?

{renderPhotoLink}

+ : renderPhotoLink)}
{photo.caption &&
{ + + const linkProps: + Omit, 'children'> | + undefined = photo + ? { + className, + href: pathForPhoto({ photo, ...categories }), + onClick: () => { if (nextPhotoAnimation) { setNextPhotoAnimation?.(nextPhotoAnimation); } - }} - className={className} - scroll={scroll} - > - {children ?? titleForPhoto(photo)} - + }, + scroll, + prefetch, + } + : undefined; + + const children = photo + ? (_children ?? titleForPhoto(photo)) + : _children; + + return ( + photo && linkProps + ? loaderType === 'spinner' + ? + {({ isLoading }) => <> + {children} + {isLoading && <> +   + } + } + + : + {children} + : - {children ?? (photo ? titleForPhoto(photo) : undefined)} + {children} ); }; diff --git a/src/photo/PhotoPrevNext.tsx b/src/photo/PhotoPrevNext.tsx index 861c4d8c..4ac73b50 100644 --- a/src/photo/PhotoPrevNext.tsx +++ b/src/photo/PhotoPrevNext.tsx @@ -85,21 +85,21 @@ export default function PhotoPrevNext({ className, )}>
- + PREV @@ -108,14 +108,12 @@ export default function PhotoPrevNext({ - + NEXT