From 10920e1d81d368da5bd3f642469a8bf997c4d4a2 Mon Sep 17 00:00:00 2001 From: Aria Moradi Date: Wed, 17 Nov 2021 16:58:39 +0330 Subject: [PATCH] migrate Manga to Mui 5 (#99) * migrate Manga to Mui 5 * completetly migrate to new system --- src/screens/Manga.tsx | 49 +++++++++++++------------------------------ 1 file changed, 15 insertions(+), 34 deletions(-) diff --git a/src/screens/Manga.tsx b/src/screens/Manga.tsx index 4ef84d4b..dd02df31 100644 --- a/src/screens/Manga.tsx +++ b/src/screens/Manga.tsx @@ -6,8 +6,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import React, { useEffect, useState, useContext } from 'react'; -import { Theme } from '@mui/material/styles'; -import makeStyles from '@mui/styles/makeStyles'; +import { Box, styled } from '@mui/system'; import { Link, useParams } from 'react-router-dom'; import { Virtuoso } from 'react-virtuoso'; import ChapterCard from 'components/ChapterCard'; @@ -19,31 +18,16 @@ import makeToast from 'components/util/Toast'; import { Fab } from '@mui/material'; import PlayArrow from '@mui/icons-material/PlayArrow'; -const useStyles = makeStyles((theme: Theme) => ({ - root: { - [theme.breakpoints.up('md')]: { - display: 'flex', - }, - overflow: 'hidden', +const StyledVirtuoso = styled(Virtuoso)((({ theme }) => ({ + listStyle: 'none', + padding: 0, + minHeight: '200px', + [theme.breakpoints.up('md')]: { + width: '50vw', + height: 'calc(100vh - 64px)', + margin: 0, }, - - chapters: { - listStyle: 'none', - padding: 0, - minHeight: '200px', - [theme.breakpoints.up('md')]: { - width: '50vw', - height: 'calc(100vh - 64px)', - margin: 0, - }, - }, - - loading: { - margin: '10px 0', - display: 'flex', - justifyContent: 'center', - }, -})); +}))); const baseWebsocketUrl = JSON.parse(window.localStorage.getItem('serverBaseURL')!).replace('http', 'ws'); const initialQueue = { @@ -52,8 +36,6 @@ const initialQueue = { } as IQueue; export default function Manga() { - const classes = useStyles(); - const { setTitle } = useContext(NavbarContext); useEffect(() => { setTitle('Manga'); }, []); // delegate setting topbar action to MangaDetails @@ -153,7 +135,7 @@ export default function Manga() { )); return ( -
+ 0 || noChaptersFound} > - ( )} - useWindowScroll={window.innerWidth < 960} + useWindowScroll={window.innerWidth < 900} overscan={window.innerHeight * 0.5} /> -
+ ); }