mirror of
https://github.com/Qortal/chrome-extension.git
synced 2025-02-19 05:35:51 +00:00
mobile update
This commit is contained in:
parent
eebcd8c36f
commit
93fba38de3
63
src/App.tsx
63
src/App.tsx
@ -351,25 +351,25 @@ function App() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkIfUserHasLocalNode = useCallback(async () => {
|
// const checkIfUserHasLocalNode = useCallback(async () => {
|
||||||
try {
|
// try {
|
||||||
const url = `http://127.0.0.1:12391/admin/status`;
|
// const url = `http://127.0.0.1:12391/admin/status`;
|
||||||
const response = await fetch(url, {
|
// const response = await fetch(url, {
|
||||||
method: "GET",
|
// method: "GET",
|
||||||
headers: {
|
// headers: {
|
||||||
"Content-Type": "application/json",
|
// "Content-Type": "application/json",
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
const data = await response.json();
|
// const data = await response.json();
|
||||||
if (data?.isSynchronizing === false && data?.syncPercent === 100) {
|
// if (data?.isSynchronizing === false && data?.syncPercent === 100) {
|
||||||
setHasLocalNode(true);
|
// setHasLocalNode(true);
|
||||||
}
|
// }
|
||||||
} catch (error) {}
|
// } catch (error) {}
|
||||||
}, []);
|
// }, []);
|
||||||
|
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
checkIfUserHasLocalNode();
|
// checkIfUserHasLocalNode();
|
||||||
}, [extState]);
|
// }, [extState]);
|
||||||
|
|
||||||
const address = useMemo(() => {
|
const address = useMemo(() => {
|
||||||
if (!rawWallet?.address0) return "";
|
if (!rawWallet?.address0) return "";
|
||||||
@ -1418,7 +1418,7 @@ function App() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
{hasLocalNode && (
|
{!isMobile && (
|
||||||
<>
|
<>
|
||||||
<Spacer height="15px" />
|
<Spacer height="15px" />
|
||||||
<Box
|
<Box
|
||||||
@ -1568,17 +1568,20 @@ function App() {
|
|||||||
{!isMobile && renderProfile()}
|
{!isMobile && renderProfile()}
|
||||||
|
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
{!isMobile && (
|
||||||
sx={{
|
<Box
|
||||||
position: "fixed",
|
sx={{
|
||||||
right: "25px",
|
position: "fixed",
|
||||||
bottom: "25px",
|
right: "25px",
|
||||||
width: "350px",
|
bottom: "25px",
|
||||||
zIndex: 100000,
|
width: "350px",
|
||||||
}}
|
zIndex: 100000,
|
||||||
>
|
}}
|
||||||
<TaskManger getUserInfo={getUserInfo} />
|
>
|
||||||
</Box>
|
<TaskManger getUserInfo={getUserInfo} />
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
|
||||||
</MyContext.Provider>
|
</MyContext.Provider>
|
||||||
)}
|
)}
|
||||||
{extState === "send-qort" && isMainWindow && (
|
{extState === "send-qort" && isMainWindow && (
|
||||||
|
@ -26,6 +26,8 @@ export const AnnouncementDiscussion = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const [isSending, setIsSending] = useState(false);
|
const [isSending, setIsSending] = useState(false);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const [isFocusedParent, setIsFocusedParent] = useState(false);
|
||||||
|
|
||||||
const [comments, setComments] = useState([])
|
const [comments, setComments] = useState([])
|
||||||
const [tempPublishedList, setTempPublishedList] = useState([])
|
const [tempPublishedList, setTempPublishedList] = useState([])
|
||||||
const firstMountRef = useRef(false)
|
const firstMountRef = useRef(false)
|
||||||
@ -38,6 +40,12 @@ export const AnnouncementDiscussion = ({
|
|||||||
const clearEditorContent = () => {
|
const clearEditorContent = () => {
|
||||||
if (editorRef.current) {
|
if (editorRef.current) {
|
||||||
editorRef.current.chain().focus().clearContent().run();
|
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) {
|
if (!response?.error) {
|
||||||
res(response);
|
res(response);
|
||||||
|
return
|
||||||
}
|
}
|
||||||
rej(response.error);
|
rej(response.error);
|
||||||
}
|
}
|
||||||
@ -281,14 +290,18 @@ export const AnnouncementDiscussion = ({
|
|||||||
// position: 'fixed',
|
// position: 'fixed',
|
||||||
// bottom: '0px',
|
// bottom: '0px',
|
||||||
backgroundColor: "#232428",
|
backgroundColor: "#232428",
|
||||||
minHeight: "150px",
|
minHeight: isMobile ? "0px" : "150px",
|
||||||
maxHeight: "400px",
|
maxHeight: isMobile ? "auto" : "400px",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
boxSizing: "border-box",
|
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,
|
flexShrink:0,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -297,6 +310,7 @@ export const AnnouncementDiscussion = ({
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
// height: '100%',
|
// height: '100%',
|
||||||
|
flexGrow: isMobile && 1,
|
||||||
overflow: "auto",
|
overflow: "auto",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -304,8 +318,19 @@ export const AnnouncementDiscussion = ({
|
|||||||
setEditorRef={setEditorRef}
|
setEditorRef={setEditorRef}
|
||||||
onEnter={publishComment}
|
onEnter={publishComment}
|
||||||
disableEnter
|
disableEnter
|
||||||
|
maxHeightOffset="60px"
|
||||||
|
isFocusedParent={isFocusedParent} setIsFocusedParent={setIsFocusedParent}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<Box sx={{
|
||||||
|
display: 'flex',
|
||||||
|
width: '100&',
|
||||||
|
gap: '10px',
|
||||||
|
justifyContent: 'center',
|
||||||
|
flexShrink: 0,
|
||||||
|
position: 'relative',
|
||||||
|
}}>
|
||||||
<CustomButton
|
<CustomButton
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (isSending) return;
|
if (isSending) return;
|
||||||
@ -317,6 +342,8 @@ export const AnnouncementDiscussion = ({
|
|||||||
cursor: isSending ? "default" : "pointer",
|
cursor: isSending ? "default" : "pointer",
|
||||||
background: isSending && "rgba(0, 0, 0, 0.8)",
|
background: isSending && "rgba(0, 0, 0, 0.8)",
|
||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
|
padding: isMobile && '5px',
|
||||||
|
fontSize: isMobile && '14px'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isSending && (
|
{isSending && (
|
||||||
@ -334,6 +361,30 @@ export const AnnouncementDiscussion = ({
|
|||||||
)}
|
)}
|
||||||
{` Publish Comment`}
|
{` Publish Comment`}
|
||||||
</CustomButton>
|
</CustomButton>
|
||||||
|
{isFocusedParent && (
|
||||||
|
<CustomButton
|
||||||
|
onClick={()=> {
|
||||||
|
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`}
|
||||||
|
</CustomButton>
|
||||||
|
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<LoadingSnackbar
|
<LoadingSnackbar
|
||||||
|
@ -6,7 +6,7 @@ import "@chatscope/chat-ui-kit-styles/dist/default/styles.min.css";
|
|||||||
import Tiptap from './TipTap'
|
import Tiptap from './TipTap'
|
||||||
import { CustomButton } from '../../App-styles'
|
import { CustomButton } from '../../App-styles'
|
||||||
import CircularProgress from '@mui/material/CircularProgress';
|
import CircularProgress from '@mui/material/CircularProgress';
|
||||||
import { Input } from '@mui/material';
|
import { Box, Input } from '@mui/material';
|
||||||
import { LoadingSnackbar } from '../Snackbar/LoadingSnackbar';
|
import { LoadingSnackbar } from '../Snackbar/LoadingSnackbar';
|
||||||
import { getNameInfo } from '../Group/Group';
|
import { getNameInfo } from '../Group/Group';
|
||||||
import { Spacer } from '../../common/Spacer';
|
import { Spacer } from '../../common/Spacer';
|
||||||
@ -15,6 +15,7 @@ import { getBaseApiReactSocket, isMobile, pauseAllQueues, resumeAllQueues } from
|
|||||||
import { getPublicKey } from '../../background';
|
import { getPublicKey } from '../../background';
|
||||||
import { useMessageQueue } from '../../MessageQueueContext';
|
import { useMessageQueue } from '../../MessageQueueContext';
|
||||||
import { executeEvent } from '../../utils/events';
|
import { executeEvent } from '../../utils/events';
|
||||||
|
import zIndex from '@mui/material/styles/zIndex';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -22,6 +23,7 @@ import { executeEvent } from '../../utils/events';
|
|||||||
|
|
||||||
export const ChatDirect = ({ myAddress, isNewChat, selectedDirect, setSelectedDirect, setNewChat, getTimestampEnterChat, myName, balance}) => {
|
export const ChatDirect = ({ myAddress, isNewChat, selectedDirect, setSelectedDirect, setNewChat, getTimestampEnterChat, myName, balance}) => {
|
||||||
const { queueChats, addToQueue, } = useMessageQueue();
|
const { queueChats, addToQueue, } = useMessageQueue();
|
||||||
|
const [isFocusedParent, setIsFocusedParent] = useState(false);
|
||||||
|
|
||||||
const [messages, setMessages] = useState([])
|
const [messages, setMessages] = useState([])
|
||||||
const [isSending, setIsSending] = useState(false)
|
const [isSending, setIsSending] = useState(false)
|
||||||
@ -252,6 +254,13 @@ const sendChatDirect = async ({ chatReference = undefined, messageText}: any, ad
|
|||||||
const clearEditorContent = () => {
|
const clearEditorContent = () => {
|
||||||
if (editorRef.current) {
|
if (editorRef.current) {
|
||||||
editorRef.current.chain().focus().clearContent().run();
|
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", {})
|
executeEvent("sent-new-message-group", {})
|
||||||
}, 150);
|
}, 150);
|
||||||
clearEditorContent()
|
clearEditorContent()
|
||||||
clearEditorContent()
|
|
||||||
}
|
}
|
||||||
// send chat message
|
// send chat message
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -310,7 +318,7 @@ const clearEditorContent = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('isFocusedParent', isFocusedParent)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{
|
<div style={{
|
||||||
@ -336,25 +344,37 @@ const clearEditorContent = () => {
|
|||||||
// position: 'fixed',
|
// position: 'fixed',
|
||||||
// bottom: '0px',
|
// bottom: '0px',
|
||||||
backgroundColor: "#232428",
|
backgroundColor: "#232428",
|
||||||
minHeight: '150px',
|
minHeight: isMobile ? '0px' : '150px',
|
||||||
maxHeight: '400px',
|
maxHeight: isMobile ? 'auto' : '400px',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
boxSizing: 'border-box',
|
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'
|
||||||
}}>
|
}}>
|
||||||
<div style={{
|
<div style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
// height: '100%',
|
flexGrow: isMobile && 1,
|
||||||
overflow: 'auto'
|
overflow: !isMobile && "auto",
|
||||||
}}>
|
}}>
|
||||||
|
|
||||||
|
|
||||||
<Tiptap setEditorRef={setEditorRef} onEnter={sendMessage} isChat />
|
<Tiptap isFocusedParent={isFocusedParent} setEditorRef={setEditorRef} onEnter={sendMessage} isChat disableEnter={isMobile ? true : false} setIsFocusedParent={setIsFocusedParent}/>
|
||||||
</div>
|
</div>
|
||||||
|
<Box sx={{
|
||||||
|
display: 'flex',
|
||||||
|
width: '100&',
|
||||||
|
gap: '10px',
|
||||||
|
justifyContent: 'center',
|
||||||
|
flexShrink: 0,
|
||||||
|
position: 'relative',
|
||||||
|
}}>
|
||||||
<CustomButton
|
<CustomButton
|
||||||
onClick={()=> {
|
onClick={()=> {
|
||||||
if(isSending) return
|
if(isSending) return
|
||||||
@ -365,7 +385,8 @@ const clearEditorContent = () => {
|
|||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
cursor: isSending ? 'default' : 'pointer',
|
cursor: isSending ? 'default' : 'pointer',
|
||||||
background: isSending && 'rgba(0, 0, 0, 0.8)',
|
background: isSending && 'rgba(0, 0, 0, 0.8)',
|
||||||
flexShrink: 0
|
flexShrink: 0,
|
||||||
|
padding: isMobile && '5px'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isSending && (
|
{isSending && (
|
||||||
@ -383,6 +404,29 @@ const clearEditorContent = () => {
|
|||||||
)}
|
)}
|
||||||
{` Send`}
|
{` Send`}
|
||||||
</CustomButton>
|
</CustomButton>
|
||||||
|
{isFocusedParent && (
|
||||||
|
<CustomButton
|
||||||
|
onClick={()=> {
|
||||||
|
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`}
|
||||||
|
</CustomButton>
|
||||||
|
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
</div>
|
</div>
|
||||||
<LoadingSnackbar open={isLoading} info={{
|
<LoadingSnackbar open={isLoading} info={{
|
||||||
message: "Loading chat... please wait."
|
message: "Loading chat... please wait."
|
||||||
|
@ -15,6 +15,7 @@ import { CustomizedSnackbars } from '../Snackbar/Snackbar'
|
|||||||
import { PUBLIC_NOTIFICATION_CODE_FIRST_SECRET_KEY } from '../../constants/codes'
|
import { PUBLIC_NOTIFICATION_CODE_FIRST_SECRET_KEY } from '../../constants/codes'
|
||||||
import { useMessageQueue } from '../../MessageQueueContext'
|
import { useMessageQueue } from '../../MessageQueueContext'
|
||||||
import { executeEvent } from '../../utils/events'
|
import { executeEvent } from '../../utils/events'
|
||||||
|
import { Box } from '@mui/material'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -28,6 +29,8 @@ export const ChatGroup = ({selectedGroup, secretKey, setSecretKey, getSecretKey,
|
|||||||
const [openSnack, setOpenSnack] = React.useState(false);
|
const [openSnack, setOpenSnack] = React.useState(false);
|
||||||
const [infoSnack, setInfoSnack] = React.useState(null);
|
const [infoSnack, setInfoSnack] = React.useState(null);
|
||||||
const hasInitialized = useRef(false)
|
const hasInitialized = useRef(false)
|
||||||
|
const [isFocusedParent, setIsFocusedParent] = useState(false);
|
||||||
|
|
||||||
const hasInitializedWebsocket = useRef(false)
|
const hasInitializedWebsocket = useRef(false)
|
||||||
const socketRef = useRef(null); // WebSocket reference
|
const socketRef = useRef(null); // WebSocket reference
|
||||||
const timeoutIdRef = useRef(null); // Timeout ID reference
|
const timeoutIdRef = useRef(null); // Timeout ID reference
|
||||||
@ -270,6 +273,13 @@ const sendChatGroup = async ({groupId, typeMessage = undefined, chatReference =
|
|||||||
const clearEditorContent = () => {
|
const clearEditorContent = () => {
|
||||||
if (editorRef.current) {
|
if (editorRef.current) {
|
||||||
editorRef.current.chain().focus().clearContent().run();
|
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',
|
// position: 'fixed',
|
||||||
// bottom: '0px',
|
// bottom: '0px',
|
||||||
backgroundColor: "#232428",
|
backgroundColor: "#232428",
|
||||||
minHeight: '150px',
|
minHeight: isMobile ? '0px' : '150px',
|
||||||
maxHeight: '400px',
|
maxHeight: isMobile ? 'auto' : '400px',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
boxSizing: 'border-box',
|
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'
|
||||||
}}>
|
}}>
|
||||||
<div style={{
|
<div style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
// height: '100%',
|
flexGrow: isMobile && 1,
|
||||||
overflow: 'auto'
|
overflow: !isMobile && "auto",
|
||||||
}}>
|
}}>
|
||||||
|
|
||||||
|
|
||||||
<Tiptap setEditorRef={setEditorRef} onEnter={sendMessage} isChat />
|
<Tiptap setEditorRef={setEditorRef} onEnter={sendMessage} isChat disableEnter={isMobile ? true : false} isFocusedParent={isFocusedParent} setIsFocusedParent={setIsFocusedParent} />
|
||||||
</div>
|
</div>
|
||||||
|
<Box sx={{
|
||||||
|
display: 'flex',
|
||||||
|
width: '100&',
|
||||||
|
gap: '10px',
|
||||||
|
justifyContent: 'center',
|
||||||
|
flexShrink: 0,
|
||||||
|
position: 'relative',
|
||||||
|
}}>
|
||||||
<CustomButton
|
<CustomButton
|
||||||
onClick={()=> {
|
onClick={()=> {
|
||||||
if(isSending) return
|
if(isSending) return
|
||||||
@ -383,7 +405,9 @@ const clearEditorContent = () => {
|
|||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
cursor: isSending ? 'default' : 'pointer',
|
cursor: isSending ? 'default' : 'pointer',
|
||||||
background: isSending && 'rgba(0, 0, 0, 0.8)',
|
background: isSending && 'rgba(0, 0, 0, 0.8)',
|
||||||
flexShrink: 0
|
flexShrink: 0,
|
||||||
|
padding: isMobile && '5px',
|
||||||
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isSending && (
|
{isSending && (
|
||||||
@ -401,6 +425,29 @@ const clearEditorContent = () => {
|
|||||||
)}
|
)}
|
||||||
{` Send`}
|
{` Send`}
|
||||||
</CustomButton>
|
</CustomButton>
|
||||||
|
{isFocusedParent && (
|
||||||
|
<CustomButton
|
||||||
|
onClick={()=> {
|
||||||
|
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`}
|
||||||
|
</CustomButton>
|
||||||
|
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
{/* <button onClick={sendMessage}>send</button> */}
|
{/* <button onClick={sendMessage}>send</button> */}
|
||||||
</div>
|
</div>
|
||||||
{/* <ChatContainerComp messages={formatMessages} /> */}
|
{/* <ChatContainerComp messages={formatMessages} /> */}
|
||||||
|
@ -51,6 +51,7 @@ export const saveTempPublish = async ({ data, key }: any) => {
|
|||||||
|
|
||||||
if (!response?.error) {
|
if (!response?.error) {
|
||||||
res(response);
|
res(response);
|
||||||
|
return
|
||||||
}
|
}
|
||||||
rej(response.error);
|
rej(response.error);
|
||||||
}
|
}
|
||||||
@ -71,6 +72,7 @@ export const getTempPublish = async () => {
|
|||||||
(response) => {
|
(response) => {
|
||||||
if (!response?.error) {
|
if (!response?.error) {
|
||||||
res(response);
|
res(response);
|
||||||
|
return
|
||||||
}
|
}
|
||||||
rej(response.error);
|
rej(response.error);
|
||||||
}
|
}
|
||||||
@ -135,6 +137,8 @@ export const GroupAnnouncements = ({
|
|||||||
const [tempPublishedList, setTempPublishedList] = useState([])
|
const [tempPublishedList, setTempPublishedList] = useState([])
|
||||||
const [announcementData, setAnnouncementData] = useState({});
|
const [announcementData, setAnnouncementData] = useState({});
|
||||||
const [selectedAnnouncement, setSelectedAnnouncement] = useState(null);
|
const [selectedAnnouncement, setSelectedAnnouncement] = useState(null);
|
||||||
|
const [isFocusedParent, setIsFocusedParent] = useState(false);
|
||||||
|
|
||||||
const { show } = React.useContext(MyContext);
|
const { show } = React.useContext(MyContext);
|
||||||
const [openSnack, setOpenSnack] = React.useState(false);
|
const [openSnack, setOpenSnack] = React.useState(false);
|
||||||
const [infoSnack, setInfoSnack] = React.useState(null);
|
const [infoSnack, setInfoSnack] = React.useState(null);
|
||||||
@ -226,6 +230,12 @@ export const GroupAnnouncements = ({
|
|||||||
const clearEditorContent = () => {
|
const clearEditorContent = () => {
|
||||||
if (editorRef.current) {
|
if (editorRef.current) {
|
||||||
editorRef.current.chain().focus().clearContent().run();
|
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%",
|
width: "100%",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
padding: "25px",
|
padding: isMobile ? '8px' : "25px",
|
||||||
fontSize: "20px",
|
fontSize: isMobile ? '16px' : "20px",
|
||||||
gap: '20px',
|
gap: '20px',
|
||||||
alignItems: 'center'
|
alignItems: 'center'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CampaignIcon sx={{
|
<CampaignIcon sx={{
|
||||||
fontSize: '30px'
|
fontSize: isMobile ? '16px' : '30px'
|
||||||
}} />
|
}} />
|
||||||
Group Announcements
|
Group Announcements
|
||||||
</Box>
|
</Box>
|
||||||
<Spacer height="25px" />
|
<Spacer height={isMobile ? "10px" : "25px"} />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{!isLoading && combinedListTempAndReal?.length === 0 && (
|
{!isLoading && combinedListTempAndReal?.length === 0 && (
|
||||||
@ -541,31 +551,46 @@ export const GroupAnnouncements = ({
|
|||||||
// position: 'fixed',
|
// position: 'fixed',
|
||||||
// bottom: '0px',
|
// bottom: '0px',
|
||||||
backgroundColor: "#232428",
|
backgroundColor: "#232428",
|
||||||
minHeight: "150px",
|
minHeight: isMobile ? "0px" : "150px",
|
||||||
maxHeight: "400px",
|
maxHeight: isMobile ? "auto" : "400px",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
boxSizing: "border-box",
|
boxSizing: "border-box",
|
||||||
padding: "20px",
|
padding: isMobile ? "10px": "20px",
|
||||||
flexShrink: 0
|
position: isFocusedParent ? 'fixed' : 'relative',
|
||||||
|
bottom: isFocusedParent ? '0px' : 'unset',
|
||||||
|
top: isFocusedParent ? '0px' : 'unset',
|
||||||
|
zIndex: isFocusedParent ? 5 : 'unset',
|
||||||
|
flexShrink: 0
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
|
flexGrow: isMobile && 1,
|
||||||
|
overflow: "auto",
|
||||||
// height: '100%',
|
// height: '100%',
|
||||||
overflow: "auto",
|
}}
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<Tiptap
|
<Tiptap
|
||||||
setEditorRef={setEditorRef}
|
setEditorRef={setEditorRef}
|
||||||
onEnter={publishAnnouncement}
|
onEnter={publishAnnouncement}
|
||||||
disableEnter
|
disableEnter
|
||||||
|
maxHeightOffset="40px"
|
||||||
|
isFocusedParent={isFocusedParent} setIsFocusedParent={setIsFocusedParent}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<Box sx={{
|
||||||
|
display: 'flex',
|
||||||
|
width: '100&',
|
||||||
|
gap: '10px',
|
||||||
|
justifyContent: 'center',
|
||||||
|
flexShrink: 0,
|
||||||
|
position: 'relative',
|
||||||
|
}}>
|
||||||
<CustomButton
|
<CustomButton
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (isSending) return;
|
if (isSending) return;
|
||||||
@ -577,6 +602,9 @@ export const GroupAnnouncements = ({
|
|||||||
cursor: isSending ? "default" : "pointer",
|
cursor: isSending ? "default" : "pointer",
|
||||||
background: isSending && "rgba(0, 0, 0, 0.8)",
|
background: isSending && "rgba(0, 0, 0, 0.8)",
|
||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
|
padding: isMobile && '5px',
|
||||||
|
fontSize: isMobile && '14px',
|
||||||
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isSending && (
|
{isSending && (
|
||||||
@ -594,6 +622,30 @@ export const GroupAnnouncements = ({
|
|||||||
)}
|
)}
|
||||||
{` Publish Announcement`}
|
{` Publish Announcement`}
|
||||||
</CustomButton>
|
</CustomButton>
|
||||||
|
{isFocusedParent && (
|
||||||
|
<CustomButton
|
||||||
|
onClick={()=> {
|
||||||
|
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`}
|
||||||
|
</CustomButton>
|
||||||
|
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useRef } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
import { EditorProvider, useCurrentEditor } from '@tiptap/react';
|
import { EditorProvider, useCurrentEditor } from '@tiptap/react';
|
||||||
import StarterKit from '@tiptap/starter-kit';
|
import StarterKit from '@tiptap/starter-kit';
|
||||||
import { Color } from '@tiptap/extension-color';
|
import { Color } from '@tiptap/extension-color';
|
||||||
@ -25,6 +25,7 @@ import CustomImage from './CustomImage';
|
|||||||
import Compressor from 'compressorjs'
|
import Compressor from 'compressorjs'
|
||||||
|
|
||||||
import ImageResize from 'tiptap-extension-resize-image'; // Import the ResizeImage extension
|
import ImageResize from 'tiptap-extension-resize-image'; // Import the ResizeImage extension
|
||||||
|
import { isMobile } from '../../App';
|
||||||
const MenuBar = ({ setEditorRef, isChat }) => {
|
const MenuBar = ({ setEditorRef, isChat }) => {
|
||||||
const { editor } = useCurrentEditor();
|
const { editor } = useCurrentEditor();
|
||||||
const fileInputRef = useRef(null);
|
const fileInputRef = useRef(null);
|
||||||
@ -88,10 +89,11 @@ const MenuBar = ({ setEditorRef, isChat }) => {
|
|||||||
}
|
}
|
||||||
// color={editor.isActive('bold') ? 'white' : 'gray'}
|
// color={editor.isActive('bold') ? 'white' : 'gray'}
|
||||||
sx={{
|
sx={{
|
||||||
color: editor.isActive('bold') ? 'white' : 'gray'
|
color: editor.isActive('bold') ? 'white' : 'gray',
|
||||||
|
padding: isMobile ? '5px' : 'revert'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FormatBoldIcon />
|
<FormatBoldIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => editor.chain().focus().toggleItalic().run()}
|
onClick={() => editor.chain().focus().toggleItalic().run()}
|
||||||
@ -104,7 +106,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
|
|||||||
}
|
}
|
||||||
// color={editor.isActive('italic') ? 'white' : 'gray'}
|
// color={editor.isActive('italic') ? 'white' : 'gray'}
|
||||||
sx={{
|
sx={{
|
||||||
color: editor.isActive('italic') ? 'white' : 'gray'
|
color: editor.isActive('italic') ? 'white' : 'gray',
|
||||||
|
padding: isMobile ? '5px' : 'revert'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FormatItalicIcon />
|
<FormatItalicIcon />
|
||||||
@ -120,7 +123,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
|
|||||||
}
|
}
|
||||||
// color={editor.isActive('strike') ? 'white' : 'gray'}
|
// color={editor.isActive('strike') ? 'white' : 'gray'}
|
||||||
sx={{
|
sx={{
|
||||||
color: editor.isActive('strike') ? 'white' : 'gray'
|
color: editor.isActive('strike') ? 'white' : 'gray',
|
||||||
|
padding: isMobile ? '5px' : 'revert'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<StrikethroughSIcon />
|
<StrikethroughSIcon />
|
||||||
@ -136,19 +140,23 @@ const MenuBar = ({ setEditorRef, isChat }) => {
|
|||||||
}
|
}
|
||||||
// color={editor.isActive('code') ? 'white' : 'gray'}
|
// color={editor.isActive('code') ? 'white' : 'gray'}
|
||||||
sx={{
|
sx={{
|
||||||
color: editor.isActive('code') ? 'white' : 'gray'
|
color: editor.isActive('code') ? 'white' : 'gray',
|
||||||
|
padding: isMobile ? '5px' : 'revert'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CodeIcon />
|
<CodeIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton onClick={() => editor.chain().focus().unsetAllMarks().run()}>
|
<IconButton sx={{
|
||||||
|
padding: isMobile ? '5px' : 'revert'
|
||||||
|
}} onClick={() => editor.chain().focus().unsetAllMarks().run()}>
|
||||||
<FormatClearIcon />
|
<FormatClearIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => editor.chain().focus().toggleBulletList().run()}
|
onClick={() => editor.chain().focus().toggleBulletList().run()}
|
||||||
// color={editor.isActive('bulletList') ? 'white' : 'gray'}
|
// color={editor.isActive('bulletList') ? 'white' : 'gray'}
|
||||||
sx={{
|
sx={{
|
||||||
color: editor.isActive('bulletList') ? 'white' : 'gray'
|
color: editor.isActive('bulletList') ? 'white' : 'gray',
|
||||||
|
padding: isMobile ? '5px' : 'revert'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FormatListBulletedIcon />
|
<FormatListBulletedIcon />
|
||||||
@ -157,7 +165,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
|
|||||||
onClick={() => editor.chain().focus().toggleOrderedList().run()}
|
onClick={() => editor.chain().focus().toggleOrderedList().run()}
|
||||||
// color={editor.isActive('orderedList') ? 'white' : 'gray'}
|
// color={editor.isActive('orderedList') ? 'white' : 'gray'}
|
||||||
sx={{
|
sx={{
|
||||||
color: editor.isActive('orderedList') ? 'white' : 'gray'
|
color: editor.isActive('orderedList') ? 'white' : 'gray',
|
||||||
|
padding: isMobile ? '5px' : 'revert'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FormatListNumberedIcon />
|
<FormatListNumberedIcon />
|
||||||
@ -166,7 +175,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
|
|||||||
onClick={() => editor.chain().focus().toggleCodeBlock().run()}
|
onClick={() => editor.chain().focus().toggleCodeBlock().run()}
|
||||||
// color={editor.isActive('codeBlock') ? 'white' : 'gray'}
|
// color={editor.isActive('codeBlock') ? 'white' : 'gray'}
|
||||||
sx={{
|
sx={{
|
||||||
color: editor.isActive('codeBlock') ? 'white' : 'gray'
|
color: editor.isActive('codeBlock') ? 'white' : 'gray',
|
||||||
|
padding: isMobile ? '5px' : 'revert'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DeveloperModeIcon />
|
<DeveloperModeIcon />
|
||||||
@ -175,7 +185,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
|
|||||||
onClick={() => editor.chain().focus().toggleBlockquote().run()}
|
onClick={() => editor.chain().focus().toggleBlockquote().run()}
|
||||||
// color={editor.isActive('blockquote') ? 'white' : 'gray'}
|
// color={editor.isActive('blockquote') ? 'white' : 'gray'}
|
||||||
sx={{
|
sx={{
|
||||||
color: editor.isActive('blockquote') ? 'white' : 'gray'
|
color: editor.isActive('blockquote') ? 'white' : 'gray',
|
||||||
|
padding: isMobile ? '5px' : 'revert'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FormatQuoteIcon />
|
<FormatQuoteIcon />
|
||||||
@ -187,7 +198,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
|
|||||||
onClick={() => editor.chain().focus().toggleHeading({ level: 1 }).run()}
|
onClick={() => editor.chain().focus().toggleHeading({ level: 1 }).run()}
|
||||||
// color={editor.isActive('heading', { level: 1 }) ? 'white' : 'gray'}
|
// color={editor.isActive('heading', { level: 1 }) ? 'white' : 'gray'}
|
||||||
sx={{
|
sx={{
|
||||||
color: editor.isActive('heading', { level: 1 }) ? 'white' : 'gray'
|
color: editor.isActive('heading', { level: 1 }) ? 'white' : 'gray',
|
||||||
|
padding: isMobile ? '5px' : 'revert'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FormatHeadingIcon fontSize="small" />
|
<FormatHeadingIcon fontSize="small" />
|
||||||
@ -202,7 +214,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
|
|||||||
.run()
|
.run()
|
||||||
}
|
}
|
||||||
sx={{
|
sx={{
|
||||||
color: 'gray'
|
color: 'gray',
|
||||||
|
padding: isMobile ? '5px' : 'revert'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<UndoIcon />
|
<UndoIcon />
|
||||||
@ -227,7 +240,8 @@ const MenuBar = ({ setEditorRef, isChat }) => {
|
|||||||
<IconButton
|
<IconButton
|
||||||
onClick={triggerImageUpload}
|
onClick={triggerImageUpload}
|
||||||
sx={{
|
sx={{
|
||||||
color: 'gray'
|
color: 'gray',
|
||||||
|
padding: isMobile ? '5px' : 'revert'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ImageIcon />
|
<ImageIcon />
|
||||||
@ -268,32 +282,66 @@ const extensions = [
|
|||||||
|
|
||||||
const content = ``;
|
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 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() === "<p></p>"){
|
||||||
|
// setIsFocused(false);
|
||||||
|
// setIsFocusedParent(false)
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
// useEffect(()=> {
|
||||||
|
// setIsFocused(isFocusedParent)
|
||||||
|
// },[isFocusedParent])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EditorProvider
|
<EditorProvider
|
||||||
slotBefore={<MenuBar setEditorRef={setEditorRef} isChat={isChat} />}
|
slotBefore={(isFocusedParent || !isMobile || overrideMobile) && <MenuBar setEditorRef={setEditorRefFunc} isChat={isChat} />}
|
||||||
extensions={extensionsFiltered}
|
extensions={extensionsFiltered}
|
||||||
content={content}
|
content={content}
|
||||||
editorProps={{
|
onCreate={({ editor }) => {
|
||||||
handleKeyDown(view, event) {
|
editor.on('focus', handleFocus); // Listen for focus event
|
||||||
if (!disableEnter && event.key === 'Enter') {
|
editor.on('blur', handleBlur); // Listen for blur event
|
||||||
if (event.shiftKey) {
|
}}
|
||||||
// Shift+Enter: Insert a hard break
|
onUpdate={({ editor }) => {
|
||||||
view.dispatch(view.state.tr.replaceSelectionWith(view.state.schema.nodes.hardBreak.create()));
|
editor.on('focus', handleFocus); // Ensure focus is updated
|
||||||
return true;
|
editor.on('blur', handleBlur); // Ensure blur is updated
|
||||||
} else {
|
}}
|
||||||
// Enter: Call the callback function
|
editorProps={{
|
||||||
if (typeof onEnter === 'function') {
|
attributes: {
|
||||||
onEnter();
|
class: 'tiptap-prosemirror',
|
||||||
}
|
style: isMobile && `overflow: auto; min-height: ${customEditorHeight ? '200px' : '0px'}; 200px; max-height:calc(100svh - ${ customEditorHeight ? customEditorHeight : '140px'})`,
|
||||||
return true; // Prevent the default action of adding a new line
|
},
|
||||||
|
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;
|
||||||
}}
|
},
|
||||||
/>
|
}}
|
||||||
);
|
/>
|
||||||
|
)
|
||||||
};
|
};
|
||||||
|
@ -119,3 +119,4 @@
|
|||||||
display: block;
|
display: block;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ import { AddGroupList } from "./AddGroupList";
|
|||||||
import { UserListOfInvites } from "./UserListOfInvites";
|
import { UserListOfInvites } from "./UserListOfInvites";
|
||||||
import { CustomizedSnackbars } from "../Snackbar/Snackbar";
|
import { CustomizedSnackbars } from "../Snackbar/Snackbar";
|
||||||
import { getFee } from "../../background";
|
import { getFee } from "../../background";
|
||||||
import { MyContext } from "../../App";
|
import { MyContext, isMobile } from "../../App";
|
||||||
import { subscribeToEvent, unsubscribeFromEvent } from "../../utils/events";
|
import { subscribeToEvent, unsubscribeFromEvent } from "../../utils/events";
|
||||||
|
|
||||||
export const Label = styled("label")(
|
export const Label = styled("label")(
|
||||||
@ -220,44 +220,50 @@ export const AddGroup = ({ address, open, setOpen }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box sx={{ borderBottom: 1, borderColor: "divider" }}>
|
<Box sx={{ borderBottom: 1, borderColor: "divider" }}>
|
||||||
<Tabs
|
<Tabs
|
||||||
sx={{
|
value={value}
|
||||||
"& .MuiTabs-indicator": {
|
onChange={handleChange}
|
||||||
backgroundColor: "white",
|
aria-label="basic tabs example"
|
||||||
},
|
variant={isMobile ? 'scrollable' : 'fullWidth'} // Scrollable on mobile, full width on desktop
|
||||||
}}
|
scrollButtons="auto"
|
||||||
value={value}
|
allowScrollButtonsMobile
|
||||||
onChange={handleChange}
|
sx={{
|
||||||
aria-label="basic tabs example"
|
"& .MuiTabs-indicator": {
|
||||||
>
|
backgroundColor: "white",
|
||||||
<Tab
|
},
|
||||||
sx={{
|
}}
|
||||||
"&.Mui-selected": {
|
>
|
||||||
color: `white`,
|
<Tab
|
||||||
},
|
label="Create Group"
|
||||||
}}
|
{...a11yProps(0)}
|
||||||
label="Create Group"
|
sx={{
|
||||||
{...a11yProps(0)}
|
"&.Mui-selected": {
|
||||||
/>
|
color: "white",
|
||||||
<Tab
|
},
|
||||||
sx={{
|
fontSize: isMobile ? '0.75rem' : '1rem', // Adjust font size for mobile
|
||||||
"&.Mui-selected": {
|
}}
|
||||||
color: `white`,
|
/>
|
||||||
},
|
<Tab
|
||||||
}}
|
label="Find Group"
|
||||||
label="Find Group"
|
{...a11yProps(1)}
|
||||||
{...a11yProps(1)}
|
sx={{
|
||||||
/>
|
"&.Mui-selected": {
|
||||||
<Tab
|
color: "white",
|
||||||
sx={{
|
},
|
||||||
"&.Mui-selected": {
|
fontSize: isMobile ? '0.75rem' : '1rem', // Adjust font size for mobile
|
||||||
color: `white`,
|
}}
|
||||||
},
|
/>
|
||||||
}}
|
<Tab
|
||||||
label="Group Invites"
|
label="Group Invites"
|
||||||
{...a11yProps(2)}
|
{...a11yProps(2)}
|
||||||
/>
|
sx={{
|
||||||
</Tabs>
|
"&.Mui-selected": {
|
||||||
|
color: "white",
|
||||||
|
},
|
||||||
|
fontSize: isMobile ? '0.75rem' : '1rem', // Adjust font size for mobile
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Tabs>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{value === 0 && (
|
{value === 0 && (
|
||||||
|
@ -247,7 +247,7 @@ export const AddGroupList = ({ setInfoSnack, setOpenSnack }) => {
|
|||||||
style={{
|
style={{
|
||||||
position: "relative",
|
position: "relative",
|
||||||
height: "500px",
|
height: "500px",
|
||||||
width: "600px",
|
width: "100%",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
flexShrink: 1,
|
flexShrink: 1,
|
||||||
|
@ -30,7 +30,7 @@ import { formatBytes } from "../../../utils/Size";
|
|||||||
import { CreateThreadIcon } from "../../../assets/svgs/CreateThreadIcon";
|
import { CreateThreadIcon } from "../../../assets/svgs/CreateThreadIcon";
|
||||||
import { SendNewMessage } from "../../../assets/svgs/SendNewMessage";
|
import { SendNewMessage } from "../../../assets/svgs/SendNewMessage";
|
||||||
import { TextEditor } from "./TextEditor";
|
import { TextEditor } from "./TextEditor";
|
||||||
import { MyContext, pauseAllQueues, resumeAllQueues } from "../../../App";
|
import { MyContext, isMobile, pauseAllQueues, resumeAllQueues } from "../../../App";
|
||||||
import { getFee } from "../../../background";
|
import { getFee } from "../../../background";
|
||||||
import TipTap from "../../Chat/TipTap";
|
import TipTap from "../../Chat/TipTap";
|
||||||
import { MessageDisplay } from "../../Chat/MessageDisplay";
|
import { MessageDisplay } from "../../Chat/MessageDisplay";
|
||||||
@ -410,7 +410,7 @@ export const NewThread = ({
|
|||||||
<ReusableModal
|
<ReusableModal
|
||||||
open={isOpen}
|
open={isOpen}
|
||||||
customStyles={{
|
customStyles={{
|
||||||
maxHeight: "95vh",
|
maxHeight: isMobile ? '95svh' : "95vh",
|
||||||
maxWidth: "950px",
|
maxWidth: "950px",
|
||||||
height: "700px",
|
height: "700px",
|
||||||
borderRadius: "12px 12px 0px 0px",
|
borderRadius: "12px 12px 0px 0px",
|
||||||
@ -421,25 +421,27 @@ export const NewThread = ({
|
|||||||
>
|
>
|
||||||
<InstanceListHeader
|
<InstanceListHeader
|
||||||
sx={{
|
sx={{
|
||||||
height: "50px",
|
height: isMobile ? 'auto' : "50px",
|
||||||
padding: "20px 42px",
|
padding: isMobile ? '5px' : "20px 42px",
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
|
alignItems: 'center',
|
||||||
justifyContent: "space-between",
|
justifyContent: "space-between",
|
||||||
alignItems: "center",
|
|
||||||
backgroundColor: "#434448",
|
backgroundColor: "#434448",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<NewMessageHeaderP>
|
<NewMessageHeaderP>
|
||||||
{isMessage ? "Post Message" : "New Thread"}
|
{isMessage ? "Post Message" : "New Thread"}
|
||||||
</NewMessageHeaderP>
|
</NewMessageHeaderP>
|
||||||
<CloseContainer onClick={closeModal}>
|
<CloseContainer sx={{
|
||||||
|
height: '40px'
|
||||||
|
}} onClick={closeModal}>
|
||||||
<NewMessageCloseImg src={ModalCloseSVG} />
|
<NewMessageCloseImg src={ModalCloseSVG} />
|
||||||
</CloseContainer>
|
</CloseContainer>
|
||||||
</InstanceListHeader>
|
</InstanceListHeader>
|
||||||
<InstanceListContainer
|
<InstanceListContainer
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: "#434448",
|
backgroundColor: "#434448",
|
||||||
padding: "20px 42px",
|
padding: isMobile ? '5px' : "20px 42px",
|
||||||
height: "calc(100% - 150px)",
|
height: "calc(100% - 150px)",
|
||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
}}
|
}}
|
||||||
@ -463,7 +465,7 @@ export const NewThread = ({
|
|||||||
color: "white",
|
color: "white",
|
||||||
"& .MuiInput-input::placeholder": {
|
"& .MuiInput-input::placeholder": {
|
||||||
color: "rgba(255,255,255, 0.70) !important",
|
color: "rgba(255,255,255, 0.70) !important",
|
||||||
fontSize: "20px",
|
fontSize: isMobile ? '14px' : "20px",
|
||||||
fontStyle: "normal",
|
fontStyle: "normal",
|
||||||
fontWeight: 400,
|
fontWeight: 400,
|
||||||
lineHeight: "120%", // 24px
|
lineHeight: "120%", // 24px
|
||||||
@ -491,7 +493,10 @@ export const NewThread = ({
|
|||||||
<MessageDisplay htmlContent={postReply?.textContentV2} />
|
<MessageDisplay htmlContent={postReply?.textContentV2} />
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
<Spacer height="30px" />
|
{!isMobile && (
|
||||||
|
<Spacer height="30px" />
|
||||||
|
|
||||||
|
)}
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
maxHeight: "40vh",
|
maxHeight: "40vh",
|
||||||
@ -501,6 +506,8 @@ export const NewThread = ({
|
|||||||
setEditorRef={setEditorRef}
|
setEditorRef={setEditorRef}
|
||||||
onEnter={sendMail}
|
onEnter={sendMail}
|
||||||
disableEnter
|
disableEnter
|
||||||
|
overrideMobile
|
||||||
|
customEditorHeight="240px"
|
||||||
/>
|
/>
|
||||||
{/* <TextEditor
|
{/* <TextEditor
|
||||||
inlineContent={value}
|
inlineContent={value}
|
||||||
@ -513,9 +520,9 @@ export const NewThread = ({
|
|||||||
<InstanceFooter
|
<InstanceFooter
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: "#434448",
|
backgroundColor: "#434448",
|
||||||
padding: "20px 42px",
|
padding: isMobile ? '5px' : "20px 42px",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
height: "90px",
|
height: isMobile ? 'auto' : "90px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<NewMessageSendButton onClick={sendMail}>
|
<NewMessageSendButton onClick={sendMail}>
|
||||||
|
@ -522,6 +522,36 @@ export const Group = ({
|
|||||||
return hasUnread;
|
return hasUnread;
|
||||||
}, [timestampEnterData, directs, myAddress]);
|
}, [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(() => {
|
// useEffect(() => {
|
||||||
// if (!myAddress) return;
|
// if (!myAddress) return;
|
||||||
// checkGroupListFunc(myAddress);
|
// checkGroupListFunc(myAddress);
|
||||||
@ -1660,6 +1690,7 @@ export const Group = ({
|
|||||||
setNewChat(true);
|
setNewChat(true);
|
||||||
setSelectedDirect(null);
|
setSelectedDirect(null);
|
||||||
setSelectedGroup(null);
|
setSelectedGroup(null);
|
||||||
|
setIsOpenDrawer(false)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CreateIcon
|
<CreateIcon
|
||||||
@ -2205,7 +2236,11 @@ export const Group = ({
|
|||||||
size="small"
|
size="small"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
startIcon={<AnnouncementsIcon />}
|
startIcon={<AnnouncementsIcon />}
|
||||||
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}
|
onClick={goToAnnouncements}
|
||||||
>
|
>
|
||||||
ANN
|
ANN
|
||||||
@ -2217,7 +2252,10 @@ export const Group = ({
|
|||||||
size="small"
|
size="small"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
startIcon={<ChatIcon />}
|
startIcon={<ChatIcon />}
|
||||||
sx={{ padding: '4px 6px' }}
|
sx={{ padding: '4px 6px', color: groupSection === 'chat' ? 'black' : 'white',
|
||||||
|
backgroundColor: isUnreadChat
|
||||||
|
? "red"
|
||||||
|
: groupSection === 'chat' ? 'white' : 'black', }}
|
||||||
onClick={goToChat}
|
onClick={goToChat}
|
||||||
>
|
>
|
||||||
Chat
|
Chat
|
||||||
@ -2229,7 +2267,8 @@ export const Group = ({
|
|||||||
size="small"
|
size="small"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
startIcon={<ForumIcon />}
|
startIcon={<ForumIcon />}
|
||||||
sx={{ padding: '4px 6px' }}
|
sx={{ padding: '4px 6px', color: groupSection === 'forum' ? 'black' : 'white',
|
||||||
|
backgroundColor: groupSection === 'forum' ? 'white' : 'black', }}
|
||||||
onClick={() => setGroupSection("forum")}
|
onClick={() => setGroupSection("forum")}
|
||||||
>
|
>
|
||||||
Forum
|
Forum
|
||||||
@ -2241,7 +2280,7 @@ export const Group = ({
|
|||||||
size="small"
|
size="small"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
startIcon={<GroupIcon />}
|
startIcon={<GroupIcon />}
|
||||||
sx={{ padding: '4px 6px' }}
|
sx={{ padding: '4px 6px', backgroundColor: 'black' }}
|
||||||
onClick={() => setOpenManageMembers(true)}
|
onClick={() => setOpenManageMembers(true)}
|
||||||
>
|
>
|
||||||
Members
|
Members
|
||||||
@ -2257,7 +2296,7 @@ export const Group = ({
|
|||||||
size="small"
|
size="small"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
startIcon={<GroupIcon />}
|
startIcon={<GroupIcon />}
|
||||||
sx={{ padding: '2px 4px' }}
|
sx={{ padding: '2px 4px', backgroundColor: groupChatHasUnread || groupsAnnHasUnread || directChatHasUnread ? "red" : 'black' }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsOpenDrawer(true);
|
setIsOpenDrawer(true);
|
||||||
setDrawerMode("groups");
|
setDrawerMode("groups");
|
||||||
|
@ -168,7 +168,7 @@ export const ListOfBans = ({ groupId, setInfoSnack, setOpenSnack, show }) => {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<p>Ban list</p>
|
<p>Ban list</p>
|
||||||
<div style={{ position: 'relative', height: '500px', width: '600px', display: 'flex', flexDirection: 'column', flexShrink: 1 }}>
|
<div style={{ position: 'relative', height: '500px', width: '100%', display: 'flex', flexDirection: 'column', flexShrink: 1 }}>
|
||||||
<AutoSizer>
|
<AutoSizer>
|
||||||
{({ height, width }) => (
|
{({ height, width }) => (
|
||||||
<List
|
<List
|
||||||
|
@ -169,7 +169,7 @@ export const ListOfInvites = ({ groupId, setInfoSnack, setOpenSnack, show }) =>
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<p>Invitees list</p>
|
<p>Invitees list</p>
|
||||||
<div style={{ position: 'relative', height: '500px', width: '600px', display: 'flex', flexDirection: 'column', flexShrink: 1 }}>
|
<div style={{ position: 'relative', height: '500px', width: '100%', display: 'flex', flexDirection: 'column', flexShrink: 1 }}>
|
||||||
<AutoSizer>
|
<AutoSizer>
|
||||||
{({ height, width }) => (
|
{({ height, width }) => (
|
||||||
<List
|
<List
|
||||||
|
@ -169,7 +169,7 @@ export const ListOfJoinRequests = ({ groupId, setInfoSnack, setOpenSnack, show }
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<p>Join request list</p>
|
<p>Join request list</p>
|
||||||
<div style={{ position: 'relative', height: '500px', width: '600px', display: 'flex', flexDirection: 'column', flexShrink: 1 }}>
|
<div style={{ position: 'relative', height: '500px', width: '100%', display: 'flex', flexDirection: 'column', flexShrink: 1 }}>
|
||||||
<AutoSizer>
|
<AutoSizer>
|
||||||
{({ height, width }) => (
|
{({ height, width }) => (
|
||||||
<List
|
<List
|
||||||
|
@ -357,7 +357,7 @@ const ListOfMembers = ({
|
|||||||
style={{
|
style={{
|
||||||
position: "relative",
|
position: "relative",
|
||||||
height: "500px",
|
height: "500px",
|
||||||
width: "600px",
|
width: "100%",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
flexShrink: 1,
|
flexShrink: 1,
|
||||||
|
@ -19,7 +19,7 @@ import { ListOfBans } from "./ListOfBans";
|
|||||||
import { ListOfJoinRequests } from "./ListOfJoinRequests";
|
import { ListOfJoinRequests } from "./ListOfJoinRequests";
|
||||||
import { Box, Tab, Tabs } from "@mui/material";
|
import { Box, Tab, Tabs } from "@mui/material";
|
||||||
import { CustomizedSnackbars } from "../Snackbar/Snackbar";
|
import { CustomizedSnackbars } from "../Snackbar/Snackbar";
|
||||||
import { MyContext } from "../../App";
|
import { MyContext, isMobile } from "../../App";
|
||||||
import { getGroupMembers, getNames } from "./Group";
|
import { getGroupMembers, getNames } from "./Group";
|
||||||
import { LoadingSnackbar } from "../Snackbar/LoadingSnackbar";
|
import { LoadingSnackbar } from "../Snackbar/LoadingSnackbar";
|
||||||
import { getFee } from "../../background";
|
import { getFee } from "../../background";
|
||||||
@ -173,63 +173,72 @@ export const ManageMembers = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box sx={{ borderBottom: 1, borderColor: "divider" }}>
|
<Box sx={{ borderBottom: 1, borderColor: "divider" }}>
|
||||||
<Tabs
|
<Tabs
|
||||||
sx={{
|
value={value}
|
||||||
"& .MuiTabs-indicator": {
|
onChange={handleChange}
|
||||||
backgroundColor: "white",
|
aria-label="basic tabs example"
|
||||||
},
|
variant="scrollable" // Make tabs scrollable
|
||||||
}}
|
scrollButtons="auto" // Show scroll buttons automatically
|
||||||
value={value}
|
allowScrollButtonsMobile // Show scroll buttons on mobile as well
|
||||||
onChange={handleChange}
|
sx={{
|
||||||
aria-label="basic tabs example"
|
"& .MuiTabs-indicator": {
|
||||||
>
|
backgroundColor: "white",
|
||||||
<Tab
|
},
|
||||||
sx={{
|
maxWidth: '100%', // Ensure the tabs container fits within the available space
|
||||||
"&.Mui-selected": {
|
overflow: 'hidden', // Prevents overflow on small screens
|
||||||
color: `white`,
|
}}
|
||||||
},
|
>
|
||||||
}}
|
<Tab
|
||||||
label="List of members"
|
label="List of members"
|
||||||
{...a11yProps(0)}
|
{...a11yProps(0)}
|
||||||
/>
|
sx={{
|
||||||
<Tab
|
"&.Mui-selected": {
|
||||||
sx={{
|
color: "white",
|
||||||
"&.Mui-selected": {
|
},
|
||||||
color: `white`,
|
fontSize: isMobile ? '0.75rem' : '1rem', // Adjust font size for mobile
|
||||||
},
|
}}
|
||||||
}}
|
/>
|
||||||
label="Invite new member"
|
<Tab
|
||||||
{...a11yProps(1)}
|
label="Invite new member"
|
||||||
/>
|
{...a11yProps(1)}
|
||||||
<Tab
|
sx={{
|
||||||
sx={{
|
"&.Mui-selected": {
|
||||||
"&.Mui-selected": {
|
color: "white",
|
||||||
color: `white`,
|
},
|
||||||
},
|
fontSize: isMobile ? '0.75rem' : '1rem',
|
||||||
}}
|
}}
|
||||||
label="List of invites"
|
/>
|
||||||
{...a11yProps(2)}
|
<Tab
|
||||||
/>
|
label="List of invites"
|
||||||
<Tab
|
{...a11yProps(2)}
|
||||||
sx={{
|
sx={{
|
||||||
"&.Mui-selected": {
|
"&.Mui-selected": {
|
||||||
color: `white`,
|
color: "white",
|
||||||
},
|
},
|
||||||
}}
|
fontSize: isMobile ? '0.75rem' : '1rem',
|
||||||
label="List of bans"
|
}}
|
||||||
{...a11yProps(3)}
|
/>
|
||||||
/>
|
<Tab
|
||||||
|
label="List of bans"
|
||||||
<Tab
|
{...a11yProps(3)}
|
||||||
sx={{
|
sx={{
|
||||||
"&.Mui-selected": {
|
"&.Mui-selected": {
|
||||||
color: `white`,
|
color: "white",
|
||||||
},
|
},
|
||||||
}}
|
fontSize: isMobile ? '0.75rem' : '1rem',
|
||||||
label="Join requests"
|
}}
|
||||||
{...a11yProps(4)}
|
/>
|
||||||
/>
|
<Tab
|
||||||
</Tabs>
|
label="Join requests"
|
||||||
|
{...a11yProps(4)}
|
||||||
|
sx={{
|
||||||
|
"&.Mui-selected": {
|
||||||
|
color: "white",
|
||||||
|
},
|
||||||
|
fontSize: isMobile ? '0.75rem' : '1rem',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Tabs>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{selectedGroup?.groupId && !isOwner && (
|
{selectedGroup?.groupId && !isOwner && (
|
||||||
|
@ -186,7 +186,7 @@ export const UserListOfInvites = ({myAddress, setInfoSnack, setOpenSnack}) => {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<p>Invite list</p>
|
<p>Invite list</p>
|
||||||
<div style={{ position: 'relative', height: '500px', width: '600px', display: 'flex', flexDirection: 'column', flexShrink: 1 }}>
|
<div style={{ position: 'relative', height: '500px', width: '100%', display: 'flex', flexDirection: 'column', flexShrink: 1 }}>
|
||||||
<AutoSizer>
|
<AutoSizer>
|
||||||
{({ height, width }) => (
|
{({ height, width }) => (
|
||||||
<List
|
<List
|
||||||
|
Loading…
x
Reference in New Issue
Block a user