38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
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);
|