diff --git a/src/components/TemporaryDrawer.tsx b/src/components/TemporaryDrawer.tsx
index 1edf4e66..54a3b9ee 100644
--- a/src/components/TemporaryDrawer.tsx
+++ b/src/components/TemporaryDrawer.tsx
@@ -12,12 +12,15 @@ import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import CollectionsBookmarkIcon from '@material-ui/icons/CollectionsBookmark';
+import CollectionsBookmarkOutlinedIcon from '@material-ui/icons/CollectionsBookmarkOutlined';
+import VideoLibraryOutlinedIcon from '@material-ui/icons/VideoLibraryOutlined';
import ExploreIcon from '@material-ui/icons/Explore';
import ExtensionIcon from '@material-ui/icons/Extension';
import GetAppIcon from '@material-ui/icons/GetApp';
import ListItemText from '@material-ui/core/ListItemText';
import SettingsIcon from '@material-ui/icons/Settings';
import { Link } from 'react-router-dom';
+import useLocalStorage from 'util/useLocalStorage';
const useStyles = makeStyles({
list: {
@@ -33,6 +36,17 @@ interface IProps {
export default function TemporaryDrawer({ drawerOpen, setDrawerOpen }: IProps) {
const classes = useStyles();
+ const [workingMode, setWorkingMode] = useLocalStorage<'manga'|'anime'>('workingMode', 'manga');
+
+ const otherMode = () => {
+ if (workingMode === 'manga') return 'Anime';
+ return 'Manga';
+ };
+
+ const switchMode = () => {
+ if (workingMode === 'manga') setWorkingMode('anime');
+ else setWorkingMode('manga');
+ };
return (
@@ -48,15 +62,18 @@ export default function TemporaryDrawer({ drawerOpen, setDrawerOpen }: IProps) {
onKeyDown={() => setDrawerOpen(false)}
>
-
-
-
-
-
-
-
-
-
+ {workingMode === 'manga'
+ && (
+
+
+
+
+
+
+
+
+ )}
+
@@ -64,16 +81,7 @@ export default function TemporaryDrawer({ drawerOpen, setDrawerOpen }: IProps) {
- {/*
-
-
-
-
-
-
- */}
-
+
@@ -81,23 +89,17 @@ export default function TemporaryDrawer({ drawerOpen, setDrawerOpen }: IProps) {
- {/*
-
-
-
-
-
-
- */}
-
-
-
-
-
-
-
-
+ {workingMode === 'manga'
+ && (
+
+
+
+
+
+
+
+
+ )}
@@ -106,6 +108,13 @@ export default function TemporaryDrawer({ drawerOpen, setDrawerOpen }: IProps) {
+
+
+ {workingMode === 'manga' && }
+ {workingMode === 'anime' && }
+
+
+
diff --git a/src/screens/anime/Player.tsx b/src/screens/anime/Player.tsx
index 5a2c4f5d..f3ab94d2 100644
--- a/src/screens/anime/Player.tsx
+++ b/src/screens/anime/Player.tsx
@@ -28,14 +28,17 @@ const useStyles = makeStyles({
},
});
-const initialEpisode = () => ({ linkUrl: '', index: -1, episodeCount: 0 });
+const initialEpisode = () => ({
+ index: -1, episodeCount: 0, videos: [],
+});
export default function Player() {
const classes = useStyles();
const { episodeIndex, animeId } = useParams<{ episodeIndex: string, animeId: string }>();
const [episode, setEpisode] = useState(initialEpisode());
- const [episodeLink, setEpisodeLink] = useState();
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const [episodeLink, setEpisodeLink] = useState('');
const { setTitle } = useContext(NavbarContext);
useEffect(() => {
@@ -53,12 +56,11 @@ export default function Player() {
.then((response) => response.data)
.then((data:IEpisode) => {
setEpisode(data);
- setEpisodeLink(data.linkUrl);
});
}, [episodeIndex]);
// return spinner while chpater data is loading
- if (episode.linkUrl === '') {
+ if (episode.videos.length === 0) {
return (
@@ -70,7 +72,9 @@ export default function Player() {
{/* eslint-disable-next-line jsx-a11y/media-has-caption */}
);
diff --git a/src/typings.d.ts b/src/typings.d.ts
index 9b89fba9..f996c978 100644
--- a/src/typings.d.ts
+++ b/src/typings.d.ts
@@ -60,7 +60,7 @@ interface IChapter {
name: string
uploadDate: number
chapterNumber: number
- scanlator: String
+ scanlator: string
mangaId: number
read: boolean
bookmarked: boolean
@@ -71,19 +71,25 @@ interface IChapter {
downloaded: boolean
}
+interface Video{
+ url: string
+ quality: string
+ videoUrl: string
+}
+
interface IEpisode {
url: string
name: string
uploadDate: number
episodeNumber: number
- scanlator: String
+ scanlator: string
animeId: number
read: boolean
bookmarked: boolean
lastPageRead: number
index: number
episodeCount: number
- linkUrl: string
+ videos: Video[]
}
interface IPartialChpter {
@@ -93,9 +99,9 @@ interface IPartialChpter {
}
interface IPartialEpisode {
- linkUrl: string
index: number
episodeCount: number
+ videos: Video[]
}
interface ICategory {