UNPKG

@rnga/orders

Version:

## Get schema from @prisma-cms 1. yarn get-api-schema -e http://localhost:4000 2. yarn build-api-fragments

162 lines (107 loc) 4.67 kB
'use strict'; exports.__esModule = true; exports.default = undefined; var _class, _temp2; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _urijs = require('urijs'); var _urijs2 = _interopRequireDefault(_urijs); var _materialUi = require('material-ui'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure undefined"); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var PageLayout = (_temp2 = _class = function (_Component) { _inherits(PageLayout, _Component); function PageLayout() { var _temp, _this, _ret; _classCallCheck(this, PageLayout); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = {}, _this.setPageMeta = function (meta) { var title = meta.title, description = meta.description; if (title) { if (!global.document) { global.document = {}; } var _global = global, document = _global.document; var suffix = " | RNGA"; // Проверять надо именно так, потому что new RegExp не понимает экранирование | if (!/ \| RNGA$|^RNGA\:/.test(title)) { title += suffix; } if (document.title !== title) { document.title = title; } } }, _temp), _possibleConstructorReturn(_this, _ret); } PageLayout.prototype.getChildContext = function getChildContext() { return { setPageMeta: this.setPageMeta }; }; PageLayout.prototype.onChange = function onChange(event) { var _setState; var _event$target = event.target, name = _event$target.name, value = _event$target.value; this.setState((_setState = {}, _setState[name] = value, _setState)); }; PageLayout.prototype.getPage = function getPage() { var page = this.getUriParam("page"); return page ? parseInt(page) : 1; }; PageLayout.prototype.getUriParam = function getUriParam(param) { var uri = this.getUri(); var query = uri.query(true); return query ? query[param] : null; }; PageLayout.prototype.getUri = function getUri() { var location = this.props.location; var pathname = location.pathname, search = location.search; var uri = new _urijs2.default(pathname); uri.query(search); return uri; }; PageLayout.prototype.render = function render(content) { _objectDestructuringEmpty(this.props); // const { // user: currentUser, // } = this.context; // const { // id: currentUserId, // sudo, // } = currentUser || {}; // if (!sudo) { // return <Typography // variant="display1" // color="error" // > // Доступ запрещен // </Typography>; // } if (!content) { return null; } return content; }; return PageLayout; }(_react.Component), _class.contextTypes = { user: _propTypes2.default.object, client: _propTypes2.default.object.isRequired, openLoginForm: _propTypes2.default.func.isRequired, uri: _propTypes2.default.object.isRequired }, _class.defaultProps = {}, _class.childContextTypes = { setPageMeta: _propTypes2.default.func }, _temp2); exports.default = PageLayout; PageLayout.propTypes = process.env.NODE_ENV !== "production" ? {} : {}; module.exports = exports['default'];