Compare commits
4 Commits
3ac29ae909
...
bb751c1476
Author | SHA1 | Date | |
---|---|---|---|
bb751c1476 | |||
c100c71fea | |||
3bb97abdf2 | |||
919630524b |
@ -5,5 +5,5 @@ export const metadata: Metadata = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
return <p>Classes</p>;
|
return <p>Hello world!</p>;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,41 @@
|
|||||||
|
"use client";
|
||||||
import { Sidebar } from "@/app/components/Sidebar";
|
import { Sidebar } from "@/app/components/Sidebar";
|
||||||
|
import { Divider } from "@nextui-org/react";
|
||||||
|
import { usePathname } from "next/navigation";
|
||||||
|
import { FaDoorClosed, FaRegUser } from "react-icons/fa";
|
||||||
|
import { FiSettings } from "react-icons/fi";
|
||||||
|
import { IoMdStats } from "react-icons/io";
|
||||||
|
import { MdInbox } from "react-icons/md";
|
||||||
|
|
||||||
export default function Layout({ children }: { children: React.ReactNode }) {
|
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||||
|
const pathName = usePathname();
|
||||||
|
|
||||||
|
const sidebarItems = [
|
||||||
|
[
|
||||||
|
{ href: "/admin", title: "Dashboard", icon: <IoMdStats /> },
|
||||||
|
{ href: "/admin/users", title: "Users", icon: <FaRegUser /> },
|
||||||
|
{ href: "/admin/classes", title: "Classes", icon: <MdInbox /> },
|
||||||
|
{ href: "/admin/rooms", title: "Rooms", icon: <FaDoorClosed /> },
|
||||||
|
],
|
||||||
|
[{ href: "/admin/settings", title: "Settings", icon: <FiSettings /> }],
|
||||||
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<Sidebar />
|
<Sidebar items={sidebarItems} />
|
||||||
<main>{children}</main>
|
<main className="p-7 w-full">
|
||||||
|
<h1 className="text-2xl font-semibold">
|
||||||
|
{
|
||||||
|
sidebarItems
|
||||||
|
.flat()
|
||||||
|
.find((item) => item.href === pathName)?.title
|
||||||
|
}
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<Divider className="mt-2 mb-5 bg-foreground-300" />
|
||||||
|
|
||||||
|
{children}
|
||||||
|
</main>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,7 @@ export const metadata: Metadata = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
return <p>Admin Home</p>;
|
return (
|
||||||
|
<p>Hello world!</p>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,7 @@ export const metadata: Metadata = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
return <p>Rooms</p>;
|
return (
|
||||||
|
<p>Hello world!</p>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,7 @@ export const metadata: Metadata = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
return <p>Settings</p>;
|
return (
|
||||||
|
<p>Hello world!</p>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,5 @@ export const metadata: Metadata = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
return (
|
return <UserList />;
|
||||||
<div className="p-4">
|
|
||||||
<UserList />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
@ -1,77 +1,65 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Divider, Link } from "@nextui-org/react";
|
import { Divider, Link } from "@nextui-org/react";
|
||||||
import { useRouter } from "next/navigation";
|
import { usePathname, useRouter } from "next/navigation";
|
||||||
import { FaDoorClosed, FaRegUser } from "react-icons/fa";
|
|
||||||
import { FiSettings } from "react-icons/fi";
|
|
||||||
import { IoMdStats } from "react-icons/io";
|
|
||||||
import { MdInbox } from "react-icons/md";
|
|
||||||
import { ThemeSwitcher } from "../ThemeSwitcher/ThemeSwitcher";
|
import { ThemeSwitcher } from "../ThemeSwitcher/ThemeSwitcher";
|
||||||
import { SidebarItem } from "./item";
|
import { SidebarItem } from "./item";
|
||||||
|
|
||||||
export const Sidebar = () => {
|
export const Sidebar = ({
|
||||||
|
items,
|
||||||
|
}: {
|
||||||
|
items: {
|
||||||
|
href: string;
|
||||||
|
title: string;
|
||||||
|
icon: React.ReactNode;
|
||||||
|
}[][];
|
||||||
|
}) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const pathName = usePathname();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside className="h-screen">
|
<aside className="h-screen">
|
||||||
<div className="flex flex-col w-64 gap-2 h-full px-3 py-4 overflow-y-auto bg-foreground-100">
|
<div className="flex flex-col w-72 gap-5 h-full px-3 py-4 overflow-y-auto bg-foreground-100">
|
||||||
<ul className="font-medium gap-2">
|
<div className="flex flex-col gap-2 p-2">
|
||||||
<li>
|
<Link
|
||||||
<Link
|
className="flex text-2xl font-semibold text-gray-900 dark:text-white rounded-lg cursor-pointer"
|
||||||
className="flex justify-center p-2 text-gray-900 dark:text-white rounded-lg cursor-pointer"
|
onPress={() => router.push("/")}
|
||||||
onPress={() => router.push("/")}
|
>
|
||||||
>
|
Toogether
|
||||||
Toogether
|
</Link>
|
||||||
</Link>
|
<p className="text-sm text-foreground-400 dark:text-gray-400">
|
||||||
</li>
|
Manage classes, rooms, and users
|
||||||
</ul>
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<section className="flex flex-col">
|
{items.map((group, index) => (
|
||||||
<ul className="flex flex-col gap-2">
|
<div key={index}>
|
||||||
<li className="hover:bg-foreground-300 rounded-md cursor-pointer">
|
<section className="flex flex-col">
|
||||||
<SidebarItem
|
<ul className="flex flex-col gap-2">
|
||||||
href="/admin"
|
{group.map((item, index) => (
|
||||||
title="Dashboard"
|
<li
|
||||||
icon={<IoMdStats />}
|
key={index}
|
||||||
/>
|
className={`${
|
||||||
</li>
|
pathName === item.href
|
||||||
<li className="hover:bg-foreground-300 rounded-md cursor-pointer">
|
? "bg-foreground-300"
|
||||||
<SidebarItem
|
: "hover:bg-foreground-200"
|
||||||
href="/admin/users"
|
} rounded-md cursor-pointer`}
|
||||||
title="Users"
|
>
|
||||||
icon={<FaRegUser />}
|
<SidebarItem
|
||||||
/>
|
href={item.href}
|
||||||
</li>
|
title={item.title}
|
||||||
<li className="hover:bg-foreground-300 rounded-md cursor-pointer">
|
icon={item.icon}
|
||||||
<SidebarItem
|
/>
|
||||||
href="/admin/classes"
|
</li>
|
||||||
title="Classes"
|
))}
|
||||||
icon={<MdInbox />}
|
</ul>
|
||||||
/>
|
</section>
|
||||||
</li>
|
|
||||||
<li className="hover:bg-foreground-300 rounded-md cursor-pointer">
|
|
||||||
<SidebarItem
|
|
||||||
href="/admin/rooms"
|
|
||||||
title="Rooms"
|
|
||||||
icon={<FaDoorClosed />}
|
|
||||||
/>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<Divider className="bg-foreground-300 my-4" />
|
{index < items.length - 1 && (
|
||||||
|
<Divider className="bg-foreground-300 mt-4" />
|
||||||
<section className="flex flex-col">
|
)}
|
||||||
<ul className="flex flex-col gap-2">
|
</div>
|
||||||
<li className="hover:bg-foreground-300 rounded-md cursor-pointer">
|
))}
|
||||||
<SidebarItem
|
|
||||||
href="/admin/settings"
|
|
||||||
title="Settings"
|
|
||||||
icon={<FiSettings />}
|
|
||||||
/>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section className="mt-auto flex justify-between">
|
<section className="mt-auto flex justify-between">
|
||||||
<ThemeSwitcher />
|
<ThemeSwitcher />
|
||||||
|
@ -17,9 +17,9 @@ export const SidebarItem = ({
|
|||||||
<Link
|
<Link
|
||||||
onPress={() => router.push(href)}
|
onPress={() => router.push(href)}
|
||||||
color="foreground"
|
color="foreground"
|
||||||
className="w-full px-2 py-1 gap-2 text-xl"
|
className="w-full p-2 gap-3 text-md"
|
||||||
>
|
>
|
||||||
{icon}
|
<span className="text-xl">{icon}</span>
|
||||||
{title}
|
{title}
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user