"use strict";

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

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

var _Avatar = _interopRequireDefault(require("@material-ui/core/Avatar"));

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

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

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

const useStyles = (0, _styles.makeStyles)(theme => ({
  avatar: {
    background: theme.palette.secondary.dark,
    color: '#ffffff'
  }
}));

function SubsonicAvatar(props) {
  const classes = useStyles();
  const {
    subsonic
  } = (0, _hooks.useSubsonic)();
  const username = subsonic._u || 'X';
  const avatarURL = username === 'X' ? null : subsonic.getAvatarURL() || null;
  return /*#__PURE__*/_react.default.createElement(_Avatar.default, {
    className: classes.avatar,
    src: avatarURL
  }, username.substring(0, 1).toUpperCase());
}

var _default = SubsonicAvatar;
exports.default = _default;