import { ComponentType } from 'react'; export function withEdition( WrappedComponent: ComponentType, edition: 'BE' | 'CE' ): ComponentType { // Try to create a nice displayName for React Dev Tools. const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component'; function WrapperComponent(props: T & JSX.IntrinsicAttributes) { if (process.env.PORTAINER_EDITION !== edition) { return null; } return ; } WrapperComponent.displayName = `with${edition}Edition(${displayName})`; return WrapperComponent; }