From b09100b13e9daffd41ce83ffb3939f9573c6c5fa Mon Sep 17 00:00:00 2001 From: seb Date: Wed, 21 Oct 2026 02:18:37 +0200 Subject: [PATCH] u --- src/components/SectionLayout.jsx | 51 ++++++++++++++----- .../category/CategoryBreadcrumbs.jsx | 6 +-- src/routes/artikel/kategorien.jsx | 7 +-- 3 files changed, 42 insertions(+), 22 deletions(-) diff --git a/src/components/SectionLayout.jsx b/src/components/SectionLayout.jsx index 129ed3d..0a12087 100644 --- a/src/components/SectionLayout.jsx +++ b/src/components/SectionLayout.jsx @@ -1,5 +1,5 @@ import { useState, useRef, useEffect, Suspense } from 'react'; -import { Outlet, useLocation } from 'react-router-dom'; +import { Outlet, useLocation, useNavigate } from 'react-router-dom'; import Box from '@mui/material/Box'; import CircularProgress from '@mui/material/CircularProgress'; import Popover from '@mui/material/Popover'; @@ -13,7 +13,9 @@ import SettingsIcon from '@mui/icons-material/Settings'; import { enqueueSnackbar } from 'notistack'; import PageLayout from './PageLayout'; import { NAV_ITEMS, SUB_NAV, resolveActiveSub } from '../nav'; -import { isKategorienPath } from './category/categoryRoute'; +import { isKategorienPath, buildCategoryPath, KATEGORIEN_BASE } from './category/categoryRoute'; +import CategoryBreadcrumbs from './category/CategoryBreadcrumbs'; +import { getCategoryBreadcrumbs, resolveCategoryIdFromSlugPath } from '../utils/categoryUtils'; import categoryAutomat from '../automats/categoryAutomat'; import { ActionElevatedPill, ToggleElevatedPill } from 'dashgui/ElevatedPill'; import { article, category } from '../api'; @@ -41,6 +43,7 @@ function selectCatSlice(s) { export default function SectionLayout({ sectionPath }) { const { pathname } = useLocation(); + const navigate = useNavigate(); const importInputRef = useRef(null); const [extrasAnchor, setExtrasAnchor] = useState(null); const [importing, setImporting] = useState(false); @@ -141,18 +144,39 @@ export default function SectionLayout({ sectionPath }) { importInputRef.current?.click(); }; + let crumbs = []; + if (showsRenameSwitch && categories && rootCategoryId != null) { + const slugPath = pathname + .slice(KATEGORIEN_BASE.length) + .split('/') + .filter(Boolean) + .map((seg) => { + try { + return decodeURIComponent(seg); + } catch { + return seg; + } + }) + .join('/'); + const catId = resolveCategoryIdFromSlugPath(categories, rootCategoryId, slugPath); + if (catId != null) crumbs = getCategoryBreadcrumbs(categories, catId, rootCategoryId); + } + const titleAction = showsRenameSwitch ? ( - - categoryAutomat.actions.setRenameMode(checked)} - /> - } - onClick={(event) => setExtrasAnchor(event.currentTarget)} + + navigate(buildCategoryPath(categories, rootCategoryId, id))} /> + + categoryAutomat.actions.setRenameMode(checked)} + /> + crumb.name); if (visible.length === 0) return null; return ( - + {visible.map((crumb, index) => ( - - {routeError && (