App Component
The root application component that orchestrates the entire form builder interface. Location:main/frontend/src/App.tsx
State Management
The App component manages the following state:Current view mode of the application
Zoom level for the edit view (50-200)
Currently selected HubSpot form ID
Generated HubL module blob ready for download
Whether module generation is in progress
Key Features
- Integrates drag-and-drop functionality via
@dnd-kit - Manages zoom controls for canvas
- Handles module generation and download
- Coordinates between edit and preview modes
Usage Example
Sidebar
The left panel containing connection status, form selector, layout options, and field palette. Location:main/frontend/src/components/Sidebar.tsx
Props
Whether HubSpot OAuth connection is active
Callback to refresh connection status
Array of available HubSpot forms
Whether forms are currently loading
Error message if form loading failed
Currently selected form ID
Callback when a form is selected
Form schema containing field definitions
Whether schema is currently loading
Error message if schema loading failed
HubSpotForm Type
Sections
The Sidebar contains four main sections:- Connection - HubSpotConnect component
- Select Form - FormSelector component
- Layout Options - Mode selector and step management
- Detected Fields - Draggable field palette
Usage Example
LayoutBuilder
The canvas component that displays the form layout with draggable fields and steps. Location:main/frontend/src/components/LayoutBuilder.tsx
Props
Form schema containing field definitions
Visual indicators for drop positions during drag operations
Features
- Renders sortable steps using
@dnd-kit/sortable - Each step contains rows of fields
- Fields can be dragged within and between rows
- Steps can be renamed and deleted (minimum 1 step required)
- Required fields cannot be deleted
Child Components
SortableStep
Internal component for rendering individual steps. Props:Step data containing id, title, and rows
All available fields from the form schema
Callback to rename a step
Callback to delete the step
Callback to remove a field from the step
Whether the step can be deleted
Drop position indicators
FieldItem
Internal component for rendering individual fields. Props:Unique field identifier
Display label for the field
Whether the field is required
Current drop position indicator
Callback to delete the field
Usage Example
PreviewPanel
Interactive form preview with validation and multi-step navigation. Location:main/frontend/src/components/PreviewPanel.tsx
Props
Form schema containing field definitions
Current layout configuration
Features
- Renders form using Shadow DOM for style isolation
- Full form validation (required fields, email, phone)
- Multi-step navigation with progress indicators
- Simulated form submission
- Responsive field rendering
Field Types Supported
Supported Field Types
Supported Field Types
text- Single-line text inputemail- Email input with validationphone- Phone number input with validationnumber- Numeric inputtextarea- Multi-line text inputselect/dropdown- Dropdown selectionradio- Radio button groupcheckbox- Single checkboxmultiple_checkboxes- Multiple checkbox group
Validation Rules
Field must have a non-empty value
Must match email regex:
/^[^\s@]+@[^\s@]+\.[^\s@]+$/Must match phone regex for international formats
State Management
Index of currently displayed step
User-entered form values
Validation error messages by field name
Whether form has been successfully submitted
Usage Example
FormSelector
Dropdown for selecting a HubSpot form with schema preview. Location:main/frontend/src/components/FormSelector.tsx
Props
Whether HubSpot OAuth connection is active
Available forms to select from
Loading state for forms list
Error message if any
Currently selected form ID
Callback when selection changes
Schema of selected form
Loading state for schema
Schema loading error
Features
- Displays forms in a dropdown
- Shows field types for selected form
- Handles session expiration with reconnect prompt
- Empty state when no forms available
Usage Example
HubSpotConnect
OAuth connection status and control component. Location:main/frontend/src/components/HubSpotConnect.tsx
Props
Current connection status
Callback to refresh connection status
Features
- Connected State: Shows status badge, refresh button, and logout button
- Disconnected State: Shows connect button that redirects to OAuth flow
- Confirms before logout
- Reloads page after successful logout
API Endpoints Used
Redirects to HubSpot OAuth authorization
Clears OAuth session
Usage Example
DetectedFieldItem
Internal component for draggable field items in the sidebar palette. Location:main/frontend/src/components/Sidebar.tsx
Props
Field schema containing name, label, type, and required flag
Features
- Uses
useDraggablefrom@dnd-kit/core - Visual feedback during drag
- Shows required badge for required fields
- ID format:
palette:{fieldName}
