Clarify env var insight recommendations
This commit is contained in:
parent
5140addc8d
commit
272d57bec5
@ -62,12 +62,21 @@ const readmeAnchor = (anchor: string) =>
|
|||||||
README/{anchor}
|
README/{anchor}
|
||||||
</AdminLink>;
|
</AdminLink>;
|
||||||
|
|
||||||
const renderLabeledEnvVar = (label: string, envVar: string, value?: string) =>
|
const renderLabeledEnvVar = (
|
||||||
|
label: string,
|
||||||
|
variable: string,
|
||||||
|
value?: string,
|
||||||
|
icon?: ReactNode,
|
||||||
|
) =>
|
||||||
<div className="flex flex-col gap-0.5">
|
<div className="flex flex-col gap-0.5">
|
||||||
<span className="text-xs uppercase font-medium tracking-wider">
|
<span className="text-xs uppercase font-medium tracking-wider">
|
||||||
{label}
|
{label}
|
||||||
</span>
|
</span>
|
||||||
<EnvVar variable={envVar} value={value} />
|
{icon
|
||||||
|
? <div className="flex items-center gap-1">
|
||||||
|
{icon} <EnvVar {...{ variable, value }} />
|
||||||
|
</div>
|
||||||
|
:<EnvVar {...{ variable, value }} />}
|
||||||
</div>;
|
</div>;
|
||||||
|
|
||||||
const renderHighlightText = (
|
const renderHighlightText = (
|
||||||
@ -87,6 +96,21 @@ const renderHighlightText = (
|
|||||||
{text}
|
{text}
|
||||||
</span>;
|
</span>;
|
||||||
|
|
||||||
|
const renderWarningIconLarge =
|
||||||
|
<PiWarningBold
|
||||||
|
size={17}
|
||||||
|
className={clsx(
|
||||||
|
'translate-x-[0.5px]',
|
||||||
|
TEXT_COLOR_WARNING,
|
||||||
|
)}
|
||||||
|
/>;
|
||||||
|
|
||||||
|
const renderWarningIconSmall =
|
||||||
|
<PiWarningBold
|
||||||
|
size={14}
|
||||||
|
className="translate-y-[0.5px] text-extra-dim"
|
||||||
|
/>;
|
||||||
|
|
||||||
export default function AdminAppInsightsClient({
|
export default function AdminAppInsightsClient({
|
||||||
codeMeta,
|
codeMeta,
|
||||||
insights,
|
insights,
|
||||||
@ -118,7 +142,8 @@ export default function AdminAppInsightsClient({
|
|||||||
noAi,
|
noAi,
|
||||||
noAiRateLimiting,
|
noAiRateLimiting,
|
||||||
noConfiguredDomain,
|
noConfiguredDomain,
|
||||||
noConfiguredMeta,
|
noConfiguredMetaTitle,
|
||||||
|
noConfiguredMetaDescription,
|
||||||
photosNeedSync,
|
photosNeedSync,
|
||||||
photoMatting,
|
photoMatting,
|
||||||
gridFirst,
|
gridFirst,
|
||||||
@ -257,13 +282,7 @@ export default function AdminAppInsightsClient({
|
|||||||
{(hasTemplateRecommendations(insights) || debug)
|
{(hasTemplateRecommendations(insights) || debug)
|
||||||
? <>
|
? <>
|
||||||
{(deprecatedEnvVars || debug) && <ScoreCardRow
|
{(deprecatedEnvVars || debug) && <ScoreCardRow
|
||||||
icon={<PiWarningBold
|
icon={renderWarningIconLarge}
|
||||||
size={17}
|
|
||||||
className={clsx(
|
|
||||||
'translate-x-[0.5px]',
|
|
||||||
TEXT_COLOR_WARNING,
|
|
||||||
)}
|
|
||||||
/>}
|
|
||||||
content={isExpanded => renderHighlightText(
|
content={isExpanded => renderHighlightText(
|
||||||
'Update environment variables',
|
'Update environment variables',
|
||||||
'yellow',
|
'yellow',
|
||||||
@ -282,7 +301,13 @@ export default function AdminAppInsightsClient({
|
|||||||
)}
|
)}
|
||||||
direction="horizontal"
|
direction="horizontal"
|
||||||
>
|
>
|
||||||
<div className="text-xs font-medium">{old}</div>
|
<div className={clsx(
|
||||||
|
'inline-flex items-center gap-1.5',
|
||||||
|
'text-xs font-medium',
|
||||||
|
)}>
|
||||||
|
{renderWarningIconSmall}
|
||||||
|
{old}
|
||||||
|
</div>
|
||||||
<FaArrowRight
|
<FaArrowRight
|
||||||
size={11}
|
size={11}
|
||||||
className="shrink-0 text-extra-dim"
|
className="shrink-0 text-extra-dim"
|
||||||
@ -294,13 +319,7 @@ export default function AdminAppInsightsClient({
|
|||||||
</div>}
|
</div>}
|
||||||
/>}
|
/>}
|
||||||
{(noAiRateLimiting || debug) && <ScoreCardRow
|
{(noAiRateLimiting || debug) && <ScoreCardRow
|
||||||
icon={<PiWarningBold
|
icon={renderWarningIconLarge}
|
||||||
size={17}
|
|
||||||
className={clsx(
|
|
||||||
'translate-x-[0.5px]',
|
|
||||||
TEXT_COLOR_WARNING,
|
|
||||||
)}
|
|
||||||
/>}
|
|
||||||
content={isExpanded => renderHighlightText(
|
content={isExpanded => renderHighlightText(
|
||||||
'Enable AI rate limiting',
|
'Enable AI rate limiting',
|
||||||
'yellow',
|
'yellow',
|
||||||
@ -313,13 +332,7 @@ export default function AdminAppInsightsClient({
|
|||||||
</>}
|
</>}
|
||||||
/>}
|
/>}
|
||||||
{(noConfiguredDomain || debug) && <ScoreCardRow
|
{(noConfiguredDomain || debug) && <ScoreCardRow
|
||||||
icon={<PiWarningBold
|
icon={renderWarningIconLarge}
|
||||||
size={17}
|
|
||||||
className={clsx(
|
|
||||||
'translate-x-[0.5px]',
|
|
||||||
TEXT_COLOR_WARNING,
|
|
||||||
)}
|
|
||||||
/>}
|
|
||||||
content={isExpanded => renderHighlightText(
|
content={isExpanded => renderHighlightText(
|
||||||
'Configure domain',
|
'Configure domain',
|
||||||
'yellow',
|
'yellow',
|
||||||
@ -335,7 +348,11 @@ export default function AdminAppInsightsClient({
|
|||||||
/>
|
/>
|
||||||
</>}
|
</>}
|
||||||
/>}
|
/>}
|
||||||
{(noConfiguredMeta || debug) && <ScoreCardRow
|
{(
|
||||||
|
noConfiguredMetaTitle ||
|
||||||
|
noConfiguredMetaDescription ||
|
||||||
|
debug
|
||||||
|
) && <ScoreCardRow
|
||||||
icon={<HiOutlineDocumentText
|
icon={<HiOutlineDocumentText
|
||||||
size={18}
|
size={18}
|
||||||
className="translate-x-[1px] translate-y-[-1px]"
|
className="translate-x-[1px] translate-y-[-1px]"
|
||||||
@ -346,11 +363,17 @@ export default function AdminAppInsightsClient({
|
|||||||
and site description (visible in search results):
|
and site description (visible in search results):
|
||||||
{' '}
|
{' '}
|
||||||
<div className="flex flex-col gap-y-4 mt-3">
|
<div className="flex flex-col gap-y-4 mt-3">
|
||||||
{renderLabeledEnvVar(
|
{(
|
||||||
|
noConfiguredMetaTitle ||
|
||||||
|
debug
|
||||||
|
) && renderLabeledEnvVar(
|
||||||
'Site title',
|
'Site title',
|
||||||
'NEXT_PUBLIC_META_TITLE',
|
'NEXT_PUBLIC_META_TITLE',
|
||||||
)}
|
)}
|
||||||
{renderLabeledEnvVar(
|
{(
|
||||||
|
noConfiguredMetaDescription ||
|
||||||
|
debug
|
||||||
|
) && renderLabeledEnvVar(
|
||||||
'Site description',
|
'Site description',
|
||||||
'NEXT_PUBLIC_META_DESCRIPTION',
|
'NEXT_PUBLIC_META_DESCRIPTION',
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -30,7 +30,8 @@ const _INSIGHTS_TEMPLATE = [
|
|||||||
'noAi',
|
'noAi',
|
||||||
'noAiRateLimiting',
|
'noAiRateLimiting',
|
||||||
'noConfiguredDomain',
|
'noConfiguredDomain',
|
||||||
'noConfiguredMeta',
|
'noConfiguredMetaTitle',
|
||||||
|
'noConfiguredMetaDescription',
|
||||||
'photoMatting',
|
'photoMatting',
|
||||||
'gridFirst',
|
'gridFirst',
|
||||||
'noStaticOptimization',
|
'noStaticOptimization',
|
||||||
@ -137,9 +138,8 @@ export const getAllInsights = ({
|
|||||||
...getSignificantInsights({ codeMeta, photosCountNeedSync }),
|
...getSignificantInsights({ codeMeta, photosCountNeedSync }),
|
||||||
noFork: !codeMeta?.isForkedFromBase && !codeMeta?.isBaseRepo,
|
noFork: !codeMeta?.isForkedFromBase && !codeMeta?.isBaseRepo,
|
||||||
noAi: !AI_CONTENT_GENERATION_ENABLED,
|
noAi: !AI_CONTENT_GENERATION_ENABLED,
|
||||||
noConfiguredMeta:
|
noConfiguredMetaTitle: !IS_META_TITLE_CONFIGURED,
|
||||||
!IS_META_TITLE_CONFIGURED ||
|
noConfiguredMetaDescription: !IS_META_DESCRIPTION_CONFIGURED,
|
||||||
!IS_META_DESCRIPTION_CONFIGURED,
|
|
||||||
photoMatting: photosCountPortrait > 0 && !MATTE_PHOTOS,
|
photoMatting: photosCountPortrait > 0 && !MATTE_PHOTOS,
|
||||||
gridFirst: (
|
gridFirst: (
|
||||||
photosCount >= BASIC_PHOTO_INSTALLATION_COUNT &&
|
photosCount >= BASIC_PHOTO_INSTALLATION_COUNT &&
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user