Files
klz-cables.com/.pnpm-store/v10/files/30/45b9b2653e42f3e892e6e54af82b878211593f41aa2f75c09697857a0efd8f18ed6402499cc458b2eb9457bd762250b39b65c0624112ccc3cf9b27893cf1b0
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

72 lines
1.9 KiB
Plaintext

import { VersionsPill } from './VersionsPill/index.js';
export const documentViewKeys = ['api', 'default', 'livePreview', 'versions'];
export const getTabs = ({
collectionConfig,
globalConfig
}) => {
const customViews = collectionConfig?.admin?.components?.views?.edit || globalConfig?.admin?.components?.views?.edit || {};
return [{
tab: {
href: '',
label: ({
t
}) => t('general:edit'),
order: 100,
...(customViews?.['default']?.tab || {})
},
viewPath: '/'
}, {
tab: {
condition: ({
collectionConfig,
globalConfig,
permissions
}) => Boolean(collectionConfig?.versions && permissions?.collections?.[collectionConfig?.slug]?.readVersions || globalConfig?.versions && permissions?.globals?.[globalConfig?.slug]?.readVersions),
href: '/versions',
label: ({
t
}) => t('version:versions'),
order: 300,
Pill_Component: VersionsPill,
...(customViews?.['versions']?.tab || {})
},
viewPath: '/versions'
}, {
tab: {
condition: ({
collectionConfig,
globalConfig
}) => collectionConfig && !collectionConfig?.admin?.hideAPIURL || globalConfig && !globalConfig?.admin?.hideAPIURL,
href: '/api',
label: 'API',
order: 400,
...(customViews?.['api']?.tab || {})
},
viewPath: '/api'
}].concat(Object.entries(customViews).reduce((acc, [key, value]) => {
if (documentViewKeys.includes(key)) {
return acc;
}
if (value?.tab) {
acc.push({
tab: value.tab,
viewPath: 'path' in value ? value.path : ''
});
}
return acc;
}, []))?.sort(({
tab: a
}, {
tab: b
}) => {
if (a.order === undefined && b.order === undefined) {
return 0;
} else if (a.order === undefined) {
return 1;
} else if (b.order === undefined) {
return -1;
}
return a.order - b.order;
});
};
//# sourceMappingURL=index.js.map