Files
klz-cables.com/.pnpm-store/v10/files/32/b1ea55c3f8e9d61245f7111d1a57a4f0754f92a0c5757e95eead6a6a67d56095c66f3e5cc0e958c272ee83d5f372437c16a643437f18a85659517d07d6aa0d
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

48 lines
1.1 KiB
Plaintext

import { isPathMatchingRoute } from './isPathMatchingRoute.js';
export const getCustomViewByRoute = ({
config,
currentRoute: currentRouteWithAdmin
}) => {
const {
admin: {
components: {
views
}
},
routes: {
admin: adminRoute
}
} = config;
let viewKey;
const currentRoute = adminRoute === '/' ? currentRouteWithAdmin : currentRouteWithAdmin.replace(adminRoute, '');
const foundViewConfig = views && typeof views === 'object' && Object.entries(views).find(([key, view]) => {
const isMatching = isPathMatchingRoute({
currentRoute,
exact: view.exact,
path: view.path,
sensitive: view.sensitive,
strict: view.strict
});
if (isMatching) {
viewKey = key;
}
return isMatching;
})?.[1] || undefined;
if (!foundViewConfig) {
return {
view: {
Component: null
},
viewConfig: null,
viewKey: null
};
}
return {
view: {
payloadComponent: foundViewConfig.Component
},
viewConfig: foundViewConfig,
viewKey
};
};
//# sourceMappingURL=getCustomViewByRoute.js.map