mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 08:11:13 -05:00
Refactor: Optimize Captcha Loading
This commit is contained in:
@@ -24,6 +24,9 @@
|
|||||||
<!-- Cloudflare Turnstile - Preconnect for faster captcha loading -->
|
<!-- Cloudflare Turnstile - Preconnect for faster captcha loading -->
|
||||||
<link rel="dns-prefetch" href="https://challenges.cloudflare.com">
|
<link rel="dns-prefetch" href="https://challenges.cloudflare.com">
|
||||||
<link rel="preconnect" href="https://challenges.cloudflare.com" crossorigin>
|
<link rel="preconnect" href="https://challenges.cloudflare.com" crossorigin>
|
||||||
|
<link rel="modulepreload" href="https://challenges.cloudflare.com/turnstile/v0/api.js" as="script">
|
||||||
|
<link rel="dns-prefetch" href="https://cloudflare.com">
|
||||||
|
<link rel="preconnect" href="https://cloudflare.com" crossorigin>
|
||||||
|
|
||||||
<!-- Uppy CSS for photo upload functionality -->
|
<!-- Uppy CSS for photo upload functionality -->
|
||||||
<link href="https://releases.transloadit.com/uppy/v3.25.3/uppy.min.css" rel="stylesheet">
|
<link href="https://releases.transloadit.com/uppy/v3.25.3/uppy.min.css" rel="stylesheet">
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export function TurnstileCaptcha({
|
|||||||
if (loading) {
|
if (loading) {
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}, 10000); // 10 second timeout
|
}, 5000); // 5 second timeout
|
||||||
return () => clearTimeout(timeout);
|
return () => clearTimeout(timeout);
|
||||||
}
|
}
|
||||||
}, [loading]);
|
}, [loading]);
|
||||||
@@ -95,13 +95,18 @@ export function TurnstileCaptcha({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`space-y-3 ${className}`}>
|
<div className={`space-y-3 ${className}`}>
|
||||||
<div className="flex flex-col items-center min-h-[65px]">
|
<div className="flex flex-col items-center">
|
||||||
|
{loading && (
|
||||||
|
<div className="w-[300px] h-[65px] flex items-center justify-center border border-dashed border-muted-foreground/30 rounded-lg bg-muted/10 animate-pulse">
|
||||||
|
<span className="text-xs text-muted-foreground">Loading CAPTCHA...</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className="transition-opacity duration-300"
|
className="transition-opacity duration-100"
|
||||||
style={{
|
style={{
|
||||||
visibility: loading ? 'hidden' : 'visible',
|
display: loading ? 'none' : 'block',
|
||||||
opacity: loading ? 0 : 1,
|
opacity: loading ? 0 : 1
|
||||||
height: loading ? 0 : 'auto'
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Turnstile
|
<Turnstile
|
||||||
@@ -121,13 +126,6 @@ export function TurnstileCaptcha({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{loading && (
|
|
||||||
<div className="flex items-center justify-center p-4 border border-dashed border-muted-foreground/30 rounded-lg bg-muted/20">
|
|
||||||
<RefreshCw className="w-4 h-4 animate-spin mr-2 text-muted-foreground" />
|
|
||||||
<span className="text-sm text-muted-foreground">Loading CAPTCHA...</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
|
|||||||
Reference in New Issue
Block a user