Feature/library show number of mangas in category (#269)

* Pass optional browser tab only title

Makes it possible to have a different title for the "NavBar" and the browser tab

* Show number of items in category and library

---------

Co-authored-by: schroda <github@dasch.simplelogin.com>
This commit is contained in:
schroda
2023-04-22 11:39:59 +02:00
committed by GitHub
parent 4157611d83
commit 79b2305e54
7 changed files with 58 additions and 11 deletions

View File

@@ -15,7 +15,7 @@ interface IProps {
export default function NavBarProvider({ children }: IProps) {
const [defaultBackTo, setDefaultBackTo] = useState<string | undefined>();
const [title, setTitle] = useState<string>('Tachidesk');
const [title, setTitle] = useState<string | React.ReactNode>('Tachidesk');
const [action, setAction] = useState<any>(<div />);
const [override, setOverride] = useState<INavbarOverride>({
status: false,
@@ -23,8 +23,8 @@ export default function NavBarProvider({ children }: IProps) {
});
const updateTitle = useCallback(
(newTitle: string) => {
document.title = `${newTitle} - Tachidesk`;
(newTitle: string | React.ReactNode, browserTitle: string = typeof newTitle === 'string' ? newTitle : '') => {
document.title = `${browserTitle} - Tachidesk`;
setTitle(newTitle);
},
[setTitle],