import { useState, useEffect } from 'react'
import { FeatureBadge, FeatureCallout } from '../components/FeatureState.jsx'
import { featurePanelClass } from '../components/featureStateStyles.js'
import { professionalRepository } from '../repositories/professionalRepository.js'
const cardClass = 'rounded-2xl border border-[#404040] bg-[#262626] shadow-sm'
export function TeamPage({ navigate }) {
const [professionals, setProfessionals] = useState([])
const { slots, weekdays } = professionalRepository.getCoverageMap()
useEffect(() => {
professionalRepository.getAll().then(setProfessionals).catch(console.error)
}, [])
return (
{professionals.map((professional) => (
{initials(professional.name)}
{professional.name}
{professional.role}
))}
Mapa de cobertura
Matriz simples para preparar o fluxo de agenda, plantão e disponibilidade.
{['Profissional', ...weekdays].map((label) => (
{label}
))}
{professionals.map((professional, rowIndex) => (
{professional.name}
{slots.map((slot, index) => (
{shiftSlot(slot, rowIndex + index)}
))}
))}
)
}
function Info({ label, value }) {
return (
{label}
{value}
)
}
function StatusPill({ status }) {
const className =
status === 'Disponivel'
? 'bg-emerald-500/20 text-emerald-400'
: status === 'Em atendimento'
? 'bg-amber-500/20 text-amber-400'
: 'bg-blue-500/20 text-blue-400'
return {status}
}
function initials(name) {
return name
.replace(/^(Dr\.|Dra\.|Nutri\.|Enf\.)\s+/i, '')
.split(' ')
.slice(0, 2)
.map((part) => part[0])
.join('')
.toUpperCase()
}
function shiftSlot(slot, index) {
if (index % 4 === 0) {
return 'Bloqueado'
}
return slot
}