Skip to content

Commit 21bf487

Browse files
committed
Add admin page
Question table should have a search functionality that searches by question name. Mantine-datatable can be used for enhanced table features in the future.
1 parent bfaa6bf commit 21bf487

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import {
2+
Grid,
3+
useMantineTheme,
4+
Button
5+
} from "@mantine/core";
6+
7+
import StatsCard from "../components/statscard";
8+
import QuestionsTable from "~/components/table/questionstable";
9+
import type {QuestionHistory} from "../components/table/questionstable";
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<QuestionHistory[]>([
25+
{
26+
question: "Two Sum",
27+
dateAdded: "2024-10-01",
28+
lastEdited: "2024-10-01",
29+
difficulty: "Easy",
30+
topic: "Array",
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="Total Questions"
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+
<Button fullWidth onClick={() => {}}>Add Question</Button>
64+
</Grid.Col>
65+
</Grid>
66+
</Grid.Col>
67+
<Grid.Col span={12}>
68+
<QuestionsTable
69+
data={data}
70+
/>
71+
</Grid.Col>
72+
</Grid>
73+
);
74+
}

0 commit comments

Comments
 (0)