BOD-14 Cleanup and re-org of some components for messaging.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { MessageFilled } from "@ant-design/icons";
|
||||
import { Card } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import ChatConversationListContainer from "../chat-conversation-list/chat-conversation-list.container";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectChatVisible } from "../../redux/messaging/messaging.selectors";
|
||||
import { toggleChatVisible } from "../../redux/messaging/messaging.actions";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
chatVisible: selectChatVisible
|
||||
});
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
toggleChatVisible: () => dispatch(toggleChatVisible())
|
||||
});
|
||||
|
||||
export function ChatWindowComponent({ chatVisible, toggleChatVisible }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Card size='small'>
|
||||
{chatVisible ? (
|
||||
<ChatConversationListContainer />
|
||||
) : (
|
||||
<div onClick={() => toggleChatVisible()}>
|
||||
<MessageFilled />
|
||||
<strong>{t("messaging.labels.messaging")}</strong>
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(ChatWindowComponent);
|
||||
Reference in New Issue
Block a user