'use client'; import { useTransition } from 'react'; import { useRouter } from 'next/navigation'; import { cc } from '@/utility/css'; import ChecklistRow from '../components/ChecklistRow'; import { FiCheckSquare, FiExternalLink } from 'react-icons/fi'; import { BiCog, BiCopy, BiData, BiLockAlt, BiPencil, BiRefresh, } from 'react-icons/bi'; import IconButton from '@/components/IconButton'; import { toast } from 'sonner'; import InfoBlock from '@/components/InfoBlock'; import Checklist from '@/components/Checklist'; export default function SiteChecklistClient({ hasPostgres, hasBlob, hasAuth, hasAdminUser, hasTitle, hasDomain, showRepoLink, isProModeEnabled, isPublicApiEnabled, isOgTextBottomAligned, showRefreshButton, secret, }: { hasPostgres: boolean hasBlob: boolean hasAuth: boolean hasAdminUser: boolean hasTitle: boolean hasDomain: boolean showRepoLink: boolean isProModeEnabled: boolean isPublicApiEnabled: boolean isOgTextBottomAligned: boolean showRefreshButton?: boolean secret: string }) { const router = useRouter(); const [isPendingPage, startTransitionPage] = useTransition(); const [isPendingSecret, startTransitionSecret] = useTransition(); const refreshPage = () => { startTransitionPage(router.refresh); }; const refreshSecret = () => { startTransitionSecret(router.refresh); }; const renderLink = (href: string, text: string, external = true) => <> {text} {external && <>   } ; const renderCopyButton = (label: string, text: string, subtle?: boolean) => } className={cc(subtle && 'text-gray-300 dark:text-gray-700')} onClick={() => { navigator.clipboard.writeText(text); toast( `${label} copied to clipboard`, { icon: , duration: 4000, }, ); }} />; const renderEnvVar = (variable: string) =>
`{variable}` {renderCopyButton(variable, variable, true)}
; const renderEnvVars = (variables: string[]) =>
{variables.map(renderEnvVar)}
; return (
} > {renderLink( 'https://vercel.com/docs/storage/vercel-postgres/quickstart', 'Create Vercel Postgres store', )} {' '} and connect to project {renderLink( 'https://vercel.com/docs/storage/vercel-blob/quickstart', 'Create Vercel Blob store', )} {' '} and connect to project } > Store auth secret in environment variable:
{secret}
{renderCopyButton('Secret', secret)} } onClick={refreshSecret} isLoading={isPendingSecret} spinnerColor="text" />
{renderEnvVars(['AUTH_SECRET'])}
Store admin email/password {' '} in environment variables: {renderEnvVars([ 'ADMIN_EMAIL', 'ADMIN_PASSWORD', ])}
} > Store in environment variable (used in page titles): {renderEnvVars(['NEXT_PUBLIC_SITE_TITLE'])} Store in environment variable (displayed in top-right nav): {renderEnvVars(['NEXT_PUBLIC_SITE_DOMAIN'])} } > Set environment variable to {'"1"'} to hide footer link: {renderEnvVars(['NEXT_PUBLIC_HIDE_REPO_LINK'])} Set environment variable to {'"1"'} to enable higher quality image storage: {renderEnvVars(['NEXT_PUBLIC_PRO_MODE'])} Set environment variable to {'"1"'} to enable a public API available at /api: {renderEnvVars(['NEXT_PUBLIC_PUBLIC_API'])} Set environment variable to {'"BOTTOM"'} to keep OG image text bottom aligned (default is top): {renderEnvVars(['NEXT_PUBLIC_OG_TEXT_ALIGNMENT'])} {showRefreshButton &&
}
Changes to environment variables require a redeploy or reboot of local dev server
); }