From cba8d917edf5c63af548bd1f7e488f6629749bf2 Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Wed, 26 Apr 2023 20:40:16 +0200 Subject: [PATCH] refactor: move apply-dark-mode hook into other directory Signed-off-by: Tilman Vatteroth --- .../application-loader/initializers/load-dark-mode.ts | 2 +- frontend/src/components/editor-page/editor-page-content.tsx | 2 +- .../src/hooks/{common => dark-mode}/use-apply-dark-mode.ts | 4 ++-- frontend/src/pages/cheatsheet.tsx | 2 +- frontend/src/pages/render.tsx | 2 +- frontend/src/pages/s/[noteId].tsx | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) rename frontend/src/hooks/{common => dark-mode}/use-apply-dark-mode.ts (93%) diff --git a/frontend/src/components/application-loader/initializers/load-dark-mode.ts b/frontend/src/components/application-loader/initializers/load-dark-mode.ts index 39682ecad..42fc157b1 100644 --- a/frontend/src/components/application-loader/initializers/load-dark-mode.ts +++ b/frontend/src/components/application-loader/initializers/load-dark-mode.ts @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import { DARK_MODE_LOCAL_STORAGE_KEY } from '../../../hooks/common/use-apply-dark-mode' +import { DARK_MODE_LOCAL_STORAGE_KEY } from '../../../hooks/dark-mode/use-apply-dark-mode' import { setDarkModePreference } from '../../../redux/dark-mode/methods' import { DarkModePreference } from '../../../redux/dark-mode/types' import { isClientSideRendering } from '../../../utils/is-client-side-rendering' diff --git a/frontend/src/components/editor-page/editor-page-content.tsx b/frontend/src/components/editor-page/editor-page-content.tsx index 3a4ba0dc1..130433edd 100644 --- a/frontend/src/components/editor-page/editor-page-content.tsx +++ b/frontend/src/components/editor-page/editor-page-content.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ import { useApplicationState } from '../../hooks/common/use-application-state' -import { useApplyDarkMode } from '../../hooks/common/use-apply-dark-mode' +import { useApplyDarkMode } from '../../hooks/dark-mode/use-apply-dark-mode' import { Logger } from '../../utils/logger' import { MotdModal } from '../common/motd-modal/motd-modal' import { CommunicatorImageLightbox } from '../markdown-renderer/extensions/image/communicator-image-lightbox' diff --git a/frontend/src/hooks/common/use-apply-dark-mode.ts b/frontend/src/hooks/dark-mode/use-apply-dark-mode.ts similarity index 93% rename from frontend/src/hooks/common/use-apply-dark-mode.ts rename to frontend/src/hooks/dark-mode/use-apply-dark-mode.ts index 19d08cbad..074820ff0 100644 --- a/frontend/src/hooks/common/use-apply-dark-mode.ts +++ b/frontend/src/hooks/dark-mode/use-apply-dark-mode.ts @@ -1,12 +1,12 @@ /* - * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ import { DarkModePreference } from '../../redux/dark-mode/types' import { isClientSideRendering } from '../../utils/is-client-side-rendering' import { Logger } from '../../utils/logger' -import { useApplicationState } from './use-application-state' +import { useApplicationState } from '../common/use-application-state' import useMediaQuery from '@restart/hooks/useMediaQuery' import { useEffect } from 'react' diff --git a/frontend/src/pages/cheatsheet.tsx b/frontend/src/pages/cheatsheet.tsx index be49c923b..ad935d1a5 100644 --- a/frontend/src/pages/cheatsheet.tsx +++ b/frontend/src/pages/cheatsheet.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ import { CheatsheetContent } from '../components/editor-page/app-bar/cheatsheet/cheatsheet-content' -import { useApplyDarkMode } from '../hooks/common/use-apply-dark-mode' +import { useApplyDarkMode } from '../hooks/dark-mode/use-apply-dark-mode' import type { NextPage } from 'next' import { Container } from 'react-bootstrap' diff --git a/frontend/src/pages/render.tsx b/frontend/src/pages/render.tsx index fe6439e76..df78952ce 100644 --- a/frontend/src/pages/render.tsx +++ b/frontend/src/pages/render.tsx @@ -5,7 +5,7 @@ */ import { RendererToEditorCommunicatorContextProvider } from '../components/editor-page/render-context/renderer-to-editor-communicator-context-provider' import { RenderPageContent } from '../components/render-page/render-page-content' -import { useApplyDarkMode } from '../hooks/common/use-apply-dark-mode' +import { useApplyDarkMode } from '../hooks/dark-mode/use-apply-dark-mode' import type { NextPage } from 'next' import React from 'react' diff --git a/frontend/src/pages/s/[noteId].tsx b/frontend/src/pages/s/[noteId].tsx index 3db1342b3..b4a810533 100644 --- a/frontend/src/pages/s/[noteId].tsx +++ b/frontend/src/pages/s/[noteId].tsx @@ -9,7 +9,7 @@ import { DocumentReadOnlyPageContent } from '../../components/document-read-only import { AppBar, AppBarMode } from '../../components/editor-page/app-bar/app-bar' import { HeadMetaProperties } from '../../components/editor-page/head-meta-properties/head-meta-properties' import { EditorToRendererCommunicatorContextProvider } from '../../components/editor-page/render-context/editor-to-renderer-communicator-context-provider' -import { useApplyDarkMode } from '../../hooks/common/use-apply-dark-mode' +import { useApplyDarkMode } from '../../hooks/dark-mode/use-apply-dark-mode' import React from 'react' /**