Preferences in Settings and a home page the user chooses
Build and Push Docker Image / build-and-push (push) Failing after 20s
Build and Push Docker Image / build-and-push (push) Failing after 20s
Settings gets a Preferences section: theme, default Bible, the Bible new reading plans start in, verse layout, commentary, text size, reading width, audio narrator (the last three stay per device; text size and narrator are now remembered). A Home page setting (My Studies, Bible Reader or Reading Plans) decides where the app opens and where every Home button goes; already being there means My Studies. Back arrows are labelled Home. Tests cover every page leading back. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
760c1e568b
commit
8c4f54e033
15 files changed
+401
-23
No files matched your search
+26
-3
@@ -71,7 +71,7 @@ const App = () => {
|
||||
reader.stopMarksSync();
|
||||
reader.stopPrefsSync();
|
||||
setProjectIndex(switchStorageUser(null));
|
||||
goHome();
|
||||
goStudies();
|
||||
},
|
||||
});
|
||||
const library = useProjectLibrary({
|
||||
@@ -174,7 +174,7 @@ const App = () => {
|
||||
// player) so this works even without opening the reader first.
|
||||
const listenReadingPlanDay = (bookAbbrev, chapter) => {
|
||||
audio.handlePlayBookAudioFrom(bookAbbrev, chapter);
|
||||
goHome();
|
||||
goStudies();
|
||||
};
|
||||
|
||||
// Builds a new chunk-builder project seeded with a reading-plan day's
|
||||
@@ -228,12 +228,34 @@ const App = () => {
|
||||
setCurrentPage('import');
|
||||
};
|
||||
|
||||
const goHome = () => {
|
||||
// The My Studies page.
|
||||
const goStudies = () => {
|
||||
setProjectIndex(loadProjectIndex());
|
||||
setCurrentPage('home');
|
||||
setProject(null);
|
||||
};
|
||||
|
||||
// "Home": the page the user chose in Settings (My Studies, the Bible Reader, or Reading
|
||||
// Plans). If they're already on it, Home means My Studies, so there is always somewhere to go.
|
||||
const START_PAGES = { studies: 'home', reader: 'reader', plans: 'reading-plans' };
|
||||
const goHome = () => {
|
||||
const target = START_PAGES[reader.startPagePref] ?? 'home';
|
||||
if (target === 'home' || target === currentPage) { goStudies(); return; }
|
||||
setProjectIndex(loadProjectIndex());
|
||||
setProject(null);
|
||||
setCurrentPage(target);
|
||||
};
|
||||
|
||||
// Open the app on the chosen home page (once, as soon as we know who is signed in).
|
||||
const openedStartPageRef = useRef(false);
|
||||
useEffect(() => {
|
||||
if (authUser === undefined || openedStartPageRef.current) return;
|
||||
openedStartPageRef.current = true;
|
||||
const target = START_PAGES[reader.startPagePref] ?? 'home';
|
||||
if (target !== 'home') setCurrentPage(target);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [authUser]);
|
||||
|
||||
// Manual retry after a failed background sync (shown in the project header).
|
||||
const retrySync = async () => {
|
||||
if (!project) return;
|
||||
@@ -251,6 +273,7 @@ const App = () => {
|
||||
// Navigation
|
||||
currentPage, setCurrentPage,
|
||||
goHome,
|
||||
goStudies,
|
||||
authServerDown,
|
||||
// Auth (login/2FA/settings form state lives in AuthPage and SettingsPage)
|
||||
authUser, setAuthUser,
|
||||
|
||||
Reference in new issue
Block a user