Improve the way this is hidden

This commit is contained in:
2026-01-23 20:06:10 -07:00
parent fa6920403f
commit 131e34dbe8

View File

@@ -20,6 +20,7 @@ export default function CaptchaCodePage () {
<p className='mb-4 px-8 -mt-2 text-center'> <p className='mb-4 px-8 -mt-2 text-center'>
Verify you are human to get a code Verify you are human to get a code
</p> </p>
{result == -1 && (
<Turnstile <Turnstile
siteKey={process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY ?? ''} siteKey={process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY ?? ''}
onSuccess={async token => { onSuccess={async token => {
@@ -44,9 +45,9 @@ export default function CaptchaCodePage () {
} }
}} }}
onError={() => setResult(1)} onError={() => setResult(1)}
hidden={result != -1}
className='flex justify-center' className='flex justify-center'
/> />
)}
<p className='mt-2 -mb-2 text-center text-sm' hidden={result == -1}> <p className='mt-2 -mb-2 text-center text-sm' hidden={result == -1}>
{result == 0 {result == 0
? 'Getting verification code...' ? 'Getting verification code...'
@@ -57,9 +58,10 @@ export default function CaptchaCodePage () {
: resultMsg ?? : resultMsg ??
'Failed to get verification code. Please try again later.'} 'Failed to get verification code. Please try again later.'}
</p> </p>
{result == 2 && (
<>
<p <p
className='bg-[rgb(64,64,88)] border border-[rgb(88,88,112)] hover:bg-[rgb(88,88,112)] hover:border-[rgb(112,112,136)] rounded-md px-2 py-1 mt-4 transition-colors text-center cursor-pointer' className='bg-[rgb(64,64,88)] border border-[rgb(88,88,112)] hover:bg-[rgb(88,88,112)] hover:border-[rgb(112,112,136)] rounded-md px-2 py-1 mt-4 transition-colors text-center cursor-pointer'
hidden={result != 2}
onClick={async () => { onClick={async () => {
navigator.clipboard.writeText(code ?? '') navigator.clipboard.writeText(code ?? '')
if (showCopied) return if (showCopied) return
@@ -73,10 +75,12 @@ export default function CaptchaCodePage () {
</p> </p>
<p <p
className='text-blue-500 text-center mt-2 -mb-4' className='text-blue-500 text-center mt-2 -mb-4'
hidden={!showCopied || result != 2} hidden={!showCopied}
> >
Copied to clipboard! Copied to clipboard!
</p> </p>
</>
)}
</div> </div>
) )
} }