'use client' import { useState, useEffect, useMemo, useCallback } from 'react' import Link from 'next/link' import { Heart, MessageCircle, Share2, RotateCcw, Bell, Clock } from 'lucide-react' /* ─── Types & Constants ─────────────────────────────────────── */ type PrayerName = 'Fajr' | 'Dhuhr' | 'Asr' | 'Maghrib' | 'Isha' const PRAYERS: PrayerName[] = ['Fajr', 'Dhuhr', 'Asr', 'Maghrib', 'Isha'] interface Timings { Fajr: string Sunrise: string Dhuhr: string Asr: string Maghrib: string Isha: string } const AYATUL_KURSI = { arabic: 'ٱللَّهُ لَآ إِلَـٰهَ إِلَّا هُوَ ٱلْحَىُّ ٱلْقَيُّومُ ۚ لَا تَأْخُذُهُۥ سِنَةٌ وَلَا نَوْمٌ ۚ لَّهُۥ مَا فِى ٱلسَّمَـٰوَٰتِ وَمَا فِى ٱلْأَرْضِ ۗ مَن ذَا ٱلَّذِى يَشْفَعُ عِندَهُۥٓ إِلَّا بِإِذْنِهِۦ ۚ يَعْلَمُ مَا بَيْنَ أَيْدِيهِمْ وَمَا خَلْفَهُمْ ۖ وَلَا يُحِيطُونَ بِشَىْءٍ مِّنْ عِلْمِهِۦٓ إِلَّا بِمَا شَآءَ ۚ وَسِعَ كُرْسِيُّهُ ٱلسَّمَـٰوَٰتِ وَٱلْأَرْضَ ۖ وَلَا يَـُٔودُهُۥ حِفْظُهُمَا ۚ وَهُوَ ٱلْعَلِىُّ ٱلْعَظِيمُ', translation: 'Allah! There is no god but Him, the Ever-Living, the Sustainer of existence. Neither drowsiness nor sleep overtakes Him. To Him belongs whatever is in the heavens and whatever is on the earth. Who is it that can intercede with Him except by His permission? He knows what is before them and what will be after them, and they encompass nothing of His knowledge except what He wills. His Kursi extends over the heavens and the earth, and their preservation tires Him not. And He is the Most High, the Most Great.', surah: 'Surah Al-Baqarah (2:255)', } const DHIKR_ITEMS = [ { arabic: 'سُبْحَانَ ٱللَّٰهِ', latin: 'SubhanAllah', target: 33, color: '#D4AF37' }, { arabic: 'ٱلْحَمْدُ لِلَّٰهِ', latin: 'Alhamdulillah', target: 33, color: '#10B981' }, { arabic: 'ٱللَّٰهُ أَكْبَرُ', latin: 'Allahu Akbar', target: 34, color: '#D4AF37' }, ] const POSTS = [ { id: 1, name: 'Ahmad R.', avatar: 'AR', content: 'Alhamdulillah, completed my first full month of Fajr prayer on time! ☀️ The early morning blessings are real.', likes: 24, comments: 5, }, { id: 2, name: 'Fatima Z.', avatar: 'FZ', content: 'Just finished reading Surah Al-Kahf. The story of the people of the cave never gets old. SubhanAllah how Allah protects the believers! 📖', likes: 42, comments: 8, }, { id: 3, name: 'Omar H.', avatar: 'OH', content: 'Anyone looking for a good tafsir of Juz Amma? I highly recommend "The Clear Quran" by Dr. Mustafa Khattab. Very accessible English. 🤲', likes: 18, comments: 12, }, ] /* ─── Helpers ────────────────────────────────────────────────── */ const RING_R = 40 const RING_CIRCUMFERENCE = 2 * Math.PI * RING_R const DHIKR_R = 22 const DHIKR_CIRCUMFERENCE = 2 * Math.PI * DHIKR_R function toMins(t: string): number { const [h, m] = t.split(':').map(Number) return h * 60 + m } function fmtCountdown(mins: number): string { if (mins <= 0) return 'Now' const h = Math.floor(mins / 60) const m = mins % 60 if (h === 0) return `${m}m` if (m === 0) return `${h}h` return `${h}h ${m}m` } function getGreeting(h: number): string { if (h < 5) return 'Late Night Reflection' if (h < 12) return 'Good Morning' if (h < 17) return 'Good Afternoon' if (h < 20) return 'Good Evening' return 'Night Reflection' } /* ─── Sub-components ─────────────────────────────────────────── */ function DhikrCard({ item, count, onTap, onReset, }: { item: (typeof DHIKR_ITEMS)[number] count: number onTap: () => void onReset: () => void }) { const progress = Math.min(count / item.target, 1) const dashoffset = DHIKR_CIRCUMFERENCE * (1 - progress) const isComplete = count >= item.target return (
{post.name}
Just now
{post.content}
{greeting}
Welcome to Falah
Next Prayer
{nextPrayer ? ( <>{nextPrayer.name}
{nextPrayer.time}
Loading prayer times...
)}Assalamualaikum! 🌙 Your spiritual briefing for today...
Today is a new opportunity to grow closer to Allah. Remember that every good deed, no matter how small, is multiplied by the Most Generous. Start your day with intention, pray Fajr on time, and carry that light through the hours ahead.
Chat with NurBuddy →{AYATUL_KURSI.arabic}
“{AYATUL_KURSI.translation}”