Skip to content

Commit e3e083a

Browse files
authored
Merge pull request #26 from CS3219-AY2526Sem1/queue-up
Add queue up modal
2 parents dc243d0 + 94b5aab commit e3e083a

File tree

5 files changed

+104
-3
lines changed

5 files changed

+104
-3
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"hash": "61c1135b",
3+
"configHash": "bf99f7f0",
4+
"lockfileHash": "d435eb2c",
5+
"browserHash": "4f32ab05",
6+
"optimized": {},
7+
"chunks": {}
8+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "module"
3+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.pill {
2+
background-color: var(--mantine-color-brand-yellow-7);
3+
color: var(--mantine-color-black);
4+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import { useDisclosure } from "@mantine/hooks";
2+
import { Modal, Button, MultiSelect, Grid, Select } from "@mantine/core";
3+
import { useForm } from "@mantine/form";
4+
import classes from "./queuemodal.module.css";
5+
6+
const topics = [
7+
"Array",
8+
"String",
9+
"Dynamic Programming",
10+
"Backtracking",
11+
"Greedy",
12+
"Graph",
13+
"Tree",
14+
"Linked List",
15+
"Sorting",
16+
"Searching",
17+
];
18+
19+
const difficulties = ["Easy", "Medium", "Hard"];
20+
21+
export default function QueueModal() {
22+
const [opened, { open, close }] = useDisclosure(false);
23+
const form = useForm({
24+
initialValues: {
25+
topic: [],
26+
difficulty: [],
27+
},
28+
});
29+
30+
return (
31+
<>
32+
<Modal
33+
opened={opened}
34+
onClose={close}
35+
c="white"
36+
title="Select Topic and Difficulty"
37+
>
38+
<form onSubmit={form.onSubmit((values) => console.log(values))}>
39+
<Grid>
40+
<Grid.Col span={12}>
41+
<MultiSelect
42+
label="Topic"
43+
placeholder="Pick values"
44+
data={topics}
45+
searchable
46+
{...form.getInputProps("topic")}
47+
classNames={{
48+
pill: classes.pill,
49+
}}
50+
/>
51+
</Grid.Col>
52+
<Grid.Col span={12}>
53+
<MultiSelect
54+
label="Difficulty"
55+
placeholder="Pick values"
56+
data={difficulties}
57+
searchable
58+
{...form.getInputProps("difficulty")}
59+
classNames={{
60+
pill: classes.pill,
61+
}}
62+
/>
63+
</Grid.Col>
64+
<Grid.Col span={12}>
65+
<Select
66+
label="Language"
67+
placeholder="Pick one"
68+
data={["C++", "Python", "Java", "JavaScript"]}
69+
searchable
70+
{...form.getInputProps("language")}
71+
/>
72+
</Grid.Col>
73+
<Grid.Col span={12}>
74+
<Button fullWidth type="submit" mt="md" onClick={close}>
75+
Confirm
76+
</Button>
77+
</Grid.Col>
78+
</Grid>
79+
</form>
80+
</Modal>
81+
<Button fullWidth onClick={open}>
82+
Queue Up
83+
</Button>
84+
</>
85+
);
86+
}

frontend/peerprep/app/pages/userpage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {
22
Grid,
3-
Button,
43
useMantineTheme,
54
} from "@mantine/core";
65

76
import StatsCard from "../components/statscard";
87
import HistoryTable from "../components/table/table";
98
import type {InterviewHistory} from "../components/table/table";
9+
import QueueModal from "~/components/queueupmodal/queuemodal";
1010

1111
import { useState } from "react";
1212

@@ -58,8 +58,8 @@ export default function Userpage() {
5858
<Grid.Col span={{ base: 6, md: 2 }}>
5959
<StatsCard title="Hard" stat="1,234" color={theme.colors.red[5]} />
6060
</Grid.Col>
61-
<Grid.Col span={{ base: 12, md: 1 }} offset={{ md: 3 }}>
62-
<Button fullWidth>Queue Up</Button>
61+
<Grid.Col span={{ base: 12, md: 2 }} offset={{ md: 2 }}>
62+
<QueueModal />
6363
</Grid.Col>
6464
</Grid>
6565
</Grid.Col>

0 commit comments

Comments
 (0)