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
22 lines
949 B
Plaintext
22 lines
949 B
Plaintext
import { EntityType } from './groupNavItems.js';
|
|
import { groupNavItems } from './groupNavItems.js';
|
|
/** @internal */
|
|
export function getNavGroups(permissions, visibleEntities, config, i18n) {
|
|
const collections = config.collections.filter(collection => permissions?.collections?.[collection.slug]?.read && visibleEntities.collections.includes(collection.slug));
|
|
const globals = config.globals.filter(global => permissions?.globals?.[global.slug]?.read && visibleEntities.globals.includes(global.slug));
|
|
const navGroups = groupNavItems([...(collections.map(collection => {
|
|
const entityToGroup = {
|
|
type: EntityType.collection,
|
|
entity: collection
|
|
};
|
|
return entityToGroup;
|
|
}) ?? []), ...(globals.map(global => {
|
|
const entityToGroup = {
|
|
type: EntityType.global,
|
|
entity: global
|
|
};
|
|
return entityToGroup;
|
|
}) ?? [])], permissions, i18n);
|
|
return navGroups;
|
|
}
|
|
//# sourceMappingURL=getNavGroups.js.map |