develop #83

Merged
M-Gabrielly merged 426 commits from develop into main 2025-12-04 04:13:15 +00:00
Showing only changes of commit 5b3faab1bd - Show all commits

View File

@ -1153,10 +1153,20 @@ export default function PacientePage() {
{ {
// prefer the resolved doctor name; while resolving, show a loading indicator instead of raw IDs // prefer the resolved doctor name; while resolving, show a loading indicator instead of raw IDs
(() => { (() => {
const looksLikeIdStr = (s: any) => {
try {
const hexOnly = String(s || '').replace(/[^0-9a-fA-F]/g, '')
const len = (typeof hexOnly === 'string') ? hexOnly.length : (Number(hexOnly) || 0)
return len >= 8
} catch { return false }
}
const maybeId = selectedReport?.doctor_id || selectedReport?.created_by || selectedReport?.doctor || null const maybeId = selectedReport?.doctor_id || selectedReport?.created_by || selectedReport?.doctor || null
if (reportDoctorName) return <div className="font-semibold text-xl md:text-2xl">{reportTitle(selectedReport, reportDoctorName)}</div> // derive the title text
const derived = reportDoctorName ? reportTitle(selectedReport, reportDoctorName) : reportTitle(selectedReport)
// if the derived title looks like an id (UUID/hex) avoid showing it — show loading instead
if (looksLikeIdStr(derived)) return <div className="font-semibold text-xl md:text-2xl text-muted-foreground">{strings.carregando}</div>
if (resolvingDoctors && maybeId && !doctorsMap[String(maybeId)]) return <div className="font-semibold text-xl md:text-2xl text-muted-foreground">{strings.carregando}</div> if (resolvingDoctors && maybeId && !doctorsMap[String(maybeId)]) return <div className="font-semibold text-xl md:text-2xl text-muted-foreground">{strings.carregando}</div>
return <div className="font-semibold text-xl md:text-2xl">{reportTitle(selectedReport)}</div> return <div className="font-semibold text-xl md:text-2xl">{derived}</div>
})() })()
} }
<div className="text-sm text-muted-foreground">Data: {new Date(selectedReport.report_date || selectedReport.created_at || Date.now()).toLocaleDateString('pt-BR')}</div> <div className="text-sm text-muted-foreground">Data: {new Date(selectedReport.report_date || selectedReport.created_at || Date.now()).toLocaleDateString('pt-BR')}</div>