feat: Add No Website button to onboarding Step 2 with business description form

This commit is contained in:
Om-Singh1808
2025-09-04 04:29:56 +05:30
committed by DikshaDisciplines
parent f715d3edbb
commit dca2318235
2 changed files with 45 additions and 18 deletions

View File

@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react';
import { Box, Button, TextField, Typography, Card, CardContent, CircularProgress, Alert } from '@mui/material';
import { ArrowBack as ArrowBackIcon, Save as SaveIcon, CheckCircle as CheckCircleIcon } from '@mui/icons-material';
import { businessInfoApi, BusinessInfo } from '../../api/businessInfo';
import { onboardingCache } from '../../services/onboardingCache';
interface BusinessDescriptionStepProps {
onBack: () => void;
@@ -20,17 +19,6 @@ const BusinessDescriptionStep: React.FC<BusinessDescriptionStepProps> = ({ onBac
const [error, setError] = useState<string | null>(null);
const [success, setSuccess] = useState<string | null>(null);
useEffect(() => {
console.log('🔄 BusinessDescriptionStep mounted. Loading cached data...');
const cachedData = onboardingCache.getStepData(2)?.businessInfo;
if (cachedData) {
setFormData(cachedData);
console.log('✅ Loaded cached business info:', cachedData);
} else {
console.log(' No cached business info found.');
}
}, []);
const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
const { name, value } = e.target;
setFormData(prev => ({ ...prev, [name]: value }));
@@ -51,10 +39,6 @@ const BusinessDescriptionStep: React.FC<BusinessDescriptionStepProps> = ({ onBac
console.log('✅ Business info saved to DB:', response);
setSuccess('Business information saved successfully!');
// Also save to cache for consistency with other steps
onboardingCache.saveStepData(2, { businessInfo: response, hasWebsite: false });
console.log('✅ Business info saved to cache.');
setTimeout(() => {
onContinue();
}, 1500); // Give user time to see success message
@@ -90,7 +74,7 @@ const BusinessDescriptionStep: React.FC<BusinessDescriptionStepProps> = ({ onBac
rows={4}
margin="normal"
required
helperText={`${formData.business_description?.length || 0}/1000 characters`}
helperText={`${formData.business_description.length}/1000 characters`}
inputProps={{ maxLength: 1000 }}
disabled={loading}
/>
@@ -101,7 +85,7 @@ const BusinessDescriptionStep: React.FC<BusinessDescriptionStepProps> = ({ onBac
onChange={handleChange}
fullWidth
margin="normal"
helperText={`${formData.industry?.length || 0}/100 characters`}
helperText={`${formData.industry.length}/100 characters`}
inputProps={{ maxLength: 100 }}
disabled={loading}
/>