conversation list: cleanup, use React Hooks
Change-Id: I87511e5acf67e4a9a0edcf75bae1ef1ae3252046
diff --git a/client/src/components/ConversationList.js b/client/src/components/ConversationList.js
index e83b6c1..b28a6d6 100644
--- a/client/src/components/ConversationList.js
+++ b/client/src/components/ConversationList.js
@@ -4,34 +4,28 @@
import ListSubheader from '@material-ui/core/ListSubheader';
import Conversation from '../../../model/Conversation';
import GroupRoundedIcon from '@material-ui/icons/GroupRounded';
-import { Typography } from '@material-ui/core';
+import Typography from '@material-ui/core/Typography';
-class ConversationList extends React.Component {
- render() {
- console.log("ConversationList render " + this.props.accountId)
- console.log(this.props.conversations)
- return (
- <div className="rooms-list">
- <List>
- {this.props.search instanceof Conversation &&
- (<div>
- <ListSubheader>Public directory</ListSubheader>
- <ConversationListItem conversation={this.props.search} />
+export default function ConversationList(props) {
+ return (
+ <div className="rooms-list">
+ <List>
+ {props.search instanceof Conversation &&
+ (<div>
+ <ListSubheader>Public directory</ListSubheader>
+ <ConversationListItem conversation={props.search} />
<ListSubheader>Conversations</ListSubheader>
- </div>)}
- {this.props.conversations.map(conversation =>
- <ConversationListItem key={conversation.getId()} conversation={conversation} />
- )}
- {this.props.conversations.length === 0 && (
- <div className="list-placeholder">
- <GroupRoundedIcon color="disabled" fontSize="large" />
- <Typography className="subtitle" variant="subtitle2">No conversation yet</Typography>
- </div>
- )}
- </List>
- </div>
- )
- }
+ </div>)}
+ {props.conversations.map(conversation =>
+ <ConversationListItem key={conversation.getId()} conversation={conversation} />
+ )}
+ {props.conversations.length === 0 && (
+ <div className="list-placeholder">
+ <GroupRoundedIcon color="disabled" fontSize="large" />
+ <Typography className="subtitle" variant="subtitle2">No conversation yet</Typography>
+ </div>
+ )}
+ </List>
+ </div>
+ )
}
-
-export default ConversationList
\ No newline at end of file