'use client' import { memo } from 'react' import { Handle, Position } from '@xyflow/react' import type { NodeProps } from '@xyflow/react' import type { OutcomeNodeData } from '@/lib/types' function OutcomeNode({ data, selected }: NodeProps) { const nodeData = data as OutcomeNodeData const { label, description, fundingReceived, fundingTarget, status } = nodeData const progress = fundingTarget > 0 ? Math.min(100, (fundingReceived / fundingTarget) * 100) : 0 const isFunded = fundingReceived >= fundingTarget const isPartial = fundingReceived > 0 && fundingReceived < fundingTarget // Status colors const statusColors = { 'not-started': { bg: 'bg-slate-100', text: 'text-slate-600', border: 'border-slate-300' }, 'in-progress': { bg: 'bg-blue-100', text: 'text-blue-700', border: 'border-blue-300' }, 'completed': { bg: 'bg-emerald-100', text: 'text-emerald-700', border: 'border-emerald-300' }, 'blocked': { bg: 'bg-red-100', text: 'text-red-700', border: 'border-red-300' }, } const colors = statusColors[status] || statusColors['not-started'] return (
{description}
)} {/* Status badge */}