diff --git a/net/web/src/constants/Colors.js b/net/web/src/constants/Colors.js index f7ff2082..5e228692 100644 --- a/net/web/src/constants/Colors.js +++ b/net/web/src/constants/Colors.js @@ -10,6 +10,7 @@ const Colors = { mask: '#dddddd', encircle: '#cccccc', alert: '#ff8888', + warn: '#dd4444', enabled: '#444444', disabled: '#aaaaaa', text: '#444444', diff --git a/net/web/src/session/conversation/Conversation.jsx b/net/web/src/session/conversation/Conversation.jsx index fae9b28b..84311394 100644 --- a/net/web/src/session/conversation/Conversation.jsx +++ b/net/web/src/session/conversation/Conversation.jsx @@ -15,7 +15,7 @@ export function Conversation({ closeConversation, openDetails, cardId, channelId const thread = useRef(null); const topicRenderer = (topic) => { - return () + return ( actions.removeTopic(topic.id)}/>) } // an unfortunate cludge for the mobile browser diff --git a/net/web/src/session/conversation/topicItem/TopicItem.jsx b/net/web/src/session/conversation/topicItem/TopicItem.jsx index c296822a..f40fce62 100644 --- a/net/web/src/session/conversation/topicItem/TopicItem.jsx +++ b/net/web/src/session/conversation/topicItem/TopicItem.jsx @@ -7,7 +7,32 @@ import { Space, Skeleton, Button, Modal, Input } from 'antd'; import { ExclamationCircleOutlined, DeleteOutlined, EditOutlined, FireOutlined, PictureOutlined } from '@ant-design/icons'; import { Carousel } from 'carousel/Carousel'; -export function TopicItem({ host, topic }) { +export function TopicItem({ host, topic, remove }) { + + const [ modal, modalContext ] = Modal.useModal(); + + const removeTopic = () => { + modal.confirm({ + title: 'Do you want to delete this message?', + icon: , + bodyStyle: { padding: 16 }, + okText: 'Yes, Delete', + cancelText: 'No, Cancel', + onOk: async () => { + try { + await remove(); + } + catch(err) { + console.log(err); + modal.error({ + title: 'Failed to Delete Message', + content: 'Please try again.', + bodyStyle: { padding: 16 }, + }); + } + }, + }); + } const renderAsset = (asset, idx) => { if (asset.image) { @@ -26,6 +51,7 @@ export function TopicItem({ host, topic }) { return ( + { modalContext }
@@ -34,6 +60,20 @@ export function TopicItem({ host, topic }) {
{ topic.name }
{ topic.createdStr }
+
+
+ { topic.creator && ( +
console.log('edit')}> + +
+ )} + { (host || topic.creator) && ( +
+ +
+ )} +
+
{ topic.status !== 'confirmed' && (
diff --git a/net/web/src/session/conversation/topicItem/TopicItem.styled.js b/net/web/src/session/conversation/topicItem/TopicItem.styled.js index cb2fb250..99c0da3d 100644 --- a/net/web/src/session/conversation/topicItem/TopicItem.styled.js +++ b/net/web/src/session/conversation/topicItem/TopicItem.styled.js @@ -1,4 +1,5 @@ import styled from 'styled-components'; +import Colors from 'constants/Colors'; export const TopicItemWrapper = styled.div` display: flex; @@ -18,10 +19,6 @@ export const TopicItemWrapper = styled.div` visibility: visible; } - &:hover .info { - text-decoration: underline; - } - .topic-options { visibility: hidden; padding-left: 16px; @@ -33,7 +30,6 @@ export const TopicItemWrapper = styled.div` flex-direction: row; border-radius: 4px; background-color: #eeeeee; - border: 1px solid #555555; margin-top: 2px; .button { @@ -42,6 +38,14 @@ export const TopicItemWrapper = styled.div` margin-right: 8px; cursor: pointer; } + + .remove { + color: ${Colors.warn}; + } + + .edit { + color: ${Colors.primary}; + } } } diff --git a/net/web/src/session/conversation/topicItem/videoAsset/VideoAsset.jsx b/net/web/src/session/conversation/topicItem/videoAsset/VideoAsset.jsx index 75c9434d..fa0716e2 100644 --- a/net/web/src/session/conversation/topicItem/videoAsset/VideoAsset.jsx +++ b/net/web/src/session/conversation/topicItem/videoAsset/VideoAsset.jsx @@ -10,10 +10,6 @@ export function VideoAsset({ thumbUrl, lqUrl, hdUrl }) { const { state, actions } = useVideoAsset(); const [dimension, setDimension] = useState({ width: 0, height: 0 }); - useEffect(() => { - console.log(dimension); - }, [dimension]); - const activate = () => { if (dimension.width / dimension.height > window.innerWidth / window.innerHeight) { let width = Math.floor(window.innerWidth * 8 / 10); diff --git a/net/web/src/session/conversation/useConversation.hook.js b/net/web/src/session/conversation/useConversation.hook.js index 3ce956bf..e895240c 100644 --- a/net/web/src/session/conversation/useConversation.hook.js +++ b/net/web/src/session/conversation/useConversation.hook.js @@ -210,12 +210,15 @@ export function useConversation(cardId, channelId) { useEffect(() => { const messages = new Map(); conversation.state.topics.forEach((value, id) => { - let item = topics.current.get(id); + const curCardId = conversation.state.card?.id; + const curChannelId = conversation.state.channel?.id; + const key = `${curCardId}:${curChannelId}:${id}` + let item = topics.current.get(key); if (!item) { item = { id }; } syncTopic(item, value); - messages.set(id, item); + messages.set(key, item); }); topics.current = messages; @@ -245,6 +248,9 @@ export function useConversation(cardId, channelId) { }, cancelUpload: () => { }, + removeTopic: async (topicId) => { + await conversation.actions.removeTopic(topicId); + }, }; return { state, actions }; diff --git a/net/web/src/session/identity/Identity.styled.js b/net/web/src/session/identity/Identity.styled.js index 98a39ff6..68f7103a 100644 --- a/net/web/src/session/identity/Identity.styled.js +++ b/net/web/src/session/identity/Identity.styled.js @@ -15,10 +15,10 @@ export const IdentityWrapper = styled.div` &:hover { cursor: pointer; + background-color: ${Colors.formFocus}; .drop { - border: 1px solid ${Colors.encircle}; - background-color: ${Colors.formHover}; + font-weight: bold; } }