|
@@ -1,7 +1,9 @@
|
|
|
import { Metadata } from "next";
|
|
|
import { TopbarNav } from "./components/TopbarNav";
|
|
|
-import { LayoutGrid, Tent } from "lucide-react";
|
|
|
+import { Cog, LayoutGrid, Tent, Users } from "lucide-react";
|
|
|
import Header from "./components/Header";
|
|
|
+import { verifySession } from "@app/lib/auth/verifySession";
|
|
|
+import { redirect } from "next/navigation";
|
|
|
|
|
|
export const metadata: Metadata = {
|
|
|
title: "Configuration",
|
|
@@ -11,39 +13,54 @@ export const metadata: Metadata = {
|
|
|
const topNavItems = [
|
|
|
{
|
|
|
title: "Sites",
|
|
|
- href: "/configuration/sites",
|
|
|
+ href: "/{orgId}/sites",
|
|
|
icon: <Tent />,
|
|
|
},
|
|
|
{
|
|
|
title: "Resources",
|
|
|
- href: "/configuration/resources",
|
|
|
+ href: "/{orgId}/resources",
|
|
|
icon: <LayoutGrid />,
|
|
|
},
|
|
|
+ {
|
|
|
+ title: "Users",
|
|
|
+ href: "/{orgId}/users",
|
|
|
+ icon: <Users />,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "General",
|
|
|
+ href: "/{orgId}/general",
|
|
|
+ icon: <Cog />,
|
|
|
+ },
|
|
|
];
|
|
|
|
|
|
interface ConfigurationLaytoutProps {
|
|
|
children: React.ReactNode;
|
|
|
- params: { siteId: string };
|
|
|
+ params: { orgId: string };
|
|
|
}
|
|
|
|
|
|
export default async function ConfigurationLaytout({
|
|
|
children,
|
|
|
params,
|
|
|
}: ConfigurationLaytoutProps) {
|
|
|
+ const user = await verifySession();
|
|
|
+
|
|
|
+ if (!user) {
|
|
|
+ redirect("/auth/login");
|
|
|
+ }
|
|
|
+
|
|
|
return (
|
|
|
<>
|
|
|
- <div className="w-full bg-stone-200 border-b border-stone-300 mb-5 select-none px-3">
|
|
|
+ <div className="w-full bg-stone-200 border-b border-stone-300 mb-5 select-none sm:px-0 px-3">
|
|
|
<div className="container mx-auto flex flex-col content-between gap-3 pt-2">
|
|
|
<Header
|
|
|
- email="mschwartz10612@gmail.com"
|
|
|
- orgName="Home Lab 1"
|
|
|
- name="Milo Schwartz"
|
|
|
+ email={user.email}
|
|
|
+ orgName={params.orgId}
|
|
|
/>
|
|
|
- <TopbarNav items={topNavItems} />
|
|
|
+ <TopbarNav items={topNavItems} orgId={params.orgId}/>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div className="container mx-auto px-3">{children}</div>
|
|
|
+ <div className="container mx-auto sm:px-0 px-3">{children}</div>
|
|
|
</>
|
|
|
);
|
|
|
}
|