From 7237aa6181ca35870386ca758cbbf096563b9609 Mon Sep 17 00:00:00 2001 From: nmemmert Date: Thu, 15 Jan 2026 14:10:02 -0500 Subject: [PATCH] feat: redesign home tab as dashboard with stats, move prayer entry to journal tab --- src/app/page.tsx | 30 ++++++++---- src/components/HomePage.tsx | 97 +++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 10 deletions(-) create mode 100644 src/components/HomePage.tsx diff --git a/src/app/page.tsx b/src/app/page.tsx index 0abb271..8eb693f 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -9,6 +9,7 @@ import DailyEntry from '@/components/DailyEntry'; import CalendarView from '@/components/CalendarView'; import ReflectionsList from '@/components/ReflectionsList'; import SettingsPage from '@/components/SettingsPage'; +import HomePage from '@/components/HomePage'; import { db } from '@/lib/firebase'; import { collection, addDoc, getDocs, updateDoc, query, where, doc } from 'firebase/firestore'; import toast from 'react-hot-toast'; @@ -190,20 +191,29 @@ export default function Home() { {activeTab === 'home' && ( - p.date === new Date().toISOString().split('T')[0]).length} + onStartPraying={() => setActiveTab('journal')} /> )} {activeTab === 'journal' && ( - + <> + +
+ +
+ )} {activeTab === 'reflections' && ( diff --git a/src/components/HomePage.tsx b/src/components/HomePage.tsx new file mode 100644 index 0000000..6e1d6a0 --- /dev/null +++ b/src/components/HomePage.tsx @@ -0,0 +1,97 @@ +'use client'; + +interface Prayer { + id: string; + userId: string; + date: string; + text: string; + prayFor?: string; +} + +interface HomePageProps { + prayers: Prayer[]; + todayCount: number; + onStartPraying: () => void; +} + +export default function HomePage({ prayers, todayCount, onStartPraying }: HomePageProps) { + const today = new Date().toISOString().split('T')[0]; + const todayPrayers = prayers.filter(p => p.date === today); + const recentPrayers = prayers.slice(0, 5); + const totalPrayers = prayers.length; + const uniqueDays = new Set(prayers.map(p => p.date)).size; + + return ( +
+ {/* Header */} +
+

Prayer Journal

+

+ {new Date().toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric' })} +

+
+ + {/* Today's Stats */} +
+
+
Today's Prayers
+
{todayCount}
+
+ +
+
+
Total Prayers
+
{totalPrayers}
+
+
+
Days Prayed
+
{uniqueDays}
+
+
+
+ + {/* CTA Button */} +
+ +
+ + {/* Recent Prayers */} + {recentPrayers.length > 0 && ( +
+

Recent Prayers

+
+ {recentPrayers.map((prayer) => ( +
+ {prayer.prayFor && ( +
+ {prayer.prayFor} +
+ )} +

{prayer.text}

+
+ {new Date(prayer.date).toLocaleDateString('en-US', { month: 'short', day: 'numeric' })} +
+
+ ))} +
+
+ )} + + {/* Empty State */} + {prayers.length === 0 && ( +
+
🙏
+

Start your prayer journal today

+

+ Create your first prayer entry and begin tracking your spiritual journey. +

+
+ )} +
+ ); +}