Implement comprehensive homepage enhancements and floating chat improvements

- Add dynamic date and year generation replacing static 2024 values
- Implement "Discuss this verse" feature with AI chat integration
- Fix translation key conflicts by merging duplicate hero objects
- Update Romanian translations with improved messaging
- Enhance floating chat to support initial messages via events
- Fix FORMATTING_ERROR for liveCounter with proper next-intl syntax

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
andupetcu
2025-09-22 10:39:07 +03:00
parent 72d39e74c8
commit e2c7e21967
4 changed files with 52 additions and 15 deletions

View File

@@ -57,6 +57,28 @@ export default function Home() {
return () => clearInterval(interval)
}, [])
// Generate current date and year
const getCurrentDate = () => {
const now = new Date()
if (locale === 'ro') {
return now.toLocaleDateString('ro-RO', {
year: 'numeric',
month: 'long',
day: 'numeric'
})
} else {
return now.toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
})
}
}
const getCurrentYear = () => {
return new Date().getFullYear()
}
const features = [
{
title: t('features.bible.title'),
@@ -113,7 +135,7 @@ export default function Home() {
</Typography>
<Box sx={{ mb: 4, p: 2, bgcolor: 'rgba(255,255,255,0.1)', borderRadius: 2 }}>
<Typography variant="body2" sx={{ opacity: 0.9 }}>
{t('hero.liveCounter').replace('{count}', userCount.toLocaleString())}
{t('hero.liveCounter', { count: userCount.toLocaleString() })}
</Typography>
</Box>
<Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}>
@@ -206,7 +228,7 @@ export default function Home() {
{t('dailyVerse.title')}
</Typography>
<Typography variant="body2" textAlign="center" sx={{ mb: 4, opacity: 0.9 }}>
{t('dailyVerse.date')}
{getCurrentDate()}
</Typography>
<Paper sx={{ p: 4, textAlign: 'center', bgcolor: 'rgba(255,255,255,0.95)', color: 'text.primary', borderRadius: 3 }}>
@@ -219,7 +241,23 @@ export default function Home() {
<Box sx={{ display: 'flex', gap: 1, justifyContent: 'center', mt: 3 }}>
<Tooltip title={t('dailyVerse.discuss')}>
<IconButton color="primary">
<IconButton
color="primary"
onClick={() => {
const verseText = t('dailyVerse.verse')
const reference = t('dailyVerse.reference')
const discussMessage = locale === 'ro'
? `Poți să îmi explici mai mult despre acest verset: "${verseText}" (${reference})?`
: `Can you explain more about this verse: "${verseText}" (${reference})?`
window.dispatchEvent(new CustomEvent('floating-chat:open', {
detail: {
fullscreen: true,
initialMessage: discussMessage
}
}))
}}
>
<QuestionAnswer />
</IconButton>
</Tooltip>
@@ -629,7 +667,7 @@ export default function Home() {
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', flexWrap: 'wrap', gap: 2 }}>
<Typography variant="body2" color="grey.400">
{t('footer.copyright')}
© {getCurrentYear()} {locale === 'ro' ? 'Ghid Biblic - Făcut cu ❤️ și 🙏' : 'Biblical Guide - Made with ❤️ and 🙏'}
</Typography>
<Box sx={{ display: 'flex', gap: 1, flexWrap: 'wrap' }}>
<Chip label="🇷🇴 Română" size="small" variant="outlined" sx={{ color: 'white', borderColor: 'grey.600' }} />