This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
Camera,
|
||||
AlertTriangle,
|
||||
ChevronDown,
|
||||
Loader2,
|
||||
} from 'lucide-react';
|
||||
|
||||
const logo = '/logo.png';
|
||||
@@ -52,6 +53,7 @@ export function LoginForm({ onSignUp, onForgotPassword }: Props) {
|
||||
const [password, setPassword] = useState('');
|
||||
const [error, setError] = useState('');
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [appleLoading, setAppleLoading] = useState(false);
|
||||
const [resendCooldown, setResendCooldown] = useState(0);
|
||||
const [resendLoading, setResendLoading] = useState(false);
|
||||
const aboutRef = useRef<HTMLElement>(null);
|
||||
@@ -90,7 +92,9 @@ export function LoginForm({ onSignUp, onForgotPassword }: Props) {
|
||||
}
|
||||
|
||||
async function handleApple() {
|
||||
await signIn.social({ provider: 'apple', callbackURL: window.location.origin, errorCallbackURL: window.location.origin });
|
||||
setAppleLoading(true);
|
||||
const res = await signIn.social({ provider: 'apple', callbackURL: window.location.origin, errorCallbackURL: window.location.origin });
|
||||
if (res?.error) setAppleLoading(false);
|
||||
}
|
||||
|
||||
function scrollToAbout() {
|
||||
@@ -212,11 +216,16 @@ export function LoginForm({ onSignUp, onForgotPassword }: Props) {
|
||||
variant="outline"
|
||||
className="w-full flex items-center gap-3"
|
||||
onClick={handleApple}
|
||||
disabled={appleLoading}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" className="h-4 w-4" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
||||
<path d="M16.365 1.43c0 1.14-.42 2.23-1.16 3.06-.79.91-2.07 1.62-3.18 1.53-.13-1.12.42-2.27 1.13-3.04.8-.86 2.16-1.5 3.21-1.55zM20.5 17.27c-.55 1.27-.81 1.84-1.52 2.96-.99 1.56-2.39 3.5-4.12 3.51-1.54.02-1.94-1-4.03-.99-2.09.01-2.53 1.01-4.07.99-1.73-.02-3.06-1.78-4.05-3.34C-.04 16.04-.42 11.07 1.93 8.41c1.43-1.62 3.69-2.58 5.81-2.58 2.16 0 3.52 1.18 5.31 1.18 1.74 0 2.79-1.18 5.29-1.18 1.88 0 3.88 1.03 5.3 2.81-4.66 2.55-3.9 9.21-3.14 8.63z"/>
|
||||
</svg>
|
||||
Sign in with Apple
|
||||
{appleLoading ? (
|
||||
<Loader2 className="h-4 w-4 animate-spin" />
|
||||
) : (
|
||||
<svg viewBox="0 0 24 24" className="h-4 w-4" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
|
||||
<path d="M16.365 1.43c0 1.14-.42 2.23-1.16 3.06-.79.91-2.07 1.62-3.18 1.53-.13-1.12.42-2.27 1.13-3.04.8-.86 2.16-1.5 3.21-1.55zM20.5 17.27c-.55 1.27-.81 1.84-1.52 2.96-.99 1.56-2.39 3.5-4.12 3.51-1.54.02-1.94-1-4.03-.99-2.09.01-2.53 1.01-4.07.99-1.73-.02-3.06-1.78-4.05-3.34C-.04 16.04-.42 11.07 1.93 8.41c1.43-1.62 3.69-2.58 5.81-2.58 2.16 0 3.52 1.18 5.31 1.18 1.74 0 2.79-1.18 5.29-1.18 1.88 0 3.88 1.03 5.3 2.81-4.66 2.55-3.9 9.21-3.14 8.63z"/>
|
||||
</svg>
|
||||
)}
|
||||
{appleLoading ? 'Signing in…' : 'Sign in with Apple'}
|
||||
</Button>
|
||||
|
||||
<div className="flex justify-between text-sm">
|
||||
|
||||
Reference in New Issue
Block a user