Show the current page in the browser tab title
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d13f55faf7
commit
b4f038b185
2 files changed
+28
No files matched your search
+16
@@ -128,6 +128,22 @@ const AppInner = () => {
|
||||
return () => window.removeEventListener('keydown', onKey);
|
||||
}, []);
|
||||
|
||||
// The browser tab and history show where you are ("Romans 8 · Bible Study", "Luke — Outline · Bible Study")
|
||||
useEffect(() => {
|
||||
const names = {
|
||||
home: 'My Studies', setup: 'Chunks', study: 'Study', outline: 'Outline', script: 'Script', export: 'Export',
|
||||
import: 'Import', pronunciation: 'Pronunciation Guide', settings: 'Settings', admin: 'Admin', 'reading-plans': 'Reading Plans',
|
||||
};
|
||||
let page = names[currentPage] ?? '';
|
||||
if (currentPage === 'reader') {
|
||||
const book = bookOptions.find((b) => b.abbrev === reader.readerBookAbbrev)?.name ?? '';
|
||||
page = `${book} ${reader.readerChapter}`.trim();
|
||||
} else if (project?.title && ['setup', 'study', 'outline', 'script', 'export', 'pronunciation'].includes(currentPage)) {
|
||||
page = `${project.title} — ${page}`;
|
||||
}
|
||||
document.title = page ? `${page} · Bible Study` : 'Bible Study';
|
||||
}, [currentPage, project?.title, reader.readerBookAbbrev, reader.readerChapter]);
|
||||
|
||||
// Back/Forward move between pages instead of leaving the app. (Not for ?share= links: that page is separate.)
|
||||
useHistoryNav({
|
||||
page: currentPage,
|
||||
|
||||
Reference in new issue
Block a user