This commit is contained in:
seb
2026-08-06 00:32:22 +02:00
parent 855710a198
commit d8b48d96e1
7 changed files with 151 additions and 58 deletions

View File

@@ -1,3 +1,5 @@
import { matchPath } from 'react-router-dom';
export const ARTICLE_TAB = {
history: 'history',
supplier: 'supplier',
@@ -84,6 +86,12 @@ export function resolveArticleTab(tabParam, article) {
return preferredArticleTab(article);
}
/** Tab segment from an article-detail pathname, or undefined. */
export function articleTabFromPathname(pathname) {
const match = matchPath('/artikel/:sku/:tab?', pathname);
return match?.params?.tab;
}
/**
* @param {object|string} articleOrSku
* @param {string} [tab] omitted → preferred default from localStorage

View File

@@ -61,9 +61,9 @@ class ArtikelSkuPage extends Component {
}
render() {
const { sku, tab } = this.props;
const { sku } = this.props;
if (!this.state.ready) return null;
return <ArticleView sku={sku} tab={tab} />;
return <ArticleView sku={sku} />;
}
}