From 5fefad6c3c5afc434c4cef379dad638a5a52901d Mon Sep 17 00:00:00 2001 From: Hyein Date: Wed, 24 Jun 2026 15:50:19 +0900 Subject: [PATCH] Improve minimap relation interactions --- src/App.jsx | 246 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 197 insertions(+), 49 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index bb1ad2f..076803b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -550,7 +550,8 @@ function FlowRow({ onAddStep, onRemoveStep, onMoveStep, - onProgramDelete + onProgramDelete, + rowRef }) { const activeIndex = steps.findIndex((step) => step.id === activeStep); @@ -631,6 +632,7 @@ function FlowRow({ return (
))} @@ -2312,11 +2316,17 @@ function RelationTreePanel({ + + + {relations.map((relation) => { const from = miniNodePositions[relation.from.id]; const to = miniNodePositions[relation.to.id]; if (!from || !to) return null; + const selectedToId = groupRepresentativeMap[relation.toGroupKey] ?? relation.to.id; + const relationId = `${relation.from.id}->${selectedToId}`; + const isSelectedRelation = selectedRelationId === relationId; const toGroupBox = mergeGroupBoxMap[relation.toGroupKey]; const fromLevel = levelMap[relation.from.id] ?? 0; const toLevel = levelMap[relation.to.id] ?? 0; @@ -2351,17 +2361,50 @@ function RelationTreePanel({ : Math.abs(fromCenterX - toCenterX) < 6 ? `M ${fromCenterX} ${startY} L ${toCenterX} ${endY - 8}` : `M ${fromCenterX} ${startY} C ${fromCenterX} ${midY}, ${toCenterX} ${midY}, ${toCenterX} ${endY - 8}`; + const handleRelationClick = (event) => { + event.stopPropagation(); + onRelationSelect?.(relation.from.id, selectedToId); + }; + const stopRelationDrag = (event) => { + event.stopPropagation(); + }; return ( - + + + {isSelectedRelation && ( + + )} + + ); })} @@ -2373,7 +2416,11 @@ function RelationTreePanel({ + {isEditing ? ( + updateProgramLinkLabel(representativeId, event.target.value)} + className="mt-2 w-full rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm font-bold text-slate-700 outline-none focus:border-blue-400" + /> + ) : ( +

+ {label} +

+ )} + + ); + })} + +
+ ); + }; const getProgramReviewItems = (program) => buildReviewItems( program.id, program.steps, @@ -3165,6 +3331,8 @@ export default function App() { programs={programs} onProgramClick={openProgramWindow} onOpenComparePair={openComparePair} + onRelationSelect={selectRelation} + selectedRelationId={selectedRelationId} onOpenRelationPopup={() => setIsRelationPopupOpen(true)} sidebarWidth={1280} onSidebarWidthChange={() => {}} @@ -3211,8 +3379,10 @@ export default function App() { > setIsRelationPopupOpen(true)} onOpenMapWindow={openRelationMapWindow} sidebarWidth={sidebarWidth} @@ -3260,6 +3430,9 @@ export default function App() { onAddStep={() => addStep('cheonjiin')} onRemoveStep={(index) => removeStep('cheonjiin', index)} onMoveStep={(index, nextIndex) => moveStep('cheonjiin', index, nextIndex)} + rowRef={(node) => { + programSectionRefs.current.cheonjiin = node; + }} accent={{ iconBg: 'bg-teal-50', iconText: 'text-teal-700', @@ -3267,23 +3440,7 @@ export default function App() { arrowText: 'text-teal-600' }} /> - -
-
- -
- {isEditing ? ( - updateProgramLinkLabel('wayPrimal', event.target.value)} - className="min-w-[360px] rounded-full border border-slate-200 bg-white/85 px-3 py-2 text-sm font-bold text-slate-700 outline-none focus:border-indigo-400" - /> - ) : ( -
- {content.wayPrimal.linkLabel} -
- )} -
+ {renderRelationBlock(programById.cheonjiin)} addStep('wayPrimal')} onRemoveStep={(index) => removeStep('wayPrimal', index)} onMoveStep={(index, nextIndex) => moveStep('wayPrimal', index, nextIndex)} + rowRef={(node) => { + programSectionRefs.current.wayPrimal = node; + }} accent={{ iconBg: 'bg-indigo-50', iconText: 'text-indigo-700', @@ -3311,26 +3471,10 @@ export default function App() { arrowText: 'text-indigo-600' }} /> + {renderRelationBlock(programById.wayPrimal)} {content.extraPrograms.map((program, programIndex) => ( -
-
- -
- {isEditing ? ( - updateProgramLinkLabel(program.id, event.target.value)} - className="min-w-[360px] rounded-full border border-slate-200 bg-white/85 px-3 py-2 text-sm font-bold text-slate-700 outline-none focus:border-blue-400" - /> - ) : ( -
- {program.linkLabel ?? `이전 프로그램 산출물을 ${program.name} 입력으로 연계`} -
- )} -
- {isEditing && (
@@ -3396,6 +3540,9 @@ export default function App() { onRemoveStep={(index) => removeStep(program.id, index)} onMoveStep={(index, nextIndex) => moveStep(program.id, index, nextIndex)} onProgramDelete={() => removeProgram(programIndex)} + rowRef={(node) => { + programSectionRefs.current[program.id] = node; + }} accent={{ iconBg: 'bg-blue-50', iconText: 'text-blue-700', @@ -3403,6 +3550,7 @@ export default function App() { arrowText: 'text-blue-600' }} /> + {renderRelationBlock(programById[program.id])} ))}