'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = CreatePage;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _reactIntl = require('react-intl');

var _reactRouter = require('react-router');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function CreatePage(props, context) {
  var config = context.config;
  var recordTypes = config.recordTypes;


  var items = null;

  if (recordTypes) {
    items = Object.keys(recordTypes).filter(function (recordType) {
      return recordTypes[recordType].serviceConfig.serviceType !== 'utility';
    }).map(function (recordType) {
      return _react2.default.createElement(
        'li',
        { key: recordType },
        _react2.default.createElement(
          _reactRouter.Link,
          { to: 'record/' + recordType },
          _react2.default.createElement(_reactIntl.FormattedMessage, recordTypes[recordType].messages.record.name)
        )
      );
    });
  }

  return _react2.default.createElement(
    'div',
    null,
    _react2.default.createElement(
      'h2',
      null,
      'Create New'
    ),
    _react2.default.createElement(
      'ul',
      null,
      items
    )
  );
}

CreatePage.contextTypes = {
  config: _react.PropTypes.object
};