mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-27 15:22:56 +08:00
fix: color scheme
This commit is contained in:
parent
30d39e70ac
commit
c6f7bf91c3
@ -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>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user