"use strict";

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

var _react = _interopRequireDefault(require("react"));

var _reactRouterDom = require("react-router-dom");

var _styledComponents = require("styled-components");

var _viewHelpers = _interopRequireDefault(require("../../backend/utils/view-helpers"));

var _sidebar = _interopRequireDefault(require("./app/sidebar/sidebar"));

var _topBar = _interopRequireDefault(require("./app/top-bar"));

var _notice = _interopRequireDefault(require("./app/notice"));

var _routes = require("./routes");

var _designSystem = require("./design-system");

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

/* eslint-disable react/no-children-prop */
const GlobalStyle = (0, _styledComponents.createGlobalStyle)`
  html, body, #app {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
  }
`;

const App = () => {
  const h = new _viewHelpers.default();
  const resourceId = ':resourceId';
  const actionName = ':actionName';
  const recordId = ':recordId';
  const pageName = ':pageName';
  const recordActionUrl = h.recordActionUrl({
    resourceId,
    recordId,
    actionName
  });
  const resourceActionUrl = h.resourceActionUrl({
    resourceId,
    actionName
  });
  const bulkActionUrl = h.bulkActionUrl({
    resourceId,
    actionName
  });
  const resourceUrl = h.resourceUrl({
    resourceId
  });
  const pageUrl = h.pageUrl(pageName);
  return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(GlobalStyle, null), _react.default.createElement(_designSystem.Box, {
    height: "100%",
    flex: true
  }, _react.default.createElement(_sidebar.default, null), _react.default.createElement(_designSystem.Box, {
    flex: true,
    flexGrow: 1,
    flexDirection: "column",
    overflowY: "auto",
    bg: "greyPale"
  }, _react.default.createElement(_topBar.default, null), _react.default.createElement(_designSystem.Box, {
    position: "absolute",
    top: 0
  }, _react.default.createElement(_notice.default, null)), _react.default.createElement(_reactRouterDom.Switch, null, _react.default.createElement(_reactRouterDom.Route, {
    path: resourceUrl,
    component: _routes.Resource
  }), _react.default.createElement(_reactRouterDom.Route, {
    path: pageUrl,
    exact: true,
    component: _routes.Page
  })), _react.default.createElement(_reactRouterDom.Switch, null, _react.default.createElement(_reactRouterDom.Route, {
    path: recordActionUrl,
    component: _routes.RecordAction
  }), _react.default.createElement(_reactRouterDom.Route, {
    path: resourceActionUrl,
    component: _routes.ResourceAction
  }), _react.default.createElement(_reactRouterDom.Route, {
    path: bulkActionUrl,
    component: _routes.BulkAction
  })))));
};

var _default = App;
exports.default = _default;