diff --git a/client/src/components/chat-conversation-title/chat-conversation-title.component.jsx b/client/src/components/chat-conversation-title/chat-conversation-title.component.jsx index b28c1d298..510aeb89c 100644 --- a/client/src/components/chat-conversation-title/chat-conversation-title.component.jsx +++ b/client/src/components/chat-conversation-title/chat-conversation-title.component.jsx @@ -4,7 +4,7 @@ import ChatConversationTitleTags from "../chat-conversation-title-tags/chat-conv export default function ChatConversationTitle({ conversation }) { return ( -
+
{conversation.phone_num} ; - if (error) return ; + if (error) return ; - const unreadCount = - (conversation && - conversation && - conversation.messages_aggregate && - conversation.messages_aggregate.aggregate && - conversation.messages_aggregate.aggregate.count) || - 0; + // const unreadCount = + // (conversation && + // conversation && + // conversation.messages_aggregate && + // conversation.messages_aggregate.aggregate && + // conversation.messages_aggregate.aggregate.count) || + // 0; const messages = (conversation && conversation.messages) || []; return (
- - - - - - - + onKeyDown={handleMarkConversationAsRead} + > + + +
); } diff --git a/client/src/components/chat-conversation/chat-conversation.styles.scss b/client/src/components/chat-conversation/chat-conversation.styles.scss new file mode 100644 index 000000000..80d015f1e --- /dev/null +++ b/client/src/components/chat-conversation/chat-conversation.styles.scss @@ -0,0 +1,5 @@ +.chat-conversation { + display: flex; + height: 100%; + flex-direction: column; +} diff --git a/client/src/components/chat-messages-list/chat-message-list.component.jsx b/client/src/components/chat-messages-list/chat-message-list.component.jsx index 308c465f0..8f89188ec 100644 --- a/client/src/components/chat-messages-list/chat-message-list.component.jsx +++ b/client/src/components/chat-messages-list/chat-message-list.component.jsx @@ -1,7 +1,7 @@ import { CheckCircleOutlined, CheckOutlined } from "@ant-design/icons"; import React, { useEffect, useRef } from "react"; +import { AutoSizer, CellMeasurer, CellMeasurerCache, List } from "react-virtualized"; import "./chat-message-list.styles.scss"; -import { List, CellMeasurer, CellMeasurerCache } from "react-virtualized"; export default function ChatMessageListComponent({ messages }) { const virtualizedListRef = useRef(null); @@ -29,7 +29,8 @@ export default function ChatMessageListComponent({ messages }) {
  • + className={`${messages[index].isoutbound ? "replies" : "sent"}`} + >

    {messages[index].text} {StatusRender(messages[index].status)} @@ -41,16 +42,20 @@ export default function ChatMessageListComponent({ messages }) { }; return ( -

    +
      - + + {({ height, width }) => ( + + )} +
    ); diff --git a/client/src/components/chat-messages-list/chat-message-list.styles.scss b/client/src/components/chat-messages-list/chat-message-list.styles.scss index 3b3461870..1c543cfaa 100644 --- a/client/src/components/chat-messages-list/chat-message-list.styles.scss +++ b/client/src/components/chat-messages-list/chat-message-list.styles.scss @@ -1,10 +1,13 @@ -// .messages { -// height: 300px; -// min-height: calc(100% - 10px); -// max-height: calc(100% - 93px); -// overflow-y: scroll; -// overflow-x: hidden; -// } +.messages { + //flex-grow: 1; + flex: 1; + // height: 100%; + // min-height: calc(100% - 10px); + // max-height: calc(100% - 93px); + // // overflow-y: scroll; + // // overflow-x: hidden; +} + // @media screen and (max-width: 735px) { // .messages { // max-height: calc(100% - 105px); @@ -17,13 +20,16 @@ // .messages::-webkit-scrollbar-thumb { // background-color: rgba(0, 0, 0, 0.3); // } +.messages ul { + height: 100%; +} .messages ul li { display: inline-block; - clear: both; + // clear: both; //float: left; - margin: 5px; - width: calc(100% - 25px); - font-size: 0.9em; + // margin: 5px; + //width: calc(100% - 25px); + // font-size: 0.9em; } .messages ul li:nth-last-child(1) { margin-bottom: 20px; diff --git a/client/src/components/chat-open-button/chat-open-button.component.jsx b/client/src/components/chat-open-button/chat-open-button.component.jsx index d9f9d77ec..54ef22dcb 100644 --- a/client/src/components/chat-open-button/chat-open-button.component.jsx +++ b/client/src/components/chat-open-button/chat-open-button.component.jsx @@ -1,15 +1,15 @@ import { MessageFilled } from "@ant-design/icons"; import React from "react"; import { connect } from "react-redux"; - +import { openChatByPhone } from "../../redux/messaging/messaging.actions"; const mapDispatchToProps = (dispatch) => ({ - //openConversation: (phone) => dispatch(openConversation(phone)), + openChatByPhone: (phone) => dispatch(openChatByPhone(phone)), }); -export function ChatOpenButton({ phone }) { +export function ChatOpenButton({ phone, openChatByPhone }) { return ( alert("TODO FIX ME" + phone)} + onClick={() => openChatByPhone(phone)} /> ); } diff --git a/client/src/components/chat-popup/chat-popup.component.jsx b/client/src/components/chat-popup/chat-popup.component.jsx index d6810c107..4aafa9a3d 100644 --- a/client/src/components/chat-popup/chat-popup.component.jsx +++ b/client/src/components/chat-popup/chat-popup.component.jsx @@ -24,7 +24,7 @@ export function ChatPopupComponent({ }) { const { t } = useTranslation(); return ( -
    +
    {t("messaging.labels.messaging")} @@ -35,7 +35,7 @@ export function ChatPopupComponent({ />
    - + diff --git a/client/src/components/chat-popup/chat-popup.styles.scss b/client/src/components/chat-popup/chat-popup.styles.scss index 787469fe2..11c0423cd 100644 --- a/client/src/components/chat-popup/chat-popup.styles.scss +++ b/client/src/components/chat-popup/chat-popup.styles.scss @@ -2,3 +2,7 @@ width: 40vw; height: 50vh; } + +.chat-popup-content { + height: 100%; +} diff --git a/client/src/components/chat-send-message/chat-send-message.component.jsx b/client/src/components/chat-send-message/chat-send-message.component.jsx index ca43dbf73..2a284d781 100644 --- a/client/src/components/chat-send-message/chat-send-message.component.jsx +++ b/client/src/components/chat-send-message/chat-send-message.component.jsx @@ -42,7 +42,7 @@ function ChatSendMessageComponent({ }; return ( -
    +
    conversation", conversation); const { t } = useTranslation(); const [visible, setVisible] = useState(false); const searchQueryState = useState(""); diff --git a/client/src/redux/messaging/messaging.actions.js b/client/src/redux/messaging/messaging.actions.js index 25ef4ab97..77bb569c7 100644 --- a/client/src/redux/messaging/messaging.actions.js +++ b/client/src/redux/messaging/messaging.actions.js @@ -23,3 +23,8 @@ export const setSelectedConversation = (conversationId) => ({ type: MessagingActionTypes.SET_SELECTED_CONVERSATION, payload: conversationId, }); + +export const openChatByPhone = (phoneNumber) => ({ + type: MessagingActionTypes.OPEN_CHAT_BY_PHONE, + payload: phoneNumber, +}); \ No newline at end of file diff --git a/client/src/redux/messaging/messaging.sagas.js b/client/src/redux/messaging/messaging.sagas.js index f167b42f6..a181518d0 100644 --- a/client/src/redux/messaging/messaging.sagas.js +++ b/client/src/redux/messaging/messaging.sagas.js @@ -3,7 +3,14 @@ import { sendMessageFailure, sendMessageSuccess } from "./messaging.actions"; import MessagingActionTypes from "./messaging.types"; import axios from "axios"; import { sendEmailFailure } from "../email/email.actions"; +import { withApollo } from "react-apollo"; +export function* onOpenChatByPhone() { + yield takeLatest(MessagingActionTypes.OPEN_CHAT_BY_PHONE, openChatByPhone); +} +export function* openChatByPhone({ payload: phone, client }) { + console.log("Payload: Phone, Client", phone, client); +} export function* onSendMessage() { yield takeLatest(MessagingActionTypes.SEND_MESSAGE, sendMessage); } @@ -22,5 +29,5 @@ export function* sendMessage({ payload }) { } export function* messagingSagas() { - yield all([call(onSendMessage)]); + yield all([call(onSendMessage), call(onOpenChatByPhone)]); } diff --git a/client/src/redux/messaging/messaging.types.js b/client/src/redux/messaging/messaging.types.js index c6c3caf16..a620ef027 100644 --- a/client/src/redux/messaging/messaging.types.js +++ b/client/src/redux/messaging/messaging.types.js @@ -3,6 +3,7 @@ const MessagingActionTypes = { SEND_MESSAGE: "SEND_MESSAGE", SEND_MESSAGE_SUCCESS: "SEND_MESSAGE_SUCCESS", SEND_MESSAGE_FAILURE: "SEND_MESSAGE_FAILURE", - SET_SELECTED_CONVERSATION: 'SET_SELECTED_CONVERSATION' + SET_SELECTED_CONVERSATION: "SET_SELECTED_CONVERSATION", + OPEN_CHAT_BY_PHONE: "OPEN_CHAT_BY_PHONE", }; export default MessagingActionTypes; diff --git a/client/src/serviceWorker.js b/client/src/serviceWorker.js index e247dde35..85bd9079b 100644 --- a/client/src/serviceWorker.js +++ b/client/src/serviceWorker.js @@ -55,7 +55,7 @@ export function register(config) { if ("serviceWorker" in navigator) { navigator.serviceWorker - .register("./firebase-messaging-sw.js") + .register("/firebase-messaging-sw.js") .then(function (registration) { console.log( "FCM Registration successful, scope is:",