Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | 1x 385x 1x 330x 1x 220x 1x 220x 1x 1x 67x 67x 67x 67x 67x 67x 67x 67x 67x 67x 67x 67x 67x 67x 44x 44x 44x 42x 1x 67x 2x 2x 2x 1x 1x 67x 47x 44x 44x 44x 44x 67x 63x 63x 62x 63x 67x 3x 1x 64x 67x 67x 67x 67x 64x 15x 4x 10x 1x 67x 67x 67x 67x 1x 4x 1x | import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import {
AppBar,
Button,
CircularProgress,
Stack,
Toolbar,
Grid,
Card,
CardContent,
Chip,
Divider,
Alert,
AlertTitle,
useTheme,
} from "@mui/material";
import React, { useEffect, useState } from "react";
import { useLocation, useNavigate, useParams } from "react-router-dom";
import YesNoOption from "@/utils/components/dialogs/YesNoOption";
import { useSelector } from "react-redux";
import { useDispatch } from "react-redux";
import { _studentFetchSpecificAssignmentById } from "@/store/slices/student/StudentSpecificAssignment";
import BasicBreadcrumbs from "@/utils/components/breadcrumbs/basic-breadcrumbs/BasicBreadcrumbs";
import { _fetchSpecificClassByCode } from "@/store/slices/student/StudentSpecificClass";
import SimpleLoading from "@/utils/components/SimpleLoading";
import { utcToLocalTime } from "@/utils/helpers/utcToLocalTime";
import {
isNotAvailable,
getAssignmentStatus as getAssignmentStatusFor,
getUnavailabilityReason,
} from "@/utils/helpers/assignmentAvailability";
import { _studentFetchAssignmentQuestions } from "@/store/slices/student/StudentQuestionPage";
import OKOption from "@/utils/components/dialogs/OKOption";
import axios from "axios";
import { API_ENDPOINTS } from "@/api/endpoints";
import AssignmentIcon from "@mui/icons-material/Assignment";
import AccessTimeIcon from "@mui/icons-material/AccessTime";
import QuizIcon from "@mui/icons-material/Quiz";
import RuleIcon from "@mui/icons-material/Rule";
import CalendarMonthIcon from "@mui/icons-material/CalendarMonth";
import EventAvailableIcon from "@mui/icons-material/EventAvailable";
import PlayCircleOutlineIcon from "@mui/icons-material/PlayCircleOutline";
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
import RemoveCircleOutlineIcon from "@mui/icons-material/RemoveCircleOutline";
import RepeatIcon from "@mui/icons-material/Repeat";
import ArticleIcon from "@mui/icons-material/Article";
import GppMaybeIcon from "@mui/icons-material/GppMaybe";
import WarningAmberIcon from "@mui/icons-material/WarningAmber";
import FullscreenIcon from "@mui/icons-material/Fullscreen";
import TabUnselectedIcon from "@mui/icons-material/TabUnselected";
import ContentPasteOffIcon from "@mui/icons-material/ContentPasteOff";
import KeyboardIcon from "@mui/icons-material/Keyboard";
import RubricTable from "@/app/student-page/components/assignments/RubricTable";
import {
parseTimeStringToSeconds,
formatSecondsToTime,
} from "@/app/student-page/page/assignments/take-assignment/components/takeAssignmentTimer";
/** One label/value line in the "About This Assignment" card. */
const InfoRow = ({ label, value, testId }) => (
<Box sx={{ display: "flex", justifyContent: "space-between", gap: 2, py: 0.75 }}>
<Typography variant="body2" color="text.secondary">
{label}
</Typography>
<Typography variant="body2" fontWeight={600} data-testid={testId} sx={{ textAlign: "right" }}>
{value}
</Typography>
</Box>
);
/**
* One line in the "Assignment Rules" card. Every row uses the SAME on/off icon —
* unlike the previous design, which gave each setting its own icon and only
* changed its color, so scanning the column for "what's actually on" meant
* reading colors on six different shapes instead of one.
*/
const RuleRow = ({ label, enabled }) => (
<Stack direction="row" spacing={1.25} alignItems="center">
{enabled ? (
<CheckCircleIcon color="success" fontSize="small" />
) : (
<RemoveCircleOutlineIcon color="disabled" fontSize="small" />
)}
<Typography variant="body2" color={enabled ? "text.primary" : "text.secondary"}>
{label}
</Typography>
</Stack>
);
/** One "at a glance" figure in the hero card — the handful of facts a student needs before deciding to start. */
const StatTile = ({ icon, label, value, testId }) => (
<Stack direction="row" spacing={1.25} alignItems="center" sx={{ minWidth: 160 }}>
<Box
sx={{
display: "flex",
alignItems: "center",
justifyContent: "center",
width: 40,
height: 40,
borderRadius: "50%",
bgcolor: "primary.lighter",
color: "primary.main",
flexShrink: 0,
}}
>
{icon}
</Box>
<Box>
<Typography variant="caption" color="text.secondary" sx={{ display: "block", lineHeight: 1.2 }}>
{label}
</Typography>
<Typography variant="subtitle1" fontWeight={700} data-testid={testId} sx={{ lineHeight: 1.3 }}>
{value}
</Typography>
</Box>
</Stack>
);
/** One tracked action in the "Browser Monitoring" card. */
const MonitoredActionRow = ({ icon, label }) => (
<Stack direction="row" spacing={1.5} alignItems="center">
<Box sx={{ color: "warning.main", display: "flex" }}>{icon}</Box>
<Typography variant="body2">{label}</Typography>
</Stack>
);
// The number of browser-lockdown violations a student is allowed, for the copy on
// this pre-start card. Display only — the limit is ENFORCED server-side.
//
// It must equal MAX_LOCKDOWN_VIOLATIONS in the backend
// (server/services/student/student_assignment.py). It said 5 while the backend
// said 3, so students were told they had five and the server closed the attempt
// at the third — with this page still promising two warnings left. The backend
// also stops accepting answer saves at that point (403), so the difference cost a
// student their attempt two violations early.
//
// This value cannot simply be read from the server: the only response carrying
// `max_violations` comes back from reporting a violation, and this card is shown
// BEFORE the attempt starts, when none has been reported. Removing the duplication
// properly means putting the threshold on the assignment payload this page already
// fetches. Until then the test in tests/unit/components/student/viewAssignment.test.jsx
// pins the number, so changing it is at least deliberate.
const MAX_LOCKDOWN_VIOLATIONS = 3;
const ViewAssignment = () => {
const navigate = useNavigate();
const location = useLocation();
const dispatch = useDispatch();
const customTheme = useTheme();
const { specificClassData } = useSelector((state) => state.StudentSpecificClass);
const { specificAssignmentData, isLoading } = useSelector((state) => state.StudentSpecificAssignment);
const studentQuestionPage = useSelector((state) => state.StudentQuestionPage);
const { classCode, assignmentTitle } = useParams();
const [showYesNoOption, setShowYesNoOption] = useState(false);
const [timeOver, setTimeOver] = useState(false);
const [isSubmitted, setIsSubmitted] = useState(false);
// Guard: location.state may be null on a direct deep-link or browser refresh.
// All hooks are called above — early return is safe here (hooks rules satisfied).
const assignmentId = location.state?.assignmentId;
const breadcrumbs = [
{
name: "Classes",
isLink: true,
path: "/student/classes",
},
{
name: specificClassData?.title,
isLink: true,
path: `/student/classes/${classCode}`,
},
{
name: assignmentTitle,
isLink: false,
},
];
const fetchSubmissionDetails = async () => {
Iif (!assignmentId) return;
try {
const response = await axios.get(API_ENDPOINTS.student.assignment.submission(assignmentId));
// Backend returns 200 with isSubmitted:false when no submission exists yet (C3).
// Treat isSubmitted:false as "not started" — no error path needed.
setIsSubmitted(response.data.isSubmitted === true);
} catch (error) {
console.error("Error:", error.response?.data || error.message);
}
};
const handleYesOption = () => {
setShowYesNoOption(false);
dispatch(_studentFetchAssignmentQuestions(assignmentId)).then((response) => {
if (!response.error) {
navigate(location.pathname + "/answer");
} else {
setTimeOver(true);
}
});
};
// isNotAvailable + getAssignmentStatus extracted to
// @/utils/helpers/assignmentAvailability (EI-2386) so they are unit-tested
// directly. The pure date logic is unchanged.
useEffect(() => {
if (!assignmentId) return;
setIsSubmitted(false);
dispatch(_studentFetchSpecificAssignmentById(assignmentId));
dispatch(_fetchSpecificClassByCode(classCode));
fetchSubmissionDetails();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [assignmentId, classCode]);
// Backend `time_allowed` is null for an unlimited-time assignment, so there is
// nothing to count down from. Otherwise time remaining = allowed - already used,
// floored at 0 (attempting the request after time expires is rejected server-side).
const getTimeRemaining = () => {
const allowedSeconds = parseTimeStringToSeconds(specificAssignmentData?.details?.settings?.time_allowed);
if (allowedSeconds === null) return "Unlimited";
const usedSeconds = parseTimeStringToSeconds(specificAssignmentData?.timeUsed) ?? 0;
return formatSecondsToTime(Math.max(allowedSeconds - usedSeconds, 0));
};
// null location.state guard — render a friendly message instead of crashing
if (!assignmentId) {
return (
<Box sx={{ p: 4, textAlign: "center" }}>
<Typography variant="h6" color="text.secondary">
Please open this assignment from your class page.
</Typography>
<Button sx={{ mt: 2 }} variant="outlined" onClick={() => navigate(`/student/classes/${classCode}`)}>
Go to Class
</Button>
</Box>
);
}
// Everything below only runs once specificAssignmentData is loaded (guarded in
// the JSX below), so it's safe to destructure without optional chaining here.
const details = specificAssignmentData?.details;
const settings = details?.settings ?? {};
const status = specificAssignmentData ? getAssignmentStatusFor(details.date_open, details.date_close) : null;
const notAvailable = specificAssignmentData ? isNotAvailable(details.date_open, details.date_close) : false;
// Specific reason, not a generic "not currently available" — see
// getUnavailabilityReason's own doc comment for why no API change was needed.
const unavailabilityMessage = (() => {
if (!notAvailable) return null;
switch (getUnavailabilityReason(details.date_open, details.date_close)) {
case "not_yet_open":
return `This assignment opens on ${utcToLocalTime(details.date_open)}.`;
case "closed":
return `This assignment closed on ${utcToLocalTime(details.date_close)}.`;
default:
return "This assignment doesn't have an open/close schedule set yet. Check with your teacher.";
}
})();
const noAttemptsLeft = specificAssignmentData?.remainingAttempts == 0;
// "Done with this attempt window" — used to decide both the submitted-status
// copy AND whether a "View Submission" link makes sense yet.
const isClosedOrExhausted = status?.label === "Closed" || noAttemptsLeft;
// Drives both the Start button's disabled state and whether the "get ready,
// the timer starts immediately" caption makes sense to show at all — telling a
// student to get ready under a button they can't even click is misleading.
const startDisabled = noAttemptsLeft || notAvailable;
return (
<React.Fragment>
<YesNoOption
title="Confirm Answer Assignment"
message="Are you ready to answer the assignment? Warning: Timer will start immediately upon answering."
showDialog={showYesNoOption}
clickNo={() => {
setShowYesNoOption(false);
}}
clickYes={handleYesOption}
/>
<OKOption
isDialog={timeOver}
setDialog={() => {
setTimeOver(false);
}}
title="Time Expired"
message="Sorry, but time has expired for this assignment."
/>
{isLoading ? (
<SimpleLoading showLoading={isLoading} />
) : (
specificAssignmentData && (
<React.Fragment>
<AppBar position="relative" color="primary">
<Toolbar>
<AssignmentIcon sx={{ mr: 2 }} />
<Typography variant="h6">Assignment Overview</Typography>
</Toolbar>
</AppBar>
<BasicBreadcrumbs links={breadcrumbs} />
<Box sx={{ maxWidth: 1100, mx: "auto", p: { xs: 2, md: 4 }, mb: 8 }}>
{/* Top-of-page banner: every reason the student can't start right now,
in one place, instead of scattered single-reason alerts further down
that only ever showed one at a time. */}
{(notAvailable || noAttemptsLeft) && (
<Alert severity="error" sx={{ mb: 3 }} data-testid="assignment-unavailable-banner">
<AlertTitle sx={{ fontWeight: 700 }}>
The assignment is not available for the following reasons:
</AlertTitle>
<Box component="ul" sx={{ m: 0, pl: 2.5 }}>
{notAvailable && (
<Typography component="li" variant="body2">
{unavailabilityMessage}
</Typography>
)}
{noAttemptsLeft && (
<Typography component="li" variant="body2">
You have used all available attempts for this assignment.
</Typography>
)}
</Box>
</Alert>
)}
{/* Hero: title, status, the handful of facts that decide whether/when to
start, and the Start button — one place to look, instead of the title,
the "ready to begin" pitch, and the attempts count each living in their
own card further down the page. */}
<Card elevation={3} sx={{ mb: 3 }}>
<CardContent sx={{ p: { xs: 3, md: 4 } }}>
<Stack spacing={3}>
<Box
sx={{
display: "flex",
justifyContent: "space-between",
alignItems: "flex-start",
flexWrap: "wrap",
gap: 2,
}}
>
<Box sx={{ flex: 1, minWidth: 250 }}>
<Stack direction="row" spacing={1.5} alignItems="center" sx={{ mb: 1 }}>
<Typography variant="h4" fontWeight={700}>
{details.title}
</Typography>
<Chip
label={status.label}
color={status.color}
sx={{ fontWeight: 600 }}
/>
</Stack>
{details.description && (
<Typography variant="body1" color="text.secondary">
{details.description}
</Typography>
)}
</Box>
</Box>
<Divider />
{/* At a glance: the facts a student actually needs before clicking Start. */}
<Stack direction="row" spacing={3} flexWrap="wrap" useFlexGap>
<StatTile
icon={<AccessTimeIcon />}
label="Time Remaining"
value={getTimeRemaining()}
testId="assignment-time-remaining"
/>
<StatTile
icon={<RepeatIcon />}
label="Attempts Left"
value={`${specificAssignmentData.remainingAttempts} of ${settings.allowed_attempts ?? "—"}`}
/>
<StatTile
icon={<EventAvailableIcon />}
label="Closes"
value={utcToLocalTime(details.date_close)}
/>
<StatTile
icon={<QuizIcon />}
label="Questions"
value={specificAssignmentData.totalQuestions}
/>
</Stack>
<Divider />
{/* Start / status zone — one place that explains whether the student
can start right now, and why not if they can't. */}
<Box sx={{ textAlign: "center" }}>
<Button
id="student-view-assignment-button-start-now"
variant="contained"
color="primary"
size="large"
startIcon={
studentQuestionPage.isLoading ? null : <PlayCircleOutlineIcon />
}
disabled={startDisabled}
onClick={() => {
setShowYesNoOption(true);
}}
sx={{
px: 5,
py: 1.5,
fontSize: "1.05rem",
fontWeight: 600,
borderRadius: 2,
}}
>
{studentQuestionPage.isLoading ? (
<CircularProgress size={25} color="inherit" />
) : (
"Start Assignment"
)}
</Button>
{!startDisabled && (
<Typography
variant="caption"
color="text.secondary"
sx={{ display: "block", mt: 1 }}
>
The timer starts as soon as you confirm. Make sure you're
ready.
</Typography>
)}
{(isSubmitted || noAttemptsLeft) && (
<Alert
severity={isClosedOrExhausted ? "success" : "info"}
variant="standard"
icon={<CheckCircleIcon />}
sx={{
mt: 2,
maxWidth: 500,
mx: "auto",
textAlign: "left",
border: `1px solid ${
isClosedOrExhausted
? customTheme.palette.success.main
: customTheme.palette.info.main
}`,
}}
action={
isClosedOrExhausted && (
<Button
variant="outlined"
size="small"
onClick={() => {
navigate(location.pathname + "/submission", {
state: { assignmentId: assignmentId },
});
}}
>
Submission
</Button>
)
}
>
<Typography variant="body2" fontWeight={600}>
{isClosedOrExhausted
? isSubmitted
? "You have already submitted this assignment."
: "You have used all your attempts for this assignment."
: "You have already submitted this assignment. You can view your submission once the assignment is closed or all attempts are used."}
</Typography>
</Alert>
)}
</Box>
</Stack>
</CardContent>
</Card>
{/* Browser monitoring / academic-integrity guidance — shown before the student
starts so the rules, and the consequence of breaking them, are known up
front instead of discovered mid-assessment. The guard runs unconditionally
on every attempt (no per-assignment opt-out exists yet), so this is shown
unconditionally too. See docs/implementation/browser-lockdown.md and
docs/implementation/browser_lockdown_violation_tracking.md. */}
<Card
elevation={2}
sx={{ mb: 3, borderLeft: `4px solid ${customTheme.palette.warning.main}` }}
>
<CardContent>
<Box sx={{ display: "flex", alignItems: "center", mb: 2 }}>
<GppMaybeIcon sx={{ fontSize: 30, color: "warning.main", mr: 1.5 }} />
<Typography variant="h6" fontWeight={600}>
Browser Monitoring
</Typography>
</Box>
<Divider sx={{ mb: 2 }} />
<Typography variant="body2" color="text.secondary" sx={{ mb: 2 }}>
This assessment must be taken in fullscreen, on this tab, for the whole attempt.
The following are tracked as violations:
</Typography>
<Grid container spacing={1.5} sx={{ mb: 2.5 }}>
<Grid size={{ xs: 12, sm: 6 }}>
<MonitoredActionRow
icon={<FullscreenIcon fontSize="small" />}
label="Exiting fullscreen mode"
/>
</Grid>
<Grid size={{ xs: 12, sm: 6 }}>
<MonitoredActionRow
icon={<TabUnselectedIcon fontSize="small" />}
label="Switching tabs or windows"
/>
</Grid>
<Grid size={{ xs: 12, sm: 6 }}>
<MonitoredActionRow
icon={<ContentPasteOffIcon fontSize="small" />}
label="Copying or pasting"
/>
</Grid>
<Grid size={{ xs: 12, sm: 6 }}>
<MonitoredActionRow
icon={<KeyboardIcon fontSize="small" />}
label="Blocked shortcuts (print, view source, dev tools)"
/>
</Grid>
</Grid>
<Alert severity="warning" icon={<WarningAmberIcon />} sx={{ mb: 1.5 }}>
<Typography variant="body2" fontWeight={600}>
Reaching {MAX_LOCKDOWN_VIOLATIONS} violations will automatically submit this
attempt with your current answers — you won't be able to continue.
</Typography>
</Alert>
<Typography variant="caption" color="text.secondary">
Violations 1–{MAX_LOCKDOWN_VIOLATIONS - 1} are recorded as warnings so you can
course-correct before that happens.
</Typography>
</CardContent>
</Card>
{/* EI-3182: Instructions panel — only rendered when the assignment carries instructions */}
{details.instructions && (
<Card
elevation={2}
sx={{ mb: 3 }}
id="student-assignment-instructions-card"
data-testid="instructions-card"
>
<CardContent>
<Box sx={{ display: "flex", alignItems: "center", mb: 2 }}>
<ArticleIcon sx={{ fontSize: 30, color: "primary.main", mr: 1.5 }} />
<Typography variant="h6" fontWeight={600}>
Instructions
</Typography>
</Box>
<Divider sx={{ mb: 2 }} />
<Typography
variant="body1"
id="student-assignment-instructions-text"
data-testid="instructions-text"
sx={{ whiteSpace: "pre-wrap" }}
>
{details.instructions}
</Typography>
</CardContent>
</Card>
)}
{/* EI-3182: Rubric table — only rendered when the assignment carries a rubric */}
<RubricTable rubric={details.rubric} />
<Grid container spacing={3}>
{/* About This Assignment — schedule + configuration merged into one card
(previously two separate cards repeating the same header/divider
chrome for six label/value facts total). */}
<Grid size={{ xs: 12, md: 6 }}>
<Card elevation={2} sx={{ height: "100%" }}>
<CardContent>
<Box sx={{ display: "flex", alignItems: "center", mb: 2 }}>
<CalendarMonthIcon
sx={{ fontSize: 30, color: "primary.main", mr: 1.5 }}
/>
<Typography variant="h6" fontWeight={600}>
About This Assignment
</Typography>
</Box>
<Divider sx={{ mb: 1 }} />
<Stack divider={<Divider />}>
<InfoRow
label="Opens"
value={utcToLocalTime(details.date_open)}
testId="assignment-date-open"
/>
<InfoRow
label="Closes"
value={utcToLocalTime(details.date_close)}
testId="assignment-date-close"
/>
<InfoRow
label="Time Allowed"
value={settings.time_allowed || "Unlimited"}
/>
<InfoRow
label="Total Questions"
value={specificAssignmentData.totalQuestions}
testId="assignment-total-questions"
/>
<InfoRow
label="Passing Grade"
value={details.passing_grade ? `${details.passing_grade}%` : "N/A"}
testId="assignment-passing-grade"
/>
<InfoRow label="Type" value={details.type} />
<InfoRow
label="Attempts Allowed"
value={`${settings.allowed_attempts} (${specificAssignmentData.remainingAttempts} remaining)`}
/>
</Stack>
</CardContent>
</Card>
</Grid>
{/* Assignment Rules — plain-language restatement of the settings that
affect the student, with one consistent on/off icon per row instead
of a different icon shape per setting. */}
<Grid size={{ xs: 12, md: 6 }}>
<Card elevation={2} sx={{ height: "100%" }}>
<CardContent>
<Box sx={{ display: "flex", alignItems: "center", mb: 2 }}>
<RuleIcon sx={{ fontSize: 30, color: "primary.main", mr: 1.5 }} />
<Typography variant="h6" fontWeight={600}>
Assignment Rules
</Typography>
</Box>
<Divider sx={{ mb: 2 }} />
<Stack spacing={1.5}>
<RuleRow
label="Questions shown in random order"
enabled={!!settings.shuffle_questions}
/>
<RuleRow
label="Answer choices shown in random order"
enabled={!!settings.shuffle_choices}
/>
<RuleRow
label="Calculator allowed"
enabled={!!settings.allow_calculator}
/>
<RuleRow
label="Score shown after submitting"
enabled={!!settings.show_score_after_submit}
/>
<RuleRow
label="Correct answers shown after submitting"
enabled={!!settings.show_correct_answers_after_submit}
/>
<RuleRow
label="Feedback allowed after submitting"
enabled={!!settings.allow_feedback_after_submit}
/>
</Stack>
</CardContent>
</Card>
</Grid>
</Grid>
</Box>
</React.Fragment>
)
)}
</React.Fragment>
);
};
export default ViewAssignment;
|