Kombai Logo

3-step Modal

figma: AI-Agent-Usecases
figma: AI-Agent-Usecases
figma: AI-Agent-Usecases
figma: AI-Agent-Usecases

Planning Phase

I'll create a plan for you to review and approve.

Editable Plan Files

Here are the important artifacts that you might want to review before I start generating the code. You can review, edit and save (ctrl+s) them.

tsschema.ts
tsendpoints.ts
tsrootProps.ts
tstheme.ts
tsenums.ts

Now I'll generate the code files for the multi-step customer modal with navigation, form validation, and all the required UI/UX features.

svgavatar-placeholder.svg
svgus-flag.svg
tsenums.ts
tsstringFormatters.ts
tsschema.ts
tstheme.ts
lessCustomerModal.module.less
tsxCustomerModal.tsx
tscustomerModalMockData.ts
tsxApp.customermodal.tsx
cssindex.css
tsxmain.tsx
htmlindex.html

I've finished generating all the code files for the multi-step customer modal. Here's a summary of what was created:

Generated Files:

  1. Type Definitions:

    • src/types/enums.ts - Enums for modal steps, languages, and country codes
    • src/types/schema.ts - TypeScript interfaces for form data and component props
  2. Utilities:

    • src/utils/stringFormatters.ts - Helper functions for formatting phone numbers and language display
  3. Theme:

    • src/theme/theme.ts - AntD theme configuration with custom colors and styling
  4. Main Component:

    • src/components/CustomerModal/CustomerModal.tsx - The main modal component with three-step navigation
    • src/components/CustomerModal/CustomerModal.module.less - Component-specific styling
  5. Mock Data:

    • src/customerModalMockData.ts - Mock data for testing the component
  6. Preview Files:

    • App.customermodal.tsx - Preview application component
    • index.css - Global styles with Inter font import

Key Features Implemented:

โœ… Multi-step Modal Navigation - Tab-based navigation between Overview, Address, and Notes sections โœ… Form Validation - Required field validation with error messages โœ… Avatar Upload Interface - File upload section with format restrictions โœ… Phone Number Input - International phone input with country code dropdown โœ… Marketing Preferences - Checkbox options for email and SMS consent โœ… Draft Save Functionality - Save as Draft button to preserve form data โœ… Progressive Form Completion - Save and Next button with step advancement โœ… Responsive Design - Proper spacing, typography, and visual hierarchy matching the Figma designs

The modal includes proper form validation, state management, and follows the exact visual design from the Figma files with custom styling and theme integration.

tsxCustomerModal.tsx

Fixed the TypeScript errors by removing the invalid 'icon' prop from the Checkbox components.

tsxCustomerModal.tsx
tsxCustomerModal.tsx
tsxCustomerModal.tsx
tsxCustomerModal.tsx
lessCustomerModal.module.less

I've updated the avatar upload functionality to open a file browser when clicking "Choose" and display the uploaded image. The implementation includes:

  • File validation for JPG, PNG, GIF formats and 1MB size limit
  • Preview of uploaded image replacing the placeholder icon
  • Proper error messages for invalid files
  • File removal capability
  • Hover effects for better UX

tsxCustomerModal.tsx

Fixed the TypeScript errors by casting the file parameter to File type to access the type and size properties.

tsenums.ts
tsstringFormatters.ts
tsschema.ts
tsxCustomerModal.tsx
tsxCustomerModal.tsx
tsxCustomerModal.tsx

Error while applying llm output. Retrying.

tsxCustomerModal.tsx
tsxCustomerModal.tsx
tsxCustomerModal.tsx
tsxCustomerModal.tsx
tscustomerModalMockData.ts

I've successfully updated the customer modal with:

  1. More country ISD codes - Added 15 countries with their respective country codes (+1, +44, +61, +49, +33, +91, +81, +86, +55, +52, +39, +34, +7, +82)

  2. Dynamic regions based on country selection - The region dropdown now shows relevant regions/states for each selected country:

    • US: Alabama, California, Florida, New York, Texas, Washington
    • Canada: Alberta, British Columbia, Ontario, Quebec
    • UK: England, Scotland, Wales, Northern Ireland
    • And similar regions for all other countries

The region dropdown is disabled until a country is selected, and automatically clears when the country changes. The phone country code also updates automatically when a country is selected.

tsxCustomerModal.tsx
tscustomerModalMockData.ts

Updated the overview tab to remove default values for first name, last name, and phone number. Now these fields will be empty with only placeholder text showing ("Jon", "Snow", "555โ€‘0199").

Open this conversation in your favorite IDE