diff --git a/frontend/src/components/InvMensuelTable.jsx b/frontend/src/components/InvMensuelTable.jsx
index b897316..c1a50c7 100644
--- a/frontend/src/components/InvMensuelTable.jsx
+++ b/frontend/src/components/InvMensuelTable.jsx
@@ -27,7 +27,7 @@ const STATUT_FG = {
cloture: 'var(--text-muted)',
};
-export default function InvMensuelTable({ rows, allRembs, allReinvests, year }) {
+export default function InvMensuelTable({ rows, allRembs, allReinvests, year, originFrom }) {
const navigate = useNavigate();
const currentYear = new Date().getFullYear();
const currentMonth = new Date().getMonth() + 1;
@@ -142,7 +142,7 @@ export default function InvMensuelTable({ rows, allRembs, allReinvests, year })
{grid.map(({ inv, months }) => (
navigate(`/investissements/${inv.id}`)}>
+ onClick={() => navigate(`/investissements/${inv.id}`, originFrom ? { state: { from: originFrom } } : undefined)}>
|
{inv.nom_projet || '—'}
diff --git a/frontend/src/components/Layout.jsx b/frontend/src/components/Layout.jsx
index 39ea429..537394b 100644
--- a/frontend/src/components/Layout.jsx
+++ b/frontend/src/components/Layout.jsx
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useRef, useState } from 'react';
-import { NavLink, Outlet, useNavigate } from 'react-router-dom';
+import { NavLink, Outlet, useLocation, useNavigate } from 'react-router-dom';
import { api } from '../api.js';
import { useInvestisseur } from '../context/InvestisseurContext.jsx';
import { useUi } from '../context/UiContext.jsx';
@@ -64,6 +64,7 @@ const IconPanelExpand = () => (
/* ── Recherche rapide de projet ─────────────────────────────── */
function ProjectSearch() {
const navigate = useNavigate();
+ const location = useLocation();
const { activeId, activeView } = useInvestisseur();
const [query, setQuery] = useState('');
const [allInv, setAllInv] = useState([]);
@@ -118,9 +119,25 @@ function ProjectSearch() {
setActiveIdx(-1);
}, [results.length, query]); /* eslint-disable-line */
+ const PAGE_LABELS = {
+ '/': 'Tableau de bord',
+ '/investissements': 'Investissements',
+ '/remboursements': 'Remboursements',
+ '/depots-retraits': 'Dépôts / Retraits',
+ '/2778-sd': 'Fiscalité',
+ '/plateformes': 'Plateformes',
+ '/taxreport': 'Fiscalité',
+ '/settings': 'Paramètres',
+ '/compte': 'Mon compte',
+ '/admin': 'Administration',
+ };
+ const currentLabel = PAGE_LABELS[location.pathname] ?? 'Recherche';
+
const goTo = (inv) => {
setQuery(''); setOpen(false);
- navigate(`/investissements/${inv.id}`);
+ navigate(`/investissements/${inv.id}`, {
+ state: { from: { path: location.pathname, search: location.search, label: currentLabel } },
+ });
};
const handleKeyDown = (e) => {
diff --git a/frontend/src/pages/Imports.jsx b/frontend/src/pages/Imports.jsx
index 2e9d9d3..06b51f8 100644
--- a/frontend/src/pages/Imports.jsx
+++ b/frontend/src/pages/Imports.jsx
@@ -1,5 +1,5 @@
import { useEffect, useRef, useState } from 'react';
-import { useNavigate } from 'react-router-dom';
+import { useLocation, useNavigate } from 'react-router-dom';
import { api } from '../api.js';
import { useInvestisseur } from '../context/InvestisseurContext.jsx';
import { fmtDate } from '../utils/format.js';
@@ -52,6 +52,7 @@ const MODULE_LABEL = {
export default function Imports() {
const { activeId } = useInvestisseur();
const navigate = useNavigate();
+ const location = useLocation();
// ── Import classique (xlsx/csv/json) ──────────────────────────
const [module, setModule] = useState('depots_retraits');
@@ -444,7 +445,7 @@ function DossierImport({
{' '}
diff --git a/frontend/src/pages/InvestissementDetail.jsx b/frontend/src/pages/InvestissementDetail.jsx
index cc05da0..b0b1b68 100644
--- a/frontend/src/pages/InvestissementDetail.jsx
+++ b/frontend/src/pages/InvestissementDetail.jsx
@@ -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() {
·
{inv.nom_projet}
- |