feat: add template flows for common mobile app patterns#20
Merged
trmquang93 merged 2 commits intomainfrom Apr 2, 2026
Merged
Conversation
Pre-built flow templates (Auth, Onboarding, Settings, Tab Bar, E-Commerce, Social Feed) that users can insert onto the canvas to eliminate cold-start. Each template includes wireframe screen images, hotspots with configured actions/API endpoints, and connections between screens. Templates are code-split via dynamic imports and IDs are regenerated on insert to prevent conflicts.
- Extract makeHotspot() factory to eliminate boilerplate across templates - Use MERGE_GAP from constants instead of local SCREEN_GAP - Deduplicate TemplateIcon (shared component with size/stroke props) - Remove unnecessary useState for hover (use direct style mutation) - Fix setLoading not reset on success path in TemplateBrowserModal - Remove unnecessary async from insertTemplate - Replace magic 390 with derived SCREEN_HEIGHT_ESTIMATE constant - Import theme colors in wireframe.js instead of hardcoding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tkeyboard shortcutimport()and IDs are regenerated on insert to prevent conflictsNew files
src/templates/-- 6 template data files + wireframe SVG generator + registry indexsrc/utils/mergeFlowAtPosition.js-- Centers template at viewport position, delegates tomergeFlow()for ID remappingsrc/hooks/useTemplateInserter.js-- Computes viewport center and inserts template datasrc/components/TemplateBrowserModal.jsx-- Modal with 2-column grid of template cardsModified files
Drawd.jsx,ModalsLayer.jsx,CanvasArea.jsx,TopBar.jsx,ToolBar.jsx-- Wire up template state and callbacksEmptyState.jsx-- Add interactive "Start from Template" buttonuseKeyboardShortcuts.js,ShortcutsPanel.jsx-- AddTshortcutuserGuide.md-- Document template flows featureTest plan
mergeFlowAtPosition, 16 for template data validation)T-- template browser opens