import React, { memo } from 'react';

import { ContextMenu } from '@vizality/components';
import { toPlural } from '@vizality/util/string';
import { Messages } from '@vizality/i18n';

export default memo(({ type, resetSearchOptions, onClose }) => {
  return (
    <ContextMenu.Menu navId='vz-addons-list-overflow-menu' onClose={onClose}>
      <ContextMenu.Item
        id='reset-search-options'
        label='Reset Options'
        action={() => resetSearchOptions()}
      />
      <ContextMenu.Separator />
      <ContextMenu.Item
        id='enable-all'
        label='Enable All'
        action={async () => vizality.manager[toPlural(type)].enableAll()}
      />
      <ContextMenu.Item
        id='disable-all'
        label='Disable All'
        action={async () => vizality.manager[toPlural(type)].disableAll()}
      />
    </ContextMenu.Menu>
  );
});
