/* === editable.jsx =================================================== Inline edit infrastructure: any text/number in the preview can be click-to-edited when state.editMode is on. Edits are stored in state.edits keyed by a stable id, so they persist across renders and screen switches. ===================================================================== */ /* Context exposes the edits map + mode toggle to descendants. */ const EditsContext = React.createContext({ edits: {}, editMode: false, setEdit: () => {}, }); function EditsProvider({ edits, editMode, onChange, children }) { const value = React.useMemo(() => ({ edits, editMode, setEdit: (id, val) => onChange({ ...edits, [id]: val }), }), [edits, editMode, onChange]); return {children}; } const useEdits = () => React.useContext(EditsContext); /* ----- Editable text/number ---------------------------------------- Clickable when editMode is on. Renders as a styled normally, swaps to /