From aaa4537e7014f9d02ebdcb899a58c5f9a18be1ed Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Fri, 28 Feb 2025 21:44:45 -0600 Subject: [PATCH] Downgrade outdated photos warning --- src/admin/AdminOutdatedClient.tsx | 2 +- src/admin/AdminPhotosClient.tsx | 32 ++++++++++++------- src/admin/AdminPhotosTable.tsx | 2 +- src/admin/insights/AdminAppInsightsClient.tsx | 13 ++++---- src/admin/insights/server.ts | 5 +-- src/components/Container.tsx | 4 +-- src/components/Spinner.tsx | 4 ++- src/components/primitives/LoaderButton.tsx | 7 +++- .../primitives/PathLoaderButton.tsx | 3 +- 9 files changed, 46 insertions(+), 26 deletions(-) diff --git a/src/admin/AdminOutdatedClient.tsx b/src/admin/AdminOutdatedClient.tsx index d171c7c0..89678fe7 100644 --- a/src/admin/AdminOutdatedClient.tsx +++ b/src/admin/AdminOutdatedClient.tsx @@ -79,7 +79,7 @@ export default function AdminOutdatedClient({ >
} >
diff --git a/src/admin/AdminPhotosClient.tsx b/src/admin/AdminPhotosClient.tsx index 78b23bff..97a78581 100644 --- a/src/admin/AdminPhotosClient.tsx +++ b/src/admin/AdminPhotosClient.tsx @@ -52,17 +52,27 @@ export default function AdminPhotosClient({ onLastUpload={onLastUpload} />
- {photosCountOutdated > 0 && } - title={`${photosCountOutdated} Outdated Photos`} - className={clsx( - isUploading && 'hidden md:inline-flex', - )} - hideTextOnMobile={false} - > - {photosCountOutdated} - } + {photosCountOutdated > 0 && + } + title={`${photosCountOutdated} Outdated Photos`} + className={clsx( + 'text-blue-600 dark:text-blue-400', + 'border border-blue-200 dark:border-blue-800/60', + 'active:bg-blue-50 dark:active:bg-blue-950/50', + 'disabled:bg-blue-50 dark:disabled:bg-blue-950/50', + isUploading && 'hidden md:inline-flex', + )} + spinnerColor="text" + spinnerClassName="text-blue-200 dark:text-blue-600/40" + hideTextOnMobile={false} + > + {photosCountOutdated} + }
{blobPhotoUrls.length > 0 &&
{canEdit && } diff --git a/src/admin/insights/AdminAppInsightsClient.tsx b/src/admin/insights/AdminAppInsightsClient.tsx index ec4ddc14..855c0599 100644 --- a/src/admin/insights/AdminAppInsightsClient.tsx +++ b/src/admin/insights/AdminAppInsightsClient.tsx @@ -46,7 +46,8 @@ const DEBUG_COMMIT_MESSAGE = 'Long commit message for debugging purposes'; const DEBUG_BEHIND_BY = 9; const DEBUG_PHOTOS_COUNT_OUTDATED = 7; -const WARNING_TEXT_COLOR = 'text-amber-600 dark:text-amber-500'; +const TEXT_COLOR_WARNING = 'text-amber-600 dark:text-amber-500'; +const TEXT_COLOR_BLUE = 'text-blue-600 dark:text-blue-500'; const readmeAnchor = (anchor: string) => @@ -128,7 +129,7 @@ export default function AdminAppInsightsClient({ } content={<> Could not analyze source code @@ -239,7 +240,7 @@ export default function AdminAppInsightsClient({ size={17} className={clsx( 'translate-x-[0.5px]', - WARNING_TEXT_COLOR, + TEXT_COLOR_WARNING, )} />} content={isExpanded => renderHighlightText( @@ -258,7 +259,7 @@ export default function AdminAppInsightsClient({ size={17} className={clsx( 'translate-x-[0.5px]', - WARNING_TEXT_COLOR, + TEXT_COLOR_WARNING, )} />} content={isExpanded => renderHighlightText( @@ -359,7 +360,7 @@ export default function AdminAppInsightsClient({ size={19} className={clsx( 'translate-y-[-2px]', - WARNING_TEXT_COLOR, + TEXT_COLOR_BLUE, )} />} content={renderHighlightText( @@ -367,7 +368,7 @@ export default function AdminAppInsightsClient({ photosCountOutdated || DEBUG_PHOTOS_COUNT_OUTDATED, 'outdated photo', ), - 'yellow', + 'blue', )} expandPath={PATH_ADMIN_OUTDATED} />} diff --git a/src/admin/insights/server.ts b/src/admin/insights/server.ts index b721d3b6..5090b12f 100644 --- a/src/admin/insights/server.ts +++ b/src/admin/insights/server.ts @@ -14,15 +14,16 @@ export const getShouldShowInsightsIndicator = async () => { const { forkBehind, noAiRateLimiting, + noConfiguredDomain, outdatedPhotos, } = getSignificantInsights({ codeMeta, photosCountOutdated, }); - if (noAiRateLimiting || outdatedPhotos) { + if (noAiRateLimiting || noConfiguredDomain) { return 'yellow'; - } else if (forkBehind) { + } else if (forkBehind || outdatedPhotos) { return 'blue'; } }; diff --git a/src/components/Container.tsx b/src/components/Container.tsx index fc4ae3c0..761217d6 100644 --- a/src/components/Container.tsx +++ b/src/components/Container.tsx @@ -33,8 +33,8 @@ export default function Container({ 'border border-gray-200 dark:border-gray-800', ]; case 'blue': return [ - 'text-blue-900 dark:text-blue-300', - 'bg-blue-100/35 dark:bg-blue-950/60', + 'text-blue-800 dark:text-blue-400', + 'bg-blue-50 dark:bg-blue-950/50', ]; case 'red': return [ 'text-red-700 dark:text-red-400', diff --git a/src/components/Spinner.tsx b/src/components/Spinner.tsx index e73cd407..1b253281 100644 --- a/src/components/Spinner.tsx +++ b/src/components/Spinner.tsx @@ -2,7 +2,7 @@ import { clsx } from 'clsx/lite'; const SIZE_DEFAULT = 12; -export type SpinnerColor = 'text' | 'dim' | 'light-gray'; +export type SpinnerColor = 'text' | 'dim' | 'light-gray' | 'semi-transparent'; export default function Spinner({ size = SIZE_DEFAULT, @@ -21,6 +21,8 @@ export default function Spinner({ 'text-gray-300 dark:text-gray-600', color === 'dim' && 'text-dim', + color === 'semi-transparent' && + 'text-black/20 dark:text-white/20', className, )} style={{ diff --git a/src/components/primitives/LoaderButton.tsx b/src/components/primitives/LoaderButton.tsx index 30e8eae3..fa105096 100644 --- a/src/components/primitives/LoaderButton.tsx +++ b/src/components/primitives/LoaderButton.tsx @@ -8,6 +8,7 @@ export default function LoaderButton(props: { isLoading?: boolean icon?: ReactNode spinnerColor?: SpinnerColor + spinnerClassName?: string styleAs?: 'button' | 'link' | 'link-without-hover' hideTextOnMobile?: boolean confirmText?: string @@ -20,6 +21,7 @@ export default function LoaderButton(props: { isLoading, icon, spinnerColor, + spinnerClassName, styleAs = 'button', hideTextOnMobile = true, confirmText, @@ -71,7 +73,10 @@ export default function LoaderButton(props: { ? : icon} } diff --git a/src/components/primitives/PathLoaderButton.tsx b/src/components/primitives/PathLoaderButton.tsx index 27a4efa8..cd15085c 100644 --- a/src/components/primitives/PathLoaderButton.tsx +++ b/src/components/primitives/PathLoaderButton.tsx @@ -10,6 +10,7 @@ export default function PathLoaderButton({ loaderDelay = 100, shouldScroll = true, shouldReplace, + isLoading, children, ...props }: { @@ -54,7 +55,7 @@ export default function PathLoaderButton({ } }); }} - isLoading={shouldShowLoader} + isLoading={shouldShowLoader || isLoading} > {children}