sort components into widgets and views

This commit is contained in:
or-else
2018-10-24 18:04:16 +03:00
parent 5367c71784
commit 99dfb0afeb
48 changed files with 454 additions and 453 deletions
+38
View File
@@ -0,0 +1,38 @@
/* GroupSubs: a list of group subscribers currently online */
import React from 'react';
import LetterTile from './letter-tile.jsx';
export default class GroupSubs extends React.Component {
constructor(props) {
super(props);
this.state = {
onlineSubs: props.subscribers || []
};
}
static getDerivedStateFromProps(nextProps, prevState) {
return {
onlineSubs: nextProps.subscribers ? nextProps.subscribers : []
};
}
render() {
var usersOnline = [];
this.state.onlineSubs.map((sub) => {
usersOnline.push(
<div className="avatar-box" key={sub.user}>
<LetterTile
topic={sub.user}
avatar={makeImageUrl(sub.public ? sub.public.photo : null) || true}
title={sub.public ? sub.public.fn : null} />
</div>
);
});
return (
<div id="topic-users">{usersOnline}</div>
);
}
};