Back button implementation (#47)

* Added the back button to the main Ui

* Changed the naviation in the reader ui so that when the next or previous chapter links are clicked, instead of adding the a new history entry, it will replace the current History entry and rereder the Reader component

* - Made changes so that if history is of length 1 then the backbutton will take you to /library
- made use of the startsWith method so that if we use url for the saving the last viewed category there won't be a need to change this
- changed a few relative imports to absolute imports

* Back button won't show for any route that has an icon in the  sidebar
This commit is contained in:
abhijeetChawla
2021-10-26 13:49:23 +05:30
committed by GitHub
parent 663232cd99
commit b9b5b2818c
2 changed files with 27 additions and 4 deletions

View File

@@ -228,7 +228,7 @@ export default function ReaderNavBar(props: IProps) {
color="inherit"
aria-label="menu"
disableRipple
onClick={() => history.push(`/manga/${manga.id}`)}
onClick={() => history.goBack()}
size="large"
>
<CloseIcon />
@@ -344,6 +344,7 @@ export default function ReaderNavBar(props: IProps) {
{chapter.index > 1
&& (
<Link
replace
style={{ gridArea: 'prev' }}
to={`/manga/${manga.id}/chapter/${chapter.index - 1}`}
>
@@ -358,6 +359,7 @@ export default function ReaderNavBar(props: IProps) {
{chapter.index < chapter.chapterCount
&& (
<Link
replace
style={{ gridArea: 'next' }}
to={`/manga/${manga.id}/chapter/${chapter.index + 1}`}
>