Feature/remove use back to util (#360)

* Remove "useBackTo"

Not needed

* Use browser back navigation to close the reader

This will cause the previous page (manga or updates) to be opened instead of always opening the manga page
This commit is contained in:
schroda
2023-06-08 14:25:24 +02:00
committed by GitHub
parent 87de016d6f
commit 63c1ac95eb
7 changed files with 9 additions and 50 deletions

View File

@@ -27,7 +27,6 @@ import ArrowBack from '@mui/icons-material/ArrowBack';
import { Link, useLocation, useNavigate } from 'react-router-dom';
import { createPortal } from 'react-dom';
import { NavbarItem } from '@/typings';
import useBackTo from '@/util/useBackTo';
import NavBarContext from '@/components/context/NavbarContext';
import ExtensionOutlinedIcon from '@/components/util/CustomExtensionOutlinedIcon';
import DesktopSideBar from '@/components/navbar/navigation/DesktopSideBar';
@@ -86,8 +85,7 @@ const navbarItems: Array<NavbarItem> = [
];
export default function DefaultNavBar() {
const { title, action, override } = useContext(NavBarContext);
const backTo = useBackTo();
const { title, action, override, defaultBackTo: backToUrl } = useContext(NavBarContext);
const theme = useTheme();
const navigate = useNavigate();
@@ -109,7 +107,7 @@ export default function DefaultNavBar() {
}
const handleBack = () => {
if (backTo.url != null) return;
if (backToUrl != null) return;
navigate(-1);
};
@@ -119,8 +117,8 @@ export default function DefaultNavBar() {
<Toolbar>
{!isMainRoute && (
<IconButton
component={backTo.url ? Link : 'button'}
to={backTo.url}
component={backToUrl ? Link : 'button'}
to={backToUrl}
edge="start"
sx={{ marginRight: theme.spacing(2) }}
color="inherit"