Skip to content

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

fix: loading screen

AykutSarac0b1d8ad60faf
diff --git a/package.json b/package.json
index 81796e13..dcdeecad 100644
--- a/package.json
+++ b/package.json
@@ -67,6 +67,7 @@
"@types/lodash.set": "^4.3.9",
"@types/node": "^20.4.7",
"@types/react": "18.2.45",
+ "@types/react-dom": "^18.2.18",
"eslint": "8.56.0",
"eslint-config-next": "14.0.4",
"eslint-config-prettier": "^8.10.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 898919f8..0fd6dca9 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -160,6 +160,9 @@ devDependencies:
'@types/react':
specifier: 18.2.45
version: 18.2.45
+ '@types/react-dom':
+ specifier: ^18.2.18
+ version: 18.2.18
eslint:
specifier: 8.56.0
version: 8.56.0
@@ -1120,6 +1123,12 @@ packages:
resolution: {integrity: sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==}
+ resolution: {integrity: sha512-TJxDm6OfAX2KJWJdMEVTwWke5Sc/E/RlnPGvGfS0W7+6ocy2xhDVQVh/KvC2Uf7kACs+gDytdusDSdWfWkaNzw==}
+ dependencies:
+ '@types/react': 18.2.45
+ dev: true
+
resolution: {integrity: sha512-TtAxCNrlrBp8GoeEp1npd5g+d/OejJHFxS3OWmrPBMFaVQMSN0OFySozJio5BHxTuTeug00AVXVAjfDSfk+lUg==}
dependencies:
diff --git a/src/components/MonacoEditor/index.tsx b/src/components/MonacoEditor/index.tsx
index f4b427dd..5845dd96 100644
--- a/src/components/MonacoEditor/index.tsx
+++ b/src/components/MonacoEditor/index.tsx
@@ -81,7 +81,7 @@ export const MonacoEditor = () => {
options={editorOptions}
onValidate={errors => setError(errors[0]?.message)}
onChange={contents => setContents({ contents, skipUpdate: true })}
- loading={<Loading message="Loading Editor..." />}
+ loading={<Loading message="Loading Monaco Editor..." loading />}
/>
</StyledWrapper>
);
diff --git a/src/containers/Editor/Panes.tsx b/src/containers/Editor/Panes.tsx
index 201e20f2..a239c3be 100644
--- a/src/containers/Editor/Panes.tsx
+++ b/src/containers/Editor/Panes.tsx
@@ -26,24 +26,18 @@ const LiveEditor = dynamic(() => import("src/containers/Editor/LiveEditor"), {
const Panes: React.FC = () => {
const fullscreen = useGraph(state => state.fullscreen);
- const toggleFullscreen = useGraph(state => state.toggleFullscreen);
- const isMobile = React.useMemo(() => window.innerWidth <= 768, []);
-
- React.useEffect(() => {
- if (isMobile) toggleFullscreen(true);
- }, [isMobile, toggleFullscreen]);
return (
- <StyledEditor proportionalLayout={false} vertical={isMobile}>
+ <StyledEditor proportionalLayout={false}>
<Allotment.Pane
- preferredSize={isMobile ? "100%" : 450}
+ preferredSize={450}
minSize={fullscreen ? 0 : 300}
- maxSize={isMobile ? Infinity : 800}
+ maxSize={800}
visible={!fullscreen}
>
<JsonEditor />
</Allotment.Pane>
- <Allotment.Pane minSize={0} maxSize={isMobile && !fullscreen ? 0 : Infinity}>
+ <Allotment.Pane minSize={0}>
<LiveEditor />
</Allotment.Pane>
</StyledEditor>
diff --git a/src/layout/JsonCrackLogo/index.tsx b/src/layout/JsonCrackLogo/index.tsx
index 1512012b..fbb7c630 100644
--- a/src/layout/JsonCrackLogo/index.tsx
+++ b/src/layout/JsonCrackLogo/index.tsx
@@ -10,7 +10,7 @@ const StyledTitle = styled.div<{ fontSize: string }>`
font-size: ${({ fontSize }) => fontSize};
white-space: nowrap;
z-index: 10;
- color: ${({ theme }) => theme.TEXT_NORMAL};
+ color: ${({ theme }) => theme.INTERACTIVE_HOVER};
`;
interface LogoProps extends React.ComponentPropsWithoutRef<"a"> {
diff --git a/src/layout/Loading/index.tsx b/src/layout/Loading/index.tsx
index 9791fb17..2e154d9e 100644
--- a/src/layout/Loading/index.tsx
+++ b/src/layout/Loading/index.tsx
@@ -1,5 +1,5 @@
import React from "react";
-import { Center, Image, Stack } from "@mantine/core";
+import { Center, Stack, Text } from "@mantine/core";
import styled, { keyframes } from "styled-components";
import { JSONCrackLogo } from "../JsonCrackLogo";
@@ -28,32 +28,28 @@ const StyledLoading = styled.div<{ $visible: boolean }>`
text-align: center;
z-index: 100;
pointer-events: visiblePainted;
- cursor: wait;
animation: 200ms ${fadeIn};
animation-fill-mode: forwards;
visibility: hidden;
- backdrop-filter: blur(5px);
- -webkit-backdrop-filter: blur(5px);
+ background: ${({ theme }) => theme.BACKGROUND_NODE};
+ opacity: 0.8;
+ color: ${({ theme }) => theme.INTERACTIVE_HOVER};
+ cursor: wait;
img {
transform: rotate(45deg);
}
`;
-const StyledMessage = styled.div`
- color: #b9bbbe;
- font-size: 1.5rem;
- font-weight: 600;
-`;
-
-export const Loading: React.FC<LoadingProps> = ({ loading = false, message }) => {
+export const Loading = ({ loading = false, message }: LoadingProps) => {
return (
<Center mx="auto">
<StyledLoading $visible={loading}>
<Stack>
- <Image mx="auto" width="6.5em" src="./assets/rocket_ship.webp" alt="loading image" />
- <JSONCrackLogo fontSize="2rem" />
- <StyledMessage>{message ?? "Preparing the environment for you..."}</StyledMessage>
+ <JSONCrackLogo fontSize="3rem" />
+ <Text fz="lg" fw="bold">
+ {message ?? "Preparing the environment for you..."}
+ </Text>
</Stack>
</StyledLoading>
</Center>
diff --git a/src/pages/editor.tsx b/src/pages/editor.tsx
index 010f8920..ae4d357f 100644
--- a/src/pages/editor.tsx
+++ b/src/pages/editor.tsx
@@ -29,15 +29,25 @@ export const StyledEditorWrapper = styled.div`
const EditorPage: React.FC = () => {
const { query, isReady } = useRouter();
- const checkEditorSession = useFile(state => state.checkEditorSession);
const loading = useJson(state => state.loading);
const hasQuery = React.useMemo(() => Object.keys(query).length > 0, [query]);
+ const checkEditorSession = useFile(state => state.checkEditorSession);
React.useEffect(() => {
if (isReady) checkEditorSession(query?.json);
}, [checkEditorSession, isReady, query]);
- if (loading) return <Loading message="Fetching JSON from cloud..." />;
+ if (loading) {
+ return (
+ <StyledEditorWrapper>
+ <Head>
+ <title>Editor | JSON Crack</title>
+ {hasQuery && <meta name="robots" content="noindex,nofollow" />}
+ </Head>
+ <Loading message="Preparing the editor for you..." loading />
+ </StyledEditorWrapper>
+ );
+ }
return (
<EditorWrapper>