diff --git a/frontend/logos/csb-logo.png b/frontend/logos/csb-logo.png new file mode 100644 index 00000000..ed913cf4 Binary files /dev/null and b/frontend/logos/csb-logo.png differ diff --git a/frontend/logos/niv-logo.png b/frontend/logos/niv-logo.png new file mode 100644 index 00000000..8cb72f28 Binary files /dev/null and b/frontend/logos/niv-logo.png differ diff --git a/frontend/logos/nlt-logo.png b/frontend/logos/nlt-logo.png new file mode 100644 index 00000000..b2969177 Binary files /dev/null and b/frontend/logos/nlt-logo.png differ diff --git a/frontend/src/components/ChapterSelector.tsx b/frontend/src/components/ChapterSelector.tsx index d6fc90f6..e099e786 100644 --- a/frontend/src/components/ChapterSelector.tsx +++ b/frontend/src/components/ChapterSelector.tsx @@ -114,21 +114,21 @@ const ChapterSelector: React.FC = ({ book, onChapterSelect const loadChapters = async () => { try { setLoading(true); - const response = await getBook(book); - + const response = await getBook(book, version); + // The API now returns { chapters: ["1", "2", "3", ...] } if (response.chapters) { - setChapters(response.chapters); + // Sort chapters numerically to ensure proper order + const sortedChapters = response.chapters.sort((a, b) => parseInt(a, 10) - parseInt(b, 10)); + setChapters(sortedChapters); } else { - // Fallback: generate chapter numbers 1-50 (most books have fewer than 50 chapters) - const fallbackChapters = Array.from({ length: 50 }, (_, i) => (i + 1).toString()); - setChapters(fallbackChapters); + console.error('API returned no chapters data'); + setChapters([]); } } catch (error) { console.error('Failed to load chapters:', error); - // Fallback: generate chapter numbers 1-50 (most books have fewer than 50 chapters) - const fallbackChapters = Array.from({ length: 50 }, (_, i) => (i + 1).toString()); - setChapters(fallbackChapters); + // Don't show fallback chapters - just show an empty list + setChapters([]); } finally { setLoading(false); } diff --git a/frontend/src/services/api.ts b/frontend/src/services/api.ts index b0052de9..14a29bac 100644 --- a/frontend/src/services/api.ts +++ b/frontend/src/services/api.ts @@ -18,13 +18,13 @@ export const getBooks = async (): Promise => { return response.data; }; -export const getBook = async (book: string): Promise<{ chapters: string[] }> => { - const response = await api.get(`/books/${book}`); +export const getBook = async (book: string, version: string = 'esv'): Promise<{ chapters: string[] }> => { + const response = await api.get(`/books/${book}?version=${version}`); return response.data; }; -export const getChapter = async (book: string, chapter: string): Promise => { - const response = await api.get(`/books/${book}/${chapter}`); +export const getChapter = async (book: string, chapter: string, version: string = 'esv'): Promise => { + const response = await api.get(`/books/${book}/${chapter}?version=${version}`); return response.data; };