mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-20 05:56:10 +05:00
added theme switcher
This commit is contained in:
@@ -82,9 +82,14 @@ export default function App() {
|
||||
>
|
||||
<HeaderToggle
|
||||
onClick={() => {
|
||||
currentThemeMode === THEME_MODES.LIGHT && setCurrentThemeMode(THEME_MODES.DARK)
|
||||
currentThemeMode === THEME_MODES.DARK && setCurrentThemeMode(THEME_MODES.AUTO)
|
||||
currentThemeMode === THEME_MODES.AUTO && setCurrentThemeMode(THEME_MODES.LIGHT)
|
||||
const updateThemeMode = mode => {
|
||||
setCurrentThemeMode(mode)
|
||||
localStorage.setItem('themeMode', mode)
|
||||
}
|
||||
|
||||
if (currentThemeMode === THEME_MODES.LIGHT) updateThemeMode(THEME_MODES.DARK)
|
||||
if (currentThemeMode === THEME_MODES.DARK) updateThemeMode(THEME_MODES.AUTO)
|
||||
if (currentThemeMode === THEME_MODES.AUTO) updateThemeMode(THEME_MODES.LIGHT)
|
||||
}}
|
||||
>
|
||||
{currentThemeMode === THEME_MODES.LIGHT ? (
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useState, memo, useRef, useEffect, useContext } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import isEqual from 'lodash/isEqual'
|
||||
import { DarkModeContext } from 'components/App'
|
||||
import { THEME_MODES } from 'style/materialUISetup'
|
||||
|
||||
import { useCreateCacheMap } from '../customHooks'
|
||||
import getShortCacheMap from './getShortCacheMap'
|
||||
@@ -18,7 +19,7 @@ const TorrentCache = ({ cache, isMini }) => {
|
||||
const cacheMap = useCreateCacheMap(cache)
|
||||
const settingsTarget = isMini ? 'mini' : 'default'
|
||||
const { isDarkMode } = useContext(DarkModeContext)
|
||||
const theme = isDarkMode ? 'dark' : 'light'
|
||||
const theme = isDarkMode ? THEME_MODES.DARK : THEME_MODES.LIGHT
|
||||
|
||||
const {
|
||||
readerColor,
|
||||
|
||||
Reference in New Issue
Block a user