Resizable right column in the Study stage; start on the chosen page without a flash
Build and Push Docker Image / build-and-push (push) Failing after 20s
Build and Push Docker Image / build-and-push (push) Failing after 20s
The Study stage's right column has a drag handle (mouse, arrow keys, double-click or Home to reset); the width is remembered per device. The app now starts on the user's chosen home page from the first render instead of showing My Studies first. Tests wait on page headings so a lazily loaded page can't be confused with hidden text from the previous one. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8c4f54e033
commit
7a010fcda8
5 files changed
+226
-20
No files matched your search
+10
-12
@@ -32,10 +32,19 @@ const ReadingPlansPage = lazy(() => import('./pages/ReadingPlansPage.jsx'));
|
||||
// App component
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// The page each "Home page" choice in Settings opens.
|
||||
const START_PAGES = { studies: 'home', reader: 'reader', plans: 'reading-plans' };
|
||||
|
||||
// The user's chosen home page, read straight from this device's saved preference so the app
|
||||
// starts on it from the very first render (no flash of another page first).
|
||||
function savedStartPage() {
|
||||
try { return START_PAGES[localStorage.getItem('start-page')] ?? 'home'; } catch { return 'home'; }
|
||||
}
|
||||
|
||||
const App = () => {
|
||||
const [project, setProject] = useState(null);
|
||||
// 'home' | 'setup' | 'study' | 'script' | 'export' | 'reader' | 'import' | 'pronunciation' | 'settings' | 'admin' | 'reading-plans'
|
||||
const [currentPage, setCurrentPage] = useState('home');
|
||||
const [currentPage, setCurrentPage] = useState(savedStartPage);
|
||||
const [projectIndex, setProjectIndex] = useState([]);
|
||||
const [saveStatus, setSaveStatus] = useState('');
|
||||
const saveTimerRef = useRef(null);
|
||||
@@ -237,7 +246,6 @@ const App = () => {
|
||||
|
||||
// "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; }
|
||||
@@ -246,16 +254,6 @@ const App = () => {
|
||||
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;
|
||||
|
||||
Reference in new issue
Block a user