"use strict";

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

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

var _RemoteSenderMenu = _interopRequireDefault(require("./RemoteSenderMenu"));

var _RemoteMediaButtons = require("./RemoteMediaButtons");

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

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

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

var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));

var _DialogActions = _interopRequireDefault(require("@material-ui/core/DialogActions"));

var _DialogContent = _interopRequireDefault(require("@material-ui/core/DialogContent"));

var _DialogTitle = _interopRequireDefault(require("@material-ui/core/DialogTitle"));

var _TG = require("subfirelib/ui/TG");

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 styles = theme => ({
  root: {
    width: '100%',
    maxWidth: 480
  },
  container: {}
}); //, csProps, ...rsProps


const RemoteControl = props => {
  const {
    classes = {},
    handleClose
  } = props;
  const csProps = {};
  const {
    sendRemoteAction,
    setReceiver,
    isEnabled,
    receivers,
    receiver
  } = (0, _hooks.useRemoteSender)();
  const rsProps = {
    setReceiver,
    isEnabled,
    receivers,
    receiver
  };

  const play = () => {
    return sendRemoteAction('play');
  };

  const pause = () => {
    return sendRemoteAction('pause');
  }; // const playOrPause = () => {
  //   return sendRemoteAction('playOrPause');
  // };


  const playerNext = () => {
    return sendRemoteAction('playerNext');
  };

  const playerPrev = () => {
    return sendRemoteAction('playerPrev');
  };

  const shufflePlaying = () => {
    return sendRemoteAction('shufflePlaying');
  };

  const playerSkip = () => {
    return sendRemoteAction('playerSkip');
  };
  /*            */


  return /*#__PURE__*/_react.default.createElement(_Dialog.default, {
    disableBackdropClick: true,
    open: true
  }, /*#__PURE__*/_react.default.createElement(_DialogTitle.default, null, "Remote Control"), /*#__PURE__*/_react.default.createElement(_DialogContent.default, null, /*#__PURE__*/_react.default.createElement("div", {
    className: classes.root
  }, /*#__PURE__*/_react.default.createElement(_TG.Gc, {
    spacing: 2,
    className: classes.container
  }, /*#__PURE__*/_react.default.createElement(_TG.Gi, {
    xs: 12
  }, /*#__PURE__*/_react.default.createElement(_RemoteSenderMenu.default, _extends({
    variant: "button"
  }, rsProps)), /*#__PURE__*/_react.default.createElement(_TG.Tb1, {
    component: "span"
  }, receiver || '')), /*#__PURE__*/_react.default.createElement(_TG.Gi, {
    xs: 4
  }, /*#__PURE__*/_react.default.createElement(_RemoteMediaButtons.PlayButton, _extends({}, csProps, {
    action: play,
    fab: true,
    standalone: false,
    color: "primary"
  }))), /*#__PURE__*/_react.default.createElement(_TG.Gi, {
    xs: 4
  }, /*#__PURE__*/_react.default.createElement(_RemoteMediaButtons.PauseButton, _extends({}, csProps, {
    action: pause,
    fab: false,
    standalone: false,
    color: "primary"
  }))), /*#__PURE__*/_react.default.createElement(_TG.Gi, {
    xs: 4
  }, /*#__PURE__*/_react.default.createElement(_RemoteMediaButtons.SkipAlbumButton, _extends({}, csProps, {
    action: playerSkip
  }))), /*#__PURE__*/_react.default.createElement(_TG.Gi, {
    xs: 4
  }, /*#__PURE__*/_react.default.createElement(_RemoteMediaButtons.PrevButton, _extends({}, csProps, {
    action: playerPrev,
    buttonClassName: "button-class",
    iconClassName: "icon-class"
  }))), /*#__PURE__*/_react.default.createElement(_TG.Gi, {
    xs: 4
  }, /*#__PURE__*/_react.default.createElement(_RemoteMediaButtons.NextButton, _extends({}, csProps, {
    action: playerNext
  }))), /*#__PURE__*/_react.default.createElement(_TG.Gi, {
    xs: 4
  }, /*#__PURE__*/_react.default.createElement(_RemoteMediaButtons.ShuffleButton, {
    action: shufflePlaying
  }))))), /*#__PURE__*/_react.default.createElement(_DialogActions.default, null, /*#__PURE__*/_react.default.createElement(_Button.default, {
    size: "small",
    onClick: () => handleClose()
  }, "Close")));
};

exports.RemoteControl = RemoteControl;

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

exports.default = _default;