set browser tab title (#220)

* Update the browser tab title

The tab title will be set to the same title as the "NavigationBar" with "- Tachidesk" as the suffix

* Set the manga title and chapter name as browser tab title in the reader

While the reader is still loading the "mangaId" and the "chapterIndex" will be set as the title.
This commit is contained in:
Daniel
2023-01-07 16:44:00 +01:00
committed by GitHub
parent 9702728771
commit f7b369b95d
3 changed files with 15 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ type ContextType = {
// AppBar title
title: string
setTitle: React.Dispatch<React.SetStateAction<string>>
setTitle: (title: string) => void
// AppBar action buttons
action: any

View File

@@ -21,11 +21,16 @@ export default function NavBarProvider({ children }:IProps) {
value: <div />,
});
const updateTitle = (newTitle: string) => {
document.title = `${newTitle} - Tachidesk`;
setTitle(newTitle);
};
const value = {
defaultBackTo,
setDefaultBackTo,
title,
setTitle,
setTitle: updateTitle,
action,
setAction,
override,