|
|
|
@ -1,16 +1,19 @@ |
|
|
|
import React, { PropTypes } from "react"; |
|
|
|
import { Link } from "react-router"; |
|
|
|
import ImmutablePropTypes from "react-immutable-proptypes"; |
|
|
|
|
|
|
|
import md5 from "md5"; |
|
|
|
|
|
|
|
const Room = ({ name, membership, userCount }) => { |
|
|
|
const Room = ({ name, data }) => { |
|
|
|
const membership = data.get("membership"); |
|
|
|
const user_count = data.get("user_count"); |
|
|
|
|
|
|
|
const classes = ["room"]; |
|
|
|
if (membership == "Member") { |
|
|
|
classes.push("room-joined"); |
|
|
|
} |
|
|
|
|
|
|
|
const hash = md5(name); |
|
|
|
const path = `/app/rooms/${hash}`; |
|
|
|
const path = `/app/rooms/${md5(name)}`; |
|
|
|
|
|
|
|
return ( |
|
|
|
<Link to={path} |
|
|
|
@ -18,15 +21,14 @@ const Room = ({ name, membership, userCount }) => { |
|
|
|
className={classes.join(" ")} |
|
|
|
> |
|
|
|
<span className="room-name">{name}</span> |
|
|
|
<span className="room-user-count">({userCount})</span> |
|
|
|
<span className="room-user-count">({user_count})</span> |
|
|
|
</Link> |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|
Room.propTypes = { |
|
|
|
name: PropTypes.string.isRequired, |
|
|
|
membership: PropTypes.string.isRequired, |
|
|
|
userCount: PropTypes.number.isRequired |
|
|
|
data: ImmutablePropTypes.map.isRequired |
|
|
|
}; |
|
|
|
|
|
|
|
export default Room; |