feat: dynamic page titles across SPA

useDocumentTitle hook sets document.title per page.
Dynamic: movie name, person name, username, wrapup year.
Static: diary, profile, search, social, all settings pages.
This commit is contained in:
2026-06-11 12:45:01 +02:00
parent a95be0b131
commit acc20d2f43
15 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
import { useEffect } from "react"
const BASE_TITLE = "Movies Diary"
export function useDocumentTitle(title?: string) {
useEffect(() => {
document.title = title ? `${title}${BASE_TITLE}` : BASE_TITLE
return () => {
document.title = BASE_TITLE
}
}, [title])
}