setOpen(true)}>
diff --git a/web/src/components/Add/AddDialog.jsx b/web/src/components/Add/AddDialog.jsx
index 73a2d2c..69431d9 100644
--- a/web/src/components/Add/AddDialog.jsx
+++ b/web/src/components/Add/AddDialog.jsx
@@ -12,8 +12,6 @@ import usePreviousState from 'utils/usePreviousState'
import { useQuery } from 'react-query'
import { getTorrents } from 'utils/Utils'
import parseTorrent from 'parse-torrent'
-import { ThemeProvider } from '@material-ui/core/styles'
-import { lightTheme } from 'style/materialUISetup'
import { checkImageURL, getMoviePosters, chechTorrentSource, parseTorrentTitle } from './helpers'
import { ButtonWrapper, Content, Header } from './style'
@@ -221,71 +219,69 @@ export default function AddDialog({
}
return (
-
-
+
+
+
+
+
+
)
}
diff --git a/web/src/components/Add/RightSideComponent.jsx b/web/src/components/Add/RightSideComponent.jsx
index 1b90b81..ea8c962 100644
--- a/web/src/components/Add/RightSideComponent.jsx
+++ b/web/src/components/Add/RightSideComponent.jsx
@@ -1,6 +1,6 @@
import { useTranslation } from 'react-i18next'
import { NoImageIcon } from 'icons'
-import { IconButton, InputAdornment, TextField } from '@material-ui/core'
+import { IconButton, InputAdornment, TextField, useTheme } from '@material-ui/core'
import { CheckBox as CheckBoxIcon } from '@material-ui/icons'
import {
@@ -41,6 +41,7 @@ export default function RightSideComponent({
isEditMode,
}) {
const { t } = useTranslation()
+ const primary = useTheme().palette.primary.main
const handleTitleChange = ({ target: { value } }) => setTitle(value)
const handlePosterUrlChange = ({ target: { value } }) => {
@@ -91,7 +92,7 @@ export default function RightSideComponent({
setIsUserInteractedWithPoster(false)
}}
>
-
+
),
diff --git a/web/src/components/Add/style.js b/web/src/components/Add/style.js
index 7444a8b..d29809e 100644
--- a/web/src/components/Add/style.js
+++ b/web/src/components/Add/style.js
@@ -15,14 +15,20 @@ export const Header = styled.div`
`
export const Content = styled.div`
- ${({ isEditMode }) => css`
+ ${({
+ isEditMode,
+ theme: {
+ addDialog: { gradientStartColor, gradientEndColor, fontColor },
+ },
+ }) => css`
height: 550px;
- background: linear-gradient(145deg, #e4f6ed, #b5dec9);
+ background: linear-gradient(145deg, ${gradientStartColor}, ${gradientEndColor});
flex: 1;
display: grid;
grid-template-columns: repeat(${isEditMode ? '1' : '2'}, 1fr);
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
overflow: auto;
+ color: ${fontColor};
@media (max-width: 540px) {
${'' /* Just for bug fixing on small screens */}
@@ -44,7 +50,14 @@ export const RightSide = styled.div`
`
export const RightSideContainer = styled.div`
- ${({ isHidden, notificationMessage, isError }) => css`
+ ${({
+ isHidden,
+ notificationMessage,
+ isError,
+ theme: {
+ addDialog: { notificationErrorBGColor, notificationSuccessBGColor },
+ },
+ }) => css`
height: 530px;
${notificationMessage &&
@@ -58,7 +71,7 @@ export const RightSideContainer = styled.div`
content: '${notificationMessage}';
display: grid;
place-items: center;
- background: ${isError ? '#cda184' : '#88cdaa'};
+ background: ${isError ? notificationErrorBGColor : notificationSuccessBGColor};
padding: 10px 15px;
position: absolute;
top: 52%;
@@ -172,11 +185,18 @@ export const IconWrapper = styled.div`
`
export const LeftSideTopSection = styled.div`
- background: #e4f6ed;
- padding: 0 20px 20px 20px;
- transition: all 0.3s;
+ ${({
+ active,
+ theme: {
+ addDialog: { gradientStartColor },
+ },
+ }) => css`
+ background: ${gradientStartColor};
+ padding: 0 20px 20px 20px;
+ transition: all 0.3s;
- ${({ active }) => active && 'box-shadow: 0 8px 10px -9px rgba(0, 0, 0, 0.5)'};
+ ${active && 'box-shadow: 0 8px 10px -9px rgba(0, 0, 0, 0.5)'};
+ `}
`
export const PosterWrapper = styled.div`
@@ -254,7 +274,12 @@ export const PosterSuggestionsItem = styled.div`
`
export const Poster = styled.div`
- ${({ poster }) => css`
+ ${({
+ poster,
+ theme: {
+ addDialog: { posterBGColor },
+ },
+ }) => css`
border-radius: 5px;
overflow: hidden;
width: 200px;
@@ -272,7 +297,7 @@ export const Poster = styled.div`
: css`
display: grid;
place-items: center;
- background: #74c39c;
+ background: ${posterBGColor};
svg {
transform: scale(1.5) translateY(-3px);
@@ -294,28 +319,35 @@ export const ClearPosterButton = styled(Button)`
`
export const PosterLanguageSwitch = styled.div`
- grid-area: poster;
- z-index: 5;
- position: absolute;
- top: 0;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 30px;
- height: 30px;
- background: #74c39c;
- border-radius: 50%;
- display: grid;
- place-items: center;
- color: #e4f6ed;
- font-weight: 600;
- cursor: pointer;
- transition: all 0.3s;
+ ${({
+ showbutton,
+ theme: {
+ addDialog: { languageSwitchBGColor, languageSwitchFontColor },
+ },
+ }) => css`
+ grid-area: poster;
+ z-index: 5;
+ position: absolute;
+ top: 0;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 30px;
+ height: 30px;
+ background: ${languageSwitchBGColor};
+ border-radius: 50%;
+ display: grid;
+ place-items: center;
+ color: ${languageSwitchFontColor};
+ font-weight: 600;
+ cursor: pointer;
+ transition: all 0.3s;
- ${({ showbutton }) => !showbutton && 'display: none'};
+ ${!showbutton && 'display: none'};
- :hover {
- filter: brightness(1.1);
- }
+ :hover {
+ filter: brightness(1.1);
+ }
+ `}
`
export const ButtonWrapper = styled.div`
diff --git a/web/src/components/App/Sidebar.jsx b/web/src/components/App/Sidebar.jsx
index 36a17ec..03e098b 100644
--- a/web/src/components/App/Sidebar.jsx
+++ b/web/src/components/App/Sidebar.jsx
@@ -21,18 +21,24 @@ const Sidebar = ({ isDrawerOpen, setIsDonationDialogOpen, isOffline, isLoading }
+
+
+
+
+
setIsDonationDialogOpen(true)}>
+
diff --git a/web/src/components/App/index.jsx b/web/src/components/App/index.jsx
index d835286..367cd8a 100644
--- a/web/src/components/App/index.jsx
+++ b/web/src/components/App/index.jsx
@@ -1,8 +1,14 @@
import CssBaseline from '@material-ui/core/CssBaseline'
-import { useEffect, useState } from 'react'
+import { createContext, useEffect, useState } from 'react'
import Typography from '@material-ui/core/Typography'
import IconButton from '@material-ui/core/IconButton'
-import { Menu as MenuIcon, Close as CloseIcon } from '@material-ui/icons'
+import {
+ Menu as MenuIcon,
+ Close as CloseIcon,
+ Brightness4 as Brightness4Icon,
+ Brightness5 as Brightness5Icon,
+ BrightnessAuto as BrightnessAutoIcon,
+} from '@material-ui/icons'
import { echoHost } from 'utils/Hosts'
import Div100vh from 'react-div-100vh'
import axios from 'axios'
@@ -16,18 +22,19 @@ import { useQuery } from 'react-query'
import { getTorrents } from 'utils/Utils'
import GlobalStyle from 'style/GlobalStyle'
-import { AppWrapper, AppHeader, LanguageSwitch } from './style'
+import { AppWrapper, AppHeader, HeaderToggle } from './style'
import Sidebar from './Sidebar'
-import { darkTheme, lightTheme, useMaterialUITheme } from '../../style/materialUISetup'
+import { lightTheme, THEME_MODES, useMaterialUITheme } from '../../style/materialUISetup'
import getStyledComponentsTheme from '../../style/getStyledComponentsTheme'
+export const DarkModeContext = createContext()
+
export default function App() {
const [isDrawerOpen, setIsDrawerOpen] = useState(false)
const [isDonationDialogOpen, setIsDonationDialogOpen] = useState(false)
const [torrServerVersion, setTorrServerVersion] = useState('')
- // https://material-ui.com/ru/customization/palette/
- const [isDarkMode, muiTheme] = useMaterialUITheme()
+ const [isDarkMode, currentThemeMode, updateThemeMode, muiTheme] = useMaterialUITheme()
const [currentLang, changeLang] = useChangeLanguage()
const [isOffline, setIsOffline] = useState(false)
const { data: torrents, isLoading } = useQuery('torrents', getTorrents, {
@@ -45,54 +52,74 @@ export default function App() {
<>
-
-
-
+
+
+
+
- {/* Div100vh - iOS WebKit fix */}
-
-
-
- setIsDrawerOpen(!isDrawerOpen)}
- edge='start'
- >
- {isDrawerOpen ? : }
-
+ {/* Div100vh - iOS WebKit fix */}
+
+
+
+ setIsDrawerOpen(!isDrawerOpen)}
+ edge='start'
+ >
+ {isDrawerOpen ? : }
+
-
- TorrServer {torrServerVersion}
-
+
+ TorrServer {torrServerVersion}
+
-
- (currentLang === 'en' ? changeLang('ru') : changeLang('en'))}>
- {currentLang === 'en' ? 'RU' : 'EN'}
-
-
-
+
+ {
+ 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 ? (
+
+ ) : currentThemeMode === THEME_MODES.DARK ? (
+
+ ) : (
+
+ )}
+
+
+ (currentLang === 'en' ? changeLang('ru') : changeLang('en'))}>
+ {currentLang === 'en' ? 'RU' : 'EN'}
+
+
+
-
-
-
+
-
- {isDonationDialogOpen && setIsDonationDialogOpen(false)} />}
-
+
+ {isDonationDialogOpen && setIsDonationDialogOpen(false)} />}
+
- {!JSON.parse(localStorage.getItem('snackbarIsClosed')) && }
-
-
-
-
+ {!JSON.parse(localStorage.getItem('snackbarIsClosed')) && }
+
+
+
+
+
>
)
}
diff --git a/web/src/components/App/style.js b/web/src/components/App/style.js
index 857af8d..c5700f1 100644
--- a/web/src/components/App/style.js
+++ b/web/src/components/App/style.js
@@ -1,14 +1,21 @@
+import { rgba } from 'polished'
import styled, { css } from 'styled-components'
export const AppWrapper = styled.div`
- height: 100%;
- background: #cbe8d9;
- display: grid;
- grid-template-columns: 60px 1fr;
- grid-template-rows: 60px 1fr;
- grid-template-areas:
- 'head head'
- 'side content';
+ ${({
+ theme: {
+ app: { appSecondaryColor },
+ },
+ }) => css`
+ height: 100%;
+ background: ${rgba(appSecondaryColor, 0.8)};
+ display: grid;
+ grid-template-columns: 60px 1fr;
+ grid-template-rows: 60px 1fr;
+ grid-template-areas:
+ 'head head'
+ 'side content';
+ `}
`
export const CenteredGrid = styled.div`
@@ -32,16 +39,25 @@ export const AppHeader = styled.div`
`}
`
export const AppSidebarStyle = styled.div`
- ${({ isDrawerOpen }) => css`
+ ${({
+ isDrawerOpen,
+ theme: {
+ app: { appSecondaryColor, sidebarBGColor, sidebarFillColor },
+ },
+ }) => css`
grid-area: side;
width: ${isDrawerOpen ? '400%' : '100%'};
z-index: 2;
overflow-x: hidden;
transition: width 195ms cubic-bezier(0.4, 0, 0.6, 1) 0ms;
- border-right: 1px solid rgba(0, 0, 0, 0.12);
- background: #575757;
- color: #eee;
+ border-right: 1px solid ${rgba(appSecondaryColor, 0.12)};
+ background: ${sidebarBGColor};
+ color: ${sidebarFillColor};
white-space: nowrap;
+
+ svg {
+ fill: ${sidebarFillColor};
+ }
`}
`
export const TorrentListWrapper = styled.div`
@@ -69,25 +85,31 @@ export const TorrentListWrapper = styled.div`
}
`
-export const LanguageSwitch = styled.div`
- cursor: pointer;
- border-radius: 50%;
- background: #56b887;
- height: 35px;
- width: 35px;
- transition: all 0.2s;
- font-weight: 600;
- display: grid;
- place-items: center;
- color: #fff;
+export const HeaderToggle = styled.div`
+ ${({
+ theme: {
+ app: { headerToggleColor },
+ },
+ }) => css`
+ cursor: pointer;
+ border-radius: 50%;
+ background: ${headerToggleColor};
+ height: 35px;
+ width: 35px;
+ transition: all 0.2s;
+ font-weight: 600;
+ display: grid;
+ place-items: center;
+ color: #fff;
- :hover {
- background: #4db380;
- }
+ :hover {
+ background: ${rgba(headerToggleColor, 0.9)};
+ }
- @media (max-width: 700px) {
- height: 28px;
- width: 28px;
- font-size: 12px;
- }
+ @media (max-width: 700px) {
+ height: 28px;
+ width: 28px;
+ font-size: 12px;
+ }
+ `}
`
diff --git a/web/src/components/DialogTorrentDetailsContent/DetailedView/index.jsx b/web/src/components/DialogTorrentDetailsContent/DetailedView/index.jsx
index 926712e..4222d7d 100644
--- a/web/src/components/DialogTorrentDetailsContent/DetailedView/index.jsx
+++ b/web/src/components/DialogTorrentDetailsContent/DetailedView/index.jsx
@@ -42,7 +42,9 @@ export default function DetailedView({
- {t('Cache')}
+
+ {t('Cache')}
+
>
diff --git a/web/src/components/DialogTorrentDetailsContent/DetailedView/style.js b/web/src/components/DialogTorrentDetailsContent/DetailedView/style.js
index 3fd9431..c3d6002 100644
--- a/web/src/components/DialogTorrentDetailsContent/DetailedView/style.js
+++ b/web/src/components/DialogTorrentDetailsContent/DetailedView/style.js
@@ -1,19 +1,33 @@
-import styled from 'styled-components'
+import styled, { css } from 'styled-components'
export const DetailedViewWidgetSection = styled.section`
- padding: 40px;
- background: linear-gradient(145deg, #e4f6ed, #b5dec9);
+ ${({
+ theme: {
+ detailedView: { gradientStartColor, gradientEndColor },
+ },
+ }) => css`
+ padding: 40px;
+ background: linear-gradient(145deg, ${gradientStartColor}, ${gradientEndColor});
- @media (max-width: 800px) {
- padding: 20px;
- }
+ @media (max-width: 800px) {
+ padding: 20px;
+ }
+ `}
`
export const DetailedViewCacheSection = styled.section`
- padding: 40px;
- box-shadow: inset 3px 25px 8px -25px rgba(0, 0, 0, 0.5);
+ ${({
+ theme: {
+ detailedView: { cacheSectionBGColor },
+ },
+ }) => css`
+ padding: 40px;
+ box-shadow: inset 3px 25px 8px -25px rgba(0, 0, 0, 0.5);
+ background: ${cacheSectionBGColor};
+ flex: 1;
- @media (max-width: 800px) {
- padding: 20px;
- }
+ @media (max-width: 800px) {
+ padding: 20px;
+ }
+ `}
`
diff --git a/web/src/components/DialogTorrentDetailsContent/Table/index.jsx b/web/src/components/DialogTorrentDetailsContent/Table/index.jsx
index 0837622..8a15bb1 100644
--- a/web/src/components/DialogTorrentDetailsContent/Table/index.jsx
+++ b/web/src/components/DialogTorrentDetailsContent/Table/index.jsx
@@ -60,22 +60,24 @@ const Table = memo(
{fileHasEpisodeText && {episode} | }
{fileHasResolutionText && {resolution} | }
{humanizeSize(length)} |
-
-
-
-
- |