Skip to content

Commit 32973cd

Browse files
Updated to have select dropdown
1 parent 18851c7 commit 32973cd

File tree

2 files changed

+64
-2
lines changed

2 files changed

+64
-2
lines changed

apps/web/src/app/admin/layout.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { Suspense } from "react";
1010
import ClientToast from "@/components/shared/ClientToast";
1111
import { redirect } from "next/navigation";
1212
import { getUser } from "db/functions";
13+
import MobileAdminTabSelect from "@/components/shared/MobileAdminTabSelect";
1314

1415
interface AdminLayoutProps {
1516
children: React.ReactNode;
@@ -38,7 +39,7 @@ export default async function AdminLayout({ children }: AdminLayoutProps) {
3839
<>
3940
<ClientToast />
4041
<div className="fixed z-20 grid h-16 w-full grid-cols-2 bg-nav px-5">
41-
<div className="flex items-center gap-x-4">
42+
<div className="flex max-w-full items-center gap-x-4">
4243
<Link href={"/"} className="mr-5 flex items-center gap-x-2">
4344
<Image
4445
src={c.icon.svg}
@@ -77,9 +78,17 @@ export default async function AdminLayout({ children }: AdminLayoutProps) {
7778
</Link>
7879
<ProfileButton />
7980
</div>
81+
{/*show dorpdown for mobile*/}
82+
<div className={"m-4 flex gap-4 justify-self-end md:hidden"}>
83+
<MobileAdminTabSelect />
84+
<ProfileButton />
85+
</div>
86+
8087
<div className="flex items-center justify-end gap-x-4 md:hidden"></div>
8188
</div>
82-
<div className="fixed z-20 mt-16 flex h-12 w-full border-b border-b-border bg-nav px-5">
89+
90+
{/*show tabs for non-mobile*/}
91+
<div className="fixed z-20 mt-16 hidden h-12 w-full border-b border-b-border bg-nav px-5 xl:flex">
8392
{Object.entries(c.dashPaths.admin).map(([name, path]) => (
8493
<DashNavItem key={name} name={name} path={path} />
8594
))}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
"use client";
2+
import { redirect, usePathname } from "next/navigation";
3+
import {
4+
Select,
5+
SelectContent,
6+
SelectGroup,
7+
SelectItem,
8+
SelectLabel,
9+
SelectTrigger,
10+
SelectValue,
11+
} from "@/components/shadcn/ui/select";
12+
import c from "config";
13+
14+
export default function MobileAdminTabSelect() {
15+
let curPath = usePathname().slice(7);
16+
curPath = curPath.charAt(0).toUpperCase() + curPath.slice(1);
17+
if (curPath == "") curPath = "Overview";
18+
if (curPath == "check-in") curPath = "Hackathon Check-in";
19+
20+
return (
21+
<Select
22+
onValueChange={(e) => {
23+
redirect(e.valueOf());
24+
}}
25+
>
26+
<SelectTrigger className="w-[180px]">
27+
<SelectValue placeholder={curPath} />
28+
</SelectTrigger>
29+
<SelectContent>
30+
<SelectGroup>
31+
<SelectLabel>Tabs</SelectLabel>
32+
{Object.entries(c.dashPaths.admin).map(([name, path]) => (
33+
<SelectItem key={name} value={path}>
34+
{name}
35+
</SelectItem>
36+
))}
37+
</SelectGroup>
38+
<SelectGroup>
39+
<SelectLabel>Main</SelectLabel>
40+
<SelectItem key={"home"} value={"/"}>
41+
Home
42+
</SelectItem>
43+
<SelectItem key={"guide"} value={c.links.guide}>
44+
Survival Guide
45+
</SelectItem>
46+
<SelectItem key={"discord"} value={c.links.discord}>
47+
Discord
48+
</SelectItem>
49+
</SelectGroup>
50+
</SelectContent>
51+
</Select>
52+
);
53+
}

0 commit comments

Comments
 (0)