refactoring
This commit is contained in:
parent
c2258abe04
commit
0c5f9eb74b
@ -1,7 +1,5 @@
|
||||
'use server'
|
||||
import { getCookieAuth } from "@/app/lib/actions";
|
||||
import AdminPanel from "@/components/server/admin/adminPanel";
|
||||
import ServerAdminPanel from "@/components/server/admin/ServerAdminPanel";
|
||||
import AuthHandler from "@/components/server/admin/authHandler";
|
||||
import Sidebar from "@/components/server/admin/views/sidebar";
|
||||
import { cookies } from "next/headers";
|
||||
@ -63,9 +61,9 @@ export default async function Page(props:Props){
|
||||
<main className="h-screen w-screen flex flex-col p-0 bg-gray-300 box-border m-0">
|
||||
<AuthHandler params={null}>
|
||||
<Sidebar sidebarEntries={sidebarEntries} slug={slug.toString()}></Sidebar>
|
||||
<AdminPanel slug={slug.toString()}>
|
||||
<div className="AdminPanelWrapper flex flex-col p-2">
|
||||
{await getCurrentView(slug.toString())}
|
||||
</AdminPanel>
|
||||
</div>
|
||||
</AuthHandler>
|
||||
{/* <section>{JSON.stringify(cookies().getAll())}</section> */}
|
||||
</main>
|
||||
@ -1,46 +0,0 @@
|
||||
'use server'
|
||||
import { getCookieAuth } from "@/app/lib/actions";
|
||||
import AdminPanel from "@/components/server/admin/adminPanel";
|
||||
import ServerAdminPanel from "@/components/server/admin/ServerAdminPanel";
|
||||
import AuthHandler from "@/components/server/admin/authHandler";
|
||||
import Sidebar from "@/components/server/admin/views/sidebar";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
type Props = {
|
||||
params: {
|
||||
slug: string[]
|
||||
};
|
||||
}
|
||||
|
||||
export type SidebarEntry = {
|
||||
label:string;
|
||||
view:string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function getSidebarEntries():Promise<Array<SidebarEntry>>{
|
||||
return [
|
||||
{ label: 'Home', view: 'home'},
|
||||
{ label: 'Post Management', view: 'man-post'},
|
||||
{ label: 'Project Management', view: 'man-proj'},
|
||||
{ label: 'Tag Management', view: 'man-tags'},
|
||||
{ label: 'User Management', view: 'man-user'},
|
||||
]
|
||||
}
|
||||
|
||||
export default async function Page(props:Props){
|
||||
const sidebarEntries:Array<SidebarEntry> = await getSidebarEntries();
|
||||
|
||||
const slug:string|string[] = props.params.slug ? props.params.slug : 'home';
|
||||
|
||||
return (
|
||||
<main className="h-screen w-screen flex flex-col p-0 bg-background-500 box-border m-0">
|
||||
<AuthHandler params={null}>
|
||||
<Sidebar sidebarEntries={sidebarEntries} slug={""}></Sidebar>
|
||||
<ServerAdminPanel slug={slug.toString()}></ServerAdminPanel>
|
||||
</AuthHandler>
|
||||
{/* <section>{JSON.stringify(cookies().getAll())}</section> */}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
import AdminPanel from "@/components/client/admin/adminPanel";
|
||||
import AuthHandler from "@/components/server/admin/authHandler";
|
||||
import { cookies } from "next/headers";
|
||||
import { Router } from "next/router";
|
||||
|
||||
|
||||
export default async function Page(){
|
||||
return (
|
||||
<main className="h-screen w-screen flex flex-col p-0 bg-background-500 box-border m-0">
|
||||
<AuthHandler params={null}><AdminPanel></AdminPanel></AuthHandler>
|
||||
{/* <section>{JSON.stringify(cookies().getAll())}</section> */}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
'use server'
|
||||
|
||||
import AdminPanel from "@/components/server/admin/adminPanel";
|
||||
import { AuthProps } from "@/providers/providers";
|
||||
import { ReactNode } from "react";
|
||||
|
||||
|
||||
|
||||
interface Props {
|
||||
children?: ReactNode;
|
||||
slug?: string;
|
||||
}
|
||||
|
||||
export default async function ServerAdminPanel(props:Props){
|
||||
return <AdminPanel slug={props.slug?props.slug:'home'}>{props.children}</AdminPanel>
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
'use server'
|
||||
|
||||
import { ReactNode, useContext, useState } from "react";
|
||||
import { AuthProps } from "@/providers/providers";
|
||||
import SomeServerSubComponent from "@/components/server/admin/serverContextUserTest";
|
||||
import Sidebar from "./views/sidebar";
|
||||
import PostView from "./views/PostView";
|
||||
|
||||
|
||||
interface Props {
|
||||
children?: ReactNode;
|
||||
// auth?: AuthProps;
|
||||
slug?: string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default async function AdminPanel(props:Props){
|
||||
const slug = props.slug ? props.slug : 'home'
|
||||
return (
|
||||
<div className="AdminPanelWrapper w-[100%] h-[100%] flex flex-row m-auto">
|
||||
{/* <h1>Super Secret Admin Panel!</h1> */}
|
||||
{/* <h2>this is where we use the context test:<SomeSubComponent></SomeSubComponent></h2> */}
|
||||
{/* <SomeServerSubComponent></SomeServerSubComponent> */}
|
||||
{/* <section> */}
|
||||
{/* {props.children} */}
|
||||
{/* <PostView></PostView> */}
|
||||
{/* </section> */}
|
||||
{props.children}
|
||||
{/* <div>{JSON.stringify(props.auth)}</div> */}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user