Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,089 changes: 728 additions & 361 deletions frontend/package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@fontsource/roboto": "^5.2.6",
"@mui/icons-material": "^7.3.2",
"@mui/lab": "^7.0.1-beta.21",
"@mui/material": "^7.3.2",
"@mui/x-charts": "^8.26.0",
"@mui/icons-material": "^9.0.0",
"@mui/lab": "^9.0.0-beta.2",
"@mui/material": "^9.0.0",
"@mui/x-charts": "^9.0.0",
"@tiptap/core": "^3.13.0",
"@tiptap/extension-blockquote": "^3.19.0",
"@tiptap/extension-bold": "^3.13.0",
Expand Down
10 changes: 5 additions & 5 deletions frontend/personalised/certificate/Certificate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,25 +133,25 @@ const CertificateContent = () => {
<Typography
variant="h3"
align="center"
mt={4}
sx={{
mt: 4,
fontWeight: 500,
maxWidth: '80%',
}}
dangerouslySetInnerHTML={{ __html: localeMessages['description'].replace(name, "<div style='font-size: 2em; padding: 0.5em; font-weight: 700;'>" + name + "</div>") }}
>
</Typography>
<Grid container spacing={2} sx={{pt: 2, mt: 4, width: '100%', minHeight: '100px' }} alignItems="flex-end">
<Grid item size={4} sx={{ textAlign: 'center' }} >
<Grid container spacing={2} sx={{ pt: 2, mt: 4, width: '100%', minHeight: '100px', alignItems: 'flex-end' }}>
<Grid size={4} sx={{ textAlign: 'center' }} >
<Typography variant="body2">
{ logoUrl && <><img src={logoUrl} alt="Organization Logo" style={{ width: 80, height: 80, objectFit: 'contain' }} /><br /></> }
<b>{localeMessages['organization_team']}</b><br />
{localeMessages['issue_date']}: {issueDate}
</Typography>
</Grid>
<Grid item size={4} sx={{ textAlign: 'center' }} >
<Grid size={4} sx={{ textAlign: 'center' }} >
</Grid>
<Grid item size={4} sx={{ textAlign: 'center' }} >
<Grid size={4} sx={{ textAlign: 'center' }} >
<Typography variant="body2">
<img src={qrcodeUrl} alt="QR Code" style={{ width: 80, height: 80 }} />
<br />
Expand Down
2 changes: 1 addition & 1 deletion frontend/personalised/certificate_form/CertificateForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const CertificateForm = () => {
bgcolor: "background.paper",
}}
>
<Box display="flex" alignItems="center" my={4} justifyContent="center">
<Box sx={{ display: 'flex', alignItems: 'center', my: 4, justifyContent: 'center' }}>
<WorkspacePremiumIcon color="secondary" sx={{ fontSize: 50, mr: 1 }} />
<Typography variant="h4" component="h1">
{localeMessages['form_title']}
Expand Down
4 changes: 2 additions & 2 deletions frontend/personalised/command_result/CommandResult.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const CommandResult = () => {
return <Layout>
{ !errorMessage && !confirmationMessage ?<Alert severity='success' sx={{ maxWidth: 800, margin: '0 auto', backgroundColor: "background.light" }}>
{successMessage}
</Alert> : confirmationMessage ? <Box sx={{my: 6}}><Typography variant='h6' align='center' sx={{ mt: 4, color: 'text.primary' }}>
</Alert> : confirmationMessage ? <Box sx={{ my: 6 }}><Typography variant='h6' align='center' sx={{ mt: 4, color: 'text.primary' }}>
{confirmationMessage}
</Typography> <Box mt={6} sx={{ textAlign: 'center' }}><Button href={confirmUrl} variant='contained' mt={2} sx={{ mx: 'auto', px: 3, fontSize: '1rem'}}>{localeMessages["Confirm"]}</Button></Box></Box>: <Alert severity="error" sx={{ maxWidth: 800, margin: '20px auto' }}>
</Typography> <Box sx={{ mt: 6, textAlign: 'center' }}><Button href={confirmUrl} variant='contained' sx={{ mt: 2, mx: 'auto', px: 3, fontSize: '1rem' }}>{localeMessages["Confirm"]}</Button></Box></Box>: <Alert severity="error" sx={{ maxWidth: 800, margin: '20px auto' }}>
{errorMessage} (ref: {ref})
</Alert>}
</Layout>
Expand Down
18 changes: 9 additions & 9 deletions frontend/personalised/quiz_public/Quiz.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ const Quiz = () => {
return <Layout>
<Box sx={{ width: '100%', maxWidth: 920, mx: 'auto', p: { xs: 2, md: 4 }, borderRadius: 2, backgroundColor: "background.paper" }} component="form" method="POST" action="">
{ !errorMessage ? <Box>
{showQuestions ? <><Box mb={3}>
<Typography variant="h4" mb={1}>{quiz.title}</Typography>
{showQuestions ? <><Box sx={{ mb: 3 }}>
<Typography variant="h4" sx={{ mb: 1 }}>{quiz.title}</Typography>
</Box>
<Box>
<Typography sx={{ mb: 3, color: 'text.secondary' }}>
Expand All @@ -111,7 +111,7 @@ const Quiz = () => {

{quiz.questions.map((question, index) => (
<Box key={index} sx={{ mb: 2, py: 2, borderBottom: '1px solid', borderColor: 'divider' }}>
<Box mb={1}><Typography sx={{ fontWeight: 'bold', lineHeight: 1.5 }}>{question.text}</Typography></Box>
<Box sx={{ mb: 1 }}><Typography sx={{ fontWeight: 'bold', lineHeight: 1.5 }}>{question.text}</Typography></Box>
{question.answers.map((answer, cIndex) => (
<FormControlLabel control={<Checkbox onChange={(e) => { if (!e.target.checked) {
const newSelectedAnswers = [...selectedAnswers];
Expand All @@ -127,13 +127,13 @@ const Quiz = () => {
))}
</Box>
))}
<Box mt={3.5} textAlign="center">
<Box sx={{ mt: 3.5, textAlign: 'center' }}>
<Button variant="contained" onClick={showSubmitDialog} sx={{px: 3, fontSize: '1.1rem'}}>{localeMessages['submit']}</Button>
</Box>
</Box></> : <Box textAlign="center">
</Box></> : <Box sx={{ textAlign: 'center' }}>
{isPassed !== null && (isPassed ? <>{ !quizData && <CelebrationIcon sx={{mb: 2, color: 'primary.main', fontSize: '3rem'}}/> }<Alert severity={ score == 100 ? "success" : "info" } sx={{justifyContent: 'center', alignItems: 'center'}} ><Typography variant='h6'>{message} {localeMessages['your_score']}: {score}%</Typography></Alert></> :
<><Alert severity="error" sx={{ justifyContent: 'center', alignItems: 'center' }} ><Typography variant="h6">{message} {localeMessages['your_score']}: {score}%</Typography></Alert>
{!isInvalidated && <Box mt={3} textAlign="center"><Button onClick={() => window.location.reload()} variant="contained">{localeMessages['try_again']}</Button></Box>}
{!isInvalidated && <Box sx={{ mt: 3, textAlign: 'center' }}><Button onClick={() => window.location.reload()} variant="contained">{localeMessages['try_again']}</Button></Box>}
</>)}
{quizData && (
<Box sx={{ mt: 3, textAlign: direction === 'rtl' ? 'right' : 'left', border: '1px solid', borderColor: 'divider', borderRadius: 2, p: { xs: 2, md: 3 }, backgroundColor: 'background.default' }}>
Expand Down Expand Up @@ -182,11 +182,11 @@ const Quiz = () => {
</Box>}
</Box> : <Alert severity="error"><Typography variant="h6">{localeMessages['error']}: {errorMessage} {ref && `(Ref: ${ref})`}</Typography></Alert>}
<Dialog open={dialogOpen} onClose={() => setDialogOpen(false)} fullWidth maxWidth="sm">
<Box p={4}>
<Typography variant="h6" mb={2}>{localeMessages['ready_to_submit']}</Typography>
<Box sx={{ p: 4 }}>
<Typography variant="h6" sx={{ mb: 2 }}>{localeMessages['ready_to_submit']}</Typography>
{warning ? <Alert severity="warning" sx={{ mb: 2 }}><Typography>{warning}</Typography></Alert> :
<Typography>{localeMessages['submit_quiz_note']}</Typography>}
<Box mt={4} textAlign="right">
<Box sx={{ mt: 4, textAlign: 'right' }}>
<Button variant="text" onClick={() => setDialogOpen(false)} sx={{ mr: 2 }}>{localeMessages['cancel']}</Button>
<Button variant="contained" onClick={submitQuiz}>{localeMessages['submit']}</Button>
</Box>
Expand Down
12 changes: 6 additions & 6 deletions frontend/platform/course/Course.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ function Course() {
</Alert>
</Box>
)}
<Grid size={{xs: 12}} px={2} pt={2} pb={3}>
<Grid size={{xs: 12}} sx={{ px: 2, pt: 2, pb: 3 }}>
<Box
sx={{
mb: 3,
Expand Down Expand Up @@ -320,7 +320,7 @@ function Course() {
</Grid>
</Grid>
</Box>
<Box p={3} sx={{ border: '1px solid', borderColor: 'border.main', backgroundColor: 'background.box', borderRadius: 2, minHeight: 300 }}>
<Box sx={{ p: 3, border: '1px solid', borderColor: 'border.main', backgroundColor: 'background.box', borderRadius: 2, minHeight: 300 }}>
{userRole !== 'viewer' && <><Button variant="contained" startIcon={<DescriptionIcon sx={{ marginLeft: direction == 'rtl' ? 1 : 0 }} />} sx={{ marginBottom: 2 }} onClick={() => {
setDialogContent(<Suspense fallback={<Box sx={{ p: 2 }}><LinearProgress /></Box>}><LessonForm
header={localeMessages["new_lesson"]}
Expand All @@ -344,13 +344,13 @@ function Course() {
</Box>
<Grid container spacing={3}>
<Grid size={{xs: 12, lg: 6}}>
<Box py={3} sx={{ border: '1px solid', borderColor: 'border.main', borderRadius: 2, backgroundColor: 'background.box', height: '100%' }}>
<Box sx={{ py: 3, border: '1px solid', borderColor: 'border.main', borderRadius: 2, backgroundColor: 'background.box', height: '100%' }}>
<Typography variant="h6" align='center'>{localeMessages["enrollments_distribution"]}</Typography>
<Typography variant="body2" align='center' sx={{ mt: 1, mb: 2, color: 'text.secondary' }}>
{(localeMessages["total_enrollments"]) + ': ' + totalEnrollments}
</Typography>
{isEnrollmentsLoading ? (
<Box px={2}>
<Box sx={{ px: 2 }}>
<Skeleton variant="circular" width={180} height={180} sx={{ mx: 'auto', my: 2 }} />
<Skeleton variant="text" width="80%" sx={{ mx: 'auto' }} />
<Skeleton variant="text" width="60%" sx={{ mx: 'auto' }} />
Expand Down Expand Up @@ -391,10 +391,10 @@ function Course() {
</Box>
</Grid>
<Grid size={{xs: 12, lg: 6}}>
<Box py={3} sx={{ border: '1px solid', borderColor: 'border.main', borderRadius: 2, backgroundColor: 'background.box', height: '100%' }}>
<Box sx={{ py: 3, border: '1px solid', borderColor: 'border.main', borderRadius: 2, backgroundColor: 'background.box', height: '100%' }}>
<Typography variant="h6" align='center'>{localeMessages["weekly_enrollments"]}</Typography>
{isWeeklyStatsLoading ? (
<Box px={2}>
<Box sx={{ px: 2 }}>
<Skeleton variant="rectangular" height={220} sx={{ borderRadius: 1, my: 2 }} />
<Skeleton variant="text" width="75%" sx={{ mx: 'auto' }} />
</Box>
Expand Down
4 changes: 2 additions & 2 deletions frontend/platform/course/components/LessonForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ function LessonForm({ header, initialTitle, initialContent, cancelCallback, succ
setSuccessMessage("");
}}
sx={{ width: '200px', mr: 2 }}
inputProps={{ min: 1 }}
slotProps={{ htmlInput: { min: 1 } }}
disabled={userRole === 'viewer'}
/>
<Select size="small" value={waitingPeriodUnit} onChange={(e) => {
Expand All @@ -451,7 +451,7 @@ function LessonForm({ header, initialTitle, initialContent, cancelCallback, succ
<MenuItem value="hours">{localeMessages["hours"]}</MenuItem>
</Select>
</Tooltip>
<Box mt={2} textAlign="right" sx={{ position: 'sticky', bottom: 0, p: 1, pt: 2, backgroundColor: 'background.default', borderTop: '1px solid', borderColor: 'divider', zIndex: 2, display: 'flex', alignItems: 'center', gap: 1, flexWrap: 'wrap' }}>
<Box sx={{ mt: 2, textAlign: 'right', position: 'sticky', bottom: 0, p: 1, pt: 2, backgroundColor: 'background.default', borderTop: '1px solid', borderColor: 'divider', zIndex: 2, display: 'flex', alignItems: 'center', gap: 1, flexWrap: 'wrap' }}>
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, flexWrap: 'wrap', mr: 'auto' }}>
{successMessage && (
<Alert severity="success" sx={{ py: 0 }}>
Expand Down
8 changes: 4 additions & 4 deletions frontend/platform/course/components/QuestionForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Box, Grid, Typography, Button, Switch, Table, TableHead, TableBody, Tab
import RuleIcon from '@mui/icons-material/Rule';
import EditIcon from '@mui/icons-material/Edit';
import ClearIcon from '@mui/icons-material/Clear';
import AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline';
import AddCircleOutlinedIcon from '@mui/icons-material/AddCircleOutlined';
import { useAppContext } from '../../../src/render';


Expand Down Expand Up @@ -63,7 +63,7 @@ const QuestionForm = ({question, index, eventHandler}) => {

return (
<Box key={index} sx={{ mb: 1, p: 2, border: '1px solid', borderColor: 'grey.300', borderRadius: 1 }}>
<Grid container spacing={2} alignItems="center">
<Grid container spacing={2} sx={{ alignItems: 'center' }}>
<Grid size={{ xs: 12, md: 9 }}>
{userRole !== 'viewer' && <EditIcon sx={{borderRadius: "50%", display: "inline-block", float: "left", mr: 1, fontSize: "0.9rem", border: 1, borderColor: "grey.200", color: "grey.400", padding: "4px", cursor: "pointer", ':hover': { backgroundColor: "secondary.main", color: "white", borderColor: "secondary.main" } }} onClick={editQuestion}/>}
{!editMode ? (
Expand Down Expand Up @@ -106,14 +106,14 @@ const QuestionForm = ({question, index, eventHandler}) => {
}}
/>
</Grid>
<Grid size={{ xs: 3 }} sx={{ textAlign: 'left' }} alignItems={"center"}>
<Grid size={{ xs: 3 }} sx={{ textAlign: 'left', alignItems: 'center' }}>
<Button variant="outlined" sx={{ mt: 1, mr: 1 }} onClick={() => {
if (optionInputRef.current) {
console.log(optionInputRef.current);
addToOptions(optionInputRef.current.value);
}
}}>
<AddCircleOutlineIcon sx={{ mr: 1 }} />
<AddCircleOutlinedIcon sx={{ mr: 1 }} />
{ localeMessages["add"] }
</Button>
<Button variant="outlined" sx={{ mt: 1 }} onClick={() => setAddingOption(false)}>
Expand Down
10 changes: 5 additions & 5 deletions frontend/platform/course/components/QuizForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ const QuizForm = ({cancelCallback, successCallback, courseId, quizId, contentId,
<QuizIcon sx={{ mr: 1 }} /> {localeMessages["add_question"]}</Button>}
{ showQuestionField && (
<Box sx={{ mb: 2, border: '1px solid', borderColor: 'grey.300', borderRadius: 1, p: 2 }}>
<Grid container spacing={2} alignItems="center">
<Grid container spacing={2} sx={{ alignItems: 'center' }}>
<Grid size={{ xs: 12, md: 8 }}>
<RequiredTextField inputRef={questionInputRef} label="Question" value={newQuestion} onChange={(e) => setNewQuestion(e.target.value)} sx={{ width: '100%' }} onKeyDown={(e) => {
if (e.key === 'Enter') {
Expand All @@ -338,7 +338,7 @@ const QuizForm = ({cancelCallback, successCallback, courseId, quizId, contentId,
)) }
</Box>
{/* Quiz Settings Section */}
<Box mt={3} mb={3}>
<Box sx={{ mt: 3, mb: 3 }}>
<Typography variant="h6" sx={{ mb: 2, fontSize: '1.1rem', color: 'secondary.main' }}>
{localeMessages["quiz_settings"]}
</Typography>
Expand Down Expand Up @@ -380,7 +380,7 @@ const QuizForm = ({cancelCallback, successCallback, courseId, quizId, contentId,
value={requiredScore}
onChange={(e) => setRequiredScore(e.target.value)}
sx={{ width: '100%' }}
inputProps={{ min: 0, max: 100 }}
slotProps={{ htmlInput: { min: 0, max: 100 } }}
disabled={userRole === 'viewer' || !isBlocking}
/>
</Tooltip>
Expand All @@ -402,7 +402,7 @@ const QuizForm = ({cancelCallback, successCallback, courseId, quizId, contentId,
value={waitingPeriod}
onChange={(e) => setWaitingPeriod(e.target.value)}
sx={{ flex: 1 }}
inputProps={{ min: 1 }}
slotProps={{ htmlInput: { min: 1 } }}
disabled={userRole === 'viewer'}
/>
<Select
Expand Down Expand Up @@ -461,7 +461,7 @@ const QuizForm = ({cancelCallback, successCallback, courseId, quizId, contentId,
}
}}
sx={{ width: '100%' }}
inputProps={{ min: hasDeadline ? 1 : 0 }}
slotProps={{ htmlInput: { min: hasDeadline ? 1 : 0 } }}
disabled={userRole === 'viewer' || !hasDeadline}
/>
</Tooltip>
Expand Down
4 changes: 2 additions & 2 deletions frontend/platform/courses/Courses.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ function Courses() {
breadCrumbList={[{label: localeMessages.course_management, href: '#'}]}
organizationIdRefreshCallback={setOrganizationId}
>
<Grid size={{xs: 12}} py={2} pl={2}>
<Box p={2} sx={{ border: '1px solid', borderColor: 'border.main', backgroundColor: 'background.box', borderRadius: 2, minHeight: 300 }}>
<Grid size={{xs: 12}} sx={{ py: 2, pl: 2 }}>
<Box sx={{ p: 2, border: '1px solid', borderColor: 'border.main', backgroundColor: 'background.box', borderRadius: 2, minHeight: 300 }}>
{userRole !== 'viewer' && <Button variant="contained" startIcon={<SchoolIcon sx={{ marginLeft: direction === 'rtl' ? 1 : 0 }} />} sx={{ marginBottom: 2 }} onClick={() => {
setDialogContent(<Suspense fallback={<Box sx={{ p: 2 }}><LinearProgress /></Box>}><CourseForm
successCallback={handleCourseCreated}
Expand Down
Loading