EvalueTonSavoir/client/src/components/StudentWaitPage/StudentWaitPage.tsx

62 lines
1.8 KiB
TypeScript
Raw Normal View History

import React from 'react';
2024-09-25 14:53:17 -04:00
import { Box, Button, Chip } from '@mui/material';
2024-09-25 13:20:09 -04:00
import { StudentType } from '../../Types/StudentType';
import { PlayArrow } from '@mui/icons-material';
import LaunchQuizDialog from '../LaunchQuizDialog/LaunchQuizDialog';
import { useState } from 'react';
import './studentWaitPage.css';
interface Props {
2024-09-25 14:53:17 -04:00
students: StudentType[];
2024-09-25 13:20:09 -04:00
launchQuiz: () => void;
setQuizMode: (_mode: 'student' | 'teacher') => void;
2024-09-25 13:20:09 -04:00
}
const StudentWaitPage: React.FC<Props> = ({ students, launchQuiz, setQuizMode }) => {
2024-09-25 13:20:09 -04:00
const [isDialogOpen, setIsDialogOpen] = useState<boolean>(false);
2025-02-21 20:15:32 -05:00
const handleLaunchClick = () => {
setIsDialogOpen(true);
};
2024-09-25 13:20:09 -04:00
return (
<div className="wait">
<div className='button'>
<Button
variant="contained"
2025-02-21 20:15:32 -05:00
onClick={handleLaunchClick}
2024-09-25 13:20:09 -04:00
startIcon={<PlayArrow />}
fullWidth
sx={{ fontWeight: 600, fontSize: 20 }}
>
2025-02-21 20:15:32 -05:00
Lancer
2024-09-25 13:20:09 -04:00
</Button>
</div>
<div className="students">
2024-09-25 14:53:17 -04:00
<Box display="flex" flexWrap="wrap" gap={3}>
2024-09-25 13:20:09 -04:00
2024-09-25 14:53:17 -04:00
{students.map((student, index) => (
<Box key={student.name + index} >
<Chip label={student.name} sx={{ width: '100%' }} />
</Box>
2024-09-25 13:20:09 -04:00
))}
2024-09-25 14:53:17 -04:00
</Box>
2024-09-25 13:20:09 -04:00
</div>
<LaunchQuizDialog
open={isDialogOpen}
handleOnClose={() => setIsDialogOpen(false)}
launchQuiz={launchQuiz}
setQuizMode={setQuizMode}
/>
</div>
);
};
export default StudentWaitPage;