Skip to content

Commit 80044f4

Browse files
committed
Add UI for topic and difficulty selection for queue up
Multiselect is used for both topic and difficulty. However this commit does not have any business and validation logic.
1 parent 60ac802 commit 80044f4

File tree

3 files changed

+84
-2
lines changed

3 files changed

+84
-2
lines changed
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: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import { useDisclosure } from "@mantine/hooks";
2+
import { Modal, Button, MultiSelect, Text, Grid } 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+
<Button fullWidth type="submit" mt="md" onClick={close}>
66+
Confirm
67+
</Button>
68+
</Grid.Col>
69+
</Grid>
70+
</form>
71+
</Modal>
72+
<Button fullWidth onClick={open}>
73+
Queue Up
74+
</Button>
75+
</>
76+
);
77+
}

frontend/peerprep/app/pages/userpage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
import StatsCard from "../components/statscard";
88
import HistoryTable from "../components/table/table";
99
import type {InterviewHistory} from "../components/table/table";
10+
import QueueModal from "~/components/queueupmodal/queuemodal";
1011

1112
import { useState } from "react";
1213

@@ -58,8 +59,8 @@ export default function Userpage() {
5859
<Grid.Col span={{ base: 6, md: 2 }}>
5960
<StatsCard title="Hard" stat="1,234" color={theme.colors.red[5]} />
6061
</Grid.Col>
61-
<Grid.Col span={{ base: 12, md: 1 }} offset={{ md: 3 }}>
62-
<Button fullWidth>Queue Up</Button>
62+
<Grid.Col span={{ base: 12, md: 2 }} offset={{ md: 2 }}>
63+
<QueueModal />
6364
</Grid.Col>
6465
</Grid>
6566
</Grid.Col>

0 commit comments

Comments
 (0)