import React from 'react';
import FormDialog from '../FormDialog';
import Button from '../Button';
import ErrorBoundary from '../ErrorBoundary';
import { AppList } from './AppList';
import I18n from '../../../../../src/shared/FakeI18n';
export default function InserterForm({
  isOpen,
  closeHandler,
  loading,
  handleAdd,
  packages,
  app,
  location,
}) {
  return (
    <div>
      {isOpen && (
        <FormDialog
          open={isOpen}
          handleClose={closeHandler}
          titleContent={`Add apps to chat ${location}`}
          formComponent={
            <div className="h-64 overflow-auto">
              <ErrorBoundary>
                <AppList
                  location={location}
                  loading={loading}
                  handleAdd={handleAdd}
                  packages={packages}
                  app={app}
                />
              </ErrorBoundary>
            </div>
          }
          dialogButtons={
            <React.Fragment>
              {/* <Button onClick={deleteHandler} className="ml-2" variant="danger">
                {I18n.t('common.delete')}
              </Button> */}
              <Button onClick={closeHandler} variant="outlined">
                {I18n.t('common.cancel')}
              </Button>
            </React.Fragment>
          }
        ></FormDialog>
      )}
    </div>
  );
}
