Correction des redirections
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
||||
import { useLocation, useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
||||
import { api } from '../api.js';
|
||||
import { useInvestisseur } from '../context/InvestisseurContext.jsx';
|
||||
import { useUi } from '../context/UiContext.jsx';
|
||||
@@ -103,6 +103,8 @@ function xirr(cashflows) {
|
||||
export default function InvestissementDetail() {
|
||||
const { id } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const navOrigin = location.state?.from ?? null;
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const { activeId, investisseurs } = useInvestisseur();
|
||||
const { displayMode } = useUi();
|
||||
@@ -806,8 +808,11 @@ export default function InvestissementDetail() {
|
||||
<span style={{ color: 'var(--text-muted, #6b7280)', fontWeight: 300, fontSize: '0.85em' }}>·</span>
|
||||
<span>{inv.nom_projet}</span>
|
||||
</h2>
|
||||
<button onClick={() => navigate('/investissements')} style={{ whiteSpace: 'nowrap', flexShrink: 0 }}>
|
||||
← Investissements
|
||||
<button
|
||||
onClick={() => navOrigin ? navigate({ pathname: navOrigin.path, search: navOrigin.search || '' }) : navigate('/investissements')}
|
||||
style={{ whiteSpace: 'nowrap', flexShrink: 0 }}
|
||||
>
|
||||
← {navOrigin?.label ?? 'Investissements'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user