import { Box, Chip, Typography } from '@mui/material' import { Kanban } from 'lucide-react' import { INQUIRY_STATUS_META, DS_COLORS, DS_TEXT, DS_BG, DS_BORDER } from '../../lib/ds' import type { Inquiry } from '../../domain/inquiry' interface AnfragenInquiryItemProps { inq: Inquiry isSelected: boolean hasPipeline: boolean onSelect: (id: string) => void } export function AnfragenInquiryItem({ inq, isSelected, hasPipeline, onSelect }: AnfragenInquiryItemProps) { const cfg = INQUIRY_STATUS_META[inq.status ?? 'new'] const displayDate = new Date(inq.updatedAt).toLocaleDateString('de-CH', { day: '2-digit', month: '2-digit' }) const lastMsg = inq.thread[inq.thread.length - 1] const unreadColor = cfg?.fg ?? DS_TEXT.danger return ( onSelect(inq.id)} sx={{ px: 2, py: 1.5, borderBottom: `1px solid ${DS_BORDER.muted}`, cursor: 'pointer', bgcolor: isSelected ? DS_COLORS.futureCard.signal.headerBg : !inq.isRead ? 'rgba(220,38,38,0.03)' : 'transparent', borderLeft: isSelected ? '3px solid' : '3px solid transparent', borderLeftColor: isSelected ? 'primary.main' : 'transparent', '&:hover': { bgcolor: isSelected ? DS_COLORS.futureCard.signal.headerBg : DS_BG.page }, transition: 'background-color 0.1s ease', }}> {!inq.isRead && } {inq.tenantName} {inq.unreadCount > 0 && ( {inq.unreadCount} )} {displayDate} {inq.tenantCompany && ( {inq.tenantCompany} )} {inq.subject} {lastMsg && ( {lastMsg.senderType === 'tenant' ? 'Sie: ' : `${lastMsg.senderName}: `} {lastMsg.body.split('\n')[0]} )} {inq.matchScore && ( = 80 ? DS_TEXT.success : DS_TEXT.warning, fontWeight: 700, fontSize: '0.7rem' }}> {inq.matchScore}% )} {hasPipeline && ( } label="Pipeline" size="small" sx={{ height: 16, fontSize: '0.6rem', fontWeight: 600, bgcolor: DS_COLORS.futureCard.signal.headerBg, color: 'primary.main', '& .MuiChip-icon': { color: 'primary.main' }, }} /> )} ) }