import { memo } from 'react' import { Box, Typography, Chip, IconButton, Tooltip } from '@mui/material' import { Check, Bell, X } from 'lucide-react' import type { Reminder } from '../../domain/reminder' import { ReminderPriorityBadge } from './ReminderPriorityBadge' import { ReminderTypeBadge } from './ReminderTypeBadge' import { ReminderDaysIndicator } from './ReminderDaysIndicator' import { useCompleteReminder, useDismissReminder, useSnoozeReminder } from '../../hooks/useReminders' import { useReminderStore } from '../../stores/reminderStore' import { ReminderStatus, ReminderPriority } from '../../domain/reminder' const PRIORITY_BORDER: Record = { [ReminderPriority.URGENT]: '#dc2626', [ReminderPriority.HIGH]: '#ea580c', [ReminderPriority.MEDIUM]: '#ca8a04', [ReminderPriority.LOW]: 'transparent', } const STATUS_LABEL: Record = { ACTIVE: 'Aktiv', SNOOZED: 'Schlummernd', COMPLETED: 'Erledigt', DISMISSED: 'Verworfen', } const STATUS_STYLE: Record = { ACTIVE: { bg: '#f0fdf4', color: '#15803d', border: '#bbf7d0' }, SNOOZED: { bg: '#fefce8', color: '#92400e', border: '#fde68a' }, COMPLETED: { bg: '#f8fafc', color: '#475569', border: '#e2e8f0' }, DISMISSED: { bg: '#f8fafc', color: '#94a3b8', border: '#e8e7e4' }, } interface Props { reminder: Reminder } export const ReminderListRow = memo(function ReminderListRow({ reminder }: Props) { const { setSelectedId, setDrawerOpen } = useReminderStore() const complete = useCompleteReminder() const dismiss = useDismissReminder() const snooze = useSnoozeReminder() const isActionable = reminder.status === ReminderStatus.ACTIVE || reminder.status === ReminderStatus.SNOOZED function handleRowClick() { setSelectedId(reminder.id) setDrawerOpen(true) } function handleComplete(e: React.MouseEvent) { e.stopPropagation() complete.mutate({ id: reminder.id }) } function handleDismiss(e: React.MouseEvent) { e.stopPropagation() dismiss.mutate({ id: reminder.id }) } function handleSnooze(e: React.MouseEvent) { e.stopPropagation() // Snooze 7 days from mock today snooze.mutate({ id: reminder.id, until: '2026-05-27' }) } const borderColor = PRIORITY_BORDER[reminder.priority] ?? 'transparent' return ( {/* Priority dot */} {/* Type badge */} {/* Property + tenant */} {reminder.propertyTitle} {reminder.propertyCity} · {reminder.tenantName} {/* Due date */} {new Date(reminder.dueDate).toLocaleDateString('de-CH')} {/* Status — only shown for non-default states */} {reminder.status !== ReminderStatus.ACTIVE && ( )} {/* Actions */} e.stopPropagation()}> {isActionable && ( <> )} ) })