diff --git a/src/App.tsx b/src/App.tsx
index 7236213..d6033d4 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -351,25 +351,25 @@ function App() {
}
};
- const checkIfUserHasLocalNode = useCallback(async () => {
- try {
- const url = `http://127.0.0.1:12391/admin/status`;
- const response = await fetch(url, {
- method: "GET",
- headers: {
- "Content-Type": "application/json",
- },
- });
- const data = await response.json();
- if (data?.isSynchronizing === false && data?.syncPercent === 100) {
- setHasLocalNode(true);
- }
- } catch (error) {}
- }, []);
+ // const checkIfUserHasLocalNode = useCallback(async () => {
+ // try {
+ // const url = `http://127.0.0.1:12391/admin/status`;
+ // const response = await fetch(url, {
+ // method: "GET",
+ // headers: {
+ // "Content-Type": "application/json",
+ // },
+ // });
+ // const data = await response.json();
+ // if (data?.isSynchronizing === false && data?.syncPercent === 100) {
+ // setHasLocalNode(true);
+ // }
+ // } catch (error) {}
+ // }, []);
- useEffect(() => {
- checkIfUserHasLocalNode();
- }, [extState]);
+ // useEffect(() => {
+ // checkIfUserHasLocalNode();
+ // }, [extState]);
const address = useMemo(() => {
if (!rawWallet?.address0) return "";
@@ -1418,7 +1418,7 @@ function App() {
}}
/>
- {hasLocalNode && (
+ {!isMobile && (
<>
-
-
-
+ {!isMobile && (
+
+
+
+ )}
+
)}
{extState === "send-qort" && isMainWindow && (
diff --git a/src/components/Chat/AnnouncementDiscussion.tsx b/src/components/Chat/AnnouncementDiscussion.tsx
index 00c7691..792695a 100644
--- a/src/components/Chat/AnnouncementDiscussion.tsx
+++ b/src/components/Chat/AnnouncementDiscussion.tsx
@@ -26,6 +26,8 @@ export const AnnouncementDiscussion = ({
}) => {
const [isSending, setIsSending] = useState(false);
const [isLoading, setIsLoading] = useState(false);
+ const [isFocusedParent, setIsFocusedParent] = useState(false);
+
const [comments, setComments] = useState([])
const [tempPublishedList, setTempPublishedList] = useState([])
const firstMountRef = useRef(false)
@@ -38,6 +40,12 @@ export const AnnouncementDiscussion = ({
const clearEditorContent = () => {
if (editorRef.current) {
editorRef.current.chain().focus().clearContent().run();
+ if(isMobile){
+ setTimeout(() => {
+ editorRef.current?.chain().blur().run();
+ setIsFocusedParent(false)
+ }, 200);
+ }
}
};
@@ -78,6 +86,7 @@ export const AnnouncementDiscussion = ({
if (!response?.error) {
res(response);
+ return
}
rej(response.error);
}
@@ -281,14 +290,18 @@ export const AnnouncementDiscussion = ({
// position: 'fixed',
// bottom: '0px',
backgroundColor: "#232428",
- minHeight: "150px",
- maxHeight: "400px",
+ minHeight: isMobile ? "0px" : "150px",
+ maxHeight: isMobile ? "auto" : "400px",
display: "flex",
flexDirection: "column",
overflow: "hidden",
width: "100%",
boxSizing: "border-box",
- padding: "20px",
+ padding: isMobile ? "10px": "20px",
+ position: isFocusedParent ? 'fixed' : 'relative',
+ bottom: isFocusedParent ? '0px' : 'unset',
+ top: isFocusedParent ? '0px' : 'unset',
+ zIndex: isFocusedParent ? 5 : 'unset',
flexShrink:0,
}}
>
@@ -297,6 +310,7 @@ export const AnnouncementDiscussion = ({
display: "flex",
flexDirection: "column",
// height: '100%',
+ flexGrow: isMobile && 1,
overflow: "auto",
}}
>
@@ -304,8 +318,19 @@ export const AnnouncementDiscussion = ({
setEditorRef={setEditorRef}
onEnter={publishComment}
disableEnter
+ maxHeightOffset="60px"
+ isFocusedParent={isFocusedParent} setIsFocusedParent={setIsFocusedParent}
+
/>
+
{
if (isSending) return;
@@ -317,6 +342,8 @@ export const AnnouncementDiscussion = ({
cursor: isSending ? "default" : "pointer",
background: isSending && "rgba(0, 0, 0, 0.8)",
flexShrink: 0,
+ padding: isMobile && '5px',
+ fontSize: isMobile && '14px'
}}
>
{isSending && (
@@ -334,6 +361,30 @@ export const AnnouncementDiscussion = ({
)}
{` Publish Comment`}
+ {isFocusedParent && (
+ {
+ if(isSending) return
+ setIsFocusedParent(false)
+ clearEditorContent()
+ // Unfocus the editor
+ }}
+ style={{
+ marginTop: 'auto',
+ alignSelf: 'center',
+ cursor: isSending ? 'default' : 'pointer',
+ background: isSending && 'rgba(0, 0, 0, 0.8)',
+ flexShrink: 0,
+ padding: isMobile && '5px',
+ fontSize: isMobile && '14px',
+ }}
+ >
+
+ {` Close`}
+
+
+ )}
+
{
const { queueChats, addToQueue, } = useMessageQueue();
+ const [isFocusedParent, setIsFocusedParent] = useState(false);
const [messages, setMessages] = useState([])
const [isSending, setIsSending] = useState(false)
@@ -252,6 +254,13 @@ const sendChatDirect = async ({ chatReference = undefined, messageText}: any, ad
const clearEditorContent = () => {
if (editorRef.current) {
editorRef.current.chain().focus().clearContent().run();
+ if(isMobile){
+ setTimeout(() => {
+ editorRef.current?.chain().blur().run();
+ setIsFocusedParent(false)
+ executeEvent("sent-new-message-group", {})
+ }, 200);
+ }
}
};
@@ -293,7 +302,6 @@ const clearEditorContent = () => {
executeEvent("sent-new-message-group", {})
}, 150);
clearEditorContent()
- clearEditorContent()
}
// send chat message
} catch (error) {
@@ -310,7 +318,7 @@ const clearEditorContent = () => {
}
}
-
+console.log('isFocusedParent', isFocusedParent)
return (
{
// position: 'fixed',
// bottom: '0px',
backgroundColor: "#232428",
- minHeight: '150px',
- maxHeight: '400px',
+ minHeight: isMobile ? '0px' : '150px',
+ maxHeight: isMobile ? 'auto' : '400px',
display: 'flex',
flexDirection: 'column',
overflow: 'hidden',
width: '100%',
boxSizing: 'border-box',
- padding: '20px'
+ padding: isMobile ? '10px' : '20px',
+ position: isFocusedParent ? 'fixed' : 'relative',
+ bottom: isFocusedParent ? '0px' : 'unset',
+ top: isFocusedParent ? '0px' : 'unset',
+ zIndex: isFocusedParent ? 5 : 'unset'
}}>
-
+
+
{
if(isSending) return
@@ -365,7 +385,8 @@ const clearEditorContent = () => {
alignSelf: 'center',
cursor: isSending ? 'default' : 'pointer',
background: isSending && 'rgba(0, 0, 0, 0.8)',
- flexShrink: 0
+ flexShrink: 0,
+ padding: isMobile && '5px'
}}
>
{isSending && (
@@ -383,6 +404,29 @@ const clearEditorContent = () => {
)}
{` Send`}
+ {isFocusedParent && (
+ {
+ if(isSending) return
+ setIsFocusedParent(false)
+ clearEditorContent()
+ // Unfocus the editor
+ }}
+ style={{
+ marginTop: 'auto',
+ alignSelf: 'center',
+ cursor: isSending ? 'default' : 'pointer',
+ background: isSending && 'rgba(0, 0, 0, 0.8)',
+ flexShrink: 0,
+ padding: isMobile && '5px'
+ }}
+ >
+
+ {` Close`}
+
+
+ )}
+
{
if (editorRef.current) {
editorRef.current.chain().focus().clearContent().run();
+ if(isMobile){
+ setTimeout(() => {
+ editorRef.current?.chain().blur().run();
+ setIsFocusedParent(false)
+ executeEvent("sent-new-message-group", {})
+ }, 200);
+ }
}
};
@@ -354,25 +364,37 @@ const clearEditorContent = () => {
// position: 'fixed',
// bottom: '0px',
backgroundColor: "#232428",
- minHeight: '150px',
- maxHeight: '400px',
+ minHeight: isMobile ? '0px' : '150px',
+ maxHeight: isMobile ? 'auto' : '400px',
display: 'flex',
flexDirection: 'column',
overflow: 'hidden',
width: '100%',
boxSizing: 'border-box',
- padding: '20px'
+ padding: isMobile ? '10px' : '20px',
+ position: isFocusedParent ? 'fixed' : 'relative',
+ bottom: isFocusedParent ? '0px' : 'unset',
+ top: isFocusedParent ? '0px' : 'unset',
+ zIndex: isFocusedParent ? 5 : 'unset'
}}>
-
+
+
{
if(isSending) return
@@ -383,7 +405,9 @@ const clearEditorContent = () => {
alignSelf: 'center',
cursor: isSending ? 'default' : 'pointer',
background: isSending && 'rgba(0, 0, 0, 0.8)',
- flexShrink: 0
+ flexShrink: 0,
+ padding: isMobile && '5px',
+
}}
>
{isSending && (
@@ -401,6 +425,29 @@ const clearEditorContent = () => {
)}
{` Send`}
+ {isFocusedParent && (
+ {
+ if(isSending) return
+ setIsFocusedParent(false)
+ clearEditorContent()
+ // Unfocus the editor
+ }}
+ style={{
+ marginTop: 'auto',
+ alignSelf: 'center',
+ cursor: isSending ? 'default' : 'pointer',
+ background: isSending && 'rgba(0, 0, 0, 0.8)',
+ flexShrink: 0,
+ padding: isMobile && '5px'
+ }}
+ >
+
+ {` Close`}
+
+
+ )}
+
{/* */}
{/* */}
diff --git a/src/components/Chat/GroupAnnouncements.tsx b/src/components/Chat/GroupAnnouncements.tsx
index d592523..3b11931 100644
--- a/src/components/Chat/GroupAnnouncements.tsx
+++ b/src/components/Chat/GroupAnnouncements.tsx
@@ -51,6 +51,7 @@ export const saveTempPublish = async ({ data, key }: any) => {
if (!response?.error) {
res(response);
+ return
}
rej(response.error);
}
@@ -71,6 +72,7 @@ export const getTempPublish = async () => {
(response) => {
if (!response?.error) {
res(response);
+ return
}
rej(response.error);
}
@@ -135,6 +137,8 @@ export const GroupAnnouncements = ({
const [tempPublishedList, setTempPublishedList] = useState([])
const [announcementData, setAnnouncementData] = useState({});
const [selectedAnnouncement, setSelectedAnnouncement] = useState(null);
+ const [isFocusedParent, setIsFocusedParent] = useState(false);
+
const { show } = React.useContext(MyContext);
const [openSnack, setOpenSnack] = React.useState(false);
const [infoSnack, setInfoSnack] = React.useState(null);
@@ -226,6 +230,12 @@ export const GroupAnnouncements = ({
const clearEditorContent = () => {
if (editorRef.current) {
editorRef.current.chain().focus().clearContent().run();
+ if(isMobile){
+ setTimeout(() => {
+ editorRef.current?.chain().blur().run();
+ setIsFocusedParent(false)
+ }, 200);
+ }
}
};
@@ -500,18 +510,18 @@ export const GroupAnnouncements = ({
width: "100%",
display: "flex",
justifyContent: "center",
- padding: "25px",
- fontSize: "20px",
+ padding: isMobile ? '8px' : "25px",
+ fontSize: isMobile ? '16px' : "20px",
gap: '20px',
alignItems: 'center'
}}
>
Group Announcements
-
+
{!isLoading && combinedListTempAndReal?.length === 0 && (
@@ -541,31 +551,46 @@ export const GroupAnnouncements = ({
// position: 'fixed',
// bottom: '0px',
backgroundColor: "#232428",
- minHeight: "150px",
- maxHeight: "400px",
+ minHeight: isMobile ? "0px" : "150px",
+ maxHeight: isMobile ? "auto" : "400px",
display: "flex",
flexDirection: "column",
overflow: "hidden",
width: "100%",
boxSizing: "border-box",
- padding: "20px",
- flexShrink: 0
+ padding: isMobile ? "10px": "20px",
+ position: isFocusedParent ? 'fixed' : 'relative',
+ bottom: isFocusedParent ? '0px' : 'unset',
+ top: isFocusedParent ? '0px' : 'unset',
+ zIndex: isFocusedParent ? 5 : 'unset',
+ flexShrink: 0
}}
>
+
{
if (isSending) return;
@@ -577,6 +602,9 @@ export const GroupAnnouncements = ({
cursor: isSending ? "default" : "pointer",
background: isSending && "rgba(0, 0, 0, 0.8)",
flexShrink: 0,
+ padding: isMobile && '5px',
+ fontSize: isMobile && '14px',
+
}}
>
{isSending && (
@@ -594,6 +622,30 @@ export const GroupAnnouncements = ({
)}
{` Publish Announcement`}
+ {isFocusedParent && (
+ {
+ if(isSending) return
+ setIsFocusedParent(false)
+ clearEditorContent()
+ // Unfocus the editor
+ }}
+ style={{
+ marginTop: 'auto',
+ alignSelf: 'center',
+ cursor: isSending ? 'default' : 'pointer',
+ background: isSending && 'rgba(0, 0, 0, 0.8)',
+ flexShrink: 0,
+ padding: isMobile && '5px',
+ fontSize: isMobile && '14px',
+ }}
+ >
+
+ {` Close`}
+
+
+ )}
+
)}
diff --git a/src/components/Chat/TipTap.tsx b/src/components/Chat/TipTap.tsx
index 4bdf3c6..be6abff 100644
--- a/src/components/Chat/TipTap.tsx
+++ b/src/components/Chat/TipTap.tsx
@@ -1,4 +1,4 @@
-import React, { useEffect, useRef } from 'react';
+import React, { useEffect, useRef, useState } from 'react';
import { EditorProvider, useCurrentEditor } from '@tiptap/react';
import StarterKit from '@tiptap/starter-kit';
import { Color } from '@tiptap/extension-color';
@@ -25,6 +25,7 @@ import CustomImage from './CustomImage';
import Compressor from 'compressorjs'
import ImageResize from 'tiptap-extension-resize-image'; // Import the ResizeImage extension
+import { isMobile } from '../../App';
const MenuBar = ({ setEditorRef, isChat }) => {
const { editor } = useCurrentEditor();
const fileInputRef = useRef(null);
@@ -88,10 +89,11 @@ const MenuBar = ({ setEditorRef, isChat }) => {
}
// color={editor.isActive('bold') ? 'white' : 'gray'}
sx={{
- color: editor.isActive('bold') ? 'white' : 'gray'
+ color: editor.isActive('bold') ? 'white' : 'gray',
+ padding: isMobile ? '5px' : 'revert'
}}
>
-
+
editor.chain().focus().toggleItalic().run()}
@@ -104,7 +106,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
}
// color={editor.isActive('italic') ? 'white' : 'gray'}
sx={{
- color: editor.isActive('italic') ? 'white' : 'gray'
+ color: editor.isActive('italic') ? 'white' : 'gray',
+ padding: isMobile ? '5px' : 'revert'
}}
>
@@ -120,7 +123,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
}
// color={editor.isActive('strike') ? 'white' : 'gray'}
sx={{
- color: editor.isActive('strike') ? 'white' : 'gray'
+ color: editor.isActive('strike') ? 'white' : 'gray',
+ padding: isMobile ? '5px' : 'revert'
}}
>
@@ -136,19 +140,23 @@ const MenuBar = ({ setEditorRef, isChat }) => {
}
// color={editor.isActive('code') ? 'white' : 'gray'}
sx={{
- color: editor.isActive('code') ? 'white' : 'gray'
+ color: editor.isActive('code') ? 'white' : 'gray',
+ padding: isMobile ? '5px' : 'revert'
}}
>
- editor.chain().focus().unsetAllMarks().run()}>
+ editor.chain().focus().unsetAllMarks().run()}>
editor.chain().focus().toggleBulletList().run()}
// color={editor.isActive('bulletList') ? 'white' : 'gray'}
sx={{
- color: editor.isActive('bulletList') ? 'white' : 'gray'
+ color: editor.isActive('bulletList') ? 'white' : 'gray',
+ padding: isMobile ? '5px' : 'revert'
}}
>
@@ -157,7 +165,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
onClick={() => editor.chain().focus().toggleOrderedList().run()}
// color={editor.isActive('orderedList') ? 'white' : 'gray'}
sx={{
- color: editor.isActive('orderedList') ? 'white' : 'gray'
+ color: editor.isActive('orderedList') ? 'white' : 'gray',
+ padding: isMobile ? '5px' : 'revert'
}}
>
@@ -166,7 +175,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
onClick={() => editor.chain().focus().toggleCodeBlock().run()}
// color={editor.isActive('codeBlock') ? 'white' : 'gray'}
sx={{
- color: editor.isActive('codeBlock') ? 'white' : 'gray'
+ color: editor.isActive('codeBlock') ? 'white' : 'gray',
+ padding: isMobile ? '5px' : 'revert'
}}
>
@@ -175,7 +185,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
onClick={() => editor.chain().focus().toggleBlockquote().run()}
// color={editor.isActive('blockquote') ? 'white' : 'gray'}
sx={{
- color: editor.isActive('blockquote') ? 'white' : 'gray'
+ color: editor.isActive('blockquote') ? 'white' : 'gray',
+ padding: isMobile ? '5px' : 'revert'
}}
>
@@ -187,7 +198,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
onClick={() => editor.chain().focus().toggleHeading({ level: 1 }).run()}
// color={editor.isActive('heading', { level: 1 }) ? 'white' : 'gray'}
sx={{
- color: editor.isActive('heading', { level: 1 }) ? 'white' : 'gray'
+ color: editor.isActive('heading', { level: 1 }) ? 'white' : 'gray',
+ padding: isMobile ? '5px' : 'revert'
}}
>
@@ -202,7 +214,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
.run()
}
sx={{
- color: 'gray'
+ color: 'gray',
+ padding: isMobile ? '5px' : 'revert'
}}
>
@@ -227,7 +240,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
@@ -268,32 +282,66 @@ const extensions = [
const content = ``;
-export default ({ setEditorRef, onEnter, disableEnter, isChat }) => {
-
+export default ({ setEditorRef, onEnter, disableEnter, isChat, maxHeightOffset, setIsFocusedParent, isFocusedParent, overrideMobile, customEditorHeight }) => {
+ const [isFocused, setIsFocused] = useState(false);
const extensionsFiltered = isChat ? extensions.filter((item)=> item?.name !== 'image') : extensions
+ const editorRef = useRef(null);
+ const setEditorRefFunc = (editorInstance) => {
+ editorRef.current = editorInstance;
+ setEditorRef(editorInstance)
+ };
+ const handleFocus = () => {
+ if(!isMobile) return
+ // setIsFocused(true);
+ setIsFocusedParent(true)
+ };
+
+ const handleBlur = () => {
+ const htmlContent = editorRef.current.getHTML();
+
+ if (!htmlContent?.trim() || htmlContent?.trim() === ""){
+ // setIsFocused(false);
+ // setIsFocusedParent(false)
+ };
+
+ };
+ // useEffect(()=> {
+ // setIsFocused(isFocusedParent)
+ // },[isFocusedParent])
+
return (
}
- extensions={extensionsFiltered}
- content={content}
- editorProps={{
- handleKeyDown(view, event) {
- if (!disableEnter && event.key === 'Enter') {
- if (event.shiftKey) {
- // Shift+Enter: Insert a hard break
- view.dispatch(view.state.tr.replaceSelectionWith(view.state.schema.nodes.hardBreak.create()));
- return true;
- } else {
- // Enter: Call the callback function
- if (typeof onEnter === 'function') {
- onEnter();
- }
- return true; // Prevent the default action of adding a new line
+ slotBefore={(isFocusedParent || !isMobile || overrideMobile) && }
+ extensions={extensionsFiltered}
+ content={content}
+ onCreate={({ editor }) => {
+ editor.on('focus', handleFocus); // Listen for focus event
+ editor.on('blur', handleBlur); // Listen for blur event
+ }}
+ onUpdate={({ editor }) => {
+ editor.on('focus', handleFocus); // Ensure focus is updated
+ editor.on('blur', handleBlur); // Ensure blur is updated
+ }}
+ editorProps={{
+ attributes: {
+ class: 'tiptap-prosemirror',
+ style: isMobile && `overflow: auto; min-height: ${customEditorHeight ? '200px' : '0px'}; 200px; max-height:calc(100svh - ${ customEditorHeight ? customEditorHeight : '140px'})`,
+ },
+ handleKeyDown(view, event) {
+ if (!disableEnter && event.key === 'Enter') {
+ if (event.shiftKey) {
+ view.dispatch(view.state.tr.replaceSelectionWith(view.state.schema.nodes.hardBreak.create()));
+ return true;
+ } else {
+ if (typeof onEnter === 'function') {
+ onEnter();
}
+ return true;
}
- return false; // Allow default handling for other keys
- },
- }}
- />
- );
+ }
+ return false;
+ },
+ }}
+ />
+ )
};
diff --git a/src/components/Chat/styles.css b/src/components/Chat/styles.css
index f7b28ea..8766c40 100644
--- a/src/components/Chat/styles.css
+++ b/src/components/Chat/styles.css
@@ -118,4 +118,5 @@
.tiptap img {
display: block;
max-width: 100%;
-}
\ No newline at end of file
+}
+
diff --git a/src/components/Group/AddGroup.tsx b/src/components/Group/AddGroup.tsx
index ed27d35..288e6f3 100644
--- a/src/components/Group/AddGroup.tsx
+++ b/src/components/Group/AddGroup.tsx
@@ -29,7 +29,7 @@ import { AddGroupList } from "./AddGroupList";
import { UserListOfInvites } from "./UserListOfInvites";
import { CustomizedSnackbars } from "../Snackbar/Snackbar";
import { getFee } from "../../background";
-import { MyContext } from "../../App";
+import { MyContext, isMobile } from "../../App";
import { subscribeToEvent, unsubscribeFromEvent } from "../../utils/events";
export const Label = styled("label")(
@@ -220,44 +220,50 @@ export const AddGroup = ({ address, open, setOpen }) => {
}}
>
-
-
-
-
-
+
+
+
+
+
{value === 0 && (
diff --git a/src/components/Group/AddGroupList.tsx b/src/components/Group/AddGroupList.tsx
index 2eb9495..4f459e0 100644
--- a/src/components/Group/AddGroupList.tsx
+++ b/src/components/Group/AddGroupList.tsx
@@ -247,7 +247,7 @@ export const AddGroupList = ({ setInfoSnack, setOpenSnack }) => {
style={{
position: "relative",
height: "500px",
- width: "600px",
+ width: "100%",
display: "flex",
flexDirection: "column",
flexShrink: 1,
diff --git a/src/components/Group/Forum/NewThread.tsx b/src/components/Group/Forum/NewThread.tsx
index a716823..ff1626d 100644
--- a/src/components/Group/Forum/NewThread.tsx
+++ b/src/components/Group/Forum/NewThread.tsx
@@ -30,7 +30,7 @@ import { formatBytes } from "../../../utils/Size";
import { CreateThreadIcon } from "../../../assets/svgs/CreateThreadIcon";
import { SendNewMessage } from "../../../assets/svgs/SendNewMessage";
import { TextEditor } from "./TextEditor";
-import { MyContext, pauseAllQueues, resumeAllQueues } from "../../../App";
+import { MyContext, isMobile, pauseAllQueues, resumeAllQueues } from "../../../App";
import { getFee } from "../../../background";
import TipTap from "../../Chat/TipTap";
import { MessageDisplay } from "../../Chat/MessageDisplay";
@@ -410,7 +410,7 @@ export const NewThread = ({
{isMessage ? "Post Message" : "New Thread"}
-
+
)}
-
+ {!isMobile && (
+
+
+ )}
{/*
diff --git a/src/components/Group/Group.tsx b/src/components/Group/Group.tsx
index 6e6a14a..642119d 100644
--- a/src/components/Group/Group.tsx
+++ b/src/components/Group/Group.tsx
@@ -522,6 +522,36 @@ export const Group = ({
return hasUnread;
}, [timestampEnterData, directs, myAddress]);
+ const groupChatHasUnread = useMemo(() => {
+ let hasUnread = false;
+ groups.forEach((group) => {
+ if (
+ group?.data && isExtMsg(group?.data) && group?.sender !== myAddress &&
+ group?.timestamp &&
+ ((!timestampEnterData[group?.groupId] &&
+ Date.now() - group?.timestamp <
+ timeDifferenceForNotificationChats) ||
+ timestampEnterData[group?.groupId] < group?.timestamp)
+ ) {
+ hasUnread = true;
+ }
+ });
+ return hasUnread;
+ }, [timestampEnterData, groups, myAddress]);
+
+ const groupsAnnHasUnread = useMemo(() => {
+ let hasUnread = false;
+ groups.forEach((group) => {
+ if (
+ groupAnnouncements[group?.groupId] &&
+ !groupAnnouncements[group?.groupId]?.seentimestamp
+ ) {
+ hasUnread = true;
+ }
+ });
+ return hasUnread;
+ }, [groupAnnouncements, groups]);
+
// useEffect(() => {
// if (!myAddress) return;
// checkGroupListFunc(myAddress);
@@ -1660,6 +1690,7 @@ export const Group = ({
setNewChat(true);
setSelectedDirect(null);
setSelectedGroup(null);
+ setIsOpenDrawer(false)
}}
>
}
- sx={{ padding: '4px 6px' }} // Make padding smaller
+ sx={{ padding: '4px 6px',
+ color: groupSection === 'announcement' ? 'black' : 'white',
+ backgroundColor: isUnread
+ ? "red" : groupSection === 'announcement' ? 'white' : 'black',
+ }}
onClick={goToAnnouncements}
>
ANN
@@ -2217,7 +2252,10 @@ export const Group = ({
size="small"
variant="contained"
startIcon={}
- sx={{ padding: '4px 6px' }}
+ sx={{ padding: '4px 6px', color: groupSection === 'chat' ? 'black' : 'white',
+ backgroundColor: isUnreadChat
+ ? "red"
+ : groupSection === 'chat' ? 'white' : 'black', }}
onClick={goToChat}
>
Chat
@@ -2229,7 +2267,8 @@ export const Group = ({
size="small"
variant="contained"
startIcon={}
- sx={{ padding: '4px 6px' }}
+ sx={{ padding: '4px 6px', color: groupSection === 'forum' ? 'black' : 'white',
+ backgroundColor: groupSection === 'forum' ? 'white' : 'black', }}
onClick={() => setGroupSection("forum")}
>
Forum
@@ -2241,7 +2280,7 @@ export const Group = ({
size="small"
variant="contained"
startIcon={}
- sx={{ padding: '4px 6px' }}
+ sx={{ padding: '4px 6px', backgroundColor: 'black' }}
onClick={() => setOpenManageMembers(true)}
>
Members
@@ -2257,7 +2296,7 @@ export const Group = ({
size="small"
variant="contained"
startIcon={}
- sx={{ padding: '2px 4px' }}
+ sx={{ padding: '2px 4px', backgroundColor: groupChatHasUnread || groupsAnnHasUnread || directChatHasUnread ? "red" : 'black' }}
onClick={() => {
setIsOpenDrawer(true);
setDrawerMode("groups");
diff --git a/src/components/Group/ListOfBans.tsx b/src/components/Group/ListOfBans.tsx
index b25d21e..41ef9f4 100644
--- a/src/components/Group/ListOfBans.tsx
+++ b/src/components/Group/ListOfBans.tsx
@@ -168,7 +168,7 @@ export const ListOfBans = ({ groupId, setInfoSnack, setOpenSnack, show }) => {
return (
Ban list
-
+
{({ height, width }) => (
return (
Invitees list
-
+
{({ height, width }) => (
Join request list
-
+
{({ height, width }) => (
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
{selectedGroup?.groupId && !isOwner && (
diff --git a/src/components/Group/UserListOfInvites.tsx b/src/components/Group/UserListOfInvites.tsx
index 98f37f1..20aa6fb 100644
--- a/src/components/Group/UserListOfInvites.tsx
+++ b/src/components/Group/UserListOfInvites.tsx
@@ -186,7 +186,7 @@ export const UserListOfInvites = ({myAddress, setInfoSnack, setOpenSnack}) => {
return (
Invite list
-
+
{({ height, width }) => (