|
@ -1,40 +1,36 @@ |
|
|
|
|
|
import { ListItem } from 'material-ui/List'; |
|
|
import React from 'react'; |
|
|
import React from 'react'; |
|
|
import {List, ListItem} from 'material-ui/List'; |
|
|
|
|
|
|
|
|
|
|
|
export default class SignedInList extends React.Component { |
|
|
export default class SignedInList extends React.Component { |
|
|
constructor (props) { |
|
|
constructor(props) { |
|
|
super(props); |
|
|
super(props); |
|
|
this.state = {tick: 0}; |
|
|
this.state = { tick: 0 }; |
|
|
this.componentDidMount = this.componentDidMount.bind(this); |
|
|
this.componentDidMount = this.componentDidMount.bind(this); |
|
|
this.componentWillUnmount = this.componentWillUnmount.bind(this); |
|
|
this.componentWillUnmount = this.componentWillUnmount.bind(this); |
|
|
this.tick = this.tick.bind(this); |
|
|
this.tick = this.tick.bind(this); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
componentDidMount () { |
|
|
componentDidMount() { |
|
|
this.timer = setInterval(this.tick, 50); |
|
|
this.timer = setInterval(this.tick, 50); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
componentWillUnmount () { |
|
|
componentWillUnmount() { |
|
|
clearInterval(this.timer); |
|
|
clearInterval(this.timer); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
tick () { |
|
|
tick() { |
|
|
this.setState({tick: this.state.tick++}); |
|
|
this.setState({ tick: this.state.tick += 1 }); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
render () { |
|
|
render() { |
|
|
const members = this.props.members.sort((l, r) => { |
|
|
const members = this.props.members.sort((l, r) => l.at.diff(r.at)) |
|
|
return l.at.diff(r.at); |
|
|
|
|
|
}) |
|
|
|
|
|
.reverse() |
|
|
.reverse() |
|
|
.map((member) => { |
|
|
.map(member => <ListItem key={member.id} primaryText={member.text} secondaryText={`${member.purpose} – ${member.at.fromNow()}`} />); |
|
|
return <ListItem key={member.id} primaryText={member.text} secondaryText={`${member.purpose} – ${member.at.fromNow()}`} /> |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<div className="mdl-cell mdl-cell--12-col"> |
|
|
<div className="mdl-cell mdl-cell--12-col"> |
|
|
<h3>Members signed in</h3> |
|
|
<h3>Members signed in</h3> |
|
|
{!!members.length ? members : 'No members currently signed in.'} |
|
|
{members.length ? members : 'No members currently signed in.'} |
|
|
</div> |
|
|
</div> |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|