import React, { useState } from 'react'; import { Circle, CheckCircle2, BookOpen, Briefcase, Coffee, HeartPulse, Calendar, MapPin } from 'lucide-react'; import { TodoItem, TodoCategory } from '../types'; interface TodoCardProps { item: TodoItem; index: number; onToggle: (id: string) => void; location?: string; time?: string; } export const TodoCard: React.FC = ({ item, index, onToggle, location, time }) => { const [isDone, setIsDone] = useState(item.isDone); const handleToggle = (e: React.MouseEvent) => { e.stopPropagation(); setIsDone(!isDone); onToggle(item.id); }; const getCategoryIcon = (category?: TodoCategory) => { const props = { size: 12, className: "opacity-60" }; switch (category) { case 'study': return ; case 'work': return ; case 'life': return ; case 'health': return ; default: return null; } }; const formatScheduledTime = (timestamp?: number) => { if (!timestamp) return ''; const date = new Date(timestamp); const now = new Date(); const isToday = date.toDateString() === now.toDateString(); // Simple format: "Today · 6:30 PM" const timeStr = date.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' }); if (isToday) return `Today · ${timeStr}`; // "Tomorrow" logic could go here, keeping it simple for now return `${date.toLocaleDateString([], { month: 'short', day: 'numeric' })} · ${timeStr}`; }; return (
{/* Inner highlight */}
{/* Status Indicator (Left) */} {/* Content Area */}
{/* Main Title */}

{item.title}

{/* Meta Info (Time, Location & Category) */}
{/* Time and Location */}
{/* Time */} {(item.scheduledAt || time) && (
{time || formatScheduledTime(item.scheduledAt)}
)} {/* Location */} {location && (
{location}
)}
{/* Category */} {item.category && (
{getCategoryIcon(item.category)} {item.category}
)}
); };