"use strict";

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

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

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

var _styles = require("@material-ui/core/styles");

var _BottomNavigation = _interopRequireDefault(require("@material-ui/core/BottomNavigation"));

var _BottomNavigationAction = _interopRequireDefault(require("@material-ui/core/BottomNavigationAction"));

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

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

// import {useSessionStorage} from 'react-use';

/* eslint react/prop-types: 0 */
// retired
const styles = {
  root: {
    width: '100%',
    position: 'fixed',
    bottom: 0,
    backgroundColor: '#37474F'
  },
  icon: {
    color: '#FFF8E1'
  },
  narrow: {
    minWidth: 0
  }
};

function MobileFooter(props) {
  const {
    classes
  } = props;
  const location = (0, _reactRouterDom.useLocation)();
  const history = (0, _reactRouterDom.useHistory)(); // const [frontPageIndex, setFrontPageIndex] = useSessionStorage('subfire.frontpage.index', '-1');
  // console.log(location);
  //
  // if (location.pathname === '/' && frontPageIndex === '-1') {
  //   console.log('setting', history.length);
  //   setFrontPageIndex(history.length);
  // }

  const handleChange = (event, value) => {
    // if (value === '/' && frontPageIndex !== '-1') {
    //   console.log('returning', history.length, frontPageIndex);
    //   const count = history.length - frontPageIndex;
    //   if (!count) return;
    //   history.go(-1 * count);
    //   return;
    // }
    // console.log('moving forward', value, frontPageIndex);
    history.push(value);
  };

  return /*#__PURE__*/_react.default.createElement(_BottomNavigation.default, {
    value: location,
    onChange: handleChange,
    className: classes.root
  }, /*#__PURE__*/_react.default.createElement(_BottomNavigationAction.default, {
    className: classes.icon,
    value: "/",
    icon: /*#__PURE__*/_react.default.createElement(_icons.Apps, null)
  }), /*#__PURE__*/_react.default.createElement(_BottomNavigationAction.default, {
    className: classes.icon,
    icon: /*#__PURE__*/_react.default.createElement(_icons.PlayCircleOutline, null)
  }), /*#__PURE__*/_react.default.createElement(_BottomNavigationAction.default, {
    className: classes.icon,
    value: "/player",
    icon: /*#__PURE__*/_react.default.createElement(_icons.Album, null)
  }));
}

var _default = (0, _styles.withStyles)(styles)(MobileFooter);

exports.default = _default;