u
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { matchPath, useLocation } from 'react-router-dom';
|
||||
import Box from '@mui/material/Box';
|
||||
import IconButton from '@mui/material/IconButton';
|
||||
import MapRoundedIcon from '@mui/icons-material/MapRounded';
|
||||
import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
|
||||
import { ARTICLE_TAB, readPreferredArticleTab } from './article/articleRoute';
|
||||
|
||||
const MINIMAP_WIDTH = 220;
|
||||
const MINIMAP_MAX_HEIGHT = 300;
|
||||
@@ -42,16 +40,6 @@ export default function PageMinimap({ sourceSelector = 'main' }) {
|
||||
const idleTimerRef = useRef(null);
|
||||
const metricsRef = useRef({ docH: 1, winH: 1, thumbH: 1 });
|
||||
|
||||
// SEO tab only: /artikel/:sku/seo, or /artikel/:sku when the preferred
|
||||
// default tab resolves to seo.
|
||||
const { pathname } = useLocation();
|
||||
const articleMatch = matchPath('/artikel/:sku/:tab?', pathname);
|
||||
const isSeoPage = Boolean(
|
||||
articleMatch &&
|
||||
(articleMatch.params?.tab === ARTICLE_TAB.seo ||
|
||||
(!articleMatch.params?.tab &&
|
||||
readPreferredArticleTab() === ARTICLE_TAB.seo)),
|
||||
);
|
||||
|
||||
/** Move the viewport rectangle without re-rendering (called on scroll). */
|
||||
const updateViewport = useCallback(() => {
|
||||
@@ -160,11 +148,6 @@ export default function PageMinimap({ sourceSelector = 'main' }) {
|
||||
if (enabled && open) rebuild();
|
||||
}, [enabled, open, rebuild]);
|
||||
|
||||
// Reset scroll visibility on navigation; the new page starts hidden
|
||||
// until the user scrolls again.
|
||||
useEffect(() => {
|
||||
setScrollActive(false);
|
||||
}, [pathname]);
|
||||
|
||||
useEffect(() => {
|
||||
rebuild();
|
||||
@@ -214,7 +197,7 @@ export default function PageMinimap({ sourceSelector = 'main' }) {
|
||||
// Stays mounted for fade-out; hidden unless scrolling/hovering/dragging.
|
||||
const visible = scrollActive || hovering || dragging;
|
||||
|
||||
if (!enabled || !isSeoPage) return null;
|
||||
if (!enabled) return null;
|
||||
|
||||
// Collapsed: a single centered pill to reopen the overview.
|
||||
if (!open) {
|
||||
|
||||
Reference in New Issue
Block a user