StationCard.jsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React, { Component } from "react";
  2. import { connect } from "react-redux";
  3. import { translate } from "react-i18next";
  4. @translate(["home"], { wait: true })
  5. export default class StationCard extends Component {
  6. render() {
  7. const { station, isOwner } = this.props;
  8. let icon = null;
  9. if (station.type === "official") {
  10. if (station.privacy !== "public") icon =
  11. <i className="material-icons" title={ this.props.t("home:thisStationIsNotVisible") }>lock</i>;
  12. } else {
  13. if (isOwner) icon =
  14. <i className="material-icons" title={ this.props.t("home:thisIsYourStation") }>home</i>;
  15. if (station.privacy !== "public") icon =
  16. <i className="material-icons" title={ this.props.t("home:thisStationIsNotVisible") }>lock</i>;
  17. }
  18. return (
  19. <div className="station-card">
  20. <div className="station-media">
  21. <img src={(station.currentSong) ? station.currentSong.thumbnail : ""}/>
  22. </div>
  23. <div className="station-body">
  24. <h3 className="displayName">{station.displayName}</h3>
  25. <p className="description">{station.description}</p>
  26. </div>
  27. <div className="station-footer">
  28. <div className="user-count" title={ this.props.t("home:howManyOtherUsers") }>
  29. <i className="material-icons">people</i>
  30. <span>{station.userCount}</span>
  31. </div>
  32. { icon }
  33. </div>
  34. <a href={station.type + "/" + station.name}/>
  35. </div>
  36. );
  37. }
  38. }