Fix TS build errors: guard optional remind_at, add none priority to TodoItem

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kyle 2026-02-22 18:50:32 +08:00
parent 80f3f3ed10
commit a144945077
2 changed files with 4 additions and 3 deletions

View File

@ -57,7 +57,7 @@ export default function ReminderList({ reminders, onEdit }: ReminderListProps) {
return (
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
{reminders.map((reminder) => {
const isOverdue = !reminder.is_dismissed && isPast(new Date(reminder.remind_at));
const isOverdue = !reminder.is_dismissed && !!reminder.remind_at && isPast(new Date(reminder.remind_at));
return (
<Card
key={reminder.id}
@ -85,7 +85,7 @@ export default function ReminderList({ reminders, onEdit }: ReminderListProps) {
)}
<div className="flex items-center gap-2 text-sm text-muted-foreground mb-3">
<Calendar className="h-4 w-4" />
{format(new Date(reminder.remind_at), 'MMM d, yyyy h:mm a')}
{reminder.remind_at ? format(new Date(reminder.remind_at), 'MMM d, yyyy h:mm a') : 'No date set'}
{isOverdue && <span className="text-destructive font-medium">(Overdue)</span>}
</div>
<div className="flex gap-2" onClick={(e) => e.stopPropagation()}>

View File

@ -14,7 +14,8 @@ interface TodoItemProps {
onEdit: (todo: Todo) => void;
}
const priorityColors = {
const priorityColors: Record<string, string> = {
none: 'bg-gray-500/10 text-gray-400 border-gray-500/20',
low: 'bg-green-500/10 text-green-500 border-green-500/20',
medium: 'bg-yellow-500/10 text-yellow-500 border-yellow-500/20',
high: 'bg-red-500/10 text-red-500 border-red-500/20',