From 83ea87911b1a062fa43debe347fe74c5fb7b401a Mon Sep 17 00:00:00 2001 From: VPS 4 Deploy Agent Date: Sun, 31 May 2026 07:38:22 +0200 Subject: [PATCH] =?UTF-8?q?fix(ui):=20ThumbImg=20com=20fallback=20autom?= =?UTF-8?q?=C3=A1tico=20para=20thumbnails=20ausentes=20(404)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cria ThumbImg.jsx: wrapper de que intercepta onError e exibe placeholder 🦷 + label "Aguardando reenvio" em vez de imagem quebrada. Aplicado em: - DashboardPage: cards de pacientes e galeria de imagens do paciente - PatientsPage: miniatura na coluna Nome da tabela Enquanto o Plan B (reupload-files) não tiver sido concluído pelo cliente Windows, o card exibe o placeholder informativo em vez de ícone de erro. Co-Authored-By: Claude Sonnet 4.6 --- .../dental-client/src/components/ThumbImg.jsx | 46 +++++++++++++++++++ .../dental-client/src/pages/DashboardPage.jsx | 12 +++-- .../dental-client/src/pages/PatientsPage.jsx | 10 ++-- 3 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 dental-server/dental-client/src/components/ThumbImg.jsx diff --git a/dental-server/dental-client/src/components/ThumbImg.jsx b/dental-server/dental-client/src/components/ThumbImg.jsx new file mode 100644 index 0000000..9e8861d --- /dev/null +++ b/dental-server/dental-client/src/components/ThumbImg.jsx @@ -0,0 +1,46 @@ +import { useState } from 'react'; + +/** + * Renderiza um thumbnail com fallback automático quando a imagem falha + * (404 ou erro de rede). Enquanto aguarda reenvio pelo cliente Windows + * exibe placeholder com ícone e label configuráveis. + */ +export default function ThumbImg({ src, className, style, placeholder = '🦷', label = 'Aguardando reenvio' }) { + const [failed, setFailed] = useState(false); + + if (!src || failed) { + return ( +
+ {placeholder} + {label && ( + + {label} + + )} +
+ ); + } + + return ( + setFailed(true)} + /> + ); +} diff --git a/dental-server/dental-client/src/pages/DashboardPage.jsx b/dental-server/dental-client/src/pages/DashboardPage.jsx index 50ca5f8..88241b9 100644 --- a/dental-server/dental-client/src/pages/DashboardPage.jsx +++ b/dental-server/dental-client/src/pages/DashboardPage.jsx @@ -5,6 +5,7 @@ import { useSocket } from '../contexts/SocketContext'; import { useToast } from '../contexts/ToastContext'; import { useAuth } from '../contexts/AuthContext'; import TransformModal from '../components/TransformModal'; +import ThumbImg from '../components/ThumbImg'; import CreatePatientModal from '../components/CreatePatientModal'; import SettingsModal from '../components/SettingsModal'; import UserManagementModal from '../components/UserManagementModal'; @@ -336,10 +337,11 @@ export default function DashboardPage() { return (
openPatient(p)}>
- {thumb - ? - :
🦷
- } +