2023-11-18 10:47:01 +00:00
|
|
|
import { FC, ReactNode } from "react";
|
|
|
|
// layouts
|
2023-11-20 15:16:49 +00:00
|
|
|
import { AdminAuthWrapper, UserAuthWrapper } from "layouts/auth-layout";
|
2023-11-18 10:47:01 +00:00
|
|
|
// components
|
|
|
|
import { InstanceAdminSidebar } from "./sidebar";
|
2023-11-25 15:53:50 +00:00
|
|
|
import { InstanceAdminHeader } from "./header";
|
2023-11-29 15:03:08 +00:00
|
|
|
import { InstanceSetupView } from "components/instance";
|
|
|
|
// store
|
|
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
2023-11-18 10:47:01 +00:00
|
|
|
|
|
|
|
export interface IInstanceAdminLayout {
|
|
|
|
children: ReactNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const InstanceAdminLayout: FC<IInstanceAdminLayout> = (props) => {
|
2023-11-25 15:53:50 +00:00
|
|
|
const { children } = props;
|
2023-11-29 15:03:08 +00:00
|
|
|
// store
|
|
|
|
const {
|
|
|
|
instance: { instance },
|
|
|
|
user: { currentUser },
|
|
|
|
} = useMobxStore();
|
|
|
|
// fetch
|
|
|
|
|
|
|
|
console.log("instance", instance);
|
|
|
|
|
|
|
|
if (instance?.is_setup_done === false) {
|
|
|
|
return <InstanceSetupView />;
|
|
|
|
}
|
2023-11-18 10:47:01 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<UserAuthWrapper>
|
2023-11-20 15:16:49 +00:00
|
|
|
<AdminAuthWrapper>
|
|
|
|
<div className="relative flex h-screen w-full overflow-hidden">
|
|
|
|
<InstanceAdminSidebar />
|
|
|
|
<main className="relative flex flex-col h-full w-full overflow-hidden bg-custom-background-100">
|
2023-11-25 15:53:50 +00:00
|
|
|
<InstanceAdminHeader />
|
2023-11-27 11:45:11 +00:00
|
|
|
<div className="h-full w-full overflow-hidden px-10 py-12">
|
2023-11-20 15:16:49 +00:00
|
|
|
<div className="relative h-full w-full overflow-x-hidden overflow-y-scroll">
|
|
|
|
<>{children}</>
|
|
|
|
</div>
|
2023-11-18 10:47:01 +00:00
|
|
|
</div>
|
2023-11-20 15:16:49 +00:00
|
|
|
</main>
|
|
|
|
</div>
|
|
|
|
</AdminAuthWrapper>
|
2023-11-18 10:47:01 +00:00
|
|
|
</UserAuthWrapper>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|