Skip to content

Commit 2e12910

Browse files
committed
added checkboxes to task rubric dropdown
1 parent e71c857 commit 2e12910

File tree

13 files changed

+602
-98
lines changed

13 files changed

+602
-98
lines changed

graphql.schema.json

Lines changed: 446 additions & 28 deletions
Large diffs are not rendered by default.

src/Components/Content/Content.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ export default function Content() {
4545
<Route path="/singleMissionOverview/:name">
4646
<SingleMissionOverview />
4747
</Route>
48-
<Route path="/viewTask">
48+
{/* <Route path="/viewTask">
4949
<TaskView taskId="90e0c730e56" />
50+
</Route> */}
51+
<Route path="/viewTask/:taskId">
52+
<TaskView />
5053
</Route>
5154
<Route path="/classMastery">
5255
<ClassMastery />

src/Components/LinearProgressWithLabel/ObjectiveDropDown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export default function TargetDropDown({ name, tasks }: ObjectiveDropDownProps)
9494

9595
<Collapse in={open} timeout="auto" unmountOnExit>
9696
{tasks.map((task: TaskObjectiveProgress) => (
97-
<Link to="/viewTask">
97+
<Link to={`/viewTask/${task.task.id}`}>
9898
<List component="div" disablePadding>
9999
<div style={{ display: 'flex', flexDirection: 'row' }}>
100100
<DoublePaddedDiv>

src/Components/SingleStudentOverview/SingleMissionOverview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ function SingleMissionOverview() {
180180
<TaskRowDiv className="row">
181181
<LeftColumnDiv className="col-12" style={{ justifyContent: 'right' }}>
182182
{missionProgressData?.map((task: TaskStats) => (
183-
<Link to="/viewTask" data-testid="task-btn">
183+
<Link to={`/viewTask/${task.taskId}`} data-testid="task-btn">
184184
<List
185185
component="div"
186186
disablePadding

src/Screens/TaskView/BlockPageHandler/BlockPageHandler.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ function BlockPageHandler({
2323
taskInformation: GetTaskByIdQuery;
2424
page: number;
2525
}) {
26+
if (taskInformation.task.pages[page] === undefined) {
27+
return <>Quiz is Not Yet Defined</>;
28+
}
2629
const pageBlocks = taskInformation.task.pages[page].blocks;
2730

2831
type TaskBlock =
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Checkbox, MenuItem } from '@material-ui/core';
2+
import { useState } from 'react';
3+
import { Navbar, Nav, Form, Button, Dropdown } from 'react-bootstrap';
4+
import { RubricRequirement } from '../../../__generated__/types';
5+
6+
function Rubric({ requirement }: { requirement: RubricRequirement }) {
7+
const [complete, setComplete] = useState(requirement.isComplete);
8+
console.log(requirement);
9+
const handleChange = () => {
10+
setComplete(!complete);
11+
};
12+
return (
13+
<MenuItem>
14+
<Form.Group>
15+
<Checkbox
16+
checked={complete}
17+
onChange={handleChange}
18+
inputProps={{ 'aria-label': 'primary checkbox' }}
19+
color="default"
20+
/>
21+
{/* <Form.Check required checked={requirement.isComplete} /> */}
22+
<Form.Label>{requirement.description}</Form.Label>
23+
</Form.Group>
24+
</MenuItem>
25+
);
26+
}
27+
28+
export default Rubric;

src/Screens/TaskView/TaskNavbar/TaskNavbar.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import { faCaretLeft, faHandPaper } from '@fortawesome/free-solid-svg-icons';
22
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3-
import { Navbar, Nav, Form, Button, NavDropdown } from 'react-bootstrap';
3+
import { Dispatch, SetStateAction } from 'react';
4+
import { Navbar, Nav, Form, Button, NavDropdown, Dropdown } from 'react-bootstrap';
5+
import { RubricRequirement } from '../../../__generated__/types';
6+
import Rubric from '../Rubric/Rubric';
47
import './TaskNavbar.css';
58

6-
function TaskNavbar() {
9+
function handleToggle() {}
10+
11+
function TaskNavbar({ rubric }: { rubric: RubricRequirement[] }) {
712
return (
813
<Navbar collapseOnSelect expand="sm" bg="primary" variant="light">
914
<Navbar.Toggle aria-controls="responsive-navbar-nav" />
@@ -19,10 +24,16 @@ function TaskNavbar() {
1924
<FontAwesomeIcon icon={faHandPaper} />
2025
</Button>
2126
</Form>
22-
<NavDropdown title="Task Rubric" id="rubric-dropdown" className="ml-2">
23-
<NavDropdown.Item href="">Task Rubric</NavDropdown.Item>
24-
<Form inline>
25-
<Button type="submit">Submit Task</Button>
27+
28+
<NavDropdown drop="left" title="Task Rubric" id="rubric-dropdown" className="ml-2">
29+
<Form>
30+
{rubric.map((requirement: RubricRequirement) => (
31+
<Rubric requirement={requirement} />
32+
))}
33+
<NavDropdown.Divider />
34+
<Button className="mx-auto" type="submit">
35+
Submit Task
36+
</Button>
2637
</Form>
2738
</NavDropdown>
2839
</Nav>

src/Screens/TaskView/TaskView.tsx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,35 @@
11
import { useState } from 'react';
2-
import { useGetTaskByIdQuery } from '../../__generated__/types';
2+
import { useParams } from 'react-router-dom';
3+
import {
4+
RubricRequirement,
5+
useGetTaskByIdQuery,
6+
useTaskSubmissionResultQuery,
7+
} from '../../__generated__/types';
38
import TaskNavbar from './TaskNavbar/TaskNavbar';
49
import TaskProgress from './TaskProgress/TaskProgress';
510
import BlockPageHandler from './BlockPageHandler/BlockPageHandler';
611

7-
function TaskView({ taskId }: { taskId: string }) {
12+
// function TaskView({ taskId }: { taskId: string }) {
13+
function TaskView() {
14+
const [page, setPage] = useState(0);
15+
const { taskId } = useParams<Record<string, string | undefined>>();
16+
let { username } = useParams<Record<string, string | undefined>>();
17+
username = 'bob';
18+
const { data: taskSubmissionQuery } = useTaskSubmissionResultQuery({
19+
variables: {
20+
taskId: '4f681550ba9',
21+
username: 'bob',
22+
},
23+
});
24+
if (taskId === undefined) {
25+
return <>Task Undefined</>;
26+
}
27+
828
const { data: taskByIdQuery } = useGetTaskByIdQuery({
929
variables: { taskId },
1030
});
1131

12-
const [page, setPage] = useState(0);
32+
console.log(taskSubmissionQuery?.retrieveTaskSubmission);
1333

1434
const maxPage: number =
1535
taskByIdQuery === undefined || taskByIdQuery.task.pages === undefined
@@ -20,9 +40,11 @@ function TaskView({ taskId }: { taskId: string }) {
2040
return <></>;
2141
}
2242

43+
const requirements = taskByIdQuery.task.requirements as RubricRequirement[];
44+
2345
return (
2446
<div>
25-
<TaskNavbar />
47+
<TaskNavbar rubric={requirements} />
2648
<div>
2749
<TaskProgress
2850
taskInformation={taskByIdQuery}

src/__generated__/types.ts

Lines changed: 70 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/clients/mock.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,14 @@ export const mockTask: Task = {
177177
};
178178

179179
const ansone: Answer = {
180+
graded: false,
180181
questionId: 'fakemcqid',
181182
pointsAwarded: 50,
182183
answer: 'All of us!',
183184
};
184185

185186
const anstwo: Answer = {
187+
graded: false,
186188
questionId: 'fakefrqid',
187189
pointsAwarded: 50,
188190
answer: 'Dr. Janzen',

0 commit comments

Comments
 (0)