import React, { useState } from 'react'; import { useWorkerProfiles } from '@/lib/krowHooks'; import TalentPoolCard from '@/components/krow/TalentPoolCard'; import TalentDetailModal from '@/components/krow/TalentDetailModal'; import MessageCandidateModal from '@/components/krow/MessageCandidateModal'; import { Users } from 'lucide-react'; export default function TalentPool() { const { data: profiles = [], isLoading } = useWorkerProfiles(); const [search, setSearch] = useState(''); const [scoreFilter, setScoreFilter] = useState('all'); const [contactProfile, setContactProfile] = useState(null); const [viewProfile, setViewProfile] = useState(null); const filtered = profiles.filter((p) => { const q = search.toLowerCase(); const matchesSearch = !search || p.full_name?.toLowerCase().includes(q) || p.email?.toLowerCase().includes(q) || (p.skills || []).some((s) => s.toLowerCase().includes(q)) || p.desired_position?.toLowerCase().includes(q) || p.current_position?.toLowerCase().includes(q); const score = p.krow_score || 0; const matchesScore = scoreFilter === 'all' || (scoreFilter === 'elite' && score >= 90) || (scoreFilter === 'excellent' && score >= 75 && score < 90) || (scoreFilter === 'solid' && score >= 60 && score < 75) || (scoreFilter === 'building' && score > 0 && score < 60); return matchesSearch && matchesScore; }); const bandCounts = { elite: profiles.filter((p) => (p.krow_score || 0) >= 90).length, excellent: profiles.filter((p) => (p.krow_score || 0) >= 75 && (p.krow_score || 0) < 90).length, solid: profiles.filter((p) => (p.krow_score || 0) >= 60 && (p.krow_score || 0) < 75).length, building: profiles.filter((p) => (p.krow_score || 0) > 0 && (p.krow_score || 0) < 60).length, }; const contactApp = contactProfile ? { applicant_name: contactProfile.full_name, email: contactProfile.email, phone: contactProfile.phone } : null; return (

Talent Pool

Browse all KROW talent and contact them directly

{profiles.length} talents
{/* Band summary */}
{[ { key: 'elite', label: 'Elite', color: '#0838E0' }, { key: 'excellent', label: 'Excellent', color: '#16A34A' }, { key: 'solid', label: 'Solid', color: '#2563EB' }, { key: 'building', label: 'Building', color: '#D97706' }, ].map((b) => (
{b.label}

{bandCounts[b.key]}

))}
{/* Filters */}
setSearch(e.target.value)} placeholder="Search by name, skill, or desired role..." className="flex-1 h-10 px-4 rounded-lg border border-[#E5E7EB] bg-white text-[13px] focus:border-[#0838E0] focus:outline-none" />
{/* List */} {isLoading ? (
{[...Array(6)].map((_, i) =>
)}
) : filtered.length === 0 ? (

No talent matches your filters

) : (
{filtered.map((p) => ( ))}
)} {viewProfile && ( setViewProfile(null)} profile={viewProfile} onContact={(profile) => { setViewProfile(null); setContactProfile(profile); }} /> )} {contactApp && ( setContactProfile(null)} application={contactApp} /> )}
); }