import { AdvancedScrollerAuto, ErrorBoundary } from '@vizality/components';
import { joinClassNames } from '@vizality/util/dom';
import { getModule } from '@vizality/webpack';
import React, { memo } from 'react';

/**
 * 
 * @component
 */
export default memo(({ className, wrapperClassName, children }) => {
  const { scroller } = getModule('headerContentWrapper');
  const { pageWrapper } = getModule('pageWrapper');
  const { perksModal } = getModule('perksModal');
  const { content } = getModule('wrappedLayout');
  const { base } = getModule('base');
  return (
    <div className={joinClassNames('vz-dashboard', wrapperClassName, pageWrapper, perksModal)}>
      <AdvancedScrollerAuto className={`${scroller} vz-dashboard-scroller`}>
        <div className={joinClassNames('vz-dashboard-layout', className)}>
          <ErrorBoundary
            className='vz-dashboard-error-boundary'
            headerClassName={joinClassNames('vz-dashboard-content-header', base, content)}
            showScene={true}
          >
            {children}
          </ErrorBoundary>
        </div>
      </AdvancedScrollerAuto>
    </div>
  );
});
