'use client'; import React, { useState } from 'react'; import toast from 'react-hot-toast'; import { PenSquare, Calendar as CalendarIcon, HandHeart, CheckCircle2, Sparkles, Save, Loader2, ChevronDown } from 'lucide-react'; interface DailyEntryProps { date: string; onDateChange: (date: string) => void; text: string; onTextChange: (text: string) => void; prayFor: string; onPrayForChange: (prayFor: string) => void; prayForOptions?: string[]; answered?: boolean; onAnsweredChange?: (answered: boolean) => void; answerDetails?: string; onAnswerDetailsChange?: (details: string) => void; onSubmit: (e: React.FormEvent) => void; loading?: boolean; isEditing?: boolean; } export default function DailyEntry({ date, onDateChange, text, onTextChange, prayFor, onPrayForChange, prayForOptions = [], answered = false, onAnsweredChange, answerDetails = '', onAnswerDetailsChange, onSubmit, loading = false, isEditing = false, }: DailyEntryProps) { const today = new Date().toISOString().split('T')[0]; const isToday = date === today; const wordCount = text.split(/\s+/).filter(w => w).length; return (
{/* Animated Background */}
{/* Header */}
Haver icon

{isToday ? "Today's Prayer" : 'Prayer Entry'}

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

{/* Entry Form */}
{/* Date Input */}
onDateChange(e.target.value)} className="w-full px-4 py-3 rounded-xl bg-slate-800/60 backdrop-blur-xl border border-slate-700/50 text-white placeholder-slate-500 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all" />
{/* Pray For */}
onPrayForChange(e.target.value)} placeholder="Person, situation, or concern..." list="prayfor-options" className="w-full px-4 py-3.5 pr-12 rounded-xl bg-slate-800/60 backdrop-blur-xl border border-slate-700/50 text-white placeholder-slate-500 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all" /> {prayForOptions.length > 0 && ( )}
{prayForOptions.length > 0 && ( {prayForOptions.map((opt) => ( )}
{/* Prayer Text */}
{wordCount} words