From 6ce564973e9f470ba9c861656229230a551a2e90 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sat, 15 Feb 2025 17:09:19 -0600 Subject: [PATCH] Improve insights layout on mobile --- src/admin/insights/AdminAppInsightsClient.tsx | 70 +++++++++---------- src/components/ScoreCardRow.tsx | 8 ++- tailwind.css | 4 ++ 3 files changed, 45 insertions(+), 37 deletions(-) diff --git a/src/admin/insights/AdminAppInsightsClient.tsx b/src/admin/insights/AdminAppInsightsClient.tsx index dba002dc..4c041e5e 100644 --- a/src/admin/insights/AdminAppInsightsClient.tsx +++ b/src/admin/insights/AdminAppInsightsClient.tsx @@ -53,7 +53,7 @@ const readmeAnchor = (anchor: string) => const renderLabeledEnvVar = (label: string, envVar: string, value = '1') =>
- + {label} @@ -213,6 +213,39 @@ export default function AdminAppInsightsClient({ in order prevent abuse by to enabling rate limiting. } />} + {(noStaticOptimization || debug) && } + content="Speed up page load times" + expandContent={<> + Dramatically improve load times by enabling static optimization + {' '} + on: +
+ {renderLabeledEnvVar( + 'Photo pages', + 'NEXT_PUBLIC_STATICALLY_OPTIMIZE_PHOTOS', + )} + {renderLabeledEnvVar( + 'Photo OG images', + 'NEXT_PUBLIC_STATICALLY_OPTIMIZE_PHOTO_OG_IMAGES', + )} + {renderLabeledEnvVar( + 'Category pages (tags, cameras, etc.)', + 'NEXT_PUBLIC_STATICALLY_OPTIMIZE_PHOTO_CATEGORIES', + )} + {renderLabeledEnvVar( + 'Category OG images', + 'NEXT_PUBLIC_STATICALLY_OPTIMIZE_PHOTO_CATEGORY_OG_IMAGES', + )} + + See {readmeAnchor('performance')} for cost considerations. + +
+ } + />} {(noAi || debug) && } content="Improve SEO + accessibility with AI" @@ -251,39 +284,6 @@ export default function AdminAppInsightsClient({ } />} - {(noStaticOptimization || debug) && } - content="Static optimization" - expandContent={<> - Enable static optimization - {' '} - by setting any of the following: -
- {renderLabeledEnvVar( - 'Pre-render photo pages', - 'NEXT_PUBLIC_STATICALLY_OPTIMIZE_PHOTOS', - )} - {renderLabeledEnvVar( - 'Pre-render OG image for each photo', - 'NEXT_PUBLIC_STATICALLY_OPTIMIZE_PHOTO_OG_IMAGES', - )} - {renderLabeledEnvVar( - 'Pre-render category pages (tags, cameras, etc.)', - 'NEXT_PUBLIC_STATICALLY_OPTIMIZE_PHOTO_CATEGORIES', - )} - {renderLabeledEnvVar( - 'Pre-render OG image for each category page', - 'NEXT_PUBLIC_STATICALLY_OPTIMIZE_PHOTO_CATEGORY_OG_IMAGES', - )} - - See {readmeAnchor('performance')} for cost considerations. - -
- } - />} } {(outdatedPhotos || debug) && } // eslint-disable-next-line max-len - content={`You have ${photosCountOutdated || DEBUG_PHOTOS_COUNT_OUTDATED} outdated ${(photosCountOutdated || DEBUG_PHOTOS_COUNT_OUTDATED) === 1 ? 'photo' : 'photos'}`} + content={`${photosCountOutdated || DEBUG_PHOTOS_COUNT_OUTDATED} outdated ${(photosCountOutdated || DEBUG_PHOTOS_COUNT_OUTDATED) === 1 ? 'photo' : 'photos'}`} expandPath={PATH_ADMIN_OUTDATED} />}
-
+
{content}
{isExpanded && -
+
{expandContent}
}
diff --git a/tailwind.css b/tailwind.css index a4d64d75..ee234e00 100644 --- a/tailwind.css +++ b/tailwind.css @@ -141,6 +141,10 @@ @apply bg-white dark:bg-black } +@utility bg-medium { + @apply + bg-gray-200 dark:bg-gray-700 +} @utility bg-dim { @apply bg-gray-100 dark:bg-gray-900/75