"use strict";

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

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

var _SongList = _interopRequireDefault(require("subfirelib/browsers/songs/SongList"));

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

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); }

const CurrentSongList = props => {
  const {
    styles,
    classes,
    className,
    onSongClick,
    ...rest
  } = props; // eslint-disable-line

  const {
    subsonic
  } = (0, _hooks.useSubsonic)();
  const {
    queue = {
      queue: [],
      idx: 0
    },
    current,
    setIdx
  } = (0, _hooks.useQueue)();

  const onSongItemClick = song => {
    setIdx(song.idx);
    onSongClick && onSongClick();
  };

  const songItemProperties = {
    showCover: true,
    showMeta: true,
    showYear: true,
    showCompressed: true,
    showListIndex: true,
    onClick: onSongItemClick
  };
  const songListProperties = {
    styles,
    classes,
    className,
    songItemProperties,
    coverSize: 32,
    getCoverArtURL: subsonic.getCoverArtURL
  };
  return /*#__PURE__*/_react.default.createElement(_SongList.default, _extends({}, songListProperties, {
    songs: queue.queue,
    current: current
  }));
};

var _default = CurrentSongList;
exports.default = _default;