Compare commits

...

1 Commits

Author SHA1 Message Date
5ec48cd2b2 fix: resolve critical MVP issues - search bar overlap and language selection
- Fix search bar covering main menu: removed fixed positioning from header and use flex layout instead
- Fix Bible not displaying in selected language: pass locale parameter to /api/bible/books endpoint
- Add locale dependency to loadBooks useEffect so Bible content updates when language changes

These fixes make the MVP fully usable for all languages (en, ro, es, it).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 20:43:51 +00:00

View File

@@ -1,5 +1,6 @@
'use client' 'use client'
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import { useLocale } from 'next-intl'
import { Box, Typography, Button } from '@mui/material' import { Box, Typography, Button } from '@mui/material'
import { BibleChapter, BibleVerse } from '@/types' import { BibleChapter, BibleVerse } from '@/types'
import { getCachedChapter, cacheChapter } from '@/lib/cache-manager' import { getCachedChapter, cacheChapter } from '@/lib/cache-manager'
@@ -17,6 +18,7 @@ interface BookInfo {
} }
export function BibleReaderApp() { export function BibleReaderApp() {
const locale = useLocale()
const [bookId, setBookId] = useState(1) // Genesis (numeric ID from search) const [bookId, setBookId] = useState(1) // Genesis (numeric ID from search)
const [chapter, setChapter] = useState(1) const [chapter, setChapter] = useState(1)
const [currentChapter, setCurrentChapter] = useState<BibleChapter | null>(null) const [currentChapter, setCurrentChapter] = useState<BibleChapter | null>(null)
@@ -30,10 +32,10 @@ export function BibleReaderApp() {
const [error, setError] = useState<string | null>(null) const [error, setError] = useState<string | null>(null)
const [booksLoading, setBooksLoading] = useState(true) const [booksLoading, setBooksLoading] = useState(true)
// Load books on mount // Load books on mount or when locale changes
useEffect(() => { useEffect(() => {
loadBooks() loadBooks()
}, []) }, [locale])
// Load chapter when bookId or chapter changes // Load chapter when bookId or chapter changes
useEffect(() => { useEffect(() => {
@@ -47,7 +49,7 @@ export function BibleReaderApp() {
setError(null) setError(null)
try { try {
const response = await fetch('/api/bible/books') const response = await fetch(`/api/bible/books?locale=${locale}`)
if (!response.ok) { if (!response.ok) {
throw new Error(`Failed to load books: ${response.status}`) throw new Error(`Failed to load books: ${response.status}`)
} }
@@ -167,18 +169,14 @@ export function BibleReaderApp() {
} }
return ( return (
<Box sx={{ display: 'flex', flexDirection: 'column', height: '100vh', overflow: 'hidden' }}> <Box sx={{ display: 'flex', flexDirection: 'column', height: 'auto', overflow: 'hidden' }}>
{/* Header with search */} {/* Header with search */}
<Box <Box
sx={{ sx={{
position: 'fixed',
top: 0,
left: 0,
right: 0,
zIndex: 50,
p: 2, p: 2,
bgcolor: 'background.paper', bgcolor: 'background.paper',
boxShadow: 1 boxShadow: 1,
flexShrink: 0
}} }}
> >
<SearchNavigator <SearchNavigator
@@ -190,7 +188,7 @@ export function BibleReaderApp() {
</Box> </Box>
{/* Reading area */} {/* Reading area */}
<Box sx={{ flex: 1, mt: '80px', overflow: 'auto' }}> <Box sx={{ flex: 1, overflow: 'auto' }}>
{!booksLoading && error ? ( {!booksLoading && error ? (
<Box sx={{ p: 4, textAlign: 'center' }}> <Box sx={{ p: 4, textAlign: 'center' }}>
<Typography color="error" variant="h6">{error}</Typography> <Typography color="error" variant="h6">{error}</Typography>