forked from github/plane
6274745284
* chore: update onboarding workflow * dev: update user count tasks * fix: forgot password endpoint * dev: instance and onboarding updates * chore: update sign-in workflow for cloud and self-hosted instances (#2993) * chore: updated auth services * chore: new signin workflow updated * chore: updated content * chore: instance admin setup * dev: update instance verification task * dev: run the instance verification task every 4 hours * dev: update migrations * chore: update latest features image --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import { FC, ReactNode } 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 },
|
|
} = useMobxStore();
|
|
|
|
const router = useRouter();
|
|
const isGodMode = router.pathname.includes("god-mode");
|
|
|
|
useSWR("INSTANCE_INFO", () => fetchInstanceInfo(), {
|
|
revalidateOnFocus: false,
|
|
});
|
|
|
|
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;
|