diff --git a/src/App.jsx b/src/App.jsx index 83f4807..7b23b63 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1238,11 +1238,33 @@ function ProgramComparePopup({ programs, comparisons, onComparisonChange, onClos const rightProgram = programs.find((program) => program.id === rightProgramId); const comparison = comparisons.find((item) => item.leftProgramId === leftProgramId && item.rightProgramId === rightProgramId) ?? {}; + const leftSteps = leftProgram?.steps ?? []; + const rightSteps = rightProgram?.steps ?? []; + const stepMatches = comparison.stepMatches ?? []; const updateComparison = (field, value) => { if (!leftProgramId || !rightProgramId || leftProgramId === rightProgramId) return; onComparisonChange(leftProgramId, rightProgramId, field, value); }; + const createStepMatch = () => ({ + id: `${Date.now()}-${Math.random().toString(36).slice(2)}`, + leftStepIndex: '0', + rightStepIndex: '0', + reason: '' + }); + const addStepMatch = () => { + updateComparison('stepMatches', [...stepMatches, createStepMatch()]); + }; + const updateStepMatch = (matchIndex, field, value) => { + updateComparison( + 'stepMatches', + stepMatches.map((match, index) => (index === matchIndex ? { ...match, [field]: value } : match)) + ); + }; + const removeStepMatch = (matchIndex) => { + updateComparison('stepMatches', stepMatches.filter((_, index) => index !== matchIndex)); + }; + const getStepLabel = (step, index) => `${index + 1}. ${step?.title ?? '-'}`; const renderProgramSummary = (program) => { if (!program) return null; @@ -1298,7 +1320,13 @@ function ProgramComparePopup({ programs, comparisons, onComparisonChange, onClos 비교 프로그램 A