2021-01-22 17:00:33 +03:30
|
|
|
import React, { useState } from 'react';
|
2020-12-24 03:21:18 +03:30
|
|
|
import {
|
2021-01-19 14:47:07 +03:30
|
|
|
BrowserRouter as Router, Route, Switch,
|
2020-12-24 17:19:49 +03:30
|
|
|
} from 'react-router-dom';
|
|
|
|
|
import NavBar from './components/NavBar';
|
2021-01-19 14:47:07 +03:30
|
|
|
import Home from './screens/Home';
|
|
|
|
|
import Sources from './screens/Sources';
|
|
|
|
|
import Extensions from './screens/Extensions';
|
2021-01-19 15:07:20 +03:30
|
|
|
import MangaList from './screens/MangaList';
|
2021-01-19 20:20:28 +03:30
|
|
|
import Manga from './screens/Manga';
|
2021-01-20 01:05:24 +03:30
|
|
|
import Reader from './screens/Reader';
|
2021-01-22 18:07:31 +03:30
|
|
|
import Search from './screens/SearchSingle';
|
2021-01-22 17:00:33 +03:30
|
|
|
import NavBarTitle from './context/NavbarTitle';
|
2020-12-24 02:37:23 +03:30
|
|
|
|
2020-12-24 16:50:50 +01:00
|
|
|
export default function App() {
|
2021-01-22 17:00:33 +03:30
|
|
|
const [title, setTitle] = useState<string>('Tachidesk');
|
|
|
|
|
const contextValue = { title, setTitle };
|
|
|
|
|
|
2020-12-24 16:50:50 +01:00
|
|
|
return (
|
|
|
|
|
<Router>
|
2021-01-22 17:00:33 +03:30
|
|
|
<NavBarTitle.Provider value={contextValue}>
|
|
|
|
|
<NavBar />
|
2020-12-24 16:50:50 +01:00
|
|
|
|
2021-01-22 17:00:33 +03:30
|
|
|
<Switch>
|
2021-01-22 18:07:31 +03:30
|
|
|
<Route path="/sources/:sourceId/search/">
|
2021-01-22 17:00:33 +03:30
|
|
|
<Search />
|
|
|
|
|
</Route>
|
|
|
|
|
<Route path="/extensions">
|
|
|
|
|
<Extensions />
|
|
|
|
|
</Route>
|
|
|
|
|
<Route path="/sources/:sourceId/popular/">
|
|
|
|
|
<MangaList popular />
|
|
|
|
|
</Route>
|
|
|
|
|
<Route path="/sources/:sourceId/latest/">
|
|
|
|
|
<MangaList popular={false} />
|
|
|
|
|
</Route>
|
|
|
|
|
<Route path="/sources">
|
|
|
|
|
<Sources />
|
|
|
|
|
</Route>
|
|
|
|
|
<Route path="/manga/:mangaId/chapter/:chapterId">
|
|
|
|
|
<Reader />
|
|
|
|
|
</Route>
|
|
|
|
|
<Route path="/manga/:id">
|
|
|
|
|
<Manga />
|
|
|
|
|
</Route>
|
|
|
|
|
<Route path="/">
|
|
|
|
|
<Home />
|
|
|
|
|
</Route>
|
|
|
|
|
</Switch>
|
|
|
|
|
</NavBarTitle.Provider>
|
2020-12-24 16:50:50 +01:00
|
|
|
</Router>
|
|
|
|
|
);
|
|
|
|
|
}
|