Skip to content

feat: link existing screens as state variants via drag#16

Merged
trmquang93 merged 1 commit intomainfrom
feat/link-existing-screen-as-state-variant
Mar 29, 2026
Merged

feat: link existing screens as state variants via drag#16
trmquang93 merged 1 commit intomainfrom
feat/link-existing-screen-as-state-variant

Conversation

@trmquang93
Copy link
Copy Markdown
Collaborator

Summary

  • When dragging a connection between two screens, a popup now asks "Navigate" or "State Variant" — similar to the existing conditional branch prompt
  • Choosing State Variant links the target screen into the source screen's state group using the existing stateGroup/stateName system
  • New linkAsState(screenId, parentScreenId) function in useScreenManager handles the grouping logic with proper undo support
  • Clicking away from the prompt defaults to "Navigate" (preserves existing drag-to-connect behavior)

Test plan

  • Drag a connection from screen A to screen B — verify the "Connection type?" popup appears
  • Click "Navigate" — verify a normal navigation connection is created
  • Drag again and click "State Variant" — verify both screens join the same state group with dashed connector
  • Verify sidebar shows sibling states when selecting a linked screen
  • Verify undo (Ctrl+Z) reverses the state link
  • Verify existing conditional prompt still works (drag a second connection from a screen that already has one)
  • npm test passes (281 tests, including 7 new linkAsState tests)
  • npm run build succeeds

When dragging a connection from one screen to another, a popup now asks
the user to choose between "Navigate" (creates a navigation connection)
and "State Variant" (links the target screen into the source's state
group). This enables users to assign existing screens as state variants
without having to create new blank screens.
@trmquang93 trmquang93 merged commit 75d021d into main Mar 29, 2026
1 check passed
@github-actions github-actions bot deleted the feat/link-existing-screen-as-state-variant branch March 29, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant