import type { GoalDefinition, GoalStatus, PeriodType } from '@/services/goals'; import { GoalProgressBar } from './GoalProgressBar'; interface GoalCardProps { goal: GoalDefinition; onStatusChange?: (status: GoalStatus) => void; onDelete?: () => void; onDuplicate?: () => void; isUpdating?: boolean; isDeleting?: boolean; } export function GoalCard({ goal, onStatusChange, onDelete, onDuplicate, isUpdating = false, isDeleting = false, }: GoalCardProps) { const getStatusColor = (status: GoalStatus) => { const colors: Record = { draft: 'bg-gray-100 text-gray-800', active: 'bg-green-100 text-green-800', paused: 'bg-yellow-100 text-yellow-800', completed: 'bg-blue-100 text-blue-800', cancelled: 'bg-red-100 text-red-800', }; return colors[status] || 'bg-gray-100 text-gray-800'; }; const getPeriodLabel = (period: PeriodType) => { const labels: Record = { daily: 'Daily', weekly: 'Weekly', monthly: 'Monthly', quarterly: 'Quarterly', yearly: 'Yearly', custom: 'Custom', }; return labels[period] || period; }; const formatDate = (dateStr: string) => { return new Date(dateStr).toLocaleDateString(); }; return (

{goal.name}

{goal.type} | {getPeriodLabel(goal.period)}
{onStatusChange ? ( ) : ( {goal.status} )}
{goal.description && (

{goal.description}

)}
Target {goal.targetValue.toLocaleString()} {goal.unit || ''}
Duration {formatDate(goal.startsAt)} - {formatDate(goal.endsAt)}
Assigned {goal.assignmentCount ?? 0} users
{goal.category && (
{goal.category}
)} {goal.milestones && goal.milestones.length > 0 && (
Milestones
)}
View Details
{onDuplicate && ( )} {onDelete && ( )}
); } export default GoalCard;