import React from 'react';

import { toPlural, toTitleCase } from '@vizality/util/string';
import { AddonsList } from '@vizality/components/addon';
import { FormTitle } from '@vizality/components';

export default {
  command: 'manage',
  description: 'Allows you to manage your addons directly in chat.',
  executor (_, type) {
    const result = {
      type: 'rich',
      color: type === 'plugin' ? 0x42ffa7 : 0xb68aff,
      provider: {
        name: <>
          <FormTitle tag='h2' className='vz-manager-command-addon-manage-header'>
            {`Manage ${toTitleCase(toPlural(type))}`}
          </FormTitle>
          <AddonsList className='vz-addons-list-embed' type={type} display='compact' limit={8} />
        </>
      }
    };

    return {
      send: false,
      result
    };
  }
};
