refactor(scratchpad): unify editor transactions and interaction state#258
refactor(scratchpad): unify editor transactions and interaction state#258johnnyjoygh merged 1 commit intomainfrom
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (18)
📝 WalkthroughWalkthroughA comprehensive refactoring of the scratchpad editor introduces a centralized state management layer with explicit viewport/camera handling, pointer interaction utilities, and viewport persistence. Components are restructured to consume editor state and viewport props, with a new toolbar component extracting page-level controls. Documentation files detail the architectural problem statement, design goals, and implementation plan. Changes
Sequence DiagramsequenceDiagram
participant User
participant Component as UI Component<br/>(Workspace/CardItem)
participant Editor as useScratchpadEditor<br/>(State & Actions)
participant Reducer as Editor Reducer<br/>(State Logic)
participant Storage as Storage<br/>(localStorage)
User->>Component: Pointer interaction<br/>(drag/zoom/select)
Component->>Editor: Call action<br/>(setViewport/patchItem/selectItem)
Editor->>Editor: Assign transaction ID<br/>& marshal parameters
Editor->>Reducer: Dispatch with operations<br/>& persistence mode
Reducer->>Reducer: Apply operations<br/>compute changes
Reducer->>Editor: Return updated state
Editor->>Component: Update state<br/>trigger re-render
Component->>User: Render new viewport<br/>& item positions
alt Persistence: immediate or debounced
Editor->>Storage: Save items & viewport<br/>to localStorage
Storage->>Storage: Serialize & persist
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary by CodeRabbit
New Features
Documentation