From bb751c14760a388f5d980a120d1cdbe301f56da1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi?= Date: Tue, 7 Jan 2025 12:37:50 +0100 Subject: [PATCH] feat: update admin pages to display "Hello world!" and enhance layout with dynamic titles and dividers --- src/app/admin/classes/page.tsx | 2 +- src/app/admin/layout.tsx | 19 ++++++++++++++++++- src/app/admin/page.tsx | 4 +++- src/app/admin/rooms/page.tsx | 4 +++- src/app/admin/settings/page.tsx | 4 +++- src/app/admin/users/page.tsx | 6 +----- 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/app/admin/classes/page.tsx b/src/app/admin/classes/page.tsx index f5783d8..938e852 100644 --- a/src/app/admin/classes/page.tsx +++ b/src/app/admin/classes/page.tsx @@ -5,5 +5,5 @@ export const metadata: Metadata = { }; export default async function Page() { - return

Classes

; + return

Hello world!

; } diff --git a/src/app/admin/layout.tsx b/src/app/admin/layout.tsx index d12d790..1c43f79 100644 --- a/src/app/admin/layout.tsx +++ b/src/app/admin/layout.tsx @@ -1,10 +1,15 @@ +"use client"; 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 }) { + const pathName = usePathname(); + const sidebarItems = [ [ { href: "/admin", title: "Dashboard", icon: }, @@ -18,7 +23,19 @@ export default function Layout({ children }: { children: React.ReactNode }) { return (
-
{children}
+
+

+ { + sidebarItems + .flat() + .find((item) => item.href === pathName)?.title + } +

+ + + + {children} +
); } diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index e143f09..0a8bb27 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -5,5 +5,7 @@ export const metadata: Metadata = { }; export default async function Page() { - return

Admin Home

; + return ( +

Hello world!

+ ); } diff --git a/src/app/admin/rooms/page.tsx b/src/app/admin/rooms/page.tsx index ef357f0..ce017d3 100644 --- a/src/app/admin/rooms/page.tsx +++ b/src/app/admin/rooms/page.tsx @@ -5,5 +5,7 @@ export const metadata: Metadata = { }; export default async function Page() { - return

Rooms

; + return ( +

Hello world!

+ ); } diff --git a/src/app/admin/settings/page.tsx b/src/app/admin/settings/page.tsx index 509c111..5cbc088 100644 --- a/src/app/admin/settings/page.tsx +++ b/src/app/admin/settings/page.tsx @@ -5,5 +5,7 @@ export const metadata: Metadata = { }; export default async function Page() { - return

Settings

; + return ( +

Hello world!

+ ); } diff --git a/src/app/admin/users/page.tsx b/src/app/admin/users/page.tsx index e0654e3..3a2f32d 100644 --- a/src/app/admin/users/page.tsx +++ b/src/app/admin/users/page.tsx @@ -6,9 +6,5 @@ export const metadata: Metadata = { }; export default async function Page() { - return ( -
- -
- ); + return ; }