mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Compare commits
11 commits
65bcda2134
...
524f48ea91
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
524f48ea91 | ||
|
|
f3e20dd820 | ||
|
|
bddbe09045 | ||
|
|
e34f04f10b | ||
|
|
e19048f5dd | ||
|
|
09ec127a76 | ||
|
|
911d051089 | ||
|
|
ddf955a7a2 | ||
|
|
51cebdaba1 | ||
|
|
57c5321c09 | ||
|
|
36b5c58b94 |
15 changed files with 602 additions and 646 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { render, screen, fireEvent } from '@testing-library/react';
|
import { render, screen, fireEvent } from '@testing-library/react';
|
||||||
import '@testing-library/jest-dom';
|
import '@testing-library/jest-dom';
|
||||||
import Editor from '../../../components/Editor/Editor';
|
import Editor from '../../../components/Editor/newEditor';
|
||||||
|
|
||||||
describe('Editor Component', () => {
|
describe('Editor Component', () => {
|
||||||
const mockOnValuesChange = jest.fn();
|
const mockOnValuesChange = jest.fn();
|
||||||
|
|
|
||||||
|
|
@ -1,202 +1,33 @@
|
||||||
import React, { useState } from 'react';
|
import React, { useRef } from 'react';
|
||||||
import { TextField, Typography, IconButton, Box, Collapse, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Button } from '@mui/material';
|
import './editor.css';
|
||||||
import DeleteIcon from '@mui/icons-material/Delete';
|
import { TextareaAutosize } from '@mui/material';
|
||||||
import VisibilityIcon from '@mui/icons-material/Visibility';
|
|
||||||
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
||||||
import ExpandLessIcon from '@mui/icons-material/ExpandLess';
|
|
||||||
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
||||||
|
|
||||||
interface EditorProps {
|
interface EditorProps {
|
||||||
label: string;
|
label: string;
|
||||||
values: string[];
|
values: string[];
|
||||||
onValuesChange: (values: string[]) => void;
|
onEditorChange: (value: string) => void;
|
||||||
onFocusQuestion?: (index: number) => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Editor: React.FC<EditorProps> = ({ label, values, onValuesChange, onFocusQuestion }) => {
|
const Editor: React.FC<EditorProps> = ({ label, values, onEditorChange }) => {
|
||||||
const [collapsed, setCollapsed] = useState<boolean[]>(Array(values.length).fill(false));
|
const editorRef = useRef<HTMLTextAreaElement | null>(null);
|
||||||
const [dialogOpen, setDialogOpen] = useState(false);
|
|
||||||
const [deleteIndex, setDeleteIndex] = useState<number | null>(null);
|
|
||||||
|
|
||||||
const handleChange = (index: number) => (event: React.ChangeEvent<HTMLInputElement>) => {
|
function handleEditorChange(event: React.ChangeEvent<HTMLTextAreaElement>) {
|
||||||
const newValues = [...values];
|
const text = event.target.value;
|
||||||
newValues[index] = event.target.value;
|
onEditorChange(text || '');
|
||||||
onValuesChange(newValues);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDeleteQuestion = (index: number) => () => {
|
|
||||||
if (values[index].trim() === '') {
|
|
||||||
const newValues = values.filter((_, i) => i !== index);
|
|
||||||
onValuesChange(newValues);
|
|
||||||
setCollapsed((prev) => prev.filter((_, i) => i !== index));
|
|
||||||
} else {
|
|
||||||
setDeleteIndex(index);
|
|
||||||
setDialogOpen(true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleConfirmDelete = () => {
|
|
||||||
if (deleteIndex !== null) {
|
|
||||||
const newValues = values.filter((_, i) => i !== deleteIndex);
|
|
||||||
onValuesChange(newValues);
|
|
||||||
setCollapsed((prev) => prev.filter((_, i) => i !== deleteIndex));
|
|
||||||
}
|
|
||||||
setDialogOpen(false);
|
|
||||||
setDeleteIndex(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCancelDelete = () => {
|
|
||||||
setDialogOpen(false);
|
|
||||||
setDeleteIndex(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleFocusQuestion = (index: number) => () => {
|
|
||||||
if (onFocusQuestion) {
|
|
||||||
onFocusQuestion(index);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleToggleCollapse = (index: number) => () => {
|
|
||||||
setCollapsed((prev) => {
|
|
||||||
const newCollapsed = [...prev];
|
|
||||||
newCollapsed[index] = !newCollapsed[index];
|
|
||||||
return newCollapsed;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const onDragEnd = (result: any) => {
|
|
||||||
if (!result.destination) return;
|
|
||||||
|
|
||||||
const newValues = [...values];
|
|
||||||
const [reorderedItem] = newValues.splice(result.source.index, 1);
|
|
||||||
newValues.splice(result.destination.index, 0, reorderedItem);
|
|
||||||
onValuesChange(newValues);
|
|
||||||
|
|
||||||
const newCollapsed = [...collapsed];
|
|
||||||
const [reorderedCollapsed] = newCollapsed.splice(result.source.index, 1);
|
|
||||||
newCollapsed.splice(result.destination.index, 0, reorderedCollapsed);
|
|
||||||
setCollapsed(newCollapsed);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (collapsed.length !== values.length) {
|
|
||||||
setCollapsed((prev) => {
|
|
||||||
const newCollapsed = [...prev];
|
|
||||||
while (newCollapsed.length < values.length) newCollapsed.push(false);
|
|
||||||
while (newCollapsed.length > values.length) newCollapsed.pop();
|
|
||||||
return newCollapsed;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<label>
|
||||||
<Typography variant="h6" fontWeight="bold" style={{ marginBottom: '24px' }}>
|
<h4>{label}</h4>
|
||||||
{label}
|
<TextareaAutosize
|
||||||
</Typography>
|
id="editor-textarea"
|
||||||
|
ref={editorRef}
|
||||||
<DragDropContext onDragEnd={onDragEnd}>
|
onChange={handleEditorChange}
|
||||||
<Droppable droppableId="questions">
|
value={values}
|
||||||
{(provided) => (
|
className="editor"
|
||||||
<div {...provided.droppableProps} ref={provided.innerRef}>
|
minRows={5}
|
||||||
{values.map((value, index) => (
|
|
||||||
<Draggable key={index} draggableId={`question-${index}`} index={index}>
|
|
||||||
{(provided) => (
|
|
||||||
<Box
|
|
||||||
ref={provided.innerRef}
|
|
||||||
{...provided.draggableProps}
|
|
||||||
{...provided.dragHandleProps}
|
|
||||||
sx={{
|
|
||||||
marginBottom: '8px',
|
|
||||||
boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)',
|
|
||||||
border: '1px solid rgba(0, 0, 0, 0.1)',
|
|
||||||
padding: '16px',
|
|
||||||
borderRadius: '4px',
|
|
||||||
...provided.draggableProps.style,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box display="flex" alignItems="center" justifyContent="space-between">
|
|
||||||
<Typography variant="subtitle1" fontWeight="bold" style={{ marginBottom: '8px' }}>
|
|
||||||
Question {index + 1}
|
|
||||||
</Typography>
|
|
||||||
<Box>
|
|
||||||
<IconButton
|
|
||||||
onClick={handleToggleCollapse(index)}
|
|
||||||
aria-label="toggle collapse"
|
|
||||||
sx={{
|
|
||||||
color: 'gray',
|
|
||||||
'&:hover': { color: 'blue' },
|
|
||||||
mr: 1,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{collapsed[index] ? <ExpandMoreIcon /> : <ExpandLessIcon />}
|
|
||||||
</IconButton>
|
|
||||||
<IconButton
|
|
||||||
onClick={handleFocusQuestion(index)}
|
|
||||||
aria-label="focus question"
|
|
||||||
sx={{
|
|
||||||
color: 'gray',
|
|
||||||
'&:hover': { color: 'blue' },
|
|
||||||
mr: 1,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<VisibilityIcon />
|
|
||||||
</IconButton>
|
|
||||||
<IconButton
|
|
||||||
onClick={handleDeleteQuestion(index)}
|
|
||||||
aria-label="delete"
|
|
||||||
sx={{
|
|
||||||
color: 'light-gray',
|
|
||||||
'&:hover': { color: 'red' },
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<DeleteIcon />
|
|
||||||
</IconButton>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
<Collapse in={!collapsed[index]}>
|
|
||||||
<TextField
|
|
||||||
value={value}
|
|
||||||
onChange={handleChange(index)}
|
|
||||||
fullWidth
|
|
||||||
multiline
|
|
||||||
minRows={4}
|
|
||||||
maxRows={Infinity}
|
|
||||||
variant="outlined"
|
|
||||||
style={{ overflow: 'auto' }}
|
|
||||||
/>
|
/>
|
||||||
</Collapse>
|
</label>
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
</Draggable>
|
|
||||||
))}
|
|
||||||
{provided.placeholder}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Droppable>
|
|
||||||
</DragDropContext>
|
|
||||||
|
|
||||||
{/* Confirmation Dialog */}
|
|
||||||
<Dialog
|
|
||||||
open={dialogOpen}
|
|
||||||
onClose={handleCancelDelete}
|
|
||||||
aria-labelledby="delete-confirmation-title"
|
|
||||||
aria-describedby="delete-confirmation-description"
|
|
||||||
>
|
|
||||||
<DialogTitle id="delete-confirmation-title" sx={{ textAlign: 'center'}}>Suppression</DialogTitle>
|
|
||||||
<DialogContent>
|
|
||||||
<DialogContentText id="delete-confirmation-description">
|
|
||||||
Confirmez vous la suppression de Question {deleteIndex !== null ? deleteIndex + 1 : ''} ?
|
|
||||||
</DialogContentText>
|
|
||||||
</DialogContent>
|
|
||||||
<DialogActions sx={{ justifyContent: 'center', pb: 2 }}>
|
|
||||||
<Button onClick={handleCancelDelete} color="primary" sx={{ mx: 1 }}>
|
|
||||||
Annuler
|
|
||||||
</Button>
|
|
||||||
<Button onClick={handleConfirmDelete} color="error" sx={{ mx: 1 }} autoFocus>
|
|
||||||
Supprimer
|
|
||||||
</Button>
|
|
||||||
</DialogActions>
|
|
||||||
</Dialog>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
9
client/src/components/Editor/newEditor.css
Normal file
9
client/src/components/Editor/newEditor.css
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
.editor {
|
||||||
|
width: 100%;
|
||||||
|
height: 50vh;
|
||||||
|
background-color: #f8f9ff;
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-top: 10px;
|
||||||
|
font-size: medium;
|
||||||
|
resize: none;
|
||||||
|
}
|
||||||
203
client/src/components/Editor/newEditor.tsx
Normal file
203
client/src/components/Editor/newEditor.tsx
Normal file
|
|
@ -0,0 +1,203 @@
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
import { TextField, Typography, IconButton, Box, Collapse, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Button } from '@mui/material';
|
||||||
|
import DeleteIcon from '@mui/icons-material/Delete';
|
||||||
|
import VisibilityIcon from '@mui/icons-material/Visibility';
|
||||||
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
||||||
|
import ExpandLessIcon from '@mui/icons-material/ExpandLess';
|
||||||
|
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
||||||
|
|
||||||
|
interface EditorProps {
|
||||||
|
label: string;
|
||||||
|
values: string[];
|
||||||
|
onValuesChange: (values: string[]) => void;
|
||||||
|
onFocusQuestion?: (index: number) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Editor: React.FC<EditorProps> = ({ label, values, onValuesChange, onFocusQuestion }) => {
|
||||||
|
const [collapsed, setCollapsed] = useState<boolean[]>(Array(values.length).fill(false));
|
||||||
|
const [dialogOpen, setDialogOpen] = useState(false);
|
||||||
|
const [deleteIndex, setDeleteIndex] = useState<number | null>(null);
|
||||||
|
|
||||||
|
const handleChange = (index: number) => (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
const newValues = [...values];
|
||||||
|
newValues[index] = event.target.value;
|
||||||
|
onValuesChange(newValues);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDeleteQuestion = (index: number) => () => {
|
||||||
|
if (values[index].trim() === '') {
|
||||||
|
const newValues = values.filter((_, i) => i !== index);
|
||||||
|
onValuesChange(newValues);
|
||||||
|
setCollapsed((prev) => prev.filter((_, i) => i !== index));
|
||||||
|
} else {
|
||||||
|
setDeleteIndex(index);
|
||||||
|
setDialogOpen(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleConfirmDelete = () => {
|
||||||
|
if (deleteIndex !== null) {
|
||||||
|
const newValues = values.filter((_, i) => i !== deleteIndex);
|
||||||
|
onValuesChange(newValues);
|
||||||
|
setCollapsed((prev) => prev.filter((_, i) => i !== deleteIndex));
|
||||||
|
}
|
||||||
|
setDialogOpen(false);
|
||||||
|
setDeleteIndex(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCancelDelete = () => {
|
||||||
|
setDialogOpen(false);
|
||||||
|
setDeleteIndex(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleFocusQuestion = (index: number) => () => {
|
||||||
|
if (onFocusQuestion) {
|
||||||
|
onFocusQuestion(index);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleToggleCollapse = (index: number) => () => {
|
||||||
|
setCollapsed((prev) => {
|
||||||
|
const newCollapsed = [...prev];
|
||||||
|
newCollapsed[index] = !newCollapsed[index];
|
||||||
|
return newCollapsed;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDragEnd = (result: any) => {
|
||||||
|
if (!result.destination) return;
|
||||||
|
|
||||||
|
const newValues = [...values];
|
||||||
|
const [reorderedItem] = newValues.splice(result.source.index, 1);
|
||||||
|
newValues.splice(result.destination.index, 0, reorderedItem);
|
||||||
|
onValuesChange(newValues);
|
||||||
|
|
||||||
|
const newCollapsed = [...collapsed];
|
||||||
|
const [reorderedCollapsed] = newCollapsed.splice(result.source.index, 1);
|
||||||
|
newCollapsed.splice(result.destination.index, 0, reorderedCollapsed);
|
||||||
|
setCollapsed(newCollapsed);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (collapsed.length !== values.length) {
|
||||||
|
setCollapsed((prev) => {
|
||||||
|
const newCollapsed = [...prev];
|
||||||
|
while (newCollapsed.length < values.length) newCollapsed.push(false);
|
||||||
|
while (newCollapsed.length > values.length) newCollapsed.pop();
|
||||||
|
return newCollapsed;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Typography variant="h6" fontWeight="bold" style={{ marginBottom: '24px' }}>
|
||||||
|
{label}
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
<DragDropContext onDragEnd={onDragEnd}>
|
||||||
|
<Droppable droppableId="questions">
|
||||||
|
{(provided) => (
|
||||||
|
<div {...provided.droppableProps} ref={provided.innerRef}>
|
||||||
|
{values.map((value, index) => (
|
||||||
|
<Draggable key={index} draggableId={`question-${index}`} index={index}>
|
||||||
|
{(provided) => (
|
||||||
|
<Box
|
||||||
|
ref={provided.innerRef}
|
||||||
|
{...provided.draggableProps}
|
||||||
|
{...provided.dragHandleProps}
|
||||||
|
sx={{
|
||||||
|
marginBottom: '8px',
|
||||||
|
boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.1)',
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.1)',
|
||||||
|
padding: '16px',
|
||||||
|
borderRadius: '4px',
|
||||||
|
...provided.draggableProps.style,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box display="flex" alignItems="center" justifyContent="space-between">
|
||||||
|
<Typography variant="subtitle1" fontWeight="bold" style={{ marginBottom: '8px' }}>
|
||||||
|
Question {index + 1}
|
||||||
|
</Typography>
|
||||||
|
<Box>
|
||||||
|
<IconButton
|
||||||
|
onClick={handleToggleCollapse(index)}
|
||||||
|
aria-label="toggle collapse"
|
||||||
|
sx={{
|
||||||
|
color: 'gray',
|
||||||
|
'&:hover': { color: 'blue' },
|
||||||
|
mr: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{collapsed[index] ? <ExpandMoreIcon /> : <ExpandLessIcon />}
|
||||||
|
</IconButton>
|
||||||
|
<IconButton
|
||||||
|
onClick={handleFocusQuestion(index)}
|
||||||
|
aria-label="focus question"
|
||||||
|
sx={{
|
||||||
|
color: 'gray',
|
||||||
|
'&:hover': { color: 'blue' },
|
||||||
|
mr: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<VisibilityIcon />
|
||||||
|
</IconButton>
|
||||||
|
<IconButton
|
||||||
|
onClick={handleDeleteQuestion(index)}
|
||||||
|
aria-label="delete"
|
||||||
|
sx={{
|
||||||
|
color: 'light-gray',
|
||||||
|
'&:hover': { color: 'red' },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<DeleteIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
<Collapse in={!collapsed[index]}>
|
||||||
|
<TextField
|
||||||
|
value={value}
|
||||||
|
onChange={handleChange(index)}
|
||||||
|
fullWidth
|
||||||
|
multiline
|
||||||
|
minRows={4}
|
||||||
|
maxRows={Infinity}
|
||||||
|
variant="outlined"
|
||||||
|
style={{ overflow: 'auto' }}
|
||||||
|
/>
|
||||||
|
</Collapse>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
</Draggable>
|
||||||
|
))}
|
||||||
|
{provided.placeholder}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</Droppable>
|
||||||
|
</DragDropContext>
|
||||||
|
|
||||||
|
{/* Confirmation Dialog */}
|
||||||
|
<Dialog
|
||||||
|
open={dialogOpen}
|
||||||
|
onClose={handleCancelDelete}
|
||||||
|
aria-labelledby="delete-confirmation-title"
|
||||||
|
aria-describedby="delete-confirmation-description"
|
||||||
|
>
|
||||||
|
<DialogTitle id="delete-confirmation-title" sx={{ textAlign: 'center'}}>Suppression</DialogTitle>
|
||||||
|
<DialogContent>
|
||||||
|
<DialogContentText id="delete-confirmation-description">
|
||||||
|
Confirmez vous la suppression de Question {deleteIndex !== null ? deleteIndex + 1 : ''} ?
|
||||||
|
</DialogContentText>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions sx={{ justifyContent: 'center', pb: 2 }}>
|
||||||
|
<Button onClick={handleCancelDelete} color="primary" sx={{ mx: 1 }}>
|
||||||
|
Annuler
|
||||||
|
</Button>
|
||||||
|
<Button onClick={handleConfirmDelete} color="error" sx={{ mx: 1 }} autoFocus>
|
||||||
|
Supprimer
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</Dialog>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Editor;
|
||||||
|
|
@ -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 =>
|
||||||
|
|
@ -120,6 +121,10 @@ const Dashboard: React.FC = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toggleSearchVisibility = () => {
|
||||||
|
setIsSearchVisible(!isSearchVisible);
|
||||||
|
};
|
||||||
|
|
||||||
// Créer une salle
|
// Créer une salle
|
||||||
const createRoom = async (title: string) => {
|
const createRoom = async (title: string) => {
|
||||||
// Créer la salle et récupérer l'objet complet
|
// Créer la salle et récupérer l'objet complet
|
||||||
|
|
@ -133,10 +138,9 @@ const Dashboard: React.FC = () => {
|
||||||
selectRoomByName(newRoom); // Utiliser l'ID de l'objet retourné
|
selectRoomByName(newRoom); // Utiliser l'ID de l'objet retourné
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Sélectionner une salle
|
// Sélectionner une salle
|
||||||
const selectRoomByName = (roomId: string) => {
|
const selectRoomByName = (roomId: string) => {
|
||||||
const room = rooms.find(r => r._id === roomId);
|
const room = rooms.find((r) => r._id === roomId);
|
||||||
selectRoom(room);
|
selectRoom(room);
|
||||||
localStorage.setItem('selectedRoomId', roomId);
|
localStorage.setItem('selectedRoomId', roomId);
|
||||||
};
|
};
|
||||||
|
|
@ -150,7 +154,7 @@ const Dashboard: React.FC = () => {
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -402,30 +406,63 @@ const Dashboard: React.FC = () => {
|
||||||
|
|
||||||
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"
|
||||||
|
style={{ display: 'flex', justifyContent: 'flex-end', gap: '15px' }}
|
||||||
|
>
|
||||||
|
<select
|
||||||
|
value={selectedRoom?._id || ''}
|
||||||
|
onChange={(e) => handleSelectRoom(e)}
|
||||||
|
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>
|
<option value="" disabled>
|
||||||
-- Sélectionner une salle --
|
Sélectionner une salle
|
||||||
</option>
|
</option>
|
||||||
{rooms.map((room) => (
|
{rooms.map((room) => (
|
||||||
<option key={room._id} value={room._id}>
|
<option key={room._id} value={room._id}>
|
||||||
{room.title}
|
{room.title}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
<option value="add-room">Ajouter salle</option>
|
<option
|
||||||
|
value="add-room"
|
||||||
|
style={{
|
||||||
|
color: 'black',
|
||||||
|
backgroundColor: '#f0f0f0',
|
||||||
|
fontWeight: 'bold'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Ajouter une salle
|
||||||
|
</option>
|
||||||
</select>
|
</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">
|
|
||||||
<IconButton>
|
|
||||||
<Search />
|
|
||||||
</IconButton>
|
|
||||||
</InputAdornment>
|
|
||||||
)
|
|
||||||
}}
|
}}
|
||||||
/>
|
></div>
|
||||||
</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>
|
||||||
|
|
@ -537,14 +572,77 @@ const Dashboard: React.FC = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="ajouter">
|
<div
|
||||||
|
className="search-bar"
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: '20px',
|
||||||
|
width: '100%'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
{/* À droite : les boutons */}
|
||||||
|
<div style={{ display: 'flex', gap: '12px' }}>
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
color="primary"
|
color="primary"
|
||||||
startIcon={<Add />}
|
startIcon={<Add />}
|
||||||
onClick={handleCreateQuiz}
|
onClick={handleCreateQuiz}
|
||||||
|
sx={{ borderRadius: '8px', minWidth: 'auto', padding: '4px 12px' }}
|
||||||
>
|
>
|
||||||
Ajouter un nouveau quiz
|
Nouveau quiz
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|
@ -553,9 +651,11 @@ const Dashboard: React.FC = () => {
|
||||||
startIcon={<Upload />}
|
startIcon={<Upload />}
|
||||||
onClick={handleOnImport}
|
onClick={handleOnImport}
|
||||||
>
|
>
|
||||||
Import
|
Importer
|
||||||
</Button>
|
</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>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,18 @@
|
||||||
// EditorQuiz.tsx
|
import React, { useState, useEffect, useRef, CSSProperties } from 'react';
|
||||||
import React, { useState, useEffect, CSSProperties } from 'react';
|
|
||||||
import { useParams, useNavigate } from 'react-router-dom';
|
import { useParams, useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
import { FolderType } from '../../../Types/FolderType';
|
import { FolderType } from '../../../Types/FolderType';
|
||||||
|
|
||||||
|
import NewEditor from 'src/components/Editor/newEditor';
|
||||||
import Editor from 'src/components/Editor/Editor';
|
import Editor from 'src/components/Editor/Editor';
|
||||||
|
|
||||||
import GiftCheatSheet from 'src/components/GIFTCheatSheet/GiftCheatSheet';
|
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 './editorQuiz.css';
|
import SaveIcon from '@mui/icons-material/Save';
|
||||||
|
import './EditorQuiz.css';
|
||||||
import { Button, TextField, NativeSelect, Divider, Dialog, DialogTitle, DialogActions, DialogContent, MenuItem, Select, Snackbar } from '@mui/material';
|
import { Button, TextField, NativeSelect, Divider, Dialog, DialogTitle, DialogActions, DialogContent, MenuItem, Select, Snackbar } from '@mui/material';
|
||||||
import ReturnButton from 'src/components/ReturnButton/ReturnButton';
|
import ReturnButton from 'src/components/ReturnButton/ReturnButton';
|
||||||
import ImageGalleryModal from 'src/components/ImageGallery/ImageGalleryModal/ImageGalleryModal';
|
import ImageGalleryModal from 'src/components/ImageGallery/ImageGalleryModal/ImageGalleryModal';
|
||||||
|
|
@ -50,6 +52,10 @@ const QuizForm: React.FC = () => {
|
||||||
const [snackbarOpen, setSnackbarOpen] = useState(false);
|
const [snackbarOpen, setSnackbarOpen] = useState(false);
|
||||||
const [snackbarMessage, setSnackbarMessage] = useState('');
|
const [snackbarMessage, setSnackbarMessage] = useState('');
|
||||||
const [copySuccess, setCopySuccess] = useState<string | null>(null);
|
const [copySuccess, setCopySuccess] = useState<string | null>(null);
|
||||||
|
const [dialogOpen, setDialogOpen] = useState(false);
|
||||||
|
const fileInputRef = useRef<HTMLInputElement | null>(null);
|
||||||
|
|
||||||
|
const [useNewEditor, setUserNewEditor] = useState(false);
|
||||||
|
|
||||||
const QuestionVraiFaux = "::Exemple de question vrai/faux:: \n 2+2 \\= 4 ? {T} //Utilisez les valeurs {T}, {F}, {TRUE} et {FALSE}.";
|
const QuestionVraiFaux = "::Exemple de question vrai/faux:: \n 2+2 \\= 4 ? {T} //Utilisez les valeurs {T}, {F}, {TRUE} et {FALSE}.";
|
||||||
const QuestionChoixMul = "::Ville capitale du Canada:: \nQuelle ville est la capitale du Canada? {\n~ Toronto\n~ Montréal\n= Ottawa #Rétroaction spécifique.\n} // Commentaire non visible (au besoin)";
|
const QuestionChoixMul = "::Ville capitale du Canada:: \nQuelle ville est la capitale du Canada? {\n~ Toronto\n~ Montréal\n= Ottawa #Rétroaction spécifique.\n} // Commentaire non visible (au besoin)";
|
||||||
|
|
@ -143,11 +149,27 @@ const QuizForm: React.FC = () => {
|
||||||
console.log("Updated values:", [...values, '']); // Log new state
|
console.log("Updated values:", [...values, '']); // Log new state
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUpdatePreview = (newValues: string[]) => {
|
const newHandleUpdatePreview = (newValues: string[]) => {
|
||||||
setValues(newValues);
|
setValues(newValues);
|
||||||
setFilteredValue(newValues.filter(value => value.trim() !== ''));
|
setFilteredValue(newValues.filter(value => value.trim() !== ''));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleUpdatePreview = (value: string) => {
|
||||||
|
if (value !== '') {
|
||||||
|
setValues([value]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// split value when there is at least one blank line
|
||||||
|
const linesArray = value.split(/\n{2,}/);
|
||||||
|
|
||||||
|
// if the first item in linesArray is blank, remove it
|
||||||
|
if (linesArray[0] === '') linesArray.shift();
|
||||||
|
|
||||||
|
if (linesArray[linesArray.length - 1] === '') linesArray.pop();
|
||||||
|
|
||||||
|
setFilteredValue(linesArray);
|
||||||
|
}
|
||||||
|
|
||||||
const handleQuizTitleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleQuizTitleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setQuizTitle(event.target.value);
|
setQuizTitle(event.target.value);
|
||||||
};
|
};
|
||||||
|
|
@ -249,6 +271,9 @@ const QuizForm: React.FC = () => {
|
||||||
copyToClipboard(value, label);
|
copyToClipboard(value, label);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toggleEditor = () => {
|
||||||
|
setUserNewEditor(!useNewEditor);
|
||||||
|
}
|
||||||
const handleCopyImage = (id: string) => {
|
const handleCopyImage = (id: string) => {
|
||||||
const escLink = `${ENV_VARIABLES.BACKEND_URL}/api/image/get/${id}`;
|
const escLink = `${ENV_VARIABLES.BACKEND_URL}/api/image/get/${id}`;
|
||||||
setImageLinks(prevLinks => [...prevLinks, escLink]);
|
setImageLinks(prevLinks => [...prevLinks, escLink]);
|
||||||
|
|
@ -256,54 +281,34 @@ const QuizForm: React.FC = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='quizEditor'>
|
<div className='quizEditor'>
|
||||||
|
<div className='editHeader' style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '32px' }}>
|
||||||
<div className='editHeader'
|
<ReturnButton quizTitle={quizTitle} quizContent={filteredValue} quizFolder={selectedFolder} quizId={quiz?._id} isNewQuiz={isNewQuiz} />
|
||||||
style={{
|
|
||||||
display: 'flex',
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
alignItems: 'center',
|
|
||||||
marginBottom: '32px'
|
|
||||||
}}>
|
|
||||||
<ReturnButton
|
|
||||||
quizTitle={quizTitle}
|
|
||||||
quizContent={filteredValue}
|
|
||||||
quizFolder={selectedFolder}
|
|
||||||
quizId={quiz?._id}
|
|
||||||
isNewQuiz={isNewQuiz}
|
|
||||||
/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div className='title'>Éditeur de Quiz</div>
|
<div className='title'>Éditeur de Quiz</div>
|
||||||
|
<Button
|
||||||
|
variant="outlined"
|
||||||
|
onClick={toggleEditor}
|
||||||
|
size="small"
|
||||||
|
style={{
|
||||||
|
fontSize: '10px', // Smaller font
|
||||||
|
padding: '2px 6px', // Reduced padding
|
||||||
|
minWidth: 'auto', // Allow button to shrink
|
||||||
|
height: 'fit-content', // Match height to content
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{useNewEditor ? 'Ancien éditeur' : 'Nouvel éditeur'}
|
||||||
|
</Button>
|
||||||
|
|
||||||
<div className='dumb'></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* <h2 className="subtitle">Éditeur</h2> */}
|
<TextField onChange={handleQuizTitleChange} value={quizTitle} placeholder="Titre du quiz" label="Titre du quiz" fullWidth />
|
||||||
|
|
||||||
<TextField
|
|
||||||
onChange={handleQuizTitleChange}
|
|
||||||
value={quizTitle}
|
|
||||||
placeholder="Titre du quiz"
|
|
||||||
label="Titre du quiz"
|
|
||||||
fullWidth
|
|
||||||
/>
|
|
||||||
<label>Choisir un dossier:
|
<label>Choisir un dossier:
|
||||||
<NativeSelect
|
<NativeSelect id="select-folder" color="primary" value={selectedFolder} onChange={handleSelectFolder} disabled={!isNewQuiz} style={{ marginBottom: '16px' }}>
|
||||||
id="select-folder"
|
|
||||||
color="primary"
|
|
||||||
value={selectedFolder}
|
|
||||||
onChange={handleSelectFolder}
|
|
||||||
disabled={!isNewQuiz}
|
|
||||||
style={{ marginBottom: '16px' }} // Ajout de marge en bas
|
|
||||||
>
|
|
||||||
<option disabled value=""> Choisir un dossier... </option>
|
<option disabled value=""> Choisir un dossier... </option>
|
||||||
|
|
||||||
{folders.map((folder: FolderType) => (
|
{folders.map((folder: FolderType) => (
|
||||||
<option value={folder._id} key={folder._id}> {folder.title} </option>
|
<option value={folder._id} key={folder._id}> {folder.title} </option>
|
||||||
))}
|
))}
|
||||||
</NativeSelect></label>
|
</NativeSelect>
|
||||||
|
</label>
|
||||||
|
|
||||||
<div className='sticky-buttons'>
|
<div className='sticky-buttons'>
|
||||||
<Select
|
<Select
|
||||||
|
|
@ -311,100 +316,62 @@ const QuizForm: React.FC = () => {
|
||||||
displayEmpty
|
displayEmpty
|
||||||
onChange={(e) => handleSelectChange(e.target.value, templates.find(t => t.value === e.target.value)?.label || '')}
|
onChange={(e) => handleSelectChange(e.target.value, templates.find(t => t.value === e.target.value)?.label || '')}
|
||||||
style={{ width: '210px' }}
|
style={{ width: '210px' }}
|
||||||
inputProps={{
|
inputProps={{ 'data-testid': 'template-select' }}
|
||||||
'data-testid': 'template-select'
|
|
||||||
}}
|
|
||||||
|
|
||||||
>
|
>
|
||||||
<MenuItem value="" disabled>Modèles de questions</MenuItem>
|
<MenuItem value="" disabled>Modèles de questions</MenuItem>
|
||||||
{templates.map((template, index) => (
|
{templates.map((template, index) => (
|
||||||
<MenuItem key={index} value={template.value}>{template.label}</MenuItem>
|
<MenuItem key={index} value={template.value}>{template.label}</MenuItem>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
<Button
|
|
||||||
variant="contained"
|
<Button variant="contained" onClick={handleQuizSave} sx={{ display: 'flex', alignItems: 'center' }}>
|
||||||
onClick={handleQuizSave}
|
|
||||||
sx={{ display: 'flex', alignItems: 'center' }}
|
|
||||||
>
|
|
||||||
<SaveIcon sx={{ fontSize: 20 }} />
|
<SaveIcon sx={{ fontSize: 20 }} />
|
||||||
Enregistrer
|
Enregistrer
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Snackbar
|
<Snackbar open={!!copySuccess} autoHideDuration={3000} onClose={() => setCopySuccess(null)} message={copySuccess} anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }} key={copySuccess ? 'open' : 'close'} />
|
||||||
open={!!copySuccess}
|
|
||||||
autoHideDuration={3000}
|
|
||||||
onClose={() => setCopySuccess(null)}
|
|
||||||
message={copySuccess}
|
|
||||||
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
|
|
||||||
key={copySuccess ? 'open' : 'close'}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Divider style={{ margin: '16px 0' }} />
|
<Divider style={{ margin: '16px 0' }} />
|
||||||
|
|
||||||
<div className='editSection'>
|
<div className='editSection'>
|
||||||
|
|
||||||
<div className='edit'>
|
<div className='edit'>
|
||||||
<Editor
|
{useNewEditor ? (
|
||||||
label=""
|
<NewEditor label="" values={values} onValuesChange={newHandleUpdatePreview} onFocusQuestion={handleFocusQuestion} />
|
||||||
values={values}
|
) : (
|
||||||
onValuesChange={handleUpdatePreview}
|
<Editor label="" values={values} onEditorChange={handleUpdatePreview} />
|
||||||
onFocusQuestion={handleFocusQuestion} />
|
)}
|
||||||
|
{useNewEditor && (
|
||||||
<Button variant="contained" onClick={handleAddQuestion}>
|
<Button variant="contained" onClick={handleAddQuestion}>
|
||||||
Ajouter une question
|
Ajouter une question
|
||||||
</Button>
|
</Button>
|
||||||
|
)}
|
||||||
<div className="images">
|
<div className="images">
|
||||||
{/* Collapsible Upload Section */}
|
|
||||||
<div style={{ marginTop: '8px' }}>
|
<div style={{ marginTop: '8px' }}>
|
||||||
<Button
|
<Button variant="outlined" onClick={() => setIsUploadCollapsed(!isUploadCollapsed)} style={{ padding: '4px 8px', fontSize: '12px', marginBottom: '4px', width: '40%' }}>
|
||||||
variant="outlined"
|
|
||||||
onClick={() => setIsUploadCollapsed(!isUploadCollapsed)}
|
|
||||||
style={{ padding: '4px 8px', fontSize: '12px', marginBottom: '4px', width: '40%' }}
|
|
||||||
>
|
|
||||||
{isUploadCollapsed ? 'Afficher Téléverser image' : 'Masquer Téléverser image'}
|
{isUploadCollapsed ? 'Afficher Téléverser image' : 'Masquer Téléverser image'}
|
||||||
</Button>
|
</Button>
|
||||||
{!isUploadCollapsed && (
|
{!isUploadCollapsed && (
|
||||||
<div className="upload">
|
<div className="upload">
|
||||||
<label className="dropArea">
|
<label className="dropArea">
|
||||||
<input
|
<input type="file" id="file-input" className="file-input" accept="image/jpeg, image/png" multiple ref={fileInputRef} />
|
||||||
type="file"
|
<Button variant="outlined" aria-label="Téléverser" onClick={handleSaveImage}>
|
||||||
id="file-input"
|
|
||||||
className="file-input"
|
|
||||||
accept="image/jpeg, image/png"
|
|
||||||
multiple
|
|
||||||
ref={fileInputRef}
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
variant="outlined"
|
|
||||||
aria-label="Téléverser"
|
|
||||||
onClick={handleSaveImage}
|
|
||||||
>
|
|
||||||
Téléverser <Upload />
|
Téléverser <Upload />
|
||||||
</Button>
|
</Button>
|
||||||
</label>
|
</label>
|
||||||
<Dialog open={dialogOpen} onClose={() => setDialogOpen(false)}>
|
<Dialog open={dialogOpen} onClose={() => setDialogOpen(false)}>
|
||||||
<DialogTitle>Erreur</DialogTitle>
|
<DialogTitle>Erreur</DialogTitle>
|
||||||
<DialogContent>
|
<DialogContent>Veuillez d'abord choisir une image à téléverser.</DialogContent>
|
||||||
Veuillez d'abord choisir une image à téléverser.
|
|
||||||
</DialogContent>
|
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={() => setDialogOpen(false)} color="primary">
|
<Button onClick={() => setDialogOpen(false)} color="primary">OK</Button>
|
||||||
OK
|
|
||||||
</Button>
|
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Collapsible Images Section */}
|
|
||||||
<div style={{ marginTop: '2px' }}>
|
<div style={{ marginTop: '2px' }}>
|
||||||
<Button
|
<Button variant="outlined" onClick={() => setIsImagesCollapsed(!isImagesCollapsed)} style={{ padding: '4px 8px', fontSize: '12px', marginBottom: '4px', width: '40%' }}>
|
||||||
variant="outlined"
|
|
||||||
onClick={() => setIsImagesCollapsed(!isImagesCollapsed)}
|
|
||||||
style={{ padding: '4px 8px', fontSize: '12px', marginBottom: '4px', width: '40%' }}
|
|
||||||
>
|
|
||||||
{isImagesCollapsed ? 'Afficher Mes images' : 'Masquer Mes images'}
|
{isImagesCollapsed ? 'Afficher Mes images' : 'Masquer Mes images'}
|
||||||
</Button>
|
</Button>
|
||||||
{!isImagesCollapsed && (
|
{!isImagesCollapsed && (
|
||||||
|
|
@ -413,16 +380,8 @@ const QuizForm: React.FC = () => {
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<div style={{ display: 'inline' }}>(Voir section </div>
|
<div style={{ display: 'inline' }}>(Voir section </div>
|
||||||
<a
|
<a href="#images-section" style={{ textDecoration: 'none' }} onClick={scrollToImagesSection}>
|
||||||
href="#images-section"
|
<u><em><h4 style={{ display: 'inline' }}> 9. Images </h4></em></u>
|
||||||
style={{ textDecoration: 'none' }}
|
|
||||||
onClick={scrollToImagesSection}
|
|
||||||
>
|
|
||||||
<u>
|
|
||||||
<em>
|
|
||||||
<h4 style={{ display: 'inline' }}> 9. Images </h4>
|
|
||||||
</em>
|
|
||||||
</u>
|
|
||||||
</a>
|
</a>
|
||||||
<div style={{ display: 'inline' }}> ci-dessous</div>
|
<div style={{ display: 'inline' }}> ci-dessous</div>
|
||||||
<div style={{ display: 'inline' }}>)</div>
|
<div style={{ display: 'inline' }}>)</div>
|
||||||
|
|
@ -434,9 +393,7 @@ const QuizForm: React.FC = () => {
|
||||||
const imgTag = `} "texte de l'infobulle")`;
|
const imgTag = `} "texte de l'infobulle")`;
|
||||||
return (
|
return (
|
||||||
<li key={index}>
|
<li key={index}>
|
||||||
<code onClick={() => handleCopyToClipboard(imgTag)}>
|
<code onClick={() => handleCopyToClipboard(imgTag)}>{imgTag}</code>
|
||||||
{imgTag}
|
|
||||||
</code>
|
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
@ -446,13 +403,8 @@ const QuizForm: React.FC = () => {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Collapsible CheatSheet Section */}
|
|
||||||
<div style={{ marginTop: '2px' }}>
|
<div style={{ marginTop: '2px' }}>
|
||||||
<Button
|
<Button variant="outlined" onClick={() => setIsCheatSheetCollapsed(!isCheatSheetCollapsed)} style={{ padding: '4px 8px', fontSize: '12px', marginBottom: '4px', width: '40%' }}>
|
||||||
variant="outlined"
|
|
||||||
onClick={() => setIsCheatSheetCollapsed(!isCheatSheetCollapsed)}
|
|
||||||
style={{ padding: '4px 8px', fontSize: '12px', marginBottom: '4px', width: '40%' }}
|
|
||||||
>
|
|
||||||
{isCheatSheetCollapsed ? 'Afficher CheatSheet' : 'Masquer CheatSheet'}
|
{isCheatSheetCollapsed ? 'Afficher CheatSheet' : 'Masquer CheatSheet'}
|
||||||
</Button>
|
</Button>
|
||||||
{!isCheatSheetCollapsed && <GiftCheatSheet />}
|
{!isCheatSheetCollapsed && <GiftCheatSheet />}
|
||||||
|
|
@ -471,24 +423,12 @@ const QuizForm: React.FC = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{showScrollButton && (
|
{showScrollButton && (
|
||||||
<Button
|
<Button onClick={scrollToTop} variant="contained" color="primary" style={scrollToTopButtonStyle} title="Scroll to top">
|
||||||
onClick={scrollToTop}
|
|
||||||
variant="contained"
|
|
||||||
color="primary"
|
|
||||||
style={scrollToTopButtonStyle}
|
|
||||||
title="Scroll to top"
|
|
||||||
>
|
|
||||||
↑
|
↑
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Snackbar
|
<Snackbar open={snackbarOpen} autoHideDuration={3000} onClose={handleSnackbarClose} message={snackbarMessage} anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }} />
|
||||||
open={snackbarOpen}
|
|
||||||
autoHideDuration={3000} // Hide after 3 seconds
|
|
||||||
onClose={handleSnackbarClose}
|
|
||||||
message={snackbarMessage}
|
|
||||||
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }} // Lower-right corner
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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 :
|
||||||
|
|
@ -462,7 +466,7 @@ const ManageRoom: React.FC = () => {
|
||||||
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>
|
||||||
|
|
@ -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