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:
@@ -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' }} />
|
||||
|
||||
@@ -70,13 +70,14 @@ export default function FloatingChat() {
|
||||
scrollToBottom()
|
||||
}, [messages])
|
||||
|
||||
// Allow external triggers to open the chat (optionally fullscreen)
|
||||
// Allow external triggers to open the chat (optionally fullscreen and with initial message)
|
||||
useEffect(() => {
|
||||
const handler = (e: Event) => {
|
||||
const detail = (e as CustomEvent).detail || {}
|
||||
setIsOpen(true)
|
||||
setIsMinimized(false)
|
||||
if (typeof detail.fullscreen === 'boolean') setIsFullscreen(detail.fullscreen)
|
||||
if (typeof detail.initialMessage === 'string') setInputMessage(detail.initialMessage)
|
||||
}
|
||||
window.addEventListener('floating-chat:open', handler as EventListener)
|
||||
return () => window.removeEventListener('floating-chat:open', handler as EventListener)
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
"subtitle": "Experience our AI assistant immediately without any sign-up required",
|
||||
"userQuestion": "What does the Bible say about hope?",
|
||||
"aiResponse": "The Bible offers many encouraging verses about hope. Romans 15:13 says 'May the God of hope fill you with all joy and peace...'",
|
||||
"tryButton": "Try It Yourself - No Sign Up Required"
|
||||
"tryButton": "Try it yourself"
|
||||
},
|
||||
"dailyVerse": {
|
||||
"title": "Today's Verse",
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
"cta": {
|
||||
"readBible": "Începe să citești",
|
||||
"askAI": "Întreabă AI"
|
||||
}
|
||||
},
|
||||
"liveCounter": "Alătură-te la {count} credincioși care studiază Cuvântul lui Dumnezeu chiar acum"
|
||||
},
|
||||
"features": {
|
||||
"title": "Descoperă funcționalitățile",
|
||||
@@ -71,15 +72,12 @@
|
||||
"description": "Alătură-te comunității noastre și descoperă înțelepciunea Scripturii",
|
||||
"startNow": "Începe acum"
|
||||
},
|
||||
"hero": {
|
||||
"liveCounter": "Alătură-te la {count} credincioși care studiază Cuvântul lui Dumnezeu chiar acum"
|
||||
},
|
||||
"demo": {
|
||||
"title": "Vezi în Acțiune",
|
||||
"subtitle": "Experimentează asistentul nostru AI imediat, fără să te înregistrezi",
|
||||
"userQuestion": "Ce spune Biblia despre speranță?",
|
||||
"aiResponse": "Biblia oferă multe versete încurajatoare despre speranță. Romani 15:13 spune: 'Să vă umple Dumnezeul speranței cu toată bucuria și pacea...'",
|
||||
"tryButton": "Încearcă Singur - Fără Înregistrare"
|
||||
"tryButton": "Încearcă și tu"
|
||||
},
|
||||
"dailyVerse": {
|
||||
"title": "Versetul de Astăzi",
|
||||
@@ -89,11 +87,11 @@
|
||||
"discuss": "Discută Acest Verset",
|
||||
"save": "Salvează",
|
||||
"share": "Partajează",
|
||||
"tomorrow": "Mâine: Primește versete zilnice în inbox-ul tău",
|
||||
"tomorrow": "Primește versete zilnice în inbox-ul tău",
|
||||
"subscribe": "Abonează-te"
|
||||
},
|
||||
"howItWorks": {
|
||||
"title": "Începe Călătoria Ta Biblică",
|
||||
"title": "Începe Călătoria Ta Acum",
|
||||
"subtitle": "Trei pași simpli pentru a-ți aprofunda credința",
|
||||
"step1": {
|
||||
"title": "Pune Orice Întrebare",
|
||||
@@ -119,12 +117,12 @@
|
||||
"time3": "acum 1 oră",
|
||||
"praying": "Se roagă",
|
||||
"celebrating": "Sărbătoresc",
|
||||
"shareRequest": "Partajează Cererea Ta de Rugăciune",
|
||||
"shareRequest": "Adaugă o rugăciune nouă",
|
||||
"viewAll": "Vezi Toate Rugăciunile"
|
||||
},
|
||||
"testimonials": {
|
||||
"title": "Povești Reale din Comunitatea Noastră",
|
||||
"subtitle": "Ascultă cum platforma noastră a atins vieți din întreaga lume",
|
||||
"subtitle": "Vezi cum platforma noastră a atins viețile credincioșilor",
|
||||
"testimonial1": {
|
||||
"name": "Maria S.",
|
||||
"role": "Mamă a doi copii | Folosește de 3 luni",
|
||||
|
||||
Reference in New Issue
Block a user