Always show documents section in professional detail, with No subido fallback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-29 10:31:40 -05:00
co-authored by Claude Sonnet 4.6
parent b0e3467565
commit aa35f4b661
+28 -40
View File
@@ -382,49 +382,37 @@ export default function ProfessionalDetailPage() {
</Card> </Card>
{/* Documentos subidos */} {/* Documentos subidos */}
{(professional.identification_picture || professional.certificate_picture || professional.banner_picture) && ( <Card>
<Card> <CardHeader><CardTitle>Documentos y fotos</CardTitle></CardHeader>
<CardHeader><CardTitle>Documentos y fotos</CardTitle></CardHeader> <CardContent className="grid grid-cols-1 gap-4 sm:grid-cols-3">
<CardContent className="grid grid-cols-1 gap-4 sm:grid-cols-3"> {(['identification_picture', 'certificate_picture', 'banner_picture'] as const).map((field) => {
{professional.identification_picture && ( const labels: Record<string, string> = {
<div className="space-y-2"> identification_picture: 'Foto de cédula',
<p className="text-sm text-muted-foreground">Foto de cédula</p> certificate_picture: 'Certificado / Diploma',
{professional.identification_picture.match(/\.(jpg|jpeg|png|webp)$/i) ? ( banner_picture: 'Foto de perfil / Banner',
<a href={professional.identification_picture} target="_blank" rel="noreferrer"> };
<img src={professional.identification_picture} alt="Cédula" className="rounded-lg border object-cover w-full max-h-48" /> const url = professional[field];
</a> return (
<div key={field} className="space-y-2">
<p className="text-sm text-muted-foreground">{labels[field]}</p>
{url ? (
url.match(/\.(jpg|jpeg|png|webp)$/i) ? (
<a href={url} target="_blank" rel="noreferrer">
<img src={url} alt={labels[field]} className="rounded-lg border object-cover w-full max-h-48" />
</a>
) : (
<a href={url} target="_blank" rel="noreferrer" className="flex items-center gap-2 text-sm text-primary underline">
<ExternalLink className="h-4 w-4" /> Ver documento
</a>
)
) : ( ) : (
<a href={professional.identification_picture} target="_blank" rel="noreferrer" className="flex items-center gap-2 text-sm text-primary underline"> <p className="text-sm text-muted-foreground italic">No subido</p>
<ExternalLink className="h-4 w-4" /> Ver documento
</a>
)} )}
</div> </div>
)} );
{professional.certificate_picture && ( })}
<div className="space-y-2"> </CardContent>
<p className="text-sm text-muted-foreground">Certificado / Diploma</p> </Card>
{professional.certificate_picture.match(/\.(jpg|jpeg|png|webp)$/i) ? (
<a href={professional.certificate_picture} target="_blank" rel="noreferrer">
<img src={professional.certificate_picture} alt="Certificado" className="rounded-lg border object-cover w-full max-h-48" />
</a>
) : (
<a href={professional.certificate_picture} target="_blank" rel="noreferrer" className="flex items-center gap-2 text-sm text-primary underline">
<ExternalLink className="h-4 w-4" /> Ver documento
</a>
)}
</div>
)}
{professional.banner_picture && (
<div className="space-y-2">
<p className="text-sm text-muted-foreground">Foto de perfil / Banner</p>
<a href={professional.banner_picture} target="_blank" rel="noreferrer">
<img src={professional.banner_picture} alt="Banner" className="rounded-lg border object-cover w-full max-h-48" />
</a>
</div>
)}
</CardContent>
</Card>
)}
{/* Métodos de pago */} {/* Métodos de pago */}
{professional.payment_methods && professional.payment_methods.length > 0 && ( {professional.payment_methods && professional.payment_methods.length > 0 && (