import { CardWithDetails } from '../types/kanban';
import { Link } from 'react-router-dom';
interface CardPreviewModalProps {
card: CardWithDetails;
onClose: () => void;
}
export function CardPreviewModal({ card, onClose }: CardPreviewModalProps) {
return (
{card.name}
{/* Labels */}
{card.labels && card.labels.length > 0 && (
{card.labels.map((label) => (
{label.name}
))}
)}
{/* Description */}
{card.description && (
Description
{card.description}
)}
{/* Checklists */}
{card.checklists && card.checklists.length > 0 && (
Checklists
{card.checklists.map((checklist) => {
const completedItems = checklist.items.filter(
(item) => item.state === 'complete'
).length;
const totalItems = checklist.items.length;
const progress = totalItems > 0 ? (completedItems / totalItems) * 100 : 0;
return (
{checklist.name}
{completedItems}/{totalItems}
{/* Checklist Items */}
{checklist.items.map((item) => (
{item.state === 'complete' && (
)}
{item.name}
))}
);
})}
)}
{/* Comments Preview */}
{card.comments && card.comments.length > 0 && (
Comments
{card.comments.slice(0, 3).map((comment) => (
{comment.user?.username.charAt(0).toUpperCase() || '?'}
{comment.user?.username || 'Unknown'}
{new Date(comment.created_at).toLocaleDateString()}
{comment.text}
))}
{card.comments.length > 3 && (
+{card.comments.length - 3} more comments
)}
)}
);
}