From 041fa31a86b876e98d32e343857354bddd698fe6 Mon Sep 17 00:00:00 2001 From: AykutSarac Date: Sun, 5 Feb 2023 11:25:16 +0300 Subject: [PATCH] implement pro version updates --- src/components/Footer/index.tsx | 3 +- src/components/Navbar/index.tsx | 59 +++++++++++++++++++++++++++ src/containers/Home/index.tsx | 17 +------- src/pages/_app.tsx | 15 +++++-- src/pages/docs.tsx | 6 +-- src/pages/pricing.tsx | 2 + src/pages/sign-in.tsx | 70 +++++++++++++++++++++++++++++++++ src/store/useUser.tsx | 3 ++ 8 files changed, 149 insertions(+), 26 deletions(-) create mode 100644 src/components/Navbar/index.tsx create mode 100644 src/pages/sign-in.tsx diff --git a/src/components/Footer/index.tsx b/src/components/Footer/index.tsx index 80b5fe1..9c1c734 100644 --- a/src/components/Footer/index.tsx +++ b/src/components/Footer/index.tsx @@ -1,7 +1,6 @@ import Link from "next/link"; import { FaDiscord, FaGithub, FaLinkedin, FaTwitter } from "react-icons/fa"; import styled from "styled-components"; -import pkg from "../../../package.json"; export const StyledFooter = styled.footer` display: flex; @@ -47,7 +46,7 @@ export const Footer = () => ( icon - © {new Date().getFullYear()} JSON Crack - {pkg.version} + © {new Date().getFullYear()} JSON Crack diff --git a/src/components/Navbar/index.tsx b/src/components/Navbar/index.tsx new file mode 100644 index 0000000..33c3325 --- /dev/null +++ b/src/components/Navbar/index.tsx @@ -0,0 +1,59 @@ +import React from "react"; +import Link from "next/link"; +import styled from "styled-components"; + +const StyledNavbar = styled.div` + display: flex; + justify-content: space-between; + align-items: center; + gap: 20px; + padding: 16px 48px; + + @media only screen and (max-width: 768px) { + a:first-of-type { + display: none; + } + } +`; + +const StyledLinkWrapper = styled.nav` + display: flex; + justify-content: center; + align-items: center; + gap: 20px; +`; + +const StyledNavLink = styled(Link)` + display: flex; + justify-content: center; + align-items: center; + font-size: 1rem; + cursor: pointer; + transition: color 0.2s; + + &:hover { + font-weight: 500; + color: ${({ theme }) => theme.ORANGE}; + } +`; + +export const Navbar = () => ( + + + json crack + + + Editor + Features + Sponsor + + GitHub + + Documentation + + +); diff --git a/src/containers/Home/index.tsx b/src/containers/Home/index.tsx index e1dc151..f2918b3 100644 --- a/src/containers/Home/index.tsx +++ b/src/containers/Home/index.tsx @@ -21,27 +21,12 @@ import { baseURL } from "src/constants/data"; import { TABS } from "src/constants/previewSection"; import { PricingCards } from "../PricingCards"; import * as Styles from "./styles"; +import { Navbar } from "src/components/Navbar"; const SyntaxHighlighter = dynamic(() => import("react-syntax-highlighter/dist/cjs/prism-async"), { ssr: false, }); -const Navbar = () => ( - - Editor - Features - Sponsor - - GitHub - - Documentation - -); - const HeroSection = () => ( diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 738a087..2194953 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -1,5 +1,6 @@ import React from "react"; import type { AppProps } from "next/app"; +import { useRouter } from "next/router"; import localFont from "@next/font/local"; import { init } from "@sentry/nextjs"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; @@ -9,6 +10,7 @@ import GlobalStyle from "src/constants/globalStyle"; import { darkTheme, lightTheme } from "src/constants/theme"; import { ModalController } from "src/containers/ModalController"; import useStored from "src/store/useStored"; +import useUser from "src/store/useUser"; import { ThemeProvider } from "styled-components"; const monaSans = localFont({ @@ -35,14 +37,19 @@ const queryClient = new QueryClient({ }); function JsonCrack({ Component, pageProps }: AppProps) { - const [isReady, setReady] = React.useState(false); + const [isLoaded, setIsLoaded] = React.useState(false); + const { isReady } = useRouter(); const lightmode = useStored(state => state.lightmode); + const checkSession = useUser(state => state.checkSession); React.useEffect(() => { - setReady(true); - }, []); + if (isReady) { + checkSession(); + } + setIsLoaded(true); + }, [checkSession, isReady]); - if (isReady) + if (isLoaded) return ( diff --git a/src/pages/docs.tsx b/src/pages/docs.tsx index 6f7599f..82835d5 100644 --- a/src/pages/docs.tsx +++ b/src/pages/docs.tsx @@ -2,8 +2,8 @@ import React from "react"; import dynamic from "next/dynamic"; import Head from "next/head"; import materialDark from "react-syntax-highlighter/dist/cjs/styles/prism/material-dark"; -import { Button } from "src/components/Button"; import { Footer } from "src/components/Footer"; +import { Navbar } from "src/components/Navbar"; import styled from "styled-components"; const SyntaxHighlighter = dynamic(() => import("react-syntax-highlighter/dist/cjs/prism-async"), { @@ -58,14 +58,12 @@ const StyledHighlight = styled.span<{ link?: boolean; alert?: boolean }>` const Docs = () => { return ( <> + Creating JSON Crack Embed | JSON Crack -

Documentation

# Fetching from URL

diff --git a/src/pages/pricing.tsx b/src/pages/pricing.tsx index f262374..071ee91 100644 --- a/src/pages/pricing.tsx +++ b/src/pages/pricing.tsx @@ -1,6 +1,7 @@ import React from "react"; import { Button } from "src/components/Button"; import { Footer } from "src/components/Footer"; +import { Navbar } from "src/components/Navbar"; import { PricingCards } from "src/containers/PricingCards"; import styled from "styled-components"; @@ -17,6 +18,7 @@ const StyledHeroSection = styled.section` const Pricing = () => { return ( <> + + + + +