diff --git a/src/views/Conversations/Online/Components/MessageListFilter.jsx b/src/views/Conversations/Online/Components/MessageListFilter.jsx index b45dce0..d6d9ebf 100644 --- a/src/views/Conversations/Online/Components/MessageListFilter.jsx +++ b/src/views/Conversations/Online/Components/MessageListFilter.jsx @@ -1,8 +1,8 @@ import { createContext, useEffect, useState } from 'react'; -import { Button, Tag, Radio, Popover, Form, Dropdown, Tabs, List, Image, Empty, Avatar } from 'antd'; +import { Button, Tag, Radio, Popover, Form, Dropdown, Tabs, List, Image, Empty, Avatar, Card } from 'antd'; import { FileSearchOutlined, FilterOutlined, FilterTwoTone } from '@ant-design/icons'; import { FilterIcon, InboxIcon, MailSendIcon, SendPlaneFillIcon, SendPlaneLineIcon } from '@/components/Icons'; -import { isEmpty, objectMapper, stringToColour } from '@/utils/commons'; +import { groupBy, isEmpty, objectMapper, stringToColour } from '@/utils/commons'; import useConversationStore from '@/stores/ConversationStore'; import { useShallow } from 'zustand/react/shallow'; import EmailDetail from './EmailDetail'; @@ -12,6 +12,10 @@ const CalColorStyle = (tag, outerStyle = true) => { const outerStyleObj = outerStyle ? { borderColor: `${color}66`, backgroundColor: `${color}0D` } : {}; return { color: `${color}`, ...outerStyleObj }; }; +const getVideoName = (vUrl) => { + const url = new URL(vUrl); + return url.pathname.split('/').pop(); +}; const MessageListFilter = ({ ...props }) => { const activeMessages = useConversationStore( useShallow((state) => (state.currentConversation.sn && state.activeConversations[state.currentConversation.sn] ? state.activeConversations[state.currentConversation.sn] : [])) @@ -23,13 +27,20 @@ const MessageListFilter = ({ ...props }) => { const Album = () => { const data = (activeMessages || []).filter((item) => item.type === 'photo').reverse(); + const byDate = groupBy(data, (item) => item.localDate.slice(0, 10)); return ( <> {data.length === 0 && } -
+
- {data.map((img) => ( - + {Object.keys(byDate).map((date, index) => ( + +
+ {byDate[date].map((img) => ( + + ))} +
+
))}
@@ -42,7 +53,7 @@ const MessageListFilter = ({ ...props }) => { const data = (activeMessages || []).filter((item) => item.type === 'video').reverse(); return ( <> - {data.length === 0 && } + {/* {data.length === 0 && }
{data.map((item) => ( ))} -
+
*/} + ( + + } + avatar={ + + {item.senderName} + + } + title={ + + {getVideoName(item?.data.videoURL)} + + } + description={item.text} + /> + {/* {item.text} */} + + )} + /> ); }; diff --git a/src/views/Conversations/Online/Input/EmailEditorPopup.jsx b/src/views/Conversations/Online/Input/EmailEditorPopup.jsx index 028f323..2ff8345 100644 --- a/src/views/Conversations/Online/Input/EmailEditorPopup.jsx +++ b/src/views/Conversations/Online/Input/EmailEditorPopup.jsx @@ -215,7 +215,7 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, reference, quote = {}, ini