diff --git a/app/[locale]/prayers/page.tsx b/app/[locale]/prayers/page.tsx index bde5f6e..c5a85fc 100644 --- a/app/[locale]/prayers/page.tsx +++ b/app/[locale]/prayers/page.tsx @@ -37,6 +37,7 @@ import { MoreVert, } from '@mui/icons-material' import { useState, useEffect } from 'react' +import { useLocale } from 'next-intl' interface PrayerRequest { id: string @@ -51,6 +52,7 @@ interface PrayerRequest { export default function PrayersPage() { const theme = useTheme() + const locale = useLocale() const [prayers, setPrayers] = useState([]) const [openDialog, setOpenDialog] = useState(false) const [newPrayer, setNewPrayer] = useState({ @@ -60,54 +62,104 @@ export default function PrayersPage() { }) const [loading, setLoading] = useState(true) - const categories = [ - { value: 'personal', label: 'Personal', color: 'primary' }, - { value: 'family', label: 'Familie', color: 'secondary' }, - { value: 'health', label: 'Sănătate', color: 'error' }, - { value: 'work', label: 'Muncă', color: 'warning' }, - { value: 'ministry', label: 'Serviciu', color: 'success' }, - { value: 'world', label: 'Lume', color: 'info' }, - ] + const categories = locale === 'en' + ? [ + { value: 'personal', label: 'Personal', color: 'primary' }, + { value: 'family', label: 'Family', color: 'secondary' }, + { value: 'health', label: 'Health', color: 'error' }, + { value: 'work', label: 'Work', color: 'warning' }, + { value: 'ministry', label: 'Ministry', color: 'success' }, + { value: 'world', label: 'World', color: 'info' }, + ] + : [ + { value: 'personal', label: 'Personal', color: 'primary' }, + { value: 'family', label: 'Familie', color: 'secondary' }, + { value: 'health', label: 'Sănătate', color: 'error' }, + { value: 'work', label: 'Muncă', color: 'warning' }, + { value: 'ministry', label: 'Serviciu', color: 'success' }, + { value: 'world', label: 'Lume', color: 'info' }, + ] // Sample data - in real app this would come from API useEffect(() => { // Simulate loading prayers setTimeout(() => { - setPrayers([ - { - id: '1', - title: 'Rugăciune pentru vindecare', - description: 'Te rog să te rogi pentru tatăl meu care se află în spital. Are nevoie de vindecarea lui Dumnezeu.', - category: 'health', - author: 'Maria P.', - timestamp: new Date(Date.now() - 2 * 60 * 60 * 1000), // 2 hours ago - prayerCount: 23, - isPrayedFor: false, - }, - { - id: '2', - title: 'Îndrumarea lui Dumnezeu în carieră', - description: 'Caut direcția lui Dumnezeu pentru următorul pas în cariera mea. Te rog să te rogi pentru claritate și pace.', - category: 'work', - author: 'Alexandru M.', - timestamp: new Date(Date.now() - 5 * 60 * 60 * 1000), // 5 hours ago - prayerCount: 15, - isPrayedFor: true, - }, - { - id: '3', - title: 'Unitatea în familia noastră', - description: 'Rugați-vă pentru restaurarea relațiilor în familia noastră și pentru iertarea reciprocă.', - category: 'family', - author: 'Anonim', - timestamp: new Date(Date.now() - 1 * 24 * 60 * 60 * 1000), // 1 day ago - prayerCount: 41, - isPrayedFor: false, - }, - ]) + setPrayers( + locale === 'en' + ? [ + { + id: '1', + title: 'Prayer for healing', + description: + 'Please pray for my father who is in the hospital. He needs God\'s healing.', + category: 'health', + author: 'Maria P.', + timestamp: new Date(Date.now() - 2 * 60 * 60 * 1000), + prayerCount: 23, + isPrayedFor: false, + }, + { + id: '2', + title: 'God\'s guidance in career', + description: + 'Seeking God\'s direction for the next step in my career. Please pray for clarity and peace.', + category: 'work', + author: 'Alex M.', + timestamp: new Date(Date.now() - 5 * 60 * 60 * 1000), + prayerCount: 15, + isPrayedFor: true, + }, + { + id: '3', + title: 'Unity in our family', + description: + 'Please pray for restoration of relationships in our family and for mutual forgiveness.', + category: 'family', + author: 'Anonymous', + timestamp: new Date(Date.now() - 1 * 24 * 60 * 60 * 1000), + prayerCount: 41, + isPrayedFor: false, + }, + ] + : [ + { + id: '1', + title: 'Rugăciune pentru vindecare', + description: + 'Te rog să te rogi pentru tatăl meu care se află în spital. Are nevoie de vindecarea lui Dumnezeu.', + category: 'health', + author: 'Maria P.', + timestamp: new Date(Date.now() - 2 * 60 * 60 * 1000), + prayerCount: 23, + isPrayedFor: false, + }, + { + id: '2', + title: 'Îndrumarea lui Dumnezeu în carieră', + description: + 'Caut direcția lui Dumnezeu pentru următorul pas în cariera mea. Te rog să te rogi pentru claritate și pace.', + category: 'work', + author: 'Alexandru M.', + timestamp: new Date(Date.now() - 5 * 60 * 60 * 1000), + prayerCount: 15, + isPrayedFor: true, + }, + { + id: '3', + title: 'Unitatea în familia noastră', + description: + 'Rugați-vă pentru restaurarea relațiilor în familia noastră și pentru iertarea reciprocă.', + category: 'family', + author: 'Anonim', + timestamp: new Date(Date.now() - 1 * 24 * 60 * 60 * 1000), + prayerCount: 41, + isPrayedFor: false, + }, + ] + ) setLoading(false) }, 1000) - }, []) + }, [locale]) const handleSubmitPrayer = async () => { if (!newPrayer.title.trim() || !newPrayer.description.trim()) return @@ -117,7 +169,7 @@ export default function PrayersPage() { title: newPrayer.title, description: newPrayer.description, category: newPrayer.category, - author: 'Tu', // In real app, get from auth + author: locale === 'en' ? 'You' : 'Tu', // In real app, get from auth timestamp: new Date(), prayerCount: 0, isPrayedFor: false, @@ -164,6 +216,11 @@ export default function PrayersPage() { const hours = Math.floor(diff / (1000 * 60 * 60)) const days = Math.floor(hours / 24) + if (locale === 'en') { + if (days > 0) return `${days} day${days === 1 ? '' : 's'} ago` + if (hours > 0) return `${hours} hour${hours === 1 ? '' : 's'} ago` + return 'A few minutes ago' + } if (days > 0) return `${days} zile în urmă` if (hours > 0) return `${hours} ore în urmă` return 'Acum câteva minute' @@ -177,10 +234,12 @@ export default function PrayersPage() { - Peretele de rugăciuni + {locale === 'en' ? 'Prayer Wall' : 'Peretele de rugăciuni'} - Partajează rugăciuni și roagă-te împreună cu comunitatea + {locale === 'en' + ? 'Share prayers and pray together with the community' + : 'Partajează rugăciuni și roagă-te împreună cu comunitatea'} @@ -190,7 +249,7 @@ export default function PrayersPage() { - Categorii + {locale === 'en' ? 'Categories' : 'Categorii'} {categories.map((category) => ( @@ -206,12 +265,22 @@ export default function PrayersPage() { - Statistici + {locale === 'en' ? 'Statistics' : 'Statistici'} - • {prayers.length} cereri active
- • {prayers.reduce((sum, p) => sum + p.prayerCount, 0)} rugăciuni totale
- • {prayers.filter(p => p.isPrayedFor).length} cereri la care te-ai rugat + {locale === 'en' ? ( + <> + • {prayers.length} active requests
+ • {prayers.reduce((sum, p) => sum + p.prayerCount, 0)} total prayers
+ • {prayers.filter(p => p.isPrayedFor).length} requests you prayed for + + ) : ( + <> + • {prayers.length} cereri active
+ • {prayers.reduce((sum, p) => sum + p.prayerCount, 0)} rugăciuni totale
+ • {prayers.filter(p => p.isPrayedFor).length} cereri la care te-ai rugat + + )}
@@ -308,19 +377,23 @@ export default function PrayersPage() { onClick={() => handlePrayFor(prayer.id)} disabled={prayer.isPrayedFor} > - {prayer.isPrayedFor ? 'M-am rugat' : 'Mă rog'} + {prayer.isPrayedFor + ? locale === 'en' ? 'Prayed' : 'M-am rugat' + : locale === 'en' ? 'Pray' : 'Mă rog'} - {prayer.prayerCount} {prayer.prayerCount === 1 ? 'rugăciune' : 'rugăciuni'} + {locale === 'en' + ? `${prayer.prayerCount} ${prayer.prayerCount === 1 ? 'prayer' : 'prayers'}` + : `${prayer.prayerCount} ${prayer.prayerCount === 1 ? 'rugăciune' : 'rugăciuni'}`} @@ -351,7 +424,7 @@ export default function PrayersPage() { > - Adaugă o cerere de rugăciune + {locale === 'en' ? 'Add a prayer request' : 'Adaugă o cerere de rugăciune'} setOpenDialog(false)} size="small"> @@ -360,7 +433,7 @@ export default function PrayersPage() { setNewPrayer({ ...newPrayer, title: e.target.value })} sx={{ mb: 2, mt: 1 }} @@ -368,7 +441,7 @@ export default function PrayersPage() { setNewPrayer({ ...newPrayer, category: e.target.value })} @@ -383,28 +456,28 @@ export default function PrayersPage() { setNewPrayer({ ...newPrayer, description: e.target.value })} - placeholder="Descrie cererea ta de rugăciune..." + placeholder={locale === 'en' ? 'Describe your prayer request...' : 'Descrie cererea ta de rugăciune...'} /> ) -} \ No newline at end of file +}