'use client'; import { Button } from '@/components/ui/button'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'; import { useMitt } from '@/plugins/MittContext'; import { useEffect, useState } from 'react'; const AuthDialog = ({ onOpenChange }) => { const emitter = useMitt(); const [isLogin, setIsLogin] = useState(false); const [isOpen, setIsOpen] = useState(false); const handleGoogleLogin = () => { window.location.href = route('auth.google.redirect'); }; // Listen for text element selection (but don't auto-open sidebar) useEffect(() => { const handleOpenAuth = () => { setIsOpen(true); }; emitter.on('401', handleOpenAuth); return () => { emitter.off('401', handleOpenAuth); }; }, [emitter]); return ( {isLogin ? 'Welcome back' : 'Create account'} {isLogin ? 'Sign in to your account to continue' : 'Sign up to get started'}
By continuing, you agree to our Terms of Service and Privacy Policy
{isLogin ? "Don't have an account?" : 'Already have an account?'}{' '}
); }; export default AuthDialog;