mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fd5b7d20a8
* chore: instance type updated * chore: instance not ready screen added * chore: instance layout added * chore: instance magic sign in endpoint and type added * chore: instance admin password endpoint added * chore: instance setup page added * chore: instance setup form added * chore: instance layout updated * fix: instance admin workflow setup * fix: admin workflow setup --------- Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
53 lines
1.2 KiB
TypeScript
53 lines
1.2 KiB
TypeScript
import { FC, ReactNode, useEffect } from "react";
|
|
|
|
import useSWR from "swr";
|
|
|
|
// route
|
|
import { useRouter } from "next/router";
|
|
// store
|
|
import { observer } from "mobx-react-lite";
|
|
import { useMobxStore } from "lib/mobx/store-provider";
|
|
// components
|
|
import { Spinner } from "@plane/ui";
|
|
import { InstanceNotReady } from "components/instance";
|
|
|
|
type Props = {
|
|
children: ReactNode;
|
|
};
|
|
|
|
const InstanceLayout: FC<Props> = observer(({ children }) => {
|
|
// store
|
|
const {
|
|
instance: { fetchInstanceInfo, instance, createInstance },
|
|
} = useMobxStore();
|
|
|
|
const router = useRouter();
|
|
const isGodMode = router.pathname.includes("god-mode");
|
|
|
|
useSWR("INSTANCE_INFO", () => fetchInstanceInfo());
|
|
|
|
useEffect(() => {
|
|
if (instance?.is_activated === false) {
|
|
createInstance();
|
|
}
|
|
}, [instance?.is_activated, createInstance]);
|
|
|
|
return (
|
|
<div className="h-screen w-full overflow-hidden">
|
|
{instance ? (
|
|
!instance.is_setup_done && !isGodMode ? (
|
|
<InstanceNotReady />
|
|
) : (
|
|
children
|
|
)
|
|
) : (
|
|
<div className="flex h-full w-full items-center justify-center">
|
|
<Spinner />
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
});
|
|
|
|
export default InstanceLayout;
|