feat(routes): simplificar rotas de paciente e imagens e ajustar redirecionamentos
This commit is contained in:
@@ -34,7 +34,7 @@ export default function App() {
|
||||
</ProtectedRoute>
|
||||
} />
|
||||
|
||||
<Route path="/patient/:patientName" element={
|
||||
<Route path="/:patientName" element={
|
||||
<ProtectedRoute>
|
||||
<DashboardPage />
|
||||
</ProtectedRoute>
|
||||
@@ -83,7 +83,7 @@ export default function App() {
|
||||
</ProtectedRoute>
|
||||
} />
|
||||
|
||||
<Route path="/patients/:patientName/image/:imageId" element={
|
||||
<Route path="/:patientName/:imageId" element={
|
||||
<ProtectedRoute>
|
||||
<ImageDetailsPage />
|
||||
</ProtectedRoute>
|
||||
|
||||
@@ -232,7 +232,7 @@ export default function DashboardPage() {
|
||||
};
|
||||
|
||||
const openPatient = (patient) => {
|
||||
navigate('/patient/' + encodeURIComponent(patient.patient_name));
|
||||
navigate('/' + encodeURIComponent(patient.patient_name));
|
||||
};
|
||||
|
||||
const goBack = () => {
|
||||
@@ -472,7 +472,7 @@ export default function DashboardPage() {
|
||||
<button
|
||||
className="btn btn-primary btn-small"
|
||||
style={{ flex: 1 }}
|
||||
onClick={() => navigate('/patients/' + encodeURIComponent(selectedPatient.patient_name) + '/image/' + image.id)}
|
||||
onClick={() => navigate('/' + encodeURIComponent(selectedPatient.patient_name) + '/' + image.id)}
|
||||
>🔄 Orientar</button>
|
||||
<button
|
||||
className="btn btn-small"
|
||||
|
||||
@@ -167,7 +167,7 @@ export default function ImageDetailsPage() {
|
||||
});
|
||||
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)
|
||||
navigate(`/patients/${encodeURIComponent(patientName)}/image/${data.imageId}`, { replace: true });
|
||||
navigate(`/${encodeURIComponent(patientName)}/${data.imageId}`, { replace: true });
|
||||
} catch {
|
||||
showToast('Erro ao salvar orientação', 'error');
|
||||
} finally {
|
||||
@@ -183,7 +183,7 @@ export default function ImageDetailsPage() {
|
||||
rotation: 0, flipH: false, flipV: false, remark: ''
|
||||
});
|
||||
showToast('Imagem restaurada para o original!', 'success');
|
||||
navigate('/patient/' + encodeURIComponent(patientName));
|
||||
navigate('/' + encodeURIComponent(patientName));
|
||||
} catch {
|
||||
showToast('Erro ao restaurar a imagem.', 'error');
|
||||
} finally {
|
||||
@@ -337,7 +337,7 @@ export default function ImageDetailsPage() {
|
||||
{/* Top Header para navegação / Voltar */}
|
||||
<header className="header" style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
||||
<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'}
|
||||
</button>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>
|
||||
|
||||
Reference in New Issue
Block a user