"use client"; import { Handle, Position, type NodeProps } from "@xyflow/react"; import type { CampaignNodeType } from "@/lib/types/campaign"; import { useCampaignStore } from "@/lib/stores/campaign-store"; interface BaseNodeProps { id: string; label: string; type: CampaignNodeType; icon: React.ReactNode; color: string; hasInput?: boolean; hasOutput?: boolean; hasTrueOutput?: boolean; hasFalseOutput?: boolean; children?: React.ReactNode; } export function BaseNode({ id, label, icon, color, hasInput = true, hasOutput = true, hasTrueOutput = false, hasFalseOutput = false, children, }: BaseNodeProps) { const selectedNodeId = useCampaignStore((s) => s.selectedNodeId); const isSelected = selectedNodeId === id; return (
{hasInput && ( )}
{icon}
{label}
{children && (
{children}
)}
{hasOutput && !hasTrueOutput && ( )} {hasTrueOutput && ( <> true )} {hasFalseOutput && ( <> false )}
); }