"use strict";

exports.__esModule = true;
exports.default = void 0;

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

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

var _orientation = require("subfirelib/ui/orientation");

var _FuzzyImageBackground = _interopRequireDefault(require("subfirelib/ui/FuzzyImageBackground"));

var _SubFire192t = _interopRequireDefault(require("subfirelib/static/logos/SubFire-192t.png"));

var _Grid = _interopRequireDefault(require("@material-ui/core/Grid"));

var _Button = _interopRequireDefault(require("@material-ui/core/Button"));

var _icons = require("@material-ui/icons");

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

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

/* eslint react/prop-types: 0 */
function NavGridItem(props) {
  return /*#__PURE__*/_react.default.createElement(_Grid.default, {
    item: true,
    xs: props.variant === 'outlined' ? 6 : 12
  }, /*#__PURE__*/_react.default.createElement(_Button.default, _extends({}, props, {
    style: {
      textTransform: 'none',
      justifyContent: props.startIcon ? 'flex-start' : 'flex-end'
    }
  })));
}

function NavGrid(props) {
  const history = (0, _reactRouterDom.useHistory)();

  const go = r => history.push(r);

  const dimensions = (0, _orientation.useWindowSize)();
  const variant = (0, _orientation.isLandscape)(dimensions) ? 'outlined' : 'text';
  const items = [{
    children: 'Radio',
    startIcon: /*#__PURE__*/_react.default.createElement(_icons.Radio, null),
    fullWidth: true,
    variant: variant,
    onClick: () => {
      go('/radio');
    }
  }, {
    children: 'Playlists',
    endIcon: /*#__PURE__*/_react.default.createElement(_icons.QueueMusic, null),
    fullWidth: true,
    variant: variant,
    onClick: () => {
      go('/playlists/normal');
    }
  }, {
    children: 'Starred Items',
    startIcon: /*#__PURE__*/_react.default.createElement(_icons.Star, null),
    fullWidth: true,
    variant: variant,
    onClick: () => {
      go('/starred');
    }
  }, {
    children: 'Albums',
    endIcon: /*#__PURE__*/_react.default.createElement(_icons.Album, null),
    fullWidth: true,
    variant: variant,
    onClick: () => {
      go('/albums');
    }
  }, {
    children: 'Indexes',
    startIcon: /*#__PURE__*/_react.default.createElement(_icons.FolderSpecial, null),
    fullWidth: true,
    variant: variant,
    disabled: false,
    onClick: () => {
      go('/indexes');
    }
  }, {
    children: 'Artists',
    endIcon: /*#__PURE__*/_react.default.createElement(_icons.People, null),
    fullWidth: true,
    variant: variant,
    disabled: false,
    onClick: () => {
      go('/artists');
    }
  }, {
    children: 'Bookmarks',
    startIcon: /*#__PURE__*/_react.default.createElement(_icons.Bookmarks, null),
    fullWidth: true,
    variant: variant,
    disabled: false,
    onClick: () => {
      go('/bookmarks');
    }
  }, {
    children: 'Podcasts',
    endIcon: /*#__PURE__*/_react.default.createElement(_icons.RssFeed, null),
    fullWidth: true,
    variant: variant,
    disabled: false,
    onClick: () => {
      go('/podcasts');
    }
  }];
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_FuzzyImageBackground.default, {
    selector: ".home-bg",
    image: _SubFire192t.default,
    showBackground: true,
    fadeBackground: true
  }), /*#__PURE__*/_react.default.createElement(_Grid.default, {
    container: true,
    spacing: dimensions.width < 600 ? 1 : 4,
    style: {
      marginTop: 5
    }
  }, items.map(i => /*#__PURE__*/_react.default.createElement(NavGridItem, _extends({}, i, {
    key: i.children
  })))));
}

var _default = NavGrid;
exports.default = _default;