Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Commit db9b88c

Browse files
committed
feat: add unpinned items to the sidebar
1 parent a289b97 commit db9b88c

File tree

4 files changed

+117
-35
lines changed

4 files changed

+117
-35
lines changed

src/components/BottomNavSheet/BottomNavSheet.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { Flex as ChakraFlex, useColorModeValue, Box } from "@chakra-ui/react";
1+
import {
2+
Flex as ChakraFlex,
3+
useColorModeValue,
4+
Box,
5+
SimpleGrid,
6+
} from "@chakra-ui/react";
27
import SidebarButton from "../Sidebar/SidebarButton";
38
import { motion, PanInfo } from "framer-motion";
49
import { useEffect, useRef, useState } from "react";
@@ -62,6 +67,7 @@ export const BottomNavSheet = () => {
6267
<Box
6368
bg="gray.500"
6469
h="5px"
70+
minH={"5px"}
6571
w="30px"
6672
my="5px"
6773
rounded="full"
@@ -74,7 +80,7 @@ export const BottomNavSheet = () => {
7480
borderTop="none"
7581
borderColor={useColorModeValue("gray.200", "gray.700")}
7682
>
77-
{routes.map((routes) => (
83+
{routes.pinned.map((routes) => (
7884
<SidebarButton
7985
key={routes.path}
8086
name={routes.name}
@@ -85,6 +91,18 @@ export const BottomNavSheet = () => {
8591
/>
8692
))}
8793
</Flex>
94+
<SimpleGrid columns={4} w="full">
95+
{routes.unpinned.map((routes) => (
96+
<SidebarButton
97+
key={routes.path}
98+
name={routes.name}
99+
icon={routes.icon}
100+
mirrored={routes.mirrored}
101+
to={`/app/${routes.path}`}
102+
onClick={close}
103+
/>
104+
))}
105+
</SimpleGrid>
88106
</Flex>
89107
);
90108
};

src/components/Routes/Routes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default () => (
5555
}
5656
>
5757
<Route index element={<Navigate to="home" replace={true} />} />
58-
{routes.map((route) => (
58+
{[...routes.pinned, ...routes.unpinned].map((route) => (
5959
<Route key={route.path} path={route.path} element={route.element} />
6060
))}
6161
<Route path={"settings/*"} element={<Settings />}>

src/components/Sidebar/Sidebar.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { routes } from "../../routes";
55
export default () => (
66
<Flex
77
w={"100px"}
8-
h={"100%"}
8+
h={"full"}
9+
maxH="calc(100% - 80px)"
910
direction={"column"}
1011
position={"fixed"}
1112
top={"80px"}
@@ -17,7 +18,7 @@ export default () => (
1718
borderTop={"none"}
1819
borderColor={useColorModeValue("gray.200", "gray.700")}
1920
>
20-
{routes.map((routes) => (
21+
{routes.pinned.map((routes) => (
2122
<SidebarButton
2223
key={routes.path}
2324
name={routes.name}
@@ -26,5 +27,21 @@ export default () => (
2627
to={`/app/${routes.path}`}
2728
/>
2829
))}
30+
<Flex
31+
direction="column"
32+
borderTop={"1px"}
33+
borderColor={useColorModeValue("gray.200", "gray.700")}
34+
overflowY="auto"
35+
>
36+
{routes.unpinned.map((routes) => (
37+
<SidebarButton
38+
key={routes.path}
39+
name={routes.name}
40+
icon={routes.icon}
41+
mirrored={routes.mirrored}
42+
to={`/app/${routes.path}`}
43+
/>
44+
))}
45+
</Flex>
2946
</Flex>
3047
);

src/routes.tsx

Lines changed: 77 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
import {
22
Barcode,
3+
BookBookmark,
34
CalendarBlank,
5+
ChatsTeardrop,
46
House,
57
IconWeight,
8+
MapTrifold,
9+
Medal,
610
Megaphone,
11+
Palette,
712
} from "phosphor-react";
813
import Announcements from "./routes/Main/Announcements";
914
import Barcodes from "./routes/Main/Barcodes";
1015
import { Calendar } from "./routes/Main/Calendar";
1116
import Home from "./routes/Main/Home";
1217

18+
const ComingSoon = () => <>Coming soon...</>;
19+
1320
export type TimetablRoute = {
1421
path: string;
1522
name: string;
@@ -24,33 +31,73 @@ export type TimetablRoute = {
2431
element: JSX.Element;
2532
};
2633

27-
export const routes: TimetablRoute[] = [
28-
{
29-
path: "home",
30-
name: "Home",
31-
icon: House,
32-
mirrored: false,
33-
element: <Home />,
34-
},
35-
{
36-
path: "barcodes",
37-
name: "Barcodes",
38-
icon: Barcode,
39-
mirrored: false,
40-
element: <Barcodes />,
41-
},
42-
{
43-
path: "announcements",
44-
name: "Notices",
45-
icon: Megaphone,
46-
mirrored: true,
47-
element: <Announcements />,
48-
},
49-
{
50-
path: "calendar",
51-
name: "Calendar",
52-
icon: CalendarBlank,
53-
mirrored: false,
54-
element: <Calendar />,
55-
},
56-
];
34+
export const routes: { pinned: TimetablRoute[]; unpinned: TimetablRoute[] } = {
35+
pinned: [
36+
{
37+
path: "home",
38+
name: "Home",
39+
icon: House,
40+
mirrored: false,
41+
element: <Home />,
42+
},
43+
{
44+
path: "barcodes",
45+
name: "Barcodes",
46+
icon: Barcode,
47+
mirrored: false,
48+
element: <Barcodes />,
49+
},
50+
{
51+
path: "announcements",
52+
name: "Notices",
53+
icon: Megaphone,
54+
mirrored: true,
55+
element: <Announcements />,
56+
},
57+
{
58+
path: "calendar",
59+
name: "Calendar",
60+
icon: CalendarBlank,
61+
mirrored: false,
62+
element: <Calendar />,
63+
},
64+
],
65+
unpinned: [
66+
{
67+
path: "maps",
68+
name: "Maps",
69+
icon: MapTrifold,
70+
mirrored: false,
71+
element: <ComingSoon />,
72+
},
73+
{
74+
path: "points",
75+
name: "Points",
76+
icon: Medal,
77+
mirrored: false,
78+
element: <ComingSoon />,
79+
},
80+
{
81+
path: "publications",
82+
name: "Publications",
83+
icon: BookBookmark,
84+
mirrored: false,
85+
element: <ComingSoon />,
86+
},
87+
{
88+
path: "feedback",
89+
name: "Feedback",
90+
icon: ChatsTeardrop,
91+
mirrored: false,
92+
element: <ComingSoon />,
93+
},
94+
95+
{
96+
path: "themes",
97+
name: "Themes",
98+
icon: Palette,
99+
mirrored: false,
100+
element: <ComingSoon />,
101+
},
102+
],
103+
};

0 commit comments

Comments
 (0)