Skip to content

Commit

Permalink
Add domain error message to admin/configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
sambecker committed Jun 20, 2024
1 parent 53941f6 commit 70e48ef
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions src/site/SiteChecklistClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 160,18 @@ export default function SiteChecklistClient({
</span>
</div>;

const renderConnectionError = (provider: string, error: string) =>
const renderError = ({
connection,
message,
}: {
connection?: { provider: string, error: string }
message?: string
}) =>
<ErrorNote size="small" className="mt-2 mb-3">
{provider} connection error: {`"${error}"`}
{connection && <>
{connection.provider} connection error: {`"${connection.error}"`}
</>}
{message}
</ErrorNote>;

return (
Expand All @@ -179,8 188,9 @@ export default function SiteChecklistClient({
status={hasDatabase}
isPending={hasDatabase && isTestingConnections}
>
{databaseError &&
renderConnectionError('Database', databaseError)}
{databaseError && renderError({
connection: { provider: 'Database', error: databaseError},
})}
{hasVercelPostgres
? renderSubStatus('checked', 'Vercel Postgres: connected')
: renderSubStatus('optional', <>
Expand Down Expand Up @@ -214,8 224,9 @@ export default function SiteChecklistClient({
status={hasStorageProvider}
isPending={hasStorageProvider && isTestingConnections}
>
{storageError &&
renderConnectionError('Storage', storageError)}
{storageError && renderError({
connection: { provider: 'Storage', error: storageError},
})}
{hasVercelBlobStorage
? renderSubStatus('checked', 'Vercel Blob: connected')
: renderSubStatus('optional', <>
Expand Down Expand Up @@ -299,9 310,14 @@ export default function SiteChecklistClient({
icon={<BiPencil size={16} />}
>
<ChecklistRow
title="Add custom domain"
title="Configure domain"
status={hasDomain}
>
{!hasDomain &&
renderError({message:
'Not configuring a domain may cause '
'certain features to behave unexpectedly',
})}
Store in environment variable (displayed in top-right nav):
{renderEnvVars(['NEXT_PUBLIC_SITE_DOMAIN'])}
</ChecklistRow>
Expand Down Expand Up @@ -339,8 355,9 @@ export default function SiteChecklistClient({
isPending={isAiTextGenerationEnabled && isTestingConnections}
optional
>
{aiError &&
renderConnectionError('OpenAI', aiError)}
{aiError && renderError({
connection: { provider: 'OpenAI', error: aiError},
})}
Store your OpenAI secret key in order to add experimental support
for AI-generated text descriptions and enable an invisible field
called {'"Semantic Description"'} used to support CMD-K search
Expand All @@ -354,8 371,9 @@ export default function SiteChecklistClient({
isPending={hasVercelKv && isTestingConnections}
optional
>
{kvError &&
renderConnectionError('Vercel KV', kvError)}
{kvError && renderError({
connection: { provider: 'Vercel KV', error: kvError},
})}
{renderLink(
// eslint-disable-next-line max-len
'https://vercel.com/docs/storage/vercel-kv/quickstart#create-a-kv-database',
Expand Down Expand Up @@ -521,15 539,15 @@ export default function SiteChecklistClient({
{!simplifiedView &&
<div className="text-dim before:content-['—']">
<div className="flex whitespace-nowrap">
<span className="font-bold">Base Url</span>
<span className="font-bold">Domain</span>
&nbsp;&nbsp;
<span className="w-full flex overflow-x-auto">
{baseUrl || 'Not Defined'}
</span>
</div>
<div>
<span className="font-bold">Commit</span>
&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;
{commitSha || 'Not Found'}
</div>
</div>}
Expand Down

0 comments on commit 70e48ef

Please sign in to comment.