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: color scheme

AykutSaracc6f7bf91c3d0
diff --git a/src/pages/editor.tsx b/src/pages/editor.tsx
index 3c3cdb63..93ea6f56 100644
--- a/src/pages/editor.tsx
+++ b/src/pages/editor.tsx
@@ -2,7 +2,7 @@ import React from "react";
import dynamic from "next/dynamic";
import Head from "next/head";
import { useRouter } from "next/router";
-import { useMantineColorScheme } from "@mantine/core";
+import { MantineProvider } from "@mantine/core";
import styled, { ThemeProvider } from "styled-components";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { darkTheme, lightTheme } from "src/constants/theme";
@@ -41,7 +41,6 @@ export const StyledEditorWrapper = styled.div`
const EditorPage: React.FC = () => {
const { query, isReady } = useRouter();
- const { setColorScheme } = useMantineColorScheme();
const checkEditorSession = useFile(state => state.checkEditorSession);
const darkmodeEnabled = useConfig(state => state.darkmodeEnabled);
@@ -49,31 +48,29 @@ const EditorPage: React.FC = () => {
if (isReady) checkEditorSession(query?.json);
}, [checkEditorSession, isReady, query]);
- React.useEffect(() => {
- setColorScheme(darkmodeEnabled ? "dark" : "light");
- }, [darkmodeEnabled, setColorScheme]);
-
return (
<>
<Head>
<title>Editor | JSON Crack</title>
<link rel="canonical" href="https://jsoncrack.com/editor" />
</Head>
- <ThemeProvider theme={darkmodeEnabled ? darkTheme : lightTheme}>
- <QueryClientProvider client={queryClient}>
- <ExternalMode />
- <ModalController />
- <StyledEditorWrapper>
- <StyledPageWrapper>
- <Toolbar />
- <StyledEditorWrapper>
- <Panes />
- </StyledEditorWrapper>
- </StyledPageWrapper>
- <BottomBar />
- </StyledEditorWrapper>
- </QueryClientProvider>
- </ThemeProvider>
+ <MantineProvider forceColorScheme="dark">
+ <ThemeProvider theme={darkmodeEnabled ? darkTheme : lightTheme}>
+ <QueryClientProvider client={queryClient}>
+ <ExternalMode />
+ <ModalController />
+ <StyledEditorWrapper>
+ <StyledPageWrapper>
+ <Toolbar />
+ <StyledEditorWrapper>
+ <Panes />
+ </StyledEditorWrapper>
+ </StyledPageWrapper>
+ <BottomBar />
+ </StyledEditorWrapper>
+ </QueryClientProvider>
+ </ThemeProvider>
+ </MantineProvider>
</>
);
};