✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.
feat: update login flow
AykutSaracc3ebefdb0afb
diff --git a/src/pages/sign-in.tsx b/src/pages/sign-in.tsxindex 9321b263..d635cf58 100644--- a/src/pages/sign-in.tsx+++ b/src/pages/sign-in.tsx@@ -22,14 +22,18 @@ const StyledHeroSection = styled.section``;const SignIn = () => {- const { isReady, replace } = useRouter();+ const { isReady, replace, query } = useRouter();const checkSession = useUser(state => state.checkSession);const isAuthenticated = useUser(state => state.isAuthenticated);+ const isAuthenticating = React.useMemo(() => {+ if (query?.access_token) return true;+ return false;+ }, [query]);+React.useEffect(() => {- if (!isReady) checkSession();if (isAuthenticated) replace("/editor");- }, [isReady, isAuthenticated, replace, checkSession]);+ }, [isReady, isAuthenticated, replace]);const handleLoginClick = (provider: "github" | "google") => {altogic.auth.signInWithProvider(provider);@@ -46,29 +50,45 @@ const SignIn = () => {<Link href="/"><img src="assets/icon.png" alt="json crack" width="400" /></Link>- <h1>Sign In</h1>+ <h1>{isAuthenticating ? "Continue With" : "Sign In"}</h1></StyledHeroSection><Container><Center>- <Stack my={60} w={250} spacing="xl">- <Button- size="md"- color="red"- onClick={() => handleLoginClick("google")}- leftIcon={<AiOutlineGoogle size={24} />}- >- Sign In with Google- </Button>- <Button- size="md"- variant="white"- color="gray"- onClick={() => handleLoginClick("github")}- leftIcon={<AiOutlineGithub size={24} />}- >- Sign In with GitHub- </Button>- </Stack>+ {isAuthenticating ? (+ <Stack my={60} w={250} spacing="xl">+ <Button size="lg" color="orange" onClick={checkSession}>+ JSON Crack+ </Button>+ <Button+ component="a"+ href={window.location.href.replace(window.location.host, "editor.herowand.com")}+ size="lg"+ color="teal"+ >+ Herowand Editor+ </Button>+ </Stack>+ ) : (+ <Stack my={60} w={250} spacing="xl">+ <Button+ size="lg"+ color="red"+ onClick={() => handleLoginClick("google")}+ leftIcon={<AiOutlineGoogle size={24} />}+ >+ Sign In with Google+ </Button>+ <Button+ size="lg"+ variant="white"+ color="gray"+ onClick={() => handleLoginClick("github")}+ leftIcon={<AiOutlineGithub size={24} />}+ >+ Sign In with GitHub+ </Button>+ </Stack>+ )}</Center></Container></StyledPageWrapper>