diff --git a/src/App.tsx b/src/App.tsx index db09c71a..3a10146e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,7 +12,7 @@ import { Redirect, } from 'react-router-dom'; import { QueryParamProvider } from 'use-query-params'; -import { Container, useMediaQuery } from '@mui/material'; +import { Container } from '@mui/material'; import CssBaseline from '@mui/material/CssBaseline'; import { createTheme, ThemeProvider, Theme, StyledEngineProvider, @@ -90,8 +90,6 @@ export default function App() { }), [darkTheme], ); - // this can only be used after the theme object is created - const isMobileWidth = useMediaQuery(theme.breakpoints.down('sm')); return ( @@ -105,10 +103,10 @@ export default function App() { id="appMainContainer" maxWidth={false} disableGutters - style={{ - marginTop: theme.spacing(8), - marginLeft: isMobileWidth ? '' : theme.spacing(8), - marginBottom: isMobileWidth ? theme.spacing(8) : '', + sx={{ + mt: 8, + ml: { sm: 8 }, + mb: { xs: 8, sm: 4 }, width: 'auto', overflow: 'auto', }} diff --git a/src/components/ChapterCard.tsx b/src/components/ChapterCard.tsx index 0d755a05..3da91058 100644 --- a/src/components/ChapterCard.tsx +++ b/src/components/ChapterCard.tsx @@ -18,6 +18,7 @@ import MenuItem from '@mui/material/MenuItem'; import BookmarkIcon from '@mui/icons-material/Bookmark'; import client from 'util/client'; +import { Box } from '@mui/system'; interface IProps{ chapter: IChapter @@ -102,7 +103,7 @@ export default function ChapterCard(props: IProps) { padding: 2, }} > -
+
@@ -117,7 +118,7 @@ export default function ChapterCard(props: IProps) { {downloadStatusString}
-
+ @@ -131,9 +132,9 @@ export default function ChapterCard(props: IProps) { onClose={handleClose} > {downloadStatusString.endsWith('Downloaded') - && Delete} + && Delete} {downloadStatusString.length === 0 - && Download } + && Download } sendChange('bookmarked', !chapter.bookmarked)}> {chapter.bookmarked && 'Remove bookmark'} {!chapter.bookmarked && 'Bookmark'} diff --git a/src/components/ExtensionCard.tsx b/src/components/ExtensionCard.tsx index 16212fc5..8d644c72 100644 --- a/src/components/ExtensionCard.tsx +++ b/src/components/ExtensionCard.tsx @@ -6,7 +6,6 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import React, { useState } from 'react'; -import makeStyles from '@mui/styles/makeStyles'; import Card from '@mui/material/Card'; import CardContent from '@mui/material/CardContent'; import Button from '@mui/material/Button'; @@ -14,35 +13,7 @@ import Avatar from '@mui/material/Avatar'; import Typography from '@mui/material/Typography'; import client from 'util/client'; import useLocalStorage from 'util/useLocalStorage'; - -const useStyles = makeStyles((theme) => ({ - root: { - display: 'flex', - justifyContent: 'space-between', - alignItems: 'center', - padding: 16, - }, - bullet: { - display: 'inline-block', - margin: '0 2px', - transform: 'scale(0.8)', - }, - title: { - fontSize: 14, - }, - pos: { - marginBottom: 12, - }, - icon: { - width: theme.spacing(7), - height: theme.spacing(7), - flex: '0 0 auto', - marginRight: 16, - }, - card: { - margin: '10px', - }, -})); +import { Box } from '@mui/system'; interface IProps { extension: IExtension @@ -67,7 +38,6 @@ export default function ExtensionCard(props: IProps) { const [serverAddress] = useLocalStorage('serverBaseURL', ''); const [useCache] = useLocalStorage('useCache', true); - const classes = useStyles(); const langPress = lang === 'all' ? 'All' : lang.toUpperCase(); function install() { @@ -118,16 +88,27 @@ export default function ExtensionCard(props: IProps) { } return ( - - -
+ + + -
+ {name} @@ -136,8 +117,8 @@ export default function ExtensionCard(props: IProps) { {' '} {versionName} -
-
+ + - +
diff --git a/src/components/library/LibraryOptions.tsx b/src/components/library/LibraryOptions.tsx index 7bc1b00f..8d58bee2 100644 --- a/src/components/library/LibraryOptions.tsx +++ b/src/components/library/LibraryOptions.tsx @@ -11,16 +11,17 @@ import FilterListIcon from '@mui/icons-material/FilterList'; import { Drawer, FormControlLabel, IconButton } from '@mui/material'; import useLibraryOptions from 'util/useLibraryOptions'; import ThreeStateCheckbox from 'components/util/ThreeStateCheckbox'; +import { Box } from '@mui/system'; function Options() { const { downloaded, setDownloaded, unread, setUnread, } = useLibraryOptions(); return ( -
+ } label="Unread" /> } label="Downloaded" /> -
+ ); } diff --git a/src/components/navbar/ReaderNavBar.tsx b/src/components/navbar/ReaderNavBar.tsx index edd98996..e5de1018 100644 --- a/src/components/navbar/ReaderNavBar.tsx +++ b/src/components/navbar/ReaderNavBar.tsx @@ -11,7 +11,6 @@ import KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft'; import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp'; -import makeStyles from '@mui/styles/makeStyles'; import React, { useContext, useEffect, useState } from 'react'; import Typography from '@mui/material/Typography'; import { useHistory, Link } from 'react-router-dom'; @@ -28,112 +27,91 @@ import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction'; import Collapse from '@mui/material/Collapse'; import Button from '@mui/material/Button'; import NavBarContext from 'components/context/NavbarContext'; +import { styled } from '@mui/system'; -const useStyles = (settings: IReaderSettings) => makeStyles((theme) => ({ - // main container and root div need to change classes... - AppMainContainer: { - display: 'none', - }, - AppRootElment: { +const Root = styled('div')(({ theme }) => ({ + top: 0, + left: 0, + width: '300px', + minWidth: '300px', + height: '100vh', + overflowY: 'auto', + backgroundColor: theme.palette.background.default, + + '& header': { + backgroundColor: + theme.palette.mode === 'dark' ? theme.palette.grey[800] : theme.palette.grey[100], display: 'flex', - }, + alignItems: 'center', + minHeight: '64px', + paddingLeft: '24px', + paddingRight: '24px', - root: { - position: settings.staticNav ? 'sticky' : 'fixed', - top: 0, - left: 0, - width: '300px', - minWidth: '300px', - height: '100vh', - overflowY: 'auto', - backgroundColor: theme.palette.background.default, + transition: 'left 2s ease', - '& header': { - backgroundColor: - theme.palette.mode === 'dark' ? theme.palette.grey[800] : theme.palette.grey[100], - display: 'flex', - alignItems: 'center', - minHeight: '64px', - paddingLeft: '24px', - paddingRight: '24px', - - transition: 'left 2s ease', - - '& button': { - flexGrow: 0, - flexShrink: 0, - }, - - '& button:nth-child(1)': { - marginRight: '16px', - }, - - '& button:nth-child(3)': { - marginRight: '-12px', - }, - - '& h1': { - fontSize: '1.25rem', - flexGrow: 1, - }, + '& button': { + flexGrow: 0, + flexShrink: 0, }, - '& hr': { - margin: '0 16px', - height: '1px', - border: '0', - backgroundColor: theme.palette.mode === 'dark' ? theme.palette.grey[800] : theme.palette.grey[100], + + '& button:nth-child(1)': { + marginRight: '16px', + }, + + '& button:nth-child(3)': { + marginRight: '-12px', + }, + + '& h1': { + fontSize: '1.25rem', + flexGrow: 1, }, }, - - navigation: { + '& hr': { margin: '0 16px', - - '& > span:nth-child(1)': { - textAlign: 'center', - display: 'block', - marginTop: '16px', - }, - - '& $navigationChapters': { - display: 'grid', - gridTemplateColumns: '1fr 1fr', - gridTemplateAreas: '"prev next"', - gridColumnGap: '5px', - margin: '10px 0', - - '& a': { - flexGrow: 1, - textDecoration: 'none', - - '& button': { - width: '100%', - padding: '5px 8px', - textTransform: 'none', - }, - }, - }, - + height: '1px', + border: '0', + backgroundColor: theme.palette.mode === 'dark' ? theme.palette.grey[800] : theme.palette.grey[100], }, - navigationChapters: {}, // dummy rule +})); - settingsCollapsseHeader: { - '& span': { - fontWeight: 'bold', +const Navigation = styled('div')({ + margin: '0 16px', + '& > span:nth-child(1)': { + textAlign: 'center', + display: 'block', + marginTop: '16px', + }, +}); + +const ChapterNavigation = styled('div')({ + display: 'grid', + gridTemplateColumns: '1fr 1fr', + gap: '5px', + margin: '10px 0', + + '& a': { + flexGrow: 1, + textDecoration: 'none', + + '& button': { + width: '100%', + padding: '5px 8px', + textTransform: 'none', }, }, +}); - openDrawerButton: { - position: 'fixed', - top: 0 + 20, - left: 10 + 20, - height: '40px', - width: '40px', - borderRadius: 5, - backgroundColor: theme.palette.mode === 'dark' ? 'black' : 'white', - - '&:hover': { - backgroundColor: theme.palette.mode === 'dark' ? theme.palette.grey[900] : theme.palette.grey[100], - }, +const OpenDrawerButton = styled(IconButton)(({ theme }) => ({ + position: 'fixed', + top: 0 + 20, + left: 10 + 20, + height: '40px', + width: '40px', + borderRadius: 5, + backgroundColor: theme.palette.mode === 'dark' ? 'black' : 'white', + '&:hover': { + backgroundColor: theme.palette.mode === 'dark' ? theme.palette.grey[900] : theme.palette.grey[100], }, })); @@ -168,8 +146,6 @@ export default function ReaderNavBar(props: IProps) { const [prevScrollPos, setPrevScrollPos] = useState(0); const [settingsCollapseOpen, setSettingsCollapseOpen] = useState(true); - const classes = useStyles(settings)(); - const setSettingValue = (key: string, value: any) => setSettings({ ...settings, [key]: value }); const handleScroll = () => { @@ -184,15 +160,16 @@ export default function ReaderNavBar(props: IProps) { useEffect(() => { window.addEventListener('scroll', handleScroll); - const rootEl = document.querySelector('#root')!; - const mainContainer = document.querySelector('#appMainContainer')!; + const rootEl:HTMLDivElement = document.querySelector('#root')!; + const mainContainer:HTMLDivElement = document.querySelector('#appMainContainer')!; - rootEl.classList.add(classes.AppRootElment); - mainContainer.classList.add(classes.AppMainContainer); + // main container and root div need to change styles... + rootEl.style.display = 'flex'; + mainContainer.style.display = 'none'; return () => { - rootEl.classList.remove(classes.AppRootElment); - mainContainer.classList.remove(classes.AppMainContainer); + rootEl.style.display = 'block'; + mainContainer.style.display = 'block'; window.removeEventListener('scroll', handleScroll); }; }, [handleScroll]);// handleScroll changes on every render @@ -207,7 +184,10 @@ export default function ReaderNavBar(props: IProps) { mountOnEnter unmountOnExit > -
+
- +
-
+ {`Currently on page ${curPage + 1} of ${chapter.pageCount}`} -
+ {chapter.index > 1 && (
-
-
+ + + - - + diff --git a/src/components/navbar/action/CategorySelect.tsx b/src/components/navbar/action/CategorySelect.tsx index 4347621e..da149de9 100644 --- a/src/components/navbar/action/CategorySelect.tsx +++ b/src/components/navbar/action/CategorySelect.tsx @@ -6,8 +6,6 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import React, { useEffect, useState } from 'react'; -import makeStyles from '@mui/styles/makeStyles'; -import createStyles from '@mui/styles/createStyles'; import Button from '@mui/material/Button'; import DialogTitle from '@mui/material/DialogTitle'; import DialogContent from '@mui/material/DialogContent'; @@ -18,13 +16,6 @@ import FormControlLabel from '@mui/material/FormControlLabel'; import FormGroup from '@mui/material/FormGroup'; import client from 'util/client'; -const useStyles = makeStyles(() => createStyles({ - paper: { - maxHeight: 435, - width: '80%', - }, -})); - interface IProps { open: boolean setOpen: (value: boolean) => void @@ -37,7 +28,6 @@ interface ICategoryInfo { } export default function CategorySelect(props: IProps) { - const classes = useStyles(); const { open, setOpen, mangaId } = props; const [categoryInfos, setCategoryInfos] = useState([]); @@ -82,7 +72,12 @@ export default function CategorySelect(props: IProps) { return ( diff --git a/src/components/navbar/action/LangSelect.tsx b/src/components/navbar/action/LangSelect.tsx index 615da2e2..9e992fc9 100644 --- a/src/components/navbar/action/LangSelect.tsx +++ b/src/components/navbar/action/LangSelect.tsx @@ -6,8 +6,6 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import React, { useState } from 'react'; -import makeStyles from '@mui/styles/makeStyles'; -import createStyles from '@mui/styles/createStyles'; import Button from '@mui/material/Button'; import DialogTitle from '@mui/material/DialogTitle'; import DialogContent from '@mui/material/DialogContent'; @@ -21,13 +19,6 @@ import ListItem from '@mui/material/ListItem'; import { langCodeToName } from 'util/language'; import cloneObject from 'util/cloneObject'; -const useStyles = makeStyles(() => createStyles({ - paper: { - maxHeight: 435, - width: '80%', - }, -})); - function removeAll(firstList: any[], secondList: any[]) { secondList.forEach((item) => { const index = firstList.indexOf(item); @@ -54,7 +45,6 @@ export default function LangSelect(props: IProps) { const [mShownLangs, setMShownLangs] = useState( removeAll(cloneObject(shownLangs), forcedLangs!), ); - const classes = useStyles(); const [open, setOpen] = useState(false); const handleCancel = () => { @@ -90,12 +80,17 @@ export default function LangSelect(props: IProps) {
Enabled Languages - + {allLangs.map((lang) => ( diff --git a/src/components/navbar/navigation/DesktopSideBar.tsx b/src/components/navbar/navigation/DesktopSideBar.tsx index e4b396b0..ebac6db8 100644 --- a/src/components/navbar/navigation/DesktopSideBar.tsx +++ b/src/components/navbar/navigation/DesktopSideBar.tsx @@ -45,7 +45,7 @@ export default function DesktopSideBar({ navBarItems }: IProps) { }: NavbarItem) => ( - + {iconFor(path, IconComponent, SelectedIconComponent)} diff --git a/src/components/reader/DoublePage.tsx b/src/components/reader/DoublePage.tsx index d8c35e17..44b266d4 100644 --- a/src/components/reader/DoublePage.tsx +++ b/src/components/reader/DoublePage.tsx @@ -5,28 +5,16 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import makeStyles from '@mui/styles/makeStyles'; import React from 'react'; +import { Box, styled } from '@mui/system'; -const useStyles = (settings: IReaderSettings) => makeStyles({ - image: { - display: 'block', - marginBottom: 0, - width: 'auto', - minHeight: '99vh', - height: 'auto', - maxHeight: '99vh', - objectFit: 'contain', - }, - page: { - display: 'flex', - flexDirection: settings.readerType === 'DoubleLTR' ? 'row' : 'row-reverse', - justifyContent: 'center', - margin: '0 auto', - width: 'auto', - height: 'auto', - overflowX: 'scroll', - }, +const Image = styled('img')({ + marginBottom: 0, + width: 'auto', + minHeight: '99vh', + height: 'auto', + maxHeight: '99vh', + objectFit: 'contain', }); interface IProps { @@ -41,21 +29,28 @@ const DoublePage = React.forwardRef((props: IProps, ref: any) => { image1src, image2src, index, settings, } = props; - const classes = useStyles(settings)(); - return ( -
- + {`Page - {`Page -
+ ); }); diff --git a/src/components/reader/Page.tsx b/src/components/reader/Page.tsx index df57b976..93231b20 100644 --- a/src/components/reader/Page.tsx +++ b/src/components/reader/Page.tsx @@ -5,7 +5,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import makeStyles from '@mui/styles/makeStyles'; import React, { useEffect, useRef } from 'react'; import SpinnerImage from 'components/util/SpinnerImage'; import useLocalStorage from 'util/useLocalStorage'; @@ -53,22 +52,6 @@ function imageStyle(settings: IReaderSettings): any { }; } -const useStyles = (settings: IReaderSettings) => makeStyles({ - loading: { - margin: '100px auto', - height: '100vh', - width: '100vw', - }, - loadingImage: { - height: '100vh', - width: '70vw', - padding: '50px calc(50% - 20px)', - backgroundColor: '#525252', - marginBottom: 10, - }, - image: imageStyle(settings), -}); - interface IProps { src: string index: number @@ -84,7 +67,6 @@ const Page = React.forwardRef((props: IProps, ref: any) => { const [useCache] = useLocalStorage('useCache', true); - const classes = useStyles(settings)(); const imgRef = useRef(null); const handleVerticalScroll = () => { @@ -127,8 +109,14 @@ const Page = React.forwardRef((props: IProps, ref: any) => { onImageLoad={onImageLoad} alt={`Page #${index}`} imgRef={imgRef} - spinnerClassName={`${classes.image} ${classes.loadingImage}`} - imgClassName={classes.image} + spinnerStyle={{ + height: '100vh', + width: '70vw', + padding: '50px calc(50% - 20px)', + backgroundColor: '#525252', + marginBottom: 10, + }} + imgStyle={imageStyle(settings)} /> ); diff --git a/src/components/reader/PageNumber.tsx b/src/components/reader/PageNumber.tsx index 45933bca..269f0c13 100644 --- a/src/components/reader/PageNumber.tsx +++ b/src/components/reader/PageNumber.tsx @@ -5,21 +5,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import makeStyles from '@mui/styles/makeStyles'; import React from 'react'; - -const useStyles = (settings: IReaderSettings) => makeStyles({ - pageNumber: { - display: settings.showPageNumber ? 'block' : 'none', - position: 'fixed', - bottom: '50px', - right: settings.staticNav ? 'calc((100vw - 325px)/2)' : 'calc((100vw - 25px)/2)', - padding: '2px', - textAlign: 'center', - backgroundColor: 'rgba(0, 0, 0, 0.3)', - borderRadius: '10px', - }, -}); +import { Box } from '@mui/system'; interface IProps { settings: IReaderSettings @@ -29,11 +16,20 @@ interface IProps { export default function PageNumber(props: IProps) { const { settings, curPage, pageCount } = props; - const classes = useStyles(settings)(); return ( -
+ {`${curPage + 1} / ${pageCount}`} -
+ ); } diff --git a/src/components/reader/pager/DoublePagedPager.tsx b/src/components/reader/pager/DoublePagedPager.tsx index 6cbd7010..94d0ff17 100644 --- a/src/components/reader/pager/DoublePagedPager.tsx +++ b/src/components/reader/pager/DoublePagedPager.tsx @@ -5,34 +5,17 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import makeStyles from '@mui/styles/makeStyles'; import React, { useEffect, useRef } from 'react'; import ReactDOM from 'react-dom'; +import { Box } from '@mui/system'; import Page from '../Page'; import DoublePage from '../DoublePage'; -const useStyles = (settings: IReaderSettings) => makeStyles({ - preload: { - display: 'none', - }, - reader: { - display: 'flex', - flexDirection: (settings.readerType === 'DoubleLTR') ? 'row' : 'row-reverse', - justifyContent: 'center', - margin: '0 auto', - width: 'auto', - height: 'auto', - overflowX: 'scroll', - }, -}); - export default function DoublePagedPager(props: IReaderProps) { const { pages, settings, setCurPage, curPage, nextChapter, prevChapter, } = props; - const classes = useStyles(settings)(); - const selfRef = useRef(null); const pagesRef = useRef([]); @@ -192,8 +175,8 @@ export default function DoublePagedPager(props: IReaderProps) { }, [selfRef, curPage, settings.readerType]); return ( -
-
+ + { pages.map((page) => ( )) } -
-
-
+ + + ); } diff --git a/src/components/reader/pager/HorizontalPager.tsx b/src/components/reader/pager/HorizontalPager.tsx index c10a34f1..533820b0 100644 --- a/src/components/reader/pager/HorizontalPager.tsx +++ b/src/components/reader/pager/HorizontalPager.tsx @@ -5,30 +5,15 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import makeStyles from '@mui/styles/makeStyles'; import React, { useEffect, useRef } from 'react'; +import { Box } from '@mui/system'; import Page from '../Page'; -const useStyles = (settings: IReaderSettings) => makeStyles({ - reader: { - display: 'flex', - flexDirection: (settings.readerType === 'ContinuesHorizontalLTR') ? 'row' : 'row-reverse', - justifyContent: (settings.readerType === 'ContinuesHorizontalLTR') ? 'flex-start' : 'flex-end', - margin: '0 auto', - width: 'auto', - height: 'auto', - overflowX: 'visible', - userSelect: 'none', - }, -}); - export default function HorizontalPager(props: IReaderProps) { const { pages, curPage, settings, setCurPage, prevChapter, nextChapter, } = props; - const classes = useStyles(settings)(); - const selfRef = useRef(null); const pagesRef = useRef([]); @@ -128,7 +113,19 @@ export default function HorizontalPager(props: IReaderProps) { }, [selfRef, curPage]); return ( -
+ { pages.map((page) => ( )) } -
+ ); } diff --git a/src/components/reader/pager/PagedPager.tsx b/src/components/reader/pager/PagedPager.tsx index 5b1a1704..1fbe434e 100644 --- a/src/components/reader/pager/PagedPager.tsx +++ b/src/components/reader/pager/PagedPager.tsx @@ -5,28 +5,15 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import makeStyles from '@mui/styles/makeStyles'; import React, { useEffect, useRef } from 'react'; +import { Box } from '@mui/system'; import Page from '../Page'; -const useStyles = makeStyles({ - reader: { - display: 'flex', - flexDirection: 'row', - justifyContent: 'center', - margin: '0 auto', - width: '100%', - height: '100vh', - }, -}); - export default function PagedReader(props: IReaderProps) { const { pages, settings, setCurPage, curPage, nextChapter, prevChapter, } = props; - const classes = useStyles(); - const selfRef = useRef(null); function nextPage() { @@ -97,7 +84,17 @@ export default function PagedReader(props: IReaderProps) { }, [selfRef, curPage, settings.readerType]); return ( -
+ -
+ ); } diff --git a/src/components/reader/pager/VerticalPager.tsx b/src/components/reader/pager/VerticalPager.tsx index 4d32d4e0..77d6f0fb 100644 --- a/src/components/reader/pager/VerticalPager.tsx +++ b/src/components/reader/pager/VerticalPager.tsx @@ -5,27 +5,15 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import makeStyles from '@mui/styles/makeStyles'; import React, { useEffect, useRef } from 'react'; +import { Box } from '@mui/system'; import Page from '../Page'; -const useStyles = makeStyles({ - reader: { - display: 'flex', - flexDirection: 'column', - justifyContent: 'center', - margin: '0 auto', - width: '100%', - }, -}); - export default function VerticalReader(props: IReaderProps) { const { pages, settings, setCurPage, curPage, chapter, nextChapter, prevChapter, } = props; - const classes = useStyles(); - const selfRef = useRef(null); const pagesRef = useRef([]); @@ -111,7 +99,16 @@ export default function VerticalReader(props: IReaderProps) { }, [pagesRef.current.length]); return ( -
+ { pages.map((page) => ( )) } -
+ ); } diff --git a/src/components/util/EmptyView.tsx b/src/components/util/EmptyView.tsx index 9a7f1e71..f41246ba 100644 --- a/src/components/util/EmptyView.tsx +++ b/src/components/util/EmptyView.tsx @@ -10,6 +10,7 @@ import React from 'react'; import Typography from '@mui/material/Typography'; import { useTheme } from '@mui/material/styles'; import { useMediaQuery } from '@mui/material'; +import { Box } from '@mui/system'; const ERROR_FACES = [ '(・o・;)', @@ -35,7 +36,7 @@ export default function EmptyView({ message, messageExtra }: IProps) { const isMobileWidth = useMediaQuery(theme.breakpoints.down('sm')); return ( -
{messageExtra} -
+ ); } diff --git a/src/components/util/LoadingPlaceholder.tsx b/src/components/util/LoadingPlaceholder.tsx index 1a2412e9..5985fa7b 100644 --- a/src/components/util/LoadingPlaceholder.tsx +++ b/src/components/util/LoadingPlaceholder.tsx @@ -8,16 +8,8 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import React from 'react'; -import makeStyles from '@mui/styles/makeStyles'; import CircularProgress from '@mui/material/CircularProgress'; - -const useStyles = makeStyles({ - loading: { - margin: '10px auto', - display: 'flex', - justifyContent: 'center', - }, -}); +import { Box } from '@mui/system'; interface IProps { shouldRender?: boolean | (() => boolean) @@ -30,7 +22,6 @@ export default function LoadingPlaceholder(props: IProps) { const { children, shouldRender, component, componentProps, } = props; - const classes = useStyles(); let condition = true; if (shouldRender !== undefined) { @@ -52,8 +43,13 @@ export default function LoadingPlaceholder(props: IProps) { } return ( -
+ -
+ ); } diff --git a/src/components/util/SpinnerImage.tsx b/src/components/util/SpinnerImage.tsx index 91f64b9d..620a823c 100644 --- a/src/components/util/SpinnerImage.tsx +++ b/src/components/util/SpinnerImage.tsx @@ -17,9 +17,7 @@ interface IProps { imgRef?: React.RefObject - spinnerClassName?: string spinnerStyle?: SxProps - imgClassName?: string imgStyle?: CSSProperties onImageLoad?: () => void @@ -27,7 +25,7 @@ interface IProps { export default function SpinnerImage(props: IProps) { const { - src, alt, onImageLoad, imgRef, spinnerClassName, imgClassName, spinnerStyle, imgStyle, + src, alt, onImageLoad, imgRef, spinnerStyle, imgStyle, } = props; const [imageSrc, setImagsrc] = useState(''); @@ -53,19 +51,18 @@ export default function SpinnerImage(props: IProps) { if (imageSrc.length === 0) { return ( - + ); } if (imageSrc === 'Not Found') { - return ; + return ; } return ( {}, diff --git a/src/screens/Browse.tsx b/src/screens/Browse.tsx index d869470a..f46e443c 100644 --- a/src/screens/Browse.tsx +++ b/src/screens/Browse.tsx @@ -6,21 +6,13 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import React, { useState } from 'react'; -import makeStyles from '@mui/styles/makeStyles'; import Tabs from '@mui/material/Tabs'; import Tab from '@mui/material/Tab'; import TabPanel from 'components/util/TabPanel'; import Sources from 'screens/Sources'; import Extensions from 'screens/Extensions'; -const useStyles = makeStyles({ - noCapitalize: { - textTransform: 'none', - }, -}); - export default function Browse() { - const classes = useStyles(); const [tabNum, setTabNum] = useState(0); return ( @@ -35,8 +27,8 @@ export default function Browse() { scrollButtons allowScrollButtonsMobile > - - + + diff --git a/src/screens/Manga.tsx b/src/screens/Manga.tsx index 4ef84d4b..31d1420c 100644 --- a/src/screens/Manga.tsx +++ b/src/screens/Manga.tsx @@ -18,15 +18,9 @@ import LoadingPlaceholder from 'components/util/LoadingPlaceholder'; import makeToast from 'components/util/Toast'; import { Fab } from '@mui/material'; import PlayArrow from '@mui/icons-material/PlayArrow'; +import { Box } from '@mui/system'; const useStyles = makeStyles((theme: Theme) => ({ - root: { - [theme.breakpoints.up('md')]: { - display: 'flex', - }, - overflow: 'hidden', - }, - chapters: { listStyle: 'none', padding: 0, @@ -37,12 +31,6 @@ const useStyles = makeStyles((theme: Theme) => ({ margin: 0, }, }, - - loading: { - margin: '10px 0', - display: 'flex', - justifyContent: 'center', - }, })); const baseWebsocketUrl = JSON.parse(window.localStorage.getItem('serverBaseURL')!).replace('http', 'ws'); @@ -153,7 +141,7 @@ export default function Manga() { )); return ( -
+ )} - useWindowScroll={window.innerWidth < 960} + useWindowScroll={window.innerWidth < 900} overscan={window.innerHeight * 0.5} /> -
+
); } diff --git a/src/screens/Reader.tsx b/src/screens/Reader.tsx index 33e090e0..ed77e457 100644 --- a/src/screens/Reader.tsx +++ b/src/screens/Reader.tsx @@ -6,7 +6,6 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import CircularProgress from '@mui/material/CircularProgress'; -import makeStyles from '@mui/styles/makeStyles'; import React, { useContext, useEffect, useState } from 'react'; import { useHistory, useParams } from 'react-router-dom'; import HorizontalPager from 'components/reader/pager/HorizontalPager'; @@ -19,18 +18,7 @@ import NavbarContext from 'components/context/NavbarContext'; import client from 'util/client'; import useLocalStorage from 'util/useLocalStorage'; import cloneObject from 'util/cloneObject'; - -const useStyles = (settings: IReaderSettings) => makeStyles({ - root: { - width: settings.staticNav ? 'calc(100vw - 300px)' : '100vw', - }, - - loading: { - margin: '50px auto', - display: 'flex', - justifyContent: 'center', - }, -}); +import { Box } from '@mui/system'; const getReaderComponent = (readerType: ReaderType) => { switch (readerType) { @@ -63,7 +51,6 @@ const initialChapter = () => ({ pageCount: -1, index: -1, chapterCount: 0 }); export default function Reader() { const [settings, setSettings] = useLocalStorage('readerSettings', defaultReaderSettings); - const classes = useStyles(settings)(); const history = useHistory(); const [serverAddress] = useLocalStorage('serverBaseURL', ''); @@ -145,9 +132,12 @@ export default function Reader() { // return spinner while chpater data is loading if (chapter.pageCount === -1) { return ( -
+ -
+
); } @@ -176,7 +166,7 @@ export default function Reader() { const ReaderComponent = getReaderComponent(settings.readerType); return ( -
+ -
+
); } diff --git a/src/screens/SearchSingle.tsx b/src/screens/SearchSingle.tsx index f60eed60..1660a215 100644 --- a/src/screens/SearchSingle.tsx +++ b/src/screens/SearchSingle.tsx @@ -6,33 +6,19 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import React, { useContext, useEffect, useState } from 'react'; -import makeStyles from '@mui/styles/makeStyles'; import TextField from '@mui/material/TextField'; import Button from '@mui/material/Button'; import { useParams } from 'react-router-dom'; import MangaGrid from 'components/MangaGrid'; import NavbarContext from 'components/context/NavbarContext'; import client from 'util/client'; - -const useStyles = makeStyles((theme) => ({ - root: { - margin: '20px 10px', - display: 'flex', - justifyContent: 'space-around', - width: '300px', - TextField: { - margin: theme.spacing(1), - width: '25ch', - }, - }, -})); +import { Box } from '@mui/system'; export default function SearchSingle() { const { setTitle, setAction } = useContext(NavbarContext); useEffect(() => { setTitle('Search'); setAction(<>); }, []); const { sourceId } = useParams<{ sourceId: string }>(); - const classes = useStyles(); const [error, setError] = useState(false); const [mangas, setMangas] = useState([]); const [message, setMessage] = useState(''); @@ -89,10 +75,20 @@ export default function SearchSingle() { return ( <> -
+ processInput()}> Search -
+ {searchTerm.length > 0 && ( - + diff --git a/src/screens/SourceConfigure.tsx b/src/screens/SourceConfigure.tsx index a46163d7..f57b02d2 100644 --- a/src/screens/SourceConfigure.tsx +++ b/src/screens/SourceConfigure.tsx @@ -57,7 +57,7 @@ export default function SourceConfigure() { return ( <> - + {sourcePreferences.map( (it, index) => { const props = cloneObject(it.props); diff --git a/src/screens/Updates.tsx b/src/screens/Updates.tsx index b82f2af9..04102e96 100644 --- a/src/screens/Updates.tsx +++ b/src/screens/Updates.tsx @@ -20,6 +20,7 @@ import client from 'util/client'; import useLocalStorage from 'util/useLocalStorage'; import EmptyView from 'components/util/EmptyView'; import LoadingPlaceholder from 'components/util/LoadingPlaceholder'; +import { Box } from '@mui/system'; function epochToDate(epoch: number) { const date = new Date(0); // The 0 there is the key, which sets the date to the epoch @@ -189,7 +190,7 @@ export default function Updates() { padding: 2, }} > -
+ -
+ {manga.title} @@ -209,8 +210,8 @@ export default function Updates() { {chapter.name} {downloadStatusStringFor(chapter)} -
-
+ + {downloadStatusStringFor(chapter) === '' && ( (); @@ -36,9 +25,12 @@ export default function About() { if (about === undefined) { return ( -
+ -
+ ); } diff --git a/src/screens/settings/Backup.tsx b/src/screens/settings/Backup.tsx index 18ef65b1..3c53646c 100644 --- a/src/screens/settings/Backup.tsx +++ b/src/screens/settings/Backup.tsx @@ -67,7 +67,7 @@ export default function Backup() { return ( <> - +