diff --git a/frontend/src/components/DevQuickLogin.tsx b/frontend/src/components/DevQuickLogin.tsx index 1094864..4ef4131 100644 --- a/frontend/src/components/DevQuickLogin.tsx +++ b/frontend/src/components/DevQuickLogin.tsx @@ -3,7 +3,7 @@ import apiClient from '../api/client'; import { setCookie } from '../utils/cookies'; import { useQueryClient } from '@tanstack/react-query'; -interface TestUser { +export interface TestUser { username: string; password: string; role: string; @@ -70,7 +70,11 @@ const testUsers: TestUser[] = [ }, ]; -export function DevQuickLogin() { +interface DevQuickLoginProps { + embedded?: boolean; +} + +export function DevQuickLogin({ embedded = false }: DevQuickLoginProps) { const queryClient = useQueryClient(); const [loading, setLoading] = useState(null); const [isMinimized, setIsMinimized] = useState(false); @@ -98,15 +102,15 @@ export function DevQuickLogin() { // Reload page to trigger auth flow window.location.reload(); - } catch (error) { + } catch (error: any) { console.error('Quick login failed:', error); - alert(`Failed to login as ${user.label}: ${error.message}`); + alert(`Failed to login as ${user.label}: ${error.message || 'Unknown error'}`); } finally { setLoading(null); } }; - if (isMinimized) { + if (!embedded && isMinimized) { return (
+ {!embedded && ( + + )}
@@ -172,8 +182,8 @@ export function DevQuickLogin() { ))}
-
- Password for all: test123 +
+ Password for all: test123
); diff --git a/frontend/src/pages/LoginPage.tsx b/frontend/src/pages/LoginPage.tsx index 2f0da6a..7375506 100644 --- a/frontend/src/pages/LoginPage.tsx +++ b/frontend/src/pages/LoginPage.tsx @@ -10,6 +10,7 @@ import { useNavigate } from 'react-router-dom'; import SmoothScheduleLogo from '../components/SmoothScheduleLogo'; import OAuthButtons from '../components/OAuthButtons'; import LanguageSelector from '../components/LanguageSelector'; +import { DevQuickLogin } from '../components/DevQuickLogin'; import { AlertCircle, Loader2, User, Lock, ArrowRight } from 'lucide-react'; const LoginPage: React.FC = () => { @@ -240,6 +241,9 @@ const LoginPage: React.FC = () => {
+ + {/* Dev Quick Login */} +