Spaces:
Running
Running
Commit ·
c98b323
1
Parent(s): 2f6e9e4
feat: add goal node settings modal, hotbar progress slider and subtask constraints
Browse filesFiles changed (3)
12345678910111213141516173 unmodified lines212223242526272829303132333435368 unmodified lines454647484950515253545556575859606162636465666768697071727374757677787980815 unmodified lines87888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179import React, { useState, useRef, useEffect } from 'react';import { Handle, Position, useReactFlow } from '@xyflow/react';import { CheckCircle2, Circle, X, ArrowRight, Sparkles, AlertCircle, CheckSquare } from 'lucide-react';import { useTranslation } from 'react-i18next';import { isDefaultLabel } from '../../utils';const SketchNode = ({ id, data, selected }) => {const { setNodes } = useReactFlow();const { t } = useTranslation();const [isEditing, setIsEditing] = useState(false);const [editData, setEditData] = useState({label: isDefaultLabel(data.label) ? '' : data.label,description: data.description || ''});const [showWarning, setShowWarning] = useState(false);const warningTimeoutRef = useRef(null);3 unmodified lines};}, []);// Synchronize local editData with incoming WebRTC data updates when not actively editinguseEffect(() => {if (!isEditing) {setEditData({label: isDefaultLabel(data.label) ? '' : data.label,description: data.description || ''});}}, [data.label, data.description, isEditing]);const toggleDone = (e) => {e.stopPropagation();8 unmodified lines}const newStatus = data.status === 'Done' ? 'Pending' : 'Done';if (data.updateNodeData) {data.updateNodeData(id, { status: newStatus });} else {setNodes((nds) =>nds.map((node) =>node.id === id ? { ...node, data: { ...node.data, status: newStatus } } : node));}};const handleDoubleClick = (e) => {e.stopPropagation();setIsEditing(true);setEditData({label: isDefaultLabel(data.label) ? '' : data.label,description: data.description || ''});};const saveEdit = () => {if (data.updateNodeData) {data.updateNodeData(id, { label: editData.label, description: editData.description });} else {setNodes((nds) =>nds.map((node) =>node.id === id ? { ...node, data: { ...node.data, label: editData.label, description: editData.description } } : node));}setIsEditing(false);};const getStatusColor = (status) => {5 unmodified lines}};return (<divonDoubleClick={handleDoubleClick}className={`px-4 py-3 min-w-[200px] max-w-[300px] rough-border bg-surface-container-lowest transition-all group ${selected ? 'shadow-[6px_6px_0px_0px_rgba(52,211,153,0.3)] dark:shadow-[6px_6px_0px_0px_rgba(52,211,153,0.3)] -translate-y-1 border-emerald-400 ring-4 ring-emerald-400/20 scale-[1.01]' : ''} ${data.status === 'Done' ? 'opacity-80' : ''} ${data.isNextStep ? 'ring-4 ring-success/30 ring-offset-2 ring-offset-background shadow-[0_0_20px_rgba(34,197,94,0.2)]' : ''}`}><Handle type="target" position={Position.Top} id="main-target" className="!bg-primary !w-3 !h-3 !border-2 !border-white" /><Handle type="source" position={Position.Bottom} id="main-source" className="!bg-primary !w-3 !h-3 !border-2 !border-white" /><Handle type="target" position={Position.Left} id="subgoals-target-left" className="!bg-yellow-500 !w-3 !h-3 !border-2 !border-white" /><Handle type="source" position={Position.Left} id="subgoals-source-left" className="!bg-yellow-500 !w-3 !h-3 !border-2 !border-white !opacity-0" />{isEditing ? (<div className="flex flex-col gap-2 p-1" onKeyDown={(e) => e.key === 'Enter' && saveEdit()}><inputautoFocusclassName="text-lg font-display-lg border-b-2 border-primary outline-none w-full bg-transparent text-primary nodrag"onMouseDown={(e) => e.stopPropagation()}onPointerDown={(e) => e.stopPropagation()}value={editData.label}placeholder={t('canvas.new_goal', 'New Goal')}onChange={(e) => setEditData({...editData, label: e.target.value})}/><textareaclassName="text-sm font-accent-note outline-none w-full h-12 resize-none bg-transparent text-primary nodrag"onMouseDown={(e) => e.stopPropagation()}onPointerDown={(e) => e.stopPropagation()}placeholder="Add description..."value={editData.description}onChange={(e) => setEditData({...editData, description: e.target.value})}/><div className="flex justify-end gap-2 mt-2"><button onClick={() => setIsEditing(false)} className="p-1 hover:text-error cursor-pointer"><X size={16}/></button><button onClick={saveEdit} className="p-1 hover:text-success cursor-pointer"><CheckCircle2 size={16}/></button></div></div>) : (<div className="flex flex-col gap-2 pointer-events-none"><div className="flex justify-between items-start gap-4 pointer-events-none"><div className="flex items-center gap-2 pointer-events-none"><button onClick={toggleDone} className="transition-colors hover:scale-110 cursor-pointer pointer-events-auto">{data.status === 'Done' ?<CheckCircle2 size={20} className="text-success fill-success/10" /> :<Circle size={20} className="text-on-surface-variant/30" />}</button><span className="font-display-lg text-xl text-primary leading-tight break-words pointer-events-none">{isDefaultLabel(data.label) ? t('canvas.new_goal', 'New Goal') : data.label}</span></div>{data.isNextStep && <ArrowRight size={18} className="text-success animate-bounce-x pointer-events-none" />}</div>{data.description && (<p className="text-sm font-accent-note text-on-surface-variant line-clamp-2 italic pointer-events-none">{data.description}</p>)}{data.subgoals && data.subgoals.total > 0 && (<div className="mt-1 flex items-center gap-1.5 text-[10px] font-bold text-secondary bg-secondary/5 px-2 py-1 rounded-sm border border-secondary/10 w-fit pointer-events-none"><CheckSquare size={11} className="text-secondary pointer-events-none" /><span className="pointer-events-none">{t('canvas.subgoals_progress', { done: data.subgoals.done, total: data.subgoals.total })}</span></div>)}{showWarning && (<div className="mt-1.5 p-1.5 rounded-sm bg-red-500/10 border border-red-500/30 flex items-center gap-1.5 text-[10px] font-bold text-red-600 dark:text-red-400 animate-shake shadow-sm pointer-events-none"><AlertCircle size={12} className="text-red-500 shrink-0 pointer-events-none" /><span className="pointer-events-none">{t('canvas.subgoal_warning')}</span></div>)}<div className="flex items-center justify-between mt-1 pointer-events-none"><span className={`text-[8px] font-bold uppercase tracking-widest px-2 py-0.5 rounded-sm border pointer-events-none ${getStatusColor(data.status)}`}>{data.status}</span><div className="flex items-center gap-2 pointer-events-none">{data.ai && <Sparkles size={12} className="text-secondary animate-pulse pointer-events-none" />}</div></div></div>)}<Handle type="target" position={Position.Right} id="subgoals-target-right" className="!bg-yellow-500 !w-3 !h-3 !border-2 !border-white !opacity-0" /><Handle type="source" position={Position.Right} id="subgoals-source-right" className="!bg-yellow-500 !w-3 !h-3 !border-2 !border-white" />1234567891011123 unmodified lines1617181920218 unmodified lines30313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293945 unmodified lines100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202import React, { useState, useRef, useEffect } from 'react';import { Handle, Position, useReactFlow } from '@xyflow/react';import { CheckCircle2, Circle, X, ArrowRight, Sparkles, AlertCircle, CheckSquare, Settings } from 'lucide-react';import { useTranslation } from 'react-i18next';import { isDefaultLabel } from '../../utils';const SketchNode = ({ id, data, selected }) => {const { setNodes } = useReactFlow();const { t } = useTranslation();const [showWarning, setShowWarning] = useState(false);const warningTimeoutRef = useRef(null);3 unmodified lines};}, []);const toggleDone = (e) => {e.stopPropagation();8 unmodified lines}const newStatus = data.status === 'Done' ? 'Pending' : 'Done';const newProgress = newStatus === 'Done' ? 100 : 0;if (data.updateNodeData) {data.updateNodeData(id, {status: newStatus,progress: data.showProgress ? newProgress : (data.progress || 0)});} else {setNodes((nds) =>nds.map((node) =>node.id === id ? {...node,data: {...node.data,status: newStatus,progress: data.showProgress ? newProgress : (data.progress || 0)}} : node));}};const handleProgressChange = (e) => {e.stopPropagation();const val = parseInt(e.target.value, 10);// Check if subgoals constraint is satisfiedif (val === 100 && data.subgoals && data.subgoals.done < data.subgoals.total) {setShowWarning(true);if (warningTimeoutRef.current) clearTimeout(warningTimeoutRef.current);warningTimeoutRef.current = setTimeout(() => {setShowWarning(false);}, 3000);// Cap progress at 99% and status to PendingupdateProgress(99, 'Pending');return;}const newStatus = val === 100 ? 'Done' : 'Pending';updateProgress(val, newStatus);};const updateProgress = (progressVal, newStatus) => {if (data.updateNodeData) {data.updateNodeData(id, { progress: progressVal, status: newStatus });} else {setNodes((nds) =>nds.map((node) =>node.id === id ? { ...node, data: { ...node.data, progress: progressVal, status: newStatus } } : node));}};const openConfigureModal = (e) => {e.stopPropagation();window.dispatchEvent(new CustomEvent('configure-sketch-node', { detail: { nodeId: id } }));};const getStatusColor = (status) => {5 unmodified lines}};const progressValue = data.progress !== undefined ? data.progress : 0;return (<divonDoubleClick={openConfigureModal}className={`px-4 py-3 min-w-[220px] max-w-[320px] rough-border bg-surface-container-lowest transition-all group relative ${selected ? 'shadow-[6px_6px_0px_0px_rgba(52,211,153,0.3)] dark:shadow-[6px_6px_0px_0px_rgba(52,211,153,0.3)] -translate-y-1 border-emerald-400 ring-4 ring-emerald-400/20 scale-[1.01]' : ''} ${data.status === 'Done' ? 'opacity-80' : ''} ${data.isNextStep ? 'ring-4 ring-success/30 ring-offset-2 ring-offset-background shadow-[0_0_20px_rgba(34,197,94,0.2)]' : ''} ${showWarning ? 'animate-shake' : ''}`}><Handle type="target" position={Position.Top} id="main-target" className="!bg-primary !w-3 !h-3 !border-2 !border-white" /><Handle type="source" position={Position.Bottom} id="main-source" className="!bg-primary !w-3 !h-3 !border-2 !border-white" /><Handle type="target" position={Position.Left} id="subgoals-target-left" className="!bg-yellow-500 !w-3 !h-3 !border-2 !border-white" /><Handle type="source" position={Position.Left} id="subgoals-source-left" className="!bg-yellow-500 !w-3 !h-3 !border-2 !border-white !opacity-0" /><div className="flex flex-col gap-2"><div className="flex justify-between items-start gap-2"><div className="flex items-center gap-2 flex-1 min-w-0"><button onClick={toggleDone} className="transition-colors hover:scale-110 cursor-pointer shrink-0">{data.status === 'Done' ?<CheckCircle2 size={20} className="text-success fill-success/10" /> :<Circle size={20} className="text-on-surface-variant/30" />}</button><span className="font-display-lg text-lg text-primary leading-tight break-words flex-1 min-w-0">{isDefaultLabel(data.label) ? t('canvas.new_goal', 'New Goal') : data.label}</span></div><div className="flex items-center gap-1 shrink-0">{data.isNextStep && <ArrowRight size={18} className="text-success animate-bounce-x" />}<buttononClick={openConfigureModal}className="opacity-0 group-hover:opacity-100 transition-opacity p-1 text-on-surface-variant/70 hover:text-primary hover:bg-primary/5 rounded-full cursor-pointer pointer-events-auto shrink-0"title={t('canvas.configure', 'Configure')}><Settings size={14} /></button></div></div>{data.description && (<p className="text-sm font-accent-note text-on-surface-variant line-clamp-2 italic">{data.description}</p>)}{data.subgoals && data.subgoals.total > 0 && (<div className="mt-0.5 flex items-center gap-1.5 text-[10px] font-bold text-secondary bg-secondary/5 px-2 py-1 rounded-sm border border-secondary/10 w-fit"><CheckSquare size={11} className="text-secondary" /><span>{t('canvas.subgoals_progress', { done: data.subgoals.done, total: data.subgoals.total })}</span></div>)}{data.showProgress && (<div className="mt-2 flex flex-col gap-1 nodrag" onMouseDown={e => e.stopPropagation()}><div className="flex justify-between items-center text-[10px] font-bold text-on-surface-variant"><span>{t('canvas.progress_readiness', 'Readiness')}</span><span className="bg-primary/10 text-primary px-1.5 py-0.5 rounded-full font-mono text-[10px]">{progressValue}%</span></div><div className="relative flex items-center mt-1"><inputtype="range"min="0"max="100"value={progressValue}onChange={handleProgressChange}className="w-full h-2 rounded-lg appearance-none cursor-pointer focus:outline-none transition-all"style={{background: `linear-gradient(to right, var(--color-primary, #10b981) ${progressValue}%, var(--color-border, #e2e8f0) ${progressValue}%)`}}/></div></div>)}{showWarning && (<div className="mt-1.5 p-1.5 rounded-sm bg-red-500/10 border border-red-500/30 flex items-center gap-1.5 text-[10px] font-bold text-red-600 dark:text-red-400 animate-shake shadow-sm"><AlertCircle size={12} className="text-red-500 shrink-0" /><span>{t('canvas.subgoal_warning')}</span></div>)}<div className="flex items-center justify-between mt-1"><span className={`text-[8px] font-bold uppercase tracking-widest px-2 py-0.5 rounded-sm border ${getStatusColor(data.status)}`}>{data.status}</span><div className="flex items-center gap-2">{data.ai && <Sparkles size={12} className="text-secondary animate-pulse" />}</div></div></div><Handle type="target" position={Position.Right} id="subgoals-target-right" className="!bg-yellow-500 !w-3 !h-3 !border-2 !border-white !opacity-0" /><Handle type="source" position={Position.Right} id="subgoals-source-right" className="!bg-yellow-500 !w-3 !h-3 !border-2 !border-white" />
372 unmodified lines37337437537637737811 unmodified lines39039139239339439592 unmodified lines488489490491492493494372 unmodified linesconsole.error('Failed to parse habit decision JSON', e);}}}return {11 unmodified lineslastResetTime,createdAt,description: description || '',updateNodeData: updateNodeDataCallback}};92 unmodified linescreatedAt: n.data.createdAt || new Date().toISOString(),description: n.data.description || ''}): n.data.decision})),edges: edges.map(e => {let cond = e.sourceHandle;372 unmodified lines37337437537637737837938038138238338438538638738838939011 unmodified lines40240340440540640740840992 unmodified lines502503504505506507508509510511512513514515372 unmodified linesconsole.error('Failed to parse habit decision JSON', e);}}} else if (n.type === 'sketch') {if (n.decision && n.decision.startsWith('{')) {try {const parsed = JSON.parse(n.decision);description = parsed.description || '';progress = parsed.progress || 0;showProgress = !!parsed.showProgress;decision = parsed.decision || 'bottom';} catch (e) {console.error('Failed to parse sketch decision JSON', e);}}}return {11 unmodified lineslastResetTime,createdAt,description: description || '',progress: progress,showProgress: showProgress,updateNodeData: updateNodeDataCallback}};92 unmodified linescreatedAt: n.data.createdAt || new Date().toISOString(),description: n.data.description || ''}): n.type === 'sketch'? JSON.stringify({description: n.data.description || '',progress: n.data.progress || 0,showProgress: !!n.data.showProgress,decision: n.data.decision || 'bottom'}): n.data.decision})),edges: edges.map(e => {let cond = e.sourceHandle;
458 unmodified lines459460461462463464185 unmodified lines6506516526536546553 unmodified lines6596606616626636646656666676686695 unmodified lines6756766776786796809 unmodified lines690691692693694695304 unmodified lines100010011002100310041005458 unmodified lines);};// Initials extractor helper for collaborator cursor badgesconst getInitials = (name) => {if (!name) return '';185 unmodified linesconst [editingConditionNodeId, setEditingConditionNodeId] = useState(null);const [editingHabitNodeId, setEditingHabitNodeId] = useState(null);const [isShareModalOpen, setIsShareModalOpen] = useState(false);useEffect(() => {3 unmodified linesconst handleConfigureHabit = (e) => {setEditingHabitNodeId(e.detail.nodeId);};window.addEventListener('configure-condition-node', handleConfigureCondition);window.addEventListener('configure-habit-node', handleConfigureHabit);return () => {window.removeEventListener('configure-condition-node', handleConfigureCondition);window.removeEventListener('configure-habit-node', handleConfigureHabit);};}, []);5 unmodified linesreturn nodes.find(n => n.id === editingHabitNodeId);}, [nodes, editingHabitNodeId]);const handleSaveConditionConfig = (updatedData) => {if (!editingConditionNodeId) return;updateNodeData(editingConditionNodeId, updatedData);9 unmodified linessetEditingHabitNodeId(null);};const nodeTypes = useMemo(() => ({sketch: SketchNode,condition: ConditionNode,304 unmodified lines/>)}{isShareModalOpen && (<ShareModalprojectId={id}458 unmodified lines459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599185 unmodified lines7857867877887897907913 unmodified lines7957967977987998008018028038048058068078088098105 unmodified lines8168178188198208218228238248259 unmodified lines835836837838839840841842843844845846304 unmodified lines11511152115311541155115611571158115911601161116211631164458 unmodified lines);};// Premium digital sketchbook style settings modal for goal (sketch) nodesconst SketchSettingsModal = ({ node, onClose, onSave }) => {const { t } = useTranslation();const [label, setLabel] = useState(() =>isDefaultLabel(node.data.label) ? '' : node.data.label);const [description, setDescription] = useState(node.data.description || '');const [showProgress, setShowProgress] = useState(!!node.data.showProgress);const [progress, setProgress] = useState(node.data.progress || 0);const handleSave = () => {const status = progress === 100 ? 'Done' : 'Pending';onSave({label: label || t('canvas.goal_node', 'Goal'),description,showProgress,progress: Number(progress),status});};return (<div className="fixed inset-0 bg-primary/40 backdrop-blur-md z-[60] flex items-center justify-center p-4"><div className="bg-surface-container-lowest border-4 border-primary rounded-3xl p-8 max-w-md w-full shadow-[8px_8px_0px_0px_var(--color-primary)] relative transition-all">{/* Close Button */}<buttononClick={onClose}className="absolute top-6 right-6 p-1.5 bg-surface-container-lowest hover:bg-red-500/20 border-2 border-primary rounded-xl transition-all cursor-pointer shadow-[2px_2px_0px_0px_var(--color-primary)] hover:scale-105 text-primary"><X size={18} className="text-primary" /></button><h3 className="text-2xl font-display-lg text-primary mb-6 flex items-center gap-2"><Target size={24} className="text-primary animate-pulse" /><span>{t('canvas.goal_settings_title', 'Налаштування цілі')}</span></h3><div className="space-y-5">{/* Goal Name Input */}<div><label className="block text-[11px] font-bold uppercase tracking-widest text-primary/60 mb-2">{t('canvas.goal_name_label', 'Назва цілі')}</label><inputtype="text"value={label}onChange={(e) => setLabel(e.target.value)}placeholder={t('canvas.goal_name_placeholder', 'Введіть назву цілі')}className="w-full px-4 py-3 bg-secondary/10 border-2 border-primary rounded-xl font-bold text-primary focus:outline-none focus:bg-surface-container-lowest transition-all shadow-[2px_2px_0px_0px_rgba(49,54,63,0.1)]"/></div>{/* Description Input */}<div><label className="block text-[11px] font-bold uppercase tracking-widest text-primary/60 mb-2">{t('canvas.goal_description_label', 'Опис цілі')}</label><textareavalue={description}onChange={(e) => setDescription(e.target.value)}placeholder={t('canvas.goal_description_placeholder', 'Додайте опис цілі...')}className="w-full h-24 px-4 py-2.5 bg-secondary/10 border-2 border-primary rounded-xl font-bold text-primary focus:outline-none focus:bg-surface-container-lowest transition-all resize-none shadow-[2px_2px_0px_0px_rgba(49,54,63,0.1)] text-xs"/></div>{/* Show Progress Toggle */}<div className="flex items-center justify-between bg-secondary/5 border-2 border-primary rounded-xl p-4"><div><span className="block font-bold text-xs text-primary">{t('canvas.goal_progress_toggle', 'Трекер прогресу')}</span><span className="block text-[10px] text-primary/60">{t('canvas.goal_progress_desc', 'Відображати повзунок виконання цілі від 0% до 100%')}</span></div><label className="relative inline-flex items-center cursor-pointer select-none"><inputtype="checkbox"checked={showProgress}onChange={(e) => setShowProgress(e.target.checked)}className="sr-only peer"/><div className="w-11 h-6 bg-secondary/20 peer-focus:outline-none border-2 border-primary rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[4px] after:left-[4px] after:bg-primary after:border-primary after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-success/20"></div></label></div>{/* Progress Slider */}{showProgress && (<div className="border-2 border-primary rounded-2xl p-4 bg-secondary/5 space-y-3"><div className="flex items-center justify-between mb-1"><label className="block text-[11px] font-bold uppercase tracking-widest text-primary/60">{t('canvas.goal_progress_value', 'Готовність цілі')}</label><span className="px-2 py-0.5 bg-primary text-white font-extrabold text-xs rounded-lg border-2 border-primary shadow-[1.5px_1.5px_0px_0px_rgba(0,0,0,0.15)]">{progress}%</span></div><inputtype="range"min="0"max="100"value={progress}onChange={(e) => setProgress(Number(e.target.value))}className="w-full h-2 bg-secondary/20 rounded-lg appearance-none cursor-pointer accent-primary border-2 border-primary"/><div className="flex justify-between text-[9px] font-extrabold uppercase text-primary/40 px-1 pt-1"><span>0%</span><span>25%</span><span>50%</span><span>75%</span><span>100%</span></div></div>)}{/* Actions */}<div className="flex items-center gap-4 pt-2"><buttononClick={onClose}className="flex-1 py-3 text-xs font-bold uppercase tracking-wider text-primary border-2 border-primary rounded-xl bg-surface-container-lowest hover:bg-surface-variant transition-all cursor-pointer shadow-[3px_3px_0px_0px_var(--color-primary)] active:translate-y-0.5 active:shadow-[1px_1px_0px_0px_var(--color-primary)]">{t('common.cancel')}</button><buttononClick={handleSave}className="flex-1 py-3 text-xs font-bold uppercase tracking-wider text-white bg-primary hover:bg-primary/95 border-2 border-primary rounded-xl transition-all cursor-pointer shadow-[3px_3px_0px_0px_var(--color-primary)] active:translate-y-0.5 active:shadow-[1px_1px_0px_0px_var(--color-primary)]">{t('common.apply')}</button></div></div></div></div>);};// Initials extractor helper for collaborator cursor badgesconst getInitials = (name) => {if (!name) return '';185 unmodified linesconst [editingConditionNodeId, setEditingConditionNodeId] = useState(null);const [editingHabitNodeId, setEditingHabitNodeId] = useState(null);const [editingSketchNodeId, setEditingSketchNodeId] = useState(null);const [isShareModalOpen, setIsShareModalOpen] = useState(false);useEffect(() => {3 unmodified linesconst handleConfigureHabit = (e) => {setEditingHabitNodeId(e.detail.nodeId);};const handleConfigureSketch = (e) => {setEditingSketchNodeId(e.detail.nodeId);};window.addEventListener('configure-condition-node', handleConfigureCondition);window.addEventListener('configure-habit-node', handleConfigureHabit);window.addEventListener('configure-sketch-node', handleConfigureSketch);return () => {window.removeEventListener('configure-condition-node', handleConfigureCondition);window.removeEventListener('configure-habit-node', handleConfigureHabit);window.removeEventListener('configure-sketch-node', handleConfigureSketch);};}, []);5 unmodified linesreturn nodes.find(n => n.id === editingHabitNodeId);}, [nodes, editingHabitNodeId]);const editingSketchNode = useMemo(() => {return nodes.find(n => n.id === editingSketchNodeId);}, [nodes, editingSketchNodeId]);const handleSaveConditionConfig = (updatedData) => {if (!editingConditionNodeId) return;updateNodeData(editingConditionNodeId, updatedData);9 unmodified linessetEditingHabitNodeId(null);};const handleSaveSketchConfig = (updatedData) => {if (!editingSketchNodeId) return;updateNodeData(editingSketchNodeId, updatedData);setEditingSketchNodeId(null);};const nodeTypes = useMemo(() => ({sketch: SketchNode,condition: ConditionNode,304 unmodified lines/>)}{editingSketchNode && (<SketchSettingsModalnode={editingSketchNode}onClose={() => setEditingSketchNodeId(null)}onSave={handleSaveSketchConfig}/>)}{isShareModalOpen && (<ShareModalprojectId={id}
src/features/canvas/components/nodes/SketchNode.jsx+118-95
src/features/canvas/hooks/useCanvasLogic.js+22-1
src/pages/CanvasPage.jsx+159