feat(routes): simplificar rotas de paciente e imagens e ajustar redirecionamentos

This commit is contained in:
VPS 4 Deploy Agent
2026-06-01 02:48:17 +02:00
parent 2fd4ab91d4
commit c00c0a3646
3 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -34,7 +34,7 @@ export default function App() {
</ProtectedRoute> </ProtectedRoute>
} /> } />
<Route path="/patient/:patientName" element={ <Route path="/:patientName" element={
<ProtectedRoute> <ProtectedRoute>
<DashboardPage /> <DashboardPage />
</ProtectedRoute> </ProtectedRoute>
@@ -83,7 +83,7 @@ export default function App() {
</ProtectedRoute> </ProtectedRoute>
} /> } />
<Route path="/patients/:patientName/image/:imageId" element={ <Route path="/:patientName/:imageId" element={
<ProtectedRoute> <ProtectedRoute>
<ImageDetailsPage /> <ImageDetailsPage />
</ProtectedRoute> </ProtectedRoute>
@@ -232,7 +232,7 @@ export default function DashboardPage() {
}; };
const openPatient = (patient) => { const openPatient = (patient) => {
navigate('/patient/' + encodeURIComponent(patient.patient_name)); navigate('/' + encodeURIComponent(patient.patient_name));
}; };
const goBack = () => { const goBack = () => {
@@ -472,7 +472,7 @@ export default function DashboardPage() {
<button <button
className="btn btn-primary btn-small" className="btn btn-primary btn-small"
style={{ flex: 1 }} style={{ flex: 1 }}
onClick={() => navigate('/patients/' + encodeURIComponent(selectedPatient.patient_name) + '/image/' + image.id)} onClick={() => navigate('/' + encodeURIComponent(selectedPatient.patient_name) + '/' + image.id)}
>🔄 Orientar</button> >🔄 Orientar</button>
<button <button
className="btn btn-small" className="btn btn-small"
@@ -167,7 +167,7 @@ export default function ImageDetailsPage() {
}); });
showToast('Imagem e orientação salvas!', 'success'); showToast('Imagem e orientação salvas!', 'success');
// Atualiza a rota com o novo ID gerado em background (sem adicionar ao histórico de navegação) // Atualiza a rota com o novo ID gerado em background (sem adicionar ao histórico de navegação)
navigate(`/patients/${encodeURIComponent(patientName)}/image/${data.imageId}`, { replace: true }); navigate(`/${encodeURIComponent(patientName)}/${data.imageId}`, { replace: true });
} catch { } catch {
showToast('Erro ao salvar orientação', 'error'); showToast('Erro ao salvar orientação', 'error');
} finally { } finally {
@@ -183,7 +183,7 @@ export default function ImageDetailsPage() {
rotation: 0, flipH: false, flipV: false, remark: '' rotation: 0, flipH: false, flipV: false, remark: ''
}); });
showToast('Imagem restaurada para o original!', 'success'); showToast('Imagem restaurada para o original!', 'success');
navigate('/patient/' + encodeURIComponent(patientName)); navigate('/' + encodeURIComponent(patientName));
} catch { } catch {
showToast('Erro ao restaurar a imagem.', 'error'); showToast('Erro ao restaurar a imagem.', 'error');
} finally { } finally {
@@ -337,7 +337,7 @@ export default function ImageDetailsPage() {
{/* Top Header para navegação / Voltar */} {/* Top Header para navegação / Voltar */}
<header className="header" style={{ display: 'flex', flexDirection: 'column', gap: 12 }}> <header className="header" style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 12, width: '100%' }}> <div style={{ display: 'flex', alignItems: 'center', gap: 12, width: '100%' }}>
<button className="btn btn-secondary" onClick={() => navigate('/patient/' + encodeURIComponent(patientName))} style={{ padding: '8px 12px' }} title="Voltar ao Painel"> <button className="btn btn-secondary" onClick={() => navigate('/' + encodeURIComponent(patientName))} style={{ padding: '8px 12px' }} title="Voltar ao Painel">
{isMobile ? '←' : '← Voltar'} {isMobile ? '←' : '← Voltar'}
</button> </button>
<div style={{ flex: 1, minWidth: 0 }}> <div style={{ flex: 1, minWidth: 0 }}>