From 1b7d0a2dcae77fad9c5552d4cef9de4959ad0038 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 20 May 2022 11:57:09 +0200 Subject: [PATCH] fix(browser-repl): gray out enxcol helpers in `show collections` --- .../src/components/types/show-collections-output.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/browser-repl/src/components/types/show-collections-output.tsx b/packages/browser-repl/src/components/types/show-collections-output.tsx index b434a44073..1424ae4f07 100644 --- a/packages/browser-repl/src/components/types/show-collections-output.tsx +++ b/packages/browser-repl/src/components/types/show-collections-output.tsx @@ -13,6 +13,10 @@ type CollectionObject = { badge: string; }; +function isSystemCollection(coll: CollectionObject): boolean { + return coll.name.startsWith('system.') || coll.name.startsWith('enxcol_.'); +} + export class ShowCollectionsOutput extends Component { static propTypes = { value: PropTypes.array @@ -25,7 +29,7 @@ export class ShowCollectionsOutput extends Component let maxCollectionNameLength = 0; value.forEach(coll => { maxCollectionNameLength = Math.max(maxCollectionNameLength, coll.name.length); - if (coll.name.startsWith('system.') || coll.name.startsWith('enxcol_.')) { + if (isSystemCollection(coll)) { systemCollections.push(coll); } else { otherCollections.push(coll); @@ -41,7 +45,7 @@ export class ShowCollectionsOutput extends Component const className = classNames( styles['shell-collections-output-collection-name'], { - [styles['shell-collections-output-system-collection']]: coll.name.startsWith('system.') + [styles['shell-collections-output-system-collection']]: isSystemCollection(coll) } ); tableEntries.push(