Skip to content

Commit 476e642

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 9a61eea commit 476e642

File tree

3 files changed

+155
-0
lines changed

3 files changed

+155
-0
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+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import {
2+
Grid,
3+
Button,
4+
useMantineTheme,
5+
} from "@mantine/core";
6+
7+
import StatsCard from "../components/statscard";
8+
import HistoryTable from "../components/table/table";
9+
import type {InterviewHistory} from "../components/table/table";
10+
import QueueModal from "~/components/queueupmodal/queuemodal";
11+
12+
import { useState } from "react";
13+
14+
export function meta() {
15+
return [
16+
{ title: "PeerPrep - Homepage" },
17+
{ name: "description", content: "Welcome to PeerPrep!" },
18+
];
19+
}
20+
21+
export default function Userpage() {
22+
const theme = useMantineTheme();
23+
24+
const [data, ] = useState<InterviewHistory[]>([
25+
{
26+
question: "Two Sum",
27+
completionDate: "2024-10-01",
28+
difficulty: "Easy",
29+
topic: "Array",
30+
language: "JavaScript",
31+
},
32+
]);
33+
34+
return (
35+
<Grid>
36+
<Grid.Col span={12}>
37+
<Grid gutter="md" align="center">
38+
<Grid.Col span={{ base: 6, md: 2 }}>
39+
<StatsCard
40+
title="Interviews"
41+
stat="1,234"
42+
color={theme.colors.gray[0]}
43+
/>
44+
</Grid.Col>
45+
<Grid.Col span={{ base: 6, md: 2 }}>
46+
<StatsCard
47+
title="Easy"
48+
stat="1,234"
49+
color={theme.colors.green[5]}
50+
/>
51+
</Grid.Col>
52+
<Grid.Col span={{ base: 6, md: 2 }}>
53+
<StatsCard
54+
title="Medium"
55+
stat="1,234"
56+
color={theme.colors.yellow[5]}
57+
/>
58+
</Grid.Col>
59+
<Grid.Col span={{ base: 6, md: 2 }}>
60+
<StatsCard title="Hard" stat="1,234" color={theme.colors.red[5]} />
61+
</Grid.Col>
62+
<Grid.Col span={{ base: 12, md: 2 }} offset={{ md: 2 }}>
63+
<QueueModal />
64+
</Grid.Col>
65+
</Grid>
66+
</Grid.Col>
67+
<Grid.Col span={12}>
68+
<HistoryTable
69+
data={data}
70+
/>
71+
</Grid.Col>
72+
</Grid>
73+
);
74+
}

0 commit comments

Comments
 (0)