From 272d57bec500ecbac7368c55fb677bdbed6c0c5e Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sat, 20 Sep 2025 19:35:07 -0500 Subject: [PATCH] Clarify env var insight recommendations --- src/admin/insights/AdminAppInsightsClient.tsx | 79 ++++++++++++------- src/admin/insights/index.ts | 8 +- 2 files changed, 55 insertions(+), 32 deletions(-) diff --git a/src/admin/insights/AdminAppInsightsClient.tsx b/src/admin/insights/AdminAppInsightsClient.tsx index a759d2eb..cc0066df 100644 --- a/src/admin/insights/AdminAppInsightsClient.tsx +++ b/src/admin/insights/AdminAppInsightsClient.tsx @@ -62,12 +62,21 @@ const readmeAnchor = (anchor: string) => README/{anchor} ; -const renderLabeledEnvVar = (label: string, envVar: string, value?: string) => +const renderLabeledEnvVar = ( + label: string, + variable: string, + value?: string, + icon?: ReactNode, +) =>
{label} - + {icon + ?
+ {icon} +
+ :}
; const renderHighlightText = ( @@ -87,6 +96,21 @@ const renderHighlightText = ( {text} ; +const renderWarningIconLarge = + ; + +const renderWarningIconSmall = + ; + export default function AdminAppInsightsClient({ codeMeta, insights, @@ -118,7 +142,8 @@ export default function AdminAppInsightsClient({ noAi, noAiRateLimiting, noConfiguredDomain, - noConfiguredMeta, + noConfiguredMetaTitle, + noConfiguredMetaDescription, photosNeedSync, photoMatting, gridFirst, @@ -257,13 +282,7 @@ export default function AdminAppInsightsClient({ {(hasTemplateRecommendations(insights) || debug) ? <> {(deprecatedEnvVars || debug) && } + icon={renderWarningIconLarge} content={isExpanded => renderHighlightText( 'Update environment variables', 'yellow', @@ -282,7 +301,13 @@ export default function AdminAppInsightsClient({ )} direction="horizontal" > -
{old}
+
+ {renderWarningIconSmall} + {old} +
} />} {(noAiRateLimiting || debug) && } + icon={renderWarningIconLarge} content={isExpanded => renderHighlightText( 'Enable AI rate limiting', 'yellow', @@ -313,13 +332,7 @@ export default function AdminAppInsightsClient({ } />} {(noConfiguredDomain || debug) && } + icon={renderWarningIconLarge} content={isExpanded => renderHighlightText( 'Configure domain', 'yellow', @@ -335,7 +348,11 @@ export default function AdminAppInsightsClient({ /> } />} - {(noConfiguredMeta || debug) && - {renderLabeledEnvVar( + {( + noConfiguredMetaTitle || + debug + ) && renderLabeledEnvVar( 'Site title', 'NEXT_PUBLIC_META_TITLE', )} - {renderLabeledEnvVar( + {( + noConfiguredMetaDescription || + debug + ) && renderLabeledEnvVar( 'Site description', 'NEXT_PUBLIC_META_DESCRIPTION', )} diff --git a/src/admin/insights/index.ts b/src/admin/insights/index.ts index c22f33e7..1320d171 100644 --- a/src/admin/insights/index.ts +++ b/src/admin/insights/index.ts @@ -30,7 +30,8 @@ const _INSIGHTS_TEMPLATE = [ 'noAi', 'noAiRateLimiting', 'noConfiguredDomain', - 'noConfiguredMeta', + 'noConfiguredMetaTitle', + 'noConfiguredMetaDescription', 'photoMatting', 'gridFirst', 'noStaticOptimization', @@ -137,9 +138,8 @@ export const getAllInsights = ({ ...getSignificantInsights({ codeMeta, photosCountNeedSync }), noFork: !codeMeta?.isForkedFromBase && !codeMeta?.isBaseRepo, noAi: !AI_CONTENT_GENERATION_ENABLED, - noConfiguredMeta: - !IS_META_TITLE_CONFIGURED || - !IS_META_DESCRIPTION_CONFIGURED, + noConfiguredMetaTitle: !IS_META_TITLE_CONFIGURED, + noConfiguredMetaDescription: !IS_META_DESCRIPTION_CONFIGURED, photoMatting: photosCountPortrait > 0 && !MATTE_PHOTOS, gridFirst: ( photosCount >= BASIC_PHOTO_INSTALLATION_COUNT &&