Fix Pronunciation page Speak buttons; tidy App.jsx
Build and Push Docker Image / build-and-push (push) Successful in 7m53s
Build and Push Docker Image / build-and-push (push) Successful in 7m53s
PronunciationPage still read speakOriginalWord from context after it moved to utils/wordStudy, so Speak would have thrown. Import it directly. App.jsx: consolidate imports, update comments, list all pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0f1a9c3d5b
commit
d08c701698
2 files changed
+12
-32
No files matched your search
+10
-31
@@ -7,20 +7,9 @@ import { useProjectLibrary } from './hooks/useProjectLibrary.js';
|
|||||||
import { useReadingPlan } from './hooks/useReadingPlan.js';
|
import { useReadingPlan } from './hooks/useReadingPlan.js';
|
||||||
import { useSharedView } from './hooks/useSharedView.js';
|
import { useSharedView } from './hooks/useSharedView.js';
|
||||||
import HomePage from './pages/HomePage.jsx';
|
import HomePage from './pages/HomePage.jsx';
|
||||||
|
import { saveRemoteProject } from './syncService.js';
|
||||||
import {
|
import { buildExportHtml, loadProjectIndex, switchStorageUser } from './utils/bibleUtils.jsx';
|
||||||
buildExportHtml,
|
import { migrateOldStorageKeys, saveProjectToStorage } from './utils/projectStorage.js';
|
||||||
loadProjectIndex,
|
|
||||||
switchStorageUser,
|
|
||||||
} from './utils/bibleUtils.jsx';
|
|
||||||
import {
|
|
||||||
saveProjectToStorage,
|
|
||||||
migrateOldStorageKeys,
|
|
||||||
} from './utils/projectStorage.js';
|
|
||||||
|
|
||||||
import {
|
|
||||||
saveRemoteProject,
|
|
||||||
} from './syncService.js';
|
|
||||||
|
|
||||||
// Less-common pages are split into their own chunks so the first load only
|
// Less-common pages are split into their own chunks so the first load only
|
||||||
// downloads what's needed to show the home screen.
|
// downloads what's needed to show the home screen.
|
||||||
@@ -33,17 +22,13 @@ const SetupPage = lazy(() => import('./pages/SetupPage.jsx'));
|
|||||||
const StudyPage = lazy(() => import('./pages/StudyPage.jsx'));
|
const StudyPage = lazy(() => import('./pages/StudyPage.jsx'));
|
||||||
const PronunciationPage = lazy(() => import('./pages/PronunciationPage.jsx'));
|
const PronunciationPage = lazy(() => import('./pages/PronunciationPage.jsx'));
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// Stable utility exports (used by tests and other modules)
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// App component
|
// App component
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const [project, setProject] = useState(null);
|
const [project, setProject] = useState(null);
|
||||||
// 'home' | 'setup' | 'study' | 'settings'
|
// 'home' | 'setup' | 'study' | 'reader' | 'import' | 'pronunciation' | 'settings' | 'admin'
|
||||||
const [currentPage, setCurrentPage] = useState('home');
|
const [currentPage, setCurrentPage] = useState('home');
|
||||||
const [projectIndex, setProjectIndex] = useState([]);
|
const [projectIndex, setProjectIndex] = useState([]);
|
||||||
const [saveStatus, setSaveStatus] = useState('');
|
const [saveStatus, setSaveStatus] = useState('');
|
||||||
@@ -73,20 +58,16 @@ const App = () => {
|
|||||||
setProjectIndex,
|
setProjectIndex,
|
||||||
setCurrentPage,
|
setCurrentPage,
|
||||||
});
|
});
|
||||||
const openBibleReader = () => {
|
|
||||||
setCurrentPage('reader');
|
|
||||||
};
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// Startup: migrate old keys and load index
|
// Startup: migrate old keys and load index
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
migrateOldStorageKeys();
|
migrateOldStorageKeys();
|
||||||
setProjectIndex(loadProjectIndex());
|
setProjectIndex(loadProjectIndex());
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const allChunks = project ? project.chapters.flatMap((ch) => ch.chunks) : [];
|
const allChunks = project ? project.chapters.flatMap((ch) => ch.chunks) : [];
|
||||||
// Autosave
|
|
||||||
|
// Autosave: 1s after the last edit, save locally, then sync to the server.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!project) return;
|
if (!project) return;
|
||||||
if (saveTimerRef.current) window.clearTimeout(saveTimerRef.current);
|
if (saveTimerRef.current) window.clearTimeout(saveTimerRef.current);
|
||||||
@@ -126,9 +107,8 @@ const App = () => {
|
|||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// Navigation
|
||||||
// Home page helpers
|
const openBibleReader = () => setCurrentPage('reader');
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
const openNewProject = () => {
|
const openNewProject = () => {
|
||||||
setProject(null);
|
setProject(null);
|
||||||
@@ -157,9 +137,8 @@ const App = () => {
|
|||||||
if (result.ok) window.setTimeout(() => setSyncStatus(''), 2500);
|
if (result.ok) window.setTimeout(() => setSyncStatus(''), 2500);
|
||||||
};
|
};
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// Shared with every page via useApp(). Page-specific state lives in the
|
||||||
// Context value — every state, handler, and computed value pages need.
|
// pages themselves or in hooks under src/hooks/.
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
const contextValue = {
|
const contextValue = {
|
||||||
// Navigation
|
// Navigation
|
||||||
currentPage, setCurrentPage,
|
currentPage, setCurrentPage,
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useApp } from '../context/AppContext.js';
|
import { useApp } from '../context/AppContext.js';
|
||||||
import { buildPronunciationGuide } from '../utils/bibleUtils.jsx';
|
import { buildPronunciationGuide } from '../utils/bibleUtils.jsx';
|
||||||
|
import { speakOriginalWord } from '../utils/wordStudy.js';
|
||||||
|
|
||||||
export default function PronunciationPage() {
|
export default function PronunciationPage() {
|
||||||
const { project, speakOriginalWord, setCurrentPage } = useApp();
|
const { project, setCurrentPage } = useApp();
|
||||||
const [search, setSearch] = useState('');
|
const [search, setSearch] = useState('');
|
||||||
const [copied, setCopied] = useState(false);
|
const [copied, setCopied] = useState(false);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user