2024-03-19 14:38:35 +00:00
|
|
|
import { observer } from "mobx-react-lite";
|
2023-12-06 11:12:57 +00:00
|
|
|
import Image from "next/image";
|
|
|
|
|
2023-09-04 11:25:43 +00:00
|
|
|
// mobx
|
2023-12-06 11:12:57 +00:00
|
|
|
import { Loader } from "@plane/ui";
|
2024-03-19 14:38:35 +00:00
|
|
|
import { SignInRoot, UserLoggedIn } from "@/components/accounts";
|
|
|
|
import { useMobxStore } from "@/lib/mobx/store-provider";
|
|
|
|
// components
|
2023-12-06 11:12:57 +00:00
|
|
|
// images
|
2023-12-06 13:41:34 +00:00
|
|
|
import BluePlaneLogoWithoutText from "public/plane-logos/blue-without-text-new.png";
|
2023-09-04 11:25:43 +00:00
|
|
|
|
2023-09-26 08:16:38 +00:00
|
|
|
export const LoginView = observer(() => {
|
2023-12-06 11:12:57 +00:00
|
|
|
// store
|
|
|
|
const {
|
|
|
|
user: { currentUser, loader },
|
|
|
|
} = useMobxStore();
|
2023-09-04 11:25:43 +00:00
|
|
|
|
2023-10-04 13:51:04 +00:00
|
|
|
return (
|
|
|
|
<>
|
2023-12-06 11:12:57 +00:00
|
|
|
{loader ? (
|
2023-12-01 07:55:48 +00:00
|
|
|
<div className="relative flex h-screen w-screen items-center justify-center">Loading</div> // TODO: Add spinner instead
|
2023-10-04 13:51:04 +00:00
|
|
|
) : (
|
2023-12-06 11:12:57 +00:00
|
|
|
<>
|
|
|
|
{currentUser ? (
|
|
|
|
<UserLoggedIn />
|
|
|
|
) : (
|
2023-12-10 10:18:10 +00:00
|
|
|
<div className={`h-full w-full bg-onboarding-gradient-100`}>
|
|
|
|
<div className="flex items-center justify-between px-8 pb-4 sm:px-16 sm:py-5 lg:px-28 ">
|
|
|
|
<div className="flex items-center gap-x-2 py-10">
|
2023-12-06 11:12:57 +00:00
|
|
|
<Image src={BluePlaneLogoWithoutText} height={30} width={30} alt="Plane Logo" className="mr-2" />
|
2023-12-10 10:18:10 +00:00
|
|
|
<span className="text-2xl font-semibold sm:text-3xl">Plane</span>
|
2023-12-06 11:12:57 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2023-12-10 10:18:10 +00:00
|
|
|
<div className="mx-auto h-full rounded-t-md border-x border-t border-custom-border-200 bg-onboarding-gradient-100 px-4 pt-4 shadow-sm sm:w-4/5 md:w-2/3 ">
|
|
|
|
<div className="h-full overflow-auto rounded-t-md bg-onboarding-gradient-200 px-7 pb-56 pt-24 sm:px-0">
|
2023-12-06 11:12:57 +00:00
|
|
|
{!true ? (
|
2023-12-10 10:18:10 +00:00
|
|
|
<div className="mx-auto flex justify-center pt-10">
|
2023-12-06 11:12:57 +00:00
|
|
|
<div>
|
2023-12-10 10:18:10 +00:00
|
|
|
<Loader className="mx-auto w-full space-y-4 pb-4">
|
2023-12-06 11:12:57 +00:00
|
|
|
<Loader.Item height="46px" width="360px" />
|
|
|
|
<Loader.Item height="46px" width="360px" />
|
|
|
|
</Loader>
|
|
|
|
|
2023-12-10 10:18:10 +00:00
|
|
|
<Loader className="mx-auto w-full space-y-4 pt-4">
|
2023-12-06 11:12:57 +00:00
|
|
|
<Loader.Item height="46px" width="360px" />
|
|
|
|
<Loader.Item height="46px" width="360px" />
|
|
|
|
</Loader>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
) : (
|
|
|
|
<SignInRoot />
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</>
|
2023-10-04 13:51:04 +00:00
|
|
|
)}
|
|
|
|
</>
|
|
|
|
);
|
2023-09-04 11:25:43 +00:00
|
|
|
});
|