import React, { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { useWorkerProfile, useUpdateWorkerProfile, useCertifications } from '@/lib/krowHooks'; import { recalcProfilePatch } from '@/lib/krowScore'; import { base44 } from '@/api/base44Client'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { toast } from 'react-hot-toast'; import { Camera, Loader2, RefreshCw, X, Sparkles, ArrowRight } from 'lucide-react'; import KrowIdentityCard from '@/components/krow/KrowIdentityCard'; import CareerPassport from '@/components/krow/talent/CareerPassport'; const AVAIL_OPTIONS = ['Weekdays', 'Weekends', 'Evenings', 'Mornings', 'Overnight', 'On-Call']; const DEFAULT_CERTS = ['Food Handler Card', 'ServSafe', 'ABC License', 'TIPS Certified', 'CPR/First Aid', 'Background Check Cleared']; export default function KrowIdentity() { const navigate = useNavigate(); const { data: profile, isLoading } = useWorkerProfile(); const update = useUpdateWorkerProfile(); const { data: certs = [] } = useCertifications(); const [form, setForm] = useState(null); const [skillInput, setSkillInput] = useState(''); const [langInput, setLangInput] = useState(''); const [uploadingSelfie, setUploadingSelfie] = useState(false); useEffect(() => { if (profile && !form) { setForm({ full_name: profile.full_name || '', phone: profile.phone || '', address: profile.address || '', career_goals: profile.career_goals || '', skills: profile.skills || [], languages: profile.languages || [], availability: profile.availability || [], certifications: profile.certifications || [], selfie_url: profile.selfie_url || '', }); } }, [profile, form]); if (isLoading || !profile || !form) { return
; } const set = (k, v) => setForm({ ...form, [k]: v }); const certOptions = certs.length > 0 ? certs.map(c => c.name) : DEFAULT_CERTS; const toggleCert = (c) => set('certifications', form.certifications.includes(c) ? form.certifications.filter(x => x !== c) : [...form.certifications, c]); const toggleAvail = (a) => set('availability', form.availability.includes(a) ? form.availability.filter(a2 => a2 !== a) : [...form.availability, a]); const handleSelfie = async (e) => { const file = e.target.files?.[0]; if (!file) return; setUploadingSelfie(true); try { const { file_url } = await base44.integrations.Core.UploadFile({ file }); set('selfie_url', file_url); } catch {} setUploadingSelfie(false); e.target.value = ''; }; const save = async () => { if (!form.full_name.trim()) { toast.error('Your name is required.'); return; } if (!form.selfie_url) { toast.error('Add a selfie to complete your identity.'); return; } try { const merged = { ...profile, ...form }; const patch = { ...form, ...recalcProfilePatch(merged) }; await update.mutateAsync({ id: profile.id, data: patch }); toast.success('KROW Identity created. Now let Owliver learn about you.'); navigate('/owliver'); } catch { toast.error('Could not save identity.'); } }; return (
{/* Living identity card — the experience, not the explanation */} {/* Career Passport — verified credentials that make up the KROW Identity */} {/* Selfie + name */}
{form.selfie_url ? ( Selfie ) : (
)}

A quick selfie so employers recognize you. No resume, just you.

{form.selfie_url ? ( ) : ( )}
set('full_name', e.target.value)} className="mt-1.5" />
set('phone', e.target.value)} className="mt-1.5" />
set('address', e.target.value)} placeholder="City, State" className="mt-1.5" />
{/* About */}

One or two lines. What you do and what you're good at. This replaces the resume summary.