import { useEffect } from "react"; import { observer } from "mobx-react-lite"; import Image from "next/image"; // ui import { useTheme } from "next-themes"; import useSWR from "swr"; import { Spinner } from "@plane/ui"; // components import { AuthRoot, UserLoggedIn } from "@/components/accounts"; // mobx import useAuthRedirection from "@/hooks/use-auth-redirection"; import { useMobxStore } from "@/lib/mobx/store-provider"; // images import PlaneBackgroundPatternDark from "public/onboarding/background-pattern-dark.svg"; import PlaneBackgroundPattern from "public/onboarding/background-pattern.svg"; import BluePlaneLogoWithoutText from "public/plane-logos/blue-without-text-new.png"; export const AuthView = observer(() => { // hooks const { resolvedTheme } = useTheme(); // store const { user: { currentUser, fetchCurrentUser, loader }, } = useMobxStore(); // sign in redirection hook const { isRedirecting, handleRedirection } = useAuthRedirection(); // fetching user information useSWR("CURRENT_USER_DETAILS", () => fetchCurrentUser(), { shouldRetryOnError: false, revalidateOnFocus: false, }); useEffect(() => { handleRedirection(); }, [handleRedirection]); return ( <> {loader || isRedirecting ? (
) : ( <> {currentUser ? ( ) : (
Plane background pattern
Plane Logo Plane
)} )} ); });