diff --git a/src/app/onboarding/page.tsx b/src/app/onboarding/page.tsx index 909484e..c601675 100644 --- a/src/app/onboarding/page.tsx +++ b/src/app/onboarding/page.tsx @@ -4,9 +4,9 @@ import { useState } from "react"; import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered'; import FooterBase from '@/components/sections/footer/FooterBase'; -import { ChevronRight, User, Heart } from 'lucide-react'; +import { ChevronRight, User, Users } from 'lucide-react'; -interface ProfileData { +interface UserProfile { name: string; gender: string; height: string; @@ -14,50 +14,49 @@ interface ProfileData { age: string; } -const GENDERS = ['Masculino', 'Feminino', 'Outro']; +type OnboardingStep = 'basic' | 'biometric' | 'complete'; export default function OnboardingPage() { - const [step, setStep] = useState<'biometric' | 'metrics'>('biometric'); - const [formData, setFormData] = useState({ + const [step, setStep] = useState('basic'); + const [profile, setProfile] = useState({ name: '', gender: '', height: '', weight: '', age: '' }); - const [savedProfile, setSavedProfile] = useState(null); - const handleBiometricChange = (field: keyof Omit, value: string) => { - setFormData(prev => ({ ...prev, [field]: value })); + const handleBasicChange = (field: keyof Pick, value: string) => { + setProfile(prev => ({ ...prev, [field]: value })); }; - const handleMetricsChange = (field: 'height' | 'weight' | 'age', value: string) => { - setFormData(prev => ({ ...prev, [field]: value })); + const handleBiometricChange = (field: keyof Pick, value: string) => { + setProfile(prev => ({ ...prev, [field]: value })); + }; + + const handleBasicSubmit = (e: React.FormEvent) => { + e.preventDefault(); + if (profile.name && profile.gender) { + setStep('biometric'); + } }; const handleBiometricSubmit = (e: React.FormEvent) => { e.preventDefault(); - if (formData.name && formData.gender) { - setStep('metrics'); + if (profile.height && profile.weight && profile.age) { + saveProfile(); + setStep('complete'); } }; - const handleMetricsSubmit = (e: React.FormEvent) => { - e.preventDefault(); - if (formData.height && formData.weight && formData.age) { - // Save to localStorage - localStorage.setItem('userProfile', JSON.stringify(formData)); - setSavedProfile(formData); - setTimeout(() => { - window.location.href = '/'; - }, 2000); - } + const saveProfile = () => { + localStorage.setItem('userProfile', JSON.stringify(profile)); + console.log('Profile saved:', profile); }; const handleReset = () => { - setStep('biometric'); - setFormData({ name: '', gender: '', height: '', weight: '', age: '' }); - setSavedProfile(null); + setProfile({ name: '', gender: '', height: '', weight: '', age: '' }); + setStep('basic'); }; return ( @@ -80,253 +79,247 @@ export default function OnboardingPage() { { name: "Treino", id: "training" }, { name: "Nutrição", id: "nutrition" }, { name: "Comunidade", id: "community" }, - { name: "Perfil", id: "profile" } + { name: "Perfil", id: "onboarding" } ]} - button={{ text: "Começar Agora", href: "/" }} + button={{ text: "Começar Agora", href: "contact" }} brandName="FitFlow Pro" /> -
-
- {!savedProfile ? ( -
- {/* Header */} -
-
- -
-

- {step === 'biometric' ? 'Criar Perfil' : 'Dados Físicos'} -

-

- {step === 'biometric' - ? 'Comece preenchendo seus dados básicos' - : 'Agora adicione suas medidas'} -

+
+
+ {/* Progress Indicator */} +
+
+
+
1
+ Dados Pessoais
- - {/* Progress Indicator */} -
-
-
-
- - {/* Form Container */} -
- {step === 'biometric' && ( -
- {/* Name Field */} -
- - handleBiometricChange('name', e.target.value)} - placeholder="Ex: João Silva" - className="w-full px-4 py-3 bg-background border border-accent/30 rounded-xl focus:outline-none focus:ring-2 focus:ring-primary-cta focus:border-transparent transition-all text-foreground placeholder:text-foreground/50" - required - /> -
- - {/* Gender Field */} -
- -
- {GENDERS.map((g) => ( - - ))} -
-
- - {/* Submit Button */} - -
- )} - - {step === 'metrics' && ( -
- {/* Height Field */} -
- - handleMetricsChange('height', e.target.value)} - placeholder="Ex: 175" - min="100" - max="250" - className="w-full px-4 py-3 bg-background border border-accent/30 rounded-xl focus:outline-none focus:ring-2 focus:ring-primary-cta focus:border-transparent transition-all text-foreground placeholder:text-foreground/50" - required - /> -
- - {/* Weight Field */} -
- - handleMetricsChange('weight', e.target.value)} - placeholder="Ex: 75" - min="20" - max="300" - step="0.1" - className="w-full px-4 py-3 bg-background border border-accent/30 rounded-xl focus:outline-none focus:ring-2 focus:ring-primary-cta focus:border-transparent transition-all text-foreground placeholder:text-foreground/50" - required - /> -
- - {/* Age Field */} -
- - handleMetricsChange('age', e.target.value)} - placeholder="Ex: 28" - min="13" - max="120" - className="w-full px-4 py-3 bg-background border border-accent/30 rounded-xl focus:outline-none focus:ring-2 focus:ring-primary-cta focus:border-transparent transition-all text-foreground placeholder:text-foreground/50" - required - /> -
- - {/* Button Group */} -
- - -
-
- )} -
- - {/* Form Info */} -
-

- Seus dados são salvos localmente e podem ser editados depois -

+
+
+
2
+ Biometria
- ) : ( - /* Success State */ -
-
-
- -
-

Perfil Criado!

-

- Bem-vindo, {savedProfile.name}! -

+
+ + {/* Step 1: Basic Information */} + {step === 'basic' && ( +
+
+

Vamos Começar!

+

Primeiro, precisamos conhecer você melhor.

- {/* Profile Summary */} -
-
- Gênero: - {savedProfile.gender} +
+ {/* Name Input */} +
+ + handleBasicChange('name', e.target.value)} + placeholder="Digite seu nome" + className="w-full px-4 py-3 rounded-lg border-2 border-gray-200 focus:border-primary-cta focus:outline-none transition" + required + />
-
- Altura: - {savedProfile.height} cm + + {/* Gender Selection */} +
+ +
+ {['Masculino', 'Feminino'].map((gender) => ( + + ))} +
-
- Peso: - {savedProfile.weight} kg + + {/* Submit Button */} + + +
+ )} + + {/* Step 2: Biometric Information */} + {step === 'biometric' && ( +
+
+

Dados Biométricos

+

Agora, alguns dados de biometria para personalizar seu treino.

+
+ +
+ {/* Height Input */} +
+ + handleBiometricChange('height', e.target.value)} + placeholder="Ex: 175" + className="w-full px-4 py-3 rounded-lg border-2 border-gray-200 focus:border-primary-cta focus:outline-none transition" + required + />
-
- Idade: - {savedProfile.age} anos + + {/* Weight Input */} +
+ + handleBiometricChange('weight', e.target.value)} + placeholder="Ex: 75" + step="0.1" + className="w-full px-4 py-3 rounded-lg border-2 border-gray-200 focus:border-primary-cta focus:outline-none transition" + required + /> +
+ + {/* Age Input */} +
+ + handleBiometricChange('age', e.target.value)} + placeholder="Ex: 28" + className="w-full px-4 py-3 rounded-lg border-2 border-gray-200 focus:border-primary-cta focus:outline-none transition" + required + /> +
+ + {/* Buttons */} +
+ + +
+ +
+ )} + + {/* Step 3: Completion */} + {step === 'complete' && ( +
+
+
+ +
+

Perfil Criado com Sucesso!

+

Bem-vindo ao FitFlow Pro, {profile.name}!

+ + {/* Profile Summary */} +
+
+ Nome: + {profile.name} +
+
+ Gênero: + {profile.gender} +
+
+ Altura: + {profile.height} cm +
+
+ Peso: + {profile.weight} kg +
+
+ Idade: + {profile.age} anos +
-

- Redirecionando para o dashboard em breve... -

- - + {/* Action Buttons */} +
+ + + Ir para Dashboard + +
)}
-
+