import React, { Component } from "react"; import { fallbackImage } from "constants.js"; import { connect } from "react-redux"; import { translate } from "react-i18next"; @connect(state => ({ user: { loggedIn: state.session.get("loggedIn"), userId: state.session.get("userId"), role: state.session.get("role"), }, })) @translate(["home"], { wait: true }) export default class StationCard extends Component { isOwner = () => { if (this.props.user.loggedIn) { if (this.props.user.role === "admin") return true; if (this.props.user.userId === this.props.station.get("stationOwner")) return true; } return false; }; render() { const { station } = this.props; let icon = null; if (station.get("type") === "official") { if (station.get("privacy") !== "public") icon = lock; } else { if (this.isOwner()) icon = home; if (station.get("privacy") !== "public") icon = lock; } return (

{station.get("displayName")}

{station.get("description")}

people {station.get("userCount")}
{ icon }
); } }