refactor: split apply-dark-mode hook into multiple hooks

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-04-26 20:47:05 +02:00
parent bcff03ef99
commit a23c215d8d
8 changed files with 70 additions and 60 deletions

View file

@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { DARK_MODE_LOCAL_STORAGE_KEY } from '../../../hooks/dark-mode/use-apply-dark-mode'
import { DARK_MODE_LOCAL_STORAGE_KEY } from '../../../hooks/dark-mode/use-save-dark-mode-preference-to-local-storage'
import { setDarkModePreference } from '../../../redux/dark-mode/methods'
import { DarkModePreference } from '../../../redux/dark-mode/types'
import { isClientSideRendering } from '../../../utils/is-client-side-rendering'

View file

@ -4,7 +4,8 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { useApplicationState } from '../../hooks/common/use-application-state'
import { useApplyDarkMode } from '../../hooks/dark-mode/use-apply-dark-mode'
import { useApplyDarkModeStyle } from '../../hooks/dark-mode/use-apply-dark-mode-style'
import { useSaveDarkModePreferenceToLocalStorage } from '../../hooks/dark-mode/use-save-dark-mode-preference-to-local-storage'
import { Logger } from '../../utils/logger'
import { MotdModal } from '../common/motd-modal/motd-modal'
import { CommunicatorImageLightbox } from '../markdown-renderer/extensions/image/communicator-image-lightbox'
@ -78,7 +79,8 @@ export const EditorPageContent: React.FC = () => {
[editorSyncScroll]
)
useApplyDarkMode()
useApplyDarkModeStyle()
useSaveDarkModePreferenceToLocalStorage()
useUpdateLocalHistoryEntry()
const setRendererToScrollSource = useCallback(() => {