import { useState } from "react"; import { useAuth } from "@/hooks/useAuth"; import { useLocation } from "wouter"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import { Badge } from "@/components/ui/badge"; import { Separator } from "@/components/ui/separator"; import { Switch } from "@/components/ui/switch"; import { Progress } from "@/components/ui/progress"; import { CheckCircle, ArrowRight, User, Briefcase, Calendar, Clock, MapPin, Phone, Users } from "lucide-react"; export default function OnboardingPage() { const { user, updateProfile } = useAuth(); const [, setLocation] = useLocation(); const [currentStep, setCurrentStep] = useState(1); const [formData, setFormData] = useState({ // Professional profile fields businessName: "", bio: "", specializations: "", address: "", phoneNumber: "", allowAppointmentBooking: false, // Availability settings workingHours: { monday: { enabled: true, start: "09:00", end: "17:00" }, tuesday: { enabled: true, start: "09:00", end: "17:00" }, wednesday: { enabled: true, start: "09:00", end: "17:00" }, thursday: { enabled: true, start: "09:00", end: "17:00" }, friday: { enabled: true, start: "09:00", end: "17:00" }, saturday: { enabled: false, start: "09:00", end: "17:00" }, sunday: { enabled: false, start: "09:00", end: "17:00" }, } }); const totalSteps = user?.role === "pro" ? 3 : 2; const progress = (currentStep / totalSteps) * 100; const handleInputChange = (field: string, value: any) => { setFormData(prev => ({ ...prev, [field]: value })); }; const handleNext = () => { if (currentStep < totalSteps) { setCurrentStep(currentStep + 1); } }; const handleBack = () => { if (currentStep > 1) { setCurrentStep(currentStep - 1); } }; const handleComplete = async () => { try { await updateProfile({ onboardingComplete: true, businessName: formData.businessName || null, bio: formData.bio || null, specializations: formData.specializations ? formData.specializations.split(',').map(s => s.trim()).join(',') : null, address: formData.address || null, phoneNumber: formData.phoneNumber || null, allowAppointmentBooking: formData.allowAppointmentBooking, }); setLocation("/dashboard"); } catch (error) { console.error("Failed to complete onboarding:", error); } }; const renderStep1 = () => (
Let's set up your account to get the most out of your experience.
Set up your professional information for better networking and discovery.
Let clients book appointments with you online
Set your working hours for appointment booking.