text: import Form from '@admin/components/form'
  import PropTypes from 'prop-types'
  import sections from './sections'
  import React from 'react'
  
  class New extends React.Component {
  
    static contextTypes = {
      modal: PropTypes.object
    }
  
    static propTypes = {
      dataset: PropTypes.object,
      fields: PropTypes.array,
      type: PropTypes.object,
      record: PropTypes.object
    }
  
    _handleCancel = this._handleCancel.bind(this)
    _handleSuccess = this._handleSuccess.bind(this)
  
    render() {
      return <Form { ...this._getForm() } />
    }
  
    _getForm() {
      const { dataset, fields, type, record } = this.props
      return {
        title: 't(Edit Record)',
        method: 'patch',
        endpoint: `/api/admin/datasets/datasets/${dataset.id}/types/${type.id}/records/${record.id}/edit`,
        action: `/api/admin/datasets/datasets/${dataset.id}/types/${type.id}/records/${record.id}`,
        onCancel: this._handleCancel,
        onSuccess: this._handleSuccess,
        sections: sections(fields)
      }
    }
  
    _handleCancel() {
      this.context.modal.close()
    }
  
    _handleSuccess(result) {
      this.context.modal.close()
    }
  
  }
  
  export default New
  