Bible Reader Enhancements: - Add chat icon to each verse for AI explanations - Implement handleVerseChat function with pre-filled contextual messages - Chat opens with message: "Explain in depth this verse [text] from [version], [book] [chapter:verse] and its meaning" - Visible to all users, redirects to login for unauthenticated users - Fix copy message translation from 'bible.copied' to 'copied' Login System Improvements: - Fix redirect parameter handling in login pages - Users are now properly redirected to /bible page after successful login - Preserve redirect URL parameters through login flow - Add Suspense boundaries for useSearchParams compliance - Ensure verse/chapter context is maintained after login Technical Changes: - Add Chat icon import from Material-UI - Implement floating chat event dispatch system - Fix Next.js 15 build warnings with proper Suspense wrapping - Maintain existing UX patterns (visible to all, functional for authenticated users) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
'use client'
|
|
|
|
import { useEffect, Suspense } from 'react'
|
|
import { useRouter, useSearchParams } from 'next/navigation'
|
|
import { useLocale } from 'next-intl'
|
|
import { Box, CircularProgress, Typography } from '@mui/material'
|
|
|
|
function LoginRedirectContent() {
|
|
const router = useRouter()
|
|
const locale = useLocale()
|
|
const searchParams = useSearchParams()
|
|
|
|
useEffect(() => {
|
|
// Preserve the redirect parameter when redirecting to the actual login page
|
|
const redirect = searchParams.get('redirect')
|
|
const redirectParam = redirect ? `?redirect=${encodeURIComponent(redirect)}` : ''
|
|
router.replace(`/${locale}/auth/login${redirectParam}`)
|
|
}, [router, locale, searchParams])
|
|
|
|
return (
|
|
<Box
|
|
display="flex"
|
|
flexDirection="column"
|
|
alignItems="center"
|
|
justifyContent="center"
|
|
minHeight="100vh"
|
|
gap={2}
|
|
>
|
|
<CircularProgress />
|
|
<Typography variant="body2" color="text.secondary">
|
|
Redirecting to login...
|
|
</Typography>
|
|
</Box>
|
|
)
|
|
}
|
|
|
|
export default function LoginRedirectPage() {
|
|
return (
|
|
<Suspense fallback={
|
|
<Box
|
|
display="flex"
|
|
flexDirection="column"
|
|
alignItems="center"
|
|
justifyContent="center"
|
|
minHeight="100vh"
|
|
gap={2}
|
|
>
|
|
<CircularProgress />
|
|
<Typography variant="body2" color="text.secondary">
|
|
Loading...
|
|
</Typography>
|
|
</Box>
|
|
}>
|
|
<LoginRedirectContent />
|
|
</Suspense>
|
|
)
|
|
} |