"use client"; import { memo } from "react"; import { Handle, Position, NodeProps } from "reactflow"; import { GitBranch } from "lucide-react"; import { CompactNodeShell } from "./CompactNodeShell"; import type { ConditionNodeData } from "@/types/node-editor"; const OPERATOR_LABELS: Record = { EQUALS: "=", NOT_EQUALS: "!=", GREATER_THAN: ">", LESS_THAN: "<", GREATER_THAN_OR_EQUAL: ">=", LESS_THAN_OR_EQUAL: "<=", LIKE: "포함", NOT_LIKE: "미포함", IN: "IN", NOT_IN: "NOT IN", IS_NULL: "NULL", IS_NOT_NULL: "NOT NULL", EXISTS_IN: "EXISTS", NOT_EXISTS_IN: "NOT EXISTS", }; export const ConditionNode = memo(({ data, selected }: NodeProps) => { const condCount = data.conditions?.length || 0; const summary = condCount > 0 ? `${condCount}개 조건 (${data.logic || "AND"})` : "조건을 설정해 주세요"; return (
{/* 헤더 */}
{data.displayName || "조건 분기"}
{summary}
{/* 조건 미리보기 */} {condCount > 0 && (
{data.conditions!.slice(0, 2).map((c, i) => (
{i > 0 && {data.logic}} {c.field} {OPERATOR_LABELS[c.operator] || c.operator} {c.value !== undefined && c.value !== null && ( {String(c.value)} )}
))} {condCount > 2 && 외 {condCount - 2}개}
)} {/* 분기 출력 */}
통과
미통과
); }); ConditionNode.displayName = "ConditionNode";