Initial commit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Button, TextField } from '@mui/material';
|
||||
import { EmailCredentials } from '../../../services/auth/authService';
|
||||
import { logger } from '../../../debugConfig';
|
||||
|
||||
interface LoginFormProps {
|
||||
role: 'email_teacher' | 'email_student';
|
||||
onSubmit: (credentials: EmailCredentials) => Promise<void>;
|
||||
}
|
||||
|
||||
export const LoginForm: React.FC<LoginFormProps> = ({ role, onSubmit }) => {
|
||||
const [email, setEmail] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
logger.debug('login-form', '🔄 Submitting login form', { role });
|
||||
await onSubmit({ email, password, role });
|
||||
};
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit} className="login-form">
|
||||
<TextField
|
||||
label="Email"
|
||||
variant="outlined"
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
fullWidth
|
||||
autoComplete="new-username"
|
||||
/>
|
||||
<TextField
|
||||
label="Password"
|
||||
type="password"
|
||||
variant="outlined"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
fullWidth
|
||||
autoComplete="new-password"
|
||||
/>
|
||||
<Button type="submit" variant="contained" fullWidth>
|
||||
Login
|
||||
</Button>
|
||||
</form>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Button } from '@mui/material';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { logger } from '../../../debugConfig';
|
||||
|
||||
export const SuperAdminSection = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleAdminClick = () => {
|
||||
logger.info('super-admin-section', '🔑 Navigating to admin page');
|
||||
navigate('/admin');
|
||||
};
|
||||
|
||||
return (
|
||||
<Button
|
||||
onClick={handleAdminClick}
|
||||
variant="contained"
|
||||
color="warning"
|
||||
sx={{ mb: 2 }}
|
||||
>
|
||||
Admin Dashboard
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user