mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Merge 09ec127a76 into 62df610d62
This commit is contained in:
commit
c9cf887f76
10 changed files with 333 additions and 342 deletions
|
|
@ -2,6 +2,7 @@ import { Link, useNavigate } from 'react-router-dom';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import './header.css';
|
import './header.css';
|
||||||
import { Button } from '@mui/material';
|
import { Button } from '@mui/material';
|
||||||
|
import ExitToAppIcon from '@mui/icons-material/ExitToApp';
|
||||||
|
|
||||||
interface HeaderProps {
|
interface HeaderProps {
|
||||||
isLoggedIn: boolean;
|
isLoggedIn: boolean;
|
||||||
|
|
@ -28,8 +29,9 @@ const Header: React.FC<HeaderProps> = ({ isLoggedIn, handleLogout }) => {
|
||||||
handleLogout();
|
handleLogout();
|
||||||
navigate('/');
|
navigate('/');
|
||||||
}}
|
}}
|
||||||
|
startIcon={<ExitToAppIcon />}
|
||||||
>
|
>
|
||||||
Logout
|
Déconnexion
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@ const TrueFalseQuestionDisplay: React.FC<Props> = (props) => {
|
||||||
disabled={disableButton}
|
disabled={disableButton}
|
||||||
>
|
>
|
||||||
{showAnswer ? (<div> {(question.isTrue ? '✅' : '❌')}</div>) : ``}
|
{showAnswer ? (<div> {(question.isTrue ? '✅' : '❌')}</div>) : ``}
|
||||||
<div className={`circle ${selectedTrue}`}>V</div>
|
|
||||||
<div className={`answer-text ${selectedTrue}`}>Vrai</div>
|
<div className={`answer-text ${selectedTrue}`}>Vrai</div>
|
||||||
|
|
||||||
{showAnswer && answer && question.trueFormattedFeedback && (
|
{showAnswer && answer && question.trueFormattedFeedback && (
|
||||||
|
|
@ -76,7 +75,6 @@ const TrueFalseQuestionDisplay: React.FC<Props> = (props) => {
|
||||||
|
|
||||||
>
|
>
|
||||||
{showAnswer ? (<div> {(!question.isTrue ? '✅' : '❌')}</div>) : ``}
|
{showAnswer ? (<div> {(!question.isTrue ? '✅' : '❌')}</div>) : ``}
|
||||||
<div className={`circle ${selectedFalse}`}>F</div>
|
|
||||||
<div className={`answer-text ${selectedFalse}`}>Faux</div>
|
<div className={`answer-text ${selectedFalse}`}>Faux</div>
|
||||||
|
|
||||||
{showAnswer && !answer && question.falseFormattedFeedback && (
|
{showAnswer && !answer && question.falseFormattedFeedback && (
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,7 @@ const StudentWaitPage: React.FC<Props> = ({ students, launchQuiz, setQuizMode })
|
||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={handleLaunchClick}
|
onClick={handleLaunchClick}
|
||||||
startIcon={<PlayArrow />}
|
startIcon={<PlayArrow />}
|
||||||
fullWidth
|
sx={{ fontWeight: 600, fontSize: 20, width: 'auto' }}
|
||||||
sx={{ fontWeight: 600, fontSize: 20 }}
|
|
||||||
>
|
>
|
||||||
Lancer
|
Lancer
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ const TeacherModeQuiz: React.FC<TeacherModeQuizProps> = ({
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={handleFeedbackDialogClose} color="primary">
|
<Button onClick={handleFeedbackDialogClose} color="primary">
|
||||||
OK
|
Fermer
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ const SimpleLogin: React.FC = () => {
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
value={email}
|
value={email}
|
||||||
onChange={(e) => setEmail(e.target.value)}
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
placeholder="Nom d'utilisateur"
|
|
||||||
sx={{ marginBottom: '1rem' }}
|
sx={{ marginBottom: '1rem' }}
|
||||||
fullWidth
|
fullWidth
|
||||||
/>
|
/>
|
||||||
|
|
@ -55,7 +54,6 @@ const SimpleLogin: React.FC = () => {
|
||||||
type="password"
|
type="password"
|
||||||
value={password}
|
value={password}
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
placeholder="Nom de la salle"
|
|
||||||
sx={{ marginBottom: '1rem' }}
|
sx={{ marginBottom: '1rem' }}
|
||||||
fullWidth
|
fullWidth
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ import {
|
||||||
Upload,
|
Upload,
|
||||||
FolderCopy,
|
FolderCopy,
|
||||||
ContentCopy,
|
ContentCopy,
|
||||||
Edit,
|
Edit
|
||||||
} from '@mui/icons-material';
|
} from '@mui/icons-material';
|
||||||
import ShareQuizModal from 'src/components/ShareQuizModal/ShareQuizModal';
|
import ShareQuizModal from 'src/components/ShareQuizModal/ShareQuizModal';
|
||||||
|
|
||||||
|
|
@ -65,6 +65,7 @@ const Dashboard: React.FC = () => {
|
||||||
const [selectedRoom, selectRoom] = useState<RoomType>(); // menu
|
const [selectedRoom, selectRoom] = useState<RoomType>(); // menu
|
||||||
const [errorMessage, setErrorMessage] = useState('');
|
const [errorMessage, setErrorMessage] = useState('');
|
||||||
const [showErrorDialog, setShowErrorDialog] = useState(false);
|
const [showErrorDialog, setShowErrorDialog] = useState(false);
|
||||||
|
const [isSearchVisible, setIsSearchVisible] = useState(false);
|
||||||
|
|
||||||
// Filter quizzes based on search term
|
// Filter quizzes based on search term
|
||||||
// const filteredQuizzes = quizzes.filter(quiz =>
|
// const filteredQuizzes = quizzes.filter(quiz =>
|
||||||
|
|
@ -104,7 +105,7 @@ const Dashboard: React.FC = () => {
|
||||||
|
|
||||||
fetchData();
|
fetchData();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (rooms.length > 0 && !selectedRoom) {
|
if (rooms.length > 0 && !selectedRoom) {
|
||||||
selectRoom(rooms[rooms.length - 1]);
|
selectRoom(rooms[rooms.length - 1]);
|
||||||
|
|
@ -120,41 +121,44 @@ const Dashboard: React.FC = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Créer une salle
|
const toggleSearchVisibility = () => {
|
||||||
const createRoom = async (title: string) => {
|
setIsSearchVisible(!isSearchVisible);
|
||||||
// Créer la salle et récupérer l'objet complet
|
};
|
||||||
const newRoom = await ApiService.createRoom(title);
|
|
||||||
|
|
||||||
// Mettre à jour la liste des salles
|
|
||||||
const updatedRooms = await ApiService.getUserRooms();
|
|
||||||
setRooms(updatedRooms as RoomType[]);
|
|
||||||
|
|
||||||
// Sélectionner la nouvelle salle avec son ID
|
|
||||||
selectRoomByName(newRoom); // Utiliser l'ID de l'objet retourné
|
|
||||||
};
|
|
||||||
|
|
||||||
|
// Créer une salle
|
||||||
|
const createRoom = async (title: string) => {
|
||||||
|
// Créer la salle et récupérer l'objet complet
|
||||||
|
const newRoom = await ApiService.createRoom(title);
|
||||||
|
|
||||||
// Sélectionner une salle
|
// Mettre à jour la liste des salles
|
||||||
const selectRoomByName = (roomId: string) => {
|
const updatedRooms = await ApiService.getUserRooms();
|
||||||
const room = rooms.find(r => r._id === roomId);
|
setRooms(updatedRooms as RoomType[]);
|
||||||
selectRoom(room);
|
|
||||||
localStorage.setItem('selectedRoomId', roomId);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCreateRoom = async () => {
|
// Sélectionner la nouvelle salle avec son ID
|
||||||
if (newRoomTitle.trim()) {
|
selectRoomByName(newRoom); // Utiliser l'ID de l'objet retourné
|
||||||
try {
|
};
|
||||||
|
|
||||||
|
// Sélectionner une salle
|
||||||
|
const selectRoomByName = (roomId: string) => {
|
||||||
|
const room = rooms.find((r) => r._id === roomId);
|
||||||
|
selectRoom(room);
|
||||||
|
localStorage.setItem('selectedRoomId', roomId);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCreateRoom = async () => {
|
||||||
|
if (newRoomTitle.trim()) {
|
||||||
|
try {
|
||||||
await createRoom(newRoomTitle);
|
await createRoom(newRoomTitle);
|
||||||
const userRooms = await ApiService.getUserRooms();
|
const userRooms = await ApiService.getUserRooms();
|
||||||
setRooms(userRooms as RoomType[]);
|
setRooms(userRooms as RoomType[]);
|
||||||
setOpenAddRoomDialog(false);
|
setOpenAddRoomDialog(false);
|
||||||
setNewRoomTitle('');
|
setNewRoomTitle('');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setErrorMessage(error instanceof Error ? error.message : "Erreur inconnue");
|
setErrorMessage(error instanceof Error ? error.message : 'Erreur inconnue');
|
||||||
setShowErrorDialog(true);
|
setShowErrorDialog(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSelectFolder = (event: React.ChangeEvent<HTMLSelectElement>) => {
|
const handleSelectFolder = (event: React.ChangeEvent<HTMLSelectElement>) => {
|
||||||
setSelectedFolderId(event.target.value);
|
setSelectedFolderId(event.target.value);
|
||||||
|
|
@ -397,35 +401,68 @@ const Dashboard: React.FC = () => {
|
||||||
} else {
|
} else {
|
||||||
const randomSixDigit = Math.floor(100000 + Math.random() * 900000);
|
const randomSixDigit = Math.floor(100000 + Math.random() * 900000);
|
||||||
navigate(`/teacher/manage-room/${quiz._id}/${randomSixDigit}`);
|
navigate(`/teacher/manage-room/${quiz._id}/${randomSixDigit}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="dashboard">
|
<div className="dashboard">
|
||||||
<div className="title">Tableau de bord</div>
|
{/* Conteneur pour le titre et le sélecteur de salle */}
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
alignItems: 'center',
|
||||||
|
marginBottom: '20px'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{/* Titre tableau de bord */}
|
||||||
|
<div className="title" style={{ fontSize: '30px', fontWeight: 'bold' }}>
|
||||||
|
Tableau de bord
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="roomSelection">
|
{/* Sélecteur de salle */}
|
||||||
<label htmlFor="select-room">Sélectionner une salle: </label>
|
<div
|
||||||
<select value={selectedRoom?._id || ''} onChange={(e) => handleSelectRoom(e)}>
|
className="roomSelection"
|
||||||
<option value="" disabled>
|
style={{ display: 'flex', justifyContent: 'flex-end', gap: '15px' }}
|
||||||
-- Sélectionner une salle --
|
>
|
||||||
</option>
|
<select
|
||||||
{rooms.map((room) => (
|
value={selectedRoom?._id || ''}
|
||||||
<option key={room._id} value={room._id}>
|
onChange={(e) => handleSelectRoom(e)}
|
||||||
{room.title}
|
id="room-select"
|
||||||
|
style={{
|
||||||
|
padding: '8px 12px',
|
||||||
|
fontSize: '14px',
|
||||||
|
borderRadius: '8px',
|
||||||
|
border: '1px solid #ccc',
|
||||||
|
backgroundColor: '#fff',
|
||||||
|
maxWidth: '200px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
fontWeight: '500'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<option value="" disabled>
|
||||||
|
Sélectionner une salle
|
||||||
</option>
|
</option>
|
||||||
))}
|
{rooms.map((room) => (
|
||||||
<option value="add-room">Ajouter salle</option>
|
<option key={room._id} value={room._id}>
|
||||||
</select>
|
{room.title}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
<option
|
||||||
|
value="add-room"
|
||||||
|
style={{
|
||||||
|
color: 'black',
|
||||||
|
backgroundColor: '#f0f0f0',
|
||||||
|
fontWeight: 'bold'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Ajouter une salle
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{selectedRoom && (
|
{/* Dialog pour créer une salle */}
|
||||||
<div className="roomTitle">
|
|
||||||
<h2>Salle sélectionnée: {selectedRoom.title}</h2>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Dialog open={openAddRoomDialog} onClose={() => setOpenAddRoomDialog(false)}>
|
<Dialog open={openAddRoomDialog} onClose={() => setOpenAddRoomDialog(false)}>
|
||||||
<DialogTitle>Créer une nouvelle salle</DialogTitle>
|
<DialogTitle>Créer une nouvelle salle</DialogTitle>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
|
|
@ -450,24 +487,17 @@ const Dashboard: React.FC = () => {
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
<div className="search-bar">
|
<div
|
||||||
<TextField
|
style={{
|
||||||
onChange={handleSearch}
|
display: 'flex',
|
||||||
value={searchTerm}
|
justifyContent: 'flex-end',
|
||||||
placeholder="Rechercher un quiz par son titre"
|
alignItems: 'center',
|
||||||
fullWidth
|
width: '100%',
|
||||||
InputProps={{
|
gap: '20px'
|
||||||
endAdornment: (
|
}}
|
||||||
<InputAdornment position="end">
|
></div>
|
||||||
<IconButton>
|
|
||||||
<Search />
|
|
||||||
</IconButton>
|
|
||||||
</InputAdornment>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
{/* Conteneur principal avec les actions et la liste des quiz */}
|
||||||
<div className="folder">
|
<div className="folder">
|
||||||
<div className="select">
|
<div className="select">
|
||||||
<NativeSelect
|
<NativeSelect
|
||||||
|
|
@ -475,13 +505,18 @@ const Dashboard: React.FC = () => {
|
||||||
color="primary"
|
color="primary"
|
||||||
value={selectedFolderId}
|
value={selectedFolderId}
|
||||||
onChange={handleSelectFolder}
|
onChange={handleSelectFolder}
|
||||||
|
sx={{
|
||||||
|
padding: '6px 12px',
|
||||||
|
maxWidth: '180px',
|
||||||
|
borderRadius: '8px',
|
||||||
|
borderColor: '#e0e0e0',
|
||||||
|
'&:hover': { borderColor: '#5271FF' }
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<option value=""> Tous les dossiers... </option>
|
<option value="">Tous les dossiers...</option>
|
||||||
|
{folders.map((folder) => (
|
||||||
{folders.map((folder: FolderType) => (
|
|
||||||
<option value={folder._id} key={folder._id}>
|
<option value={folder._id} key={folder._id}>
|
||||||
{' '}
|
{folder.title}
|
||||||
{folder.title}{' '}
|
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</NativeSelect>
|
</NativeSelect>
|
||||||
|
|
@ -497,65 +532,130 @@ const Dashboard: React.FC = () => {
|
||||||
|
|
||||||
<Tooltip title="Renommer dossier" placement="top">
|
<Tooltip title="Renommer dossier" placement="top">
|
||||||
<div>
|
<div>
|
||||||
<IconButton
|
<IconButton
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={handleRenameFolder}
|
onClick={handleRenameFolder}
|
||||||
disabled={selectedFolderId == ''} // cannot action on all
|
disabled={selectedFolderId == ''} // cannot action on all
|
||||||
>
|
>
|
||||||
{' '}
|
{' '}
|
||||||
<Edit />{' '}
|
<Edit />{' '}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
||||||
<Tooltip title="Dupliquer dossier" placement="top">
|
<Tooltip title="Dupliquer dossier" placement="top">
|
||||||
<div>
|
<div>
|
||||||
<IconButton
|
<IconButton
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={handleDuplicateFolder}
|
onClick={handleDuplicateFolder}
|
||||||
disabled={selectedFolderId == ''} // cannot action on all
|
disabled={selectedFolderId == ''} // cannot action on all
|
||||||
>
|
>
|
||||||
{' '}
|
{' '}
|
||||||
<FolderCopy />{' '}
|
<FolderCopy />{' '}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
||||||
<Tooltip title="Supprimer dossier" placement="top">
|
<Tooltip title="Supprimer dossier" placement="top">
|
||||||
<div>
|
<div>
|
||||||
<IconButton
|
<IconButton
|
||||||
aria-label="delete"
|
aria-label="delete"
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={handleDeleteFolder}
|
onClick={handleDeleteFolder}
|
||||||
disabled={selectedFolderId == ''} // cannot action on all
|
disabled={selectedFolderId == ''} // cannot action on all
|
||||||
>
|
>
|
||||||
{' '}
|
{' '}
|
||||||
<DeleteOutline />{' '}
|
<DeleteOutline />{' '}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="ajouter">
|
<div
|
||||||
<Button
|
className="search-bar"
|
||||||
variant="outlined"
|
style={{
|
||||||
color="primary"
|
display: 'flex',
|
||||||
startIcon={<Add />}
|
justifyContent: 'space-between',
|
||||||
onClick={handleCreateQuiz}
|
alignItems: 'center',
|
||||||
>
|
gap: '20px',
|
||||||
Ajouter un nouveau quiz
|
width: '100%'
|
||||||
</Button>
|
}}
|
||||||
|
>
|
||||||
|
<div style={{ flex: 1 }}>
|
||||||
|
{!isSearchVisible ? (
|
||||||
|
<IconButton
|
||||||
|
onClick={toggleSearchVisibility}
|
||||||
|
sx={{
|
||||||
|
borderRadius: '8px',
|
||||||
|
border: '1px solid #ccc',
|
||||||
|
padding: '8px 12px',
|
||||||
|
backgroundColor: '#fff',
|
||||||
|
color: '#5271FF'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Search />
|
||||||
|
</IconButton>
|
||||||
|
) : (
|
||||||
|
<TextField
|
||||||
|
onChange={handleSearch}
|
||||||
|
value={searchTerm}
|
||||||
|
placeholder="Rechercher un quiz"
|
||||||
|
fullWidth
|
||||||
|
autoFocus
|
||||||
|
sx={{
|
||||||
|
borderRadius: '8px',
|
||||||
|
border: '1px solid #ccc',
|
||||||
|
padding: '8px 12px',
|
||||||
|
backgroundColor: '#fff',
|
||||||
|
fontWeight: 500,
|
||||||
|
width: '100%',
|
||||||
|
maxWidth: '1000px'
|
||||||
|
}}
|
||||||
|
InputProps={{
|
||||||
|
endAdornment: (
|
||||||
|
<InputAdornment position="end">
|
||||||
|
<IconButton
|
||||||
|
onClick={toggleSearchVisibility}
|
||||||
|
sx={{
|
||||||
|
borderRadius: '8px',
|
||||||
|
border: '1px solid #ccc',
|
||||||
|
backgroundColor: '#fff',
|
||||||
|
color: '#5271FF'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Search />
|
||||||
|
</IconButton>
|
||||||
|
</InputAdornment>
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
<Button
|
{/* À droite : les boutons */}
|
||||||
variant="outlined"
|
<div style={{ display: 'flex', gap: '12px' }}>
|
||||||
color="primary"
|
<Button
|
||||||
startIcon={<Upload />}
|
variant="outlined"
|
||||||
onClick={handleOnImport}
|
color="primary"
|
||||||
>
|
startIcon={<Add />}
|
||||||
Import
|
onClick={handleCreateQuiz}
|
||||||
</Button>
|
sx={{ borderRadius: '8px', minWidth: 'auto', padding: '4px 12px' }}
|
||||||
|
>
|
||||||
|
Nouveau quiz
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
variant="outlined"
|
||||||
|
color="primary"
|
||||||
|
startIcon={<Upload />}
|
||||||
|
onClick={handleOnImport}
|
||||||
|
>
|
||||||
|
Importer
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="list">
|
<div className="list">
|
||||||
{Object.keys(quizzesByFolder).map((folderName) => (
|
{Object.keys(quizzesByFolder).map((folderName) => (
|
||||||
<CustomCard key={folderName} className="folder-card">
|
<CustomCard key={folderName} className="folder-card">
|
||||||
|
|
@ -571,7 +671,9 @@ const Dashboard: React.FC = () => {
|
||||||
onClick={() => handleLancerQuiz(quiz)}
|
onClick={() => handleLancerQuiz(quiz)}
|
||||||
disabled={!validateQuiz(quiz.content)}
|
disabled={!validateQuiz(quiz.content)}
|
||||||
>
|
>
|
||||||
{`${quiz.title} (${quiz.content.length} question${
|
{`${quiz.title} (${
|
||||||
|
quiz.content.length
|
||||||
|
} question${
|
||||||
quiz.content.length > 1 ? 's' : ''
|
quiz.content.length > 1 ? 's' : ''
|
||||||
})`}
|
})`}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
@ -609,21 +711,20 @@ const Dashboard: React.FC = () => {
|
||||||
<ContentCopy />{' '}
|
<ContentCopy />{' '}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
<div className="quiz-share">
|
||||||
|
<ShareQuizModal quiz={quiz} />
|
||||||
|
</div>
|
||||||
|
|
||||||
<Tooltip title="Supprimer" placement="top">
|
<Tooltip title="Supprimer" placement="top">
|
||||||
<IconButton
|
<IconButton
|
||||||
aria-label="delete"
|
aria-label="delete"
|
||||||
color="primary"
|
color="error"
|
||||||
onClick={() => handleRemoveQuiz(quiz)}
|
onClick={() => handleRemoveQuiz(quiz)}
|
||||||
>
|
>
|
||||||
{' '}
|
{' '}
|
||||||
<DeleteOutline />{' '}
|
<DeleteOutline />{' '}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
||||||
<div className="quiz-share">
|
|
||||||
<ShareQuizModal quiz={quiz} />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import GiftCheatSheet from 'src/components/GIFTCheatSheet/GiftCheatSheet';
|
||||||
import GIFTTemplatePreview from 'src/components/GiftTemplate/GIFTTemplatePreview';
|
import GIFTTemplatePreview from 'src/components/GiftTemplate/GIFTTemplatePreview';
|
||||||
|
|
||||||
import { QuizType } from '../../../Types/QuizType';
|
import { QuizType } from '../../../Types/QuizType';
|
||||||
|
import SaveIcon from '@mui/icons-material/Save';
|
||||||
import './editorQuiz.css';
|
import './editorQuiz.css';
|
||||||
import { Button, TextField, NativeSelect, Divider } from '@mui/material';
|
import { Button, TextField, NativeSelect, Divider } from '@mui/material';
|
||||||
import ReturnButton from 'src/components/ReturnButton/ReturnButton';
|
import ReturnButton from 'src/components/ReturnButton/ReturnButton';
|
||||||
|
|
@ -175,47 +175,65 @@ const QuizForm: React.FC = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='quizEditor'>
|
<div className="quizEditor">
|
||||||
|
<div
|
||||||
<div className='editHeader'>
|
className="editHeader"
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
alignItems: 'center',
|
||||||
|
marginBottom: '32px'
|
||||||
|
}}
|
||||||
|
>
|
||||||
<ReturnButton
|
<ReturnButton
|
||||||
askConfirm
|
askConfirm
|
||||||
message={`Êtes-vous sûr de vouloir quitter l'éditeur sans sauvegarder le questionnaire?`}
|
message={`Êtes-vous sûr de vouloir quitter l'éditeur sans sauvegarder le questionnaire?`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className='title'>Éditeur de quiz</div>
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
onClick={handleQuizSave}
|
||||||
|
sx={{ display: 'flex', alignItems: 'center' }}
|
||||||
|
>
|
||||||
|
<SaveIcon sx={{ fontSize: 20 }} />
|
||||||
|
Enregistrer
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className='dumb'></div>
|
<div style={{ textAlign: 'center', marginTop: '30px' }}>
|
||||||
|
<div className="title">Éditeur de quiz</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* <h2 className="subtitle">Éditeur</h2> */}
|
{/* <h2 className="subtitle">Éditeur</h2> */}
|
||||||
|
|
||||||
<TextField
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||||
onChange={handleQuizTitleChange}
|
<TextField
|
||||||
value={quizTitle}
|
onChange={handleQuizTitleChange}
|
||||||
placeholder="Titre du quiz"
|
value={quizTitle}
|
||||||
label="Titre du quiz"
|
color="primary"
|
||||||
fullWidth
|
placeholder="Titre du quiz"
|
||||||
/>
|
label="Titre du quiz"
|
||||||
<label>Choisir un dossier:
|
sx={{ width: '200px', marginTop: '50px' }}
|
||||||
<NativeSelect
|
/>
|
||||||
id="select-folder"
|
<NativeSelect
|
||||||
color="primary"
|
id="select-folder"
|
||||||
value={selectedFolder}
|
color="primary"
|
||||||
onChange={handleSelectFolder}
|
value={selectedFolder}
|
||||||
disabled={!isNewQuiz}
|
onChange={handleSelectFolder}
|
||||||
style={{ marginBottom: '16px' }} // Ajout de marge en bas
|
disabled={!isNewQuiz}
|
||||||
|
style={{ marginBottom: '16px', width: '200px', marginTop: '10px' }}
|
||||||
>
|
>
|
||||||
<option disabled value=""> Choisir un dossier... </option>
|
<option disabled value="">
|
||||||
|
Choisir un dossier...
|
||||||
|
</option>
|
||||||
|
{folders.map((folder: FolderType) => (
|
||||||
|
<option value={folder._id} key={folder._id}>
|
||||||
|
{folder.title}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</NativeSelect>
|
||||||
|
</div>
|
||||||
|
|
||||||
{folders.map((folder: FolderType) => (
|
|
||||||
<option value={folder._id} key={folder._id}> {folder.title} </option>
|
|
||||||
))}
|
|
||||||
</NativeSelect></label>
|
|
||||||
|
|
||||||
<Button variant="contained" onClick={handleQuizSave}>
|
|
||||||
Enregistrer
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Divider style={{ margin: '16px 0' }} />
|
<Divider style={{ margin: '16px 0' }} />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,7 @@ import {
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import { checkIfIsCorrect } from './useRooms';
|
import { checkIfIsCorrect } from './useRooms';
|
||||||
import { QRCodeCanvas } from 'qrcode.react';
|
import { QRCodeCanvas } from 'qrcode.react';
|
||||||
import ContentCopyIcon from "@mui/icons-material/ContentCopy";
|
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
|
||||||
|
|
||||||
|
|
||||||
const ManageRoom: React.FC = () => {
|
const ManageRoom: React.FC = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
@ -416,7 +415,7 @@ const ManageRoom: React.FC = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="room">
|
<div className="room">
|
||||||
{/* En-tête avec titre et bouton QR code*/}
|
{/* En-tête avec bouton Disconnect à gauche et QR code à droite */}
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
|
@ -425,7 +424,11 @@ const ManageRoom: React.FC = () => {
|
||||||
marginBottom: '20px'
|
marginBottom: '20px'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<h1 style={{ margin: 0 }}>Salle : {formattedRoomName}</h1>
|
<DisconnectButton
|
||||||
|
onReturn={handleReturn}
|
||||||
|
askConfirm
|
||||||
|
message={`Êtes-vous sûr de vouloir quitter?`}
|
||||||
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
|
|
@ -437,13 +440,14 @@ const ManageRoom: React.FC = () => {
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Modale QR Code */}
|
|
||||||
<Dialog
|
<Dialog
|
||||||
open={showQrModal}
|
open={showQrModal}
|
||||||
onClose={() => setShowQrModal(false)}
|
onClose={() => setShowQrModal(false)}
|
||||||
aria-labelledby="qr-modal-title"
|
aria-labelledby="qr-modal-title"
|
||||||
>
|
>
|
||||||
<DialogTitle id="qr-modal-title">Rejoindre la salle: {formattedRoomName}</DialogTitle>
|
<DialogTitle id="qr-modal-title">
|
||||||
|
Rejoindre la salle: {formattedRoomName}
|
||||||
|
</DialogTitle>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<DialogContentText>
|
<DialogContentText>
|
||||||
Scannez ce QR code ou partagez le lien ci-dessous pour rejoindre la salle :
|
Scannez ce QR code ou partagez le lien ci-dessous pour rejoindre la salle :
|
||||||
|
|
@ -457,13 +461,13 @@ const ManageRoom: React.FC = () => {
|
||||||
<h3>URL de participation :</h3>
|
<h3>URL de participation :</h3>
|
||||||
<p>{roomUrl}</p>
|
<p>{roomUrl}</p>
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
startIcon={<ContentCopyIcon />}
|
startIcon={<ContentCopyIcon />}
|
||||||
onClick={handleCopy}
|
onClick={handleCopy}
|
||||||
style={{ marginTop: '10px' }}
|
style={{ marginTop: '10px' }}
|
||||||
>
|
>
|
||||||
{copied ? "Copié !" : "Copier le lien"}
|
{copied ? 'Copié !' : 'Copier le lien'}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
|
|
@ -472,31 +476,34 @@ const ManageRoom: React.FC = () => {
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
<div className="roomHeader">
|
|
||||||
<DisconnectButton
|
|
||||||
onReturn={handleReturn}
|
|
||||||
askConfirm
|
|
||||||
message={`Êtes-vous sûr de vouloir quitter?`}
|
|
||||||
/>
|
|
||||||
|
|
||||||
|
<div className="roomHeader">
|
||||||
<div
|
<div
|
||||||
className="headerContent"
|
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'center',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
width: '100%'
|
width: '100%',
|
||||||
|
marginBottom: '10px'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{
|
<h1 style={{ margin: 0, display: 'flex', alignItems: 'center' }}>
|
||||||
|
Salle : {formattedRoomName}
|
||||||
<div
|
<div
|
||||||
className="userCount subtitle smallText"
|
className="userCount subtitle"
|
||||||
style={{ display: 'flex', justifyContent: 'flex-end' }}
|
style={{
|
||||||
|
display: 'inline-flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
fontSize: '1.5rem',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
marginLeft: '20px',
|
||||||
|
marginBottom: '0px'
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<GroupIcon style={{ marginRight: '5px' }} />
|
<GroupIcon style={{ marginRight: '5px', verticalAlign: 'middle' }} />{' '}
|
||||||
{students.length}/60
|
{students.length}/60
|
||||||
</div>
|
</div>
|
||||||
}
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="dumb"></div>
|
<div className="dumb"></div>
|
||||||
|
|
|
||||||
|
|
@ -2,25 +2,31 @@
|
||||||
.room .roomHeader {
|
.room .roomHeader {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: column;
|
||||||
justify-content: space-between;
|
align-items: flex-start;
|
||||||
align-content: stretch
|
position: relative;
|
||||||
}
|
}
|
||||||
.room .roomHeader .returnButton {
|
.room .roomHeader .returnButton {
|
||||||
flex-basis: 10%;
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
display: flex;
|
left: 0;
|
||||||
justify-content: center;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
.room .roomHeader .centerTitle {
|
.room .roomHeader .centerTitle {
|
||||||
flex-basis: auto;
|
flex-basis: auto;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
justify-content: flex-start;
|
||||||
justify-content: flex-end;
|
align-items: flex-start;
|
||||||
align-items: flex-end;
|
margin-top: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.room .roomHeader .headerContent {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.room .roomHeader .dumb {
|
.room .roomHeader .dumb {
|
||||||
|
|
@ -34,7 +40,6 @@
|
||||||
|
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
/* align-items: center; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.room .finishQuizButton {
|
.room .finishQuizButton {
|
||||||
|
|
@ -44,146 +49,7 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.room h1 {
|
||||||
|
text-align: center;
|
||||||
/* .create-room-container {
|
margin-top: 50px;
|
||||||
display: flex;
|
}
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.manage-room-container {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.quiz-setup-container {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.quiz-mode-selection {
|
|
||||||
display: flex;
|
|
||||||
flex-grow: 0;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
margin-top: 10px;
|
|
||||||
height: 15vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.users-container {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
flex-grow: 1;
|
|
||||||
gap: 2vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.launch-quiz-btn {
|
|
||||||
width: 20vw;
|
|
||||||
height: 11vh;
|
|
||||||
margin-top: 2vh;
|
|
||||||
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.mode-choice {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
width: 20vw;
|
|
||||||
margin-top: 2vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user {
|
|
||||||
background-color: #e7dad1;
|
|
||||||
padding: 10px 20px;
|
|
||||||
border: 1px solid black;
|
|
||||||
border-radius: 10px;
|
|
||||||
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.bottom-btn {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin-top: 2vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.room-container {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 60vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (max-device-width: 768px) {
|
|
||||||
.room-container {
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.room-wrapper {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.room-name-wrapper {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: end;
|
|
||||||
}
|
|
||||||
.user-item {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex-column-wrapper {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 85vh;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.preview-and-result-container {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nextQuestionButton {
|
|
||||||
align-self: flex-end;
|
|
||||||
margin-bottom: 5rem !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-container {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (max-device-height: 4000px) {
|
|
||||||
.flex-column-wrapper {
|
|
||||||
height: 60vh;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (max-device-height: 1079px) {
|
|
||||||
.flex-column-wrapper {
|
|
||||||
height: 50vh;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (max-device-height: 741px) {
|
|
||||||
.flex-column-wrapper {
|
|
||||||
height: 40vh;
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
|
|
@ -5,6 +5,7 @@ import './share.css';
|
||||||
import { Button, NativeSelect, Typography, Box } from '@mui/material';
|
import { Button, NativeSelect, Typography, Box } from '@mui/material';
|
||||||
import ReturnButton from 'src/components/ReturnButton/ReturnButton';
|
import ReturnButton from 'src/components/ReturnButton/ReturnButton';
|
||||||
import ApiService from '../../../services/ApiService';
|
import ApiService from '../../../services/ApiService';
|
||||||
|
import SaveIcon from '@mui/icons-material/Save';
|
||||||
|
|
||||||
const Share: React.FC = () => {
|
const Share: React.FC = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
@ -167,6 +168,7 @@ const Share: React.FC = () => {
|
||||||
</NativeSelect>
|
</NativeSelect>
|
||||||
|
|
||||||
<Button variant="contained" onClick={handleQuizSave} className="saveButton">
|
<Button variant="contained" onClick={handleQuizSave} className="saveButton">
|
||||||
|
{<SaveIcon sx={{ fontSize: 20, marginRight: '8px' }} />}
|
||||||
Enregistrer
|
Enregistrer
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue