Extract app page history from nav bar context

This commit is contained in:
schroda
2025-01-21 20:26:03 +01:00
parent 9b883a5170
commit 480eaf5a08
7 changed files with 50 additions and 25 deletions

View File

@@ -24,8 +24,6 @@ export interface NavbarItem {
}
export type NavbarContextType = {
history: string[];
// AppBar title
title: string | React.ReactNode;
setTitle: (title: NavbarContextType['title'], browserTitle?: string) => void;

View File

@@ -8,7 +8,6 @@
import React, { useCallback, useMemo, useState } from 'react';
import { NavBarContext } from '@/modules/navigation-bar/contexts/NavbarContext.tsx';
import { useHistory } from '@/modules/core/hooks/useHistory.ts';
import { useLocalStorage } from '@/modules/core/hooks/useStorage.tsx';
import { INavbarOverride } from '@/modules/navigation-bar/NavigationBar.types.ts';
@@ -29,8 +28,6 @@ export function NavBarContextProvider({ children }: IProps) {
const [readerNavBarWidth, setReaderNavBarWidth] = useState(0);
const [bottomBarHeight, setBottomBarHeight] = useState(0);
const history = useHistory();
const updateTitle = useCallback(
(newTitle: string | React.ReactNode, browserTitle: string = typeof newTitle === 'string' ? newTitle : '') => {
document.title = `${browserTitle} - Suwayomi`;
@@ -41,7 +38,6 @@ export function NavBarContextProvider({ children }: IProps) {
const value = useMemo(
() => ({
history,
title,
setTitle: updateTitle,
appBarHeight,
@@ -60,7 +56,6 @@ export function NavBarContextProvider({ children }: IProps) {
setBottomBarHeight,
}),
[
history,
title,
updateTitle,
appBarHeight,

View File

@@ -11,7 +11,6 @@ import React, { useContext } from 'react';
import { NavbarContextType } from '@/modules/navigation-bar/NavigationBar.types.ts';
export const NavBarContext = React.createContext<NavbarContextType>({
history: [],
title: 'Suwayomi',
setTitle: (): void => {},
appBarHeight: 0,