"use strict";

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

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

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

var _hooks = require("subfirelib/hooks");

var _SubsonicGridList = _interopRequireDefault(require("subfirelib/ui/SubsonicGridList"));

var _PlayArrow = _interopRequireDefault(require("@material-ui/icons/PlayArrow"));

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

// import PropTypes from 'prop-types';
function getSubTitle(pl) {
  const rv = pl.songCount + ' songs';
  return rv;
}

function PlaylistGrid(props) {
  const {
    onClick,
    onImageClick,
    scrollSelector
  } = props;
  const {
    pathname
  } = (0, _reactRouterDom.useLocation)();
  const {
    pltype
  } = (0, _reactRouterDom.useParams)() || {};
  const {
    allPlaylists = [],
    playlists = [],
    stations = [],
    stationPlaylists = [],
    receivers = []
  } = (0, _hooks.usePlaylistsScanner)(); // eslint-disable-line

  let pl = [];

  if (pathname === '/radio') {
    pl = stationPlaylists;
  } else if (pltype === 'all') {
    pl = allPlaylists;
  } else {
    pl = playlists;
  }

  return /*#__PURE__*/_react.default.createElement(_SubsonicGridList.default, {
    getSubTitle: getSubTitle,
    Icon: _PlayArrow.default,
    content: pl,
    onClick: onClick,
    onImageClick: onImageClick,
    ScrollToTop: true,
    scrollSelector: scrollSelector
  });
}

var _default = PlaylistGrid;
exports.default = _default;