diff --git a/public/locales/en/group.json b/public/locales/en/group.json index 62abd70..6fba714 100644 --- a/public/locales/en/group.json +++ b/public/locales/en/group.json @@ -42,6 +42,7 @@ "invitees_list": "invitees list", "join_link": "join group link", "join_requests": "join requests", + "last_message": "last message", "latest_mails": "latest Q-Mails", "message": { "generic": { diff --git a/src/components/Apps/AppsCategoryDesktop.tsx b/src/components/Apps/AppsCategoryDesktop.tsx index 754ba85..39f12ee 100644 --- a/src/components/Apps/AppsCategoryDesktop.tsx +++ b/src/components/Apps/AppsCategoryDesktop.tsx @@ -56,7 +56,7 @@ export const AppsCategoryDesktop = ({ isShow, }) => { const [searchValue, setSearchValue] = useState(''); - const virtuosoRef = useRef(); + const virtuosoRef = useRef(null); const theme = useTheme(); const categoryList = useMemo(() => { diff --git a/src/components/Apps/AppsLibraryDesktop.tsx b/src/components/Apps/AppsLibraryDesktop.tsx index 3490e89..17b9b71 100644 --- a/src/components/Apps/AppsLibraryDesktop.tsx +++ b/src/components/Apps/AppsLibraryDesktop.tsx @@ -102,7 +102,7 @@ export const AppsLibraryDesktop = ({ getQapps, }) => { const [searchValue, setSearchValue] = useState(''); - const virtuosoRef = useRef(); + const virtuosoRef = useRef(null); const theme = useTheme(); const officialApps = useMemo(() => { diff --git a/src/components/Chat/AnnouncementList.tsx b/src/components/Chat/AnnouncementList.tsx index 9c32cc1..5f3c75b 100644 --- a/src/components/Chat/AnnouncementList.tsx +++ b/src/components/Chat/AnnouncementList.tsx @@ -18,7 +18,7 @@ export const AnnouncementList = ({ loadMore, myName, }) => { - const listRef = useRef(); + const listRef = useRef(null); const [messages, setMessages] = useState(initialMessages); useEffect(() => { diff --git a/src/components/Chat/ChatList.tsx b/src/components/Chat/ChatList.tsx index 56acbc7..8362fad 100644 --- a/src/components/Chat/ChatList.tsx +++ b/src/components/Chat/ChatList.tsx @@ -23,7 +23,7 @@ export const ChatList = ({ hasSecretKey, isPrivate, }) => { - const parentRef = useRef(); + const parentRef = useRef(null); const [messages, setMessages] = useState(initialMessages); const [showScrollButton, setShowScrollButton] = useState(false); const [showScrollDownButton, setShowScrollDownButton] = useState(false); diff --git a/src/components/Chat/ChatOptions.tsx b/src/components/Chat/ChatOptions.tsx index 4f92f53..0ec1866 100644 --- a/src/components/Chat/ChatOptions.tsx +++ b/src/components/Chat/ChatOptions.tsx @@ -60,8 +60,8 @@ export const ChatOptions = ({ const [searchValue, setSearchValue] = useState(''); const [selectedMember, setSelectedMember] = useState(0); const theme = useTheme(); - const parentRef = useRef(); - const parentRefMentions = useRef(); + const parentRef = useRef(null); + const parentRefMentions = useRef(null); const [lastMentionTimestamp, setLastMentionTimestamp] = useState(null); const [debouncedValue, setDebouncedValue] = useState(''); // Debounced value const messages = useMemo(() => { diff --git a/src/components/Group/AddGroup.tsx b/src/components/Group/AddGroup.tsx index e97917d..e9e9515 100644 --- a/src/components/Group/AddGroup.tsx +++ b/src/components/Group/AddGroup.tsx @@ -452,6 +452,7 @@ export const AddGroup = ({ address, open, setOpen }) => { 100% + { postProcess: 'capitalize', })} + + { postProcess: 'capitalize', })} + + { const [groups, setGroups] = useState([]); const [popoverAnchor, setPopoverAnchor] = useState(null); // Track which list item the popover is anchored to const [openPopoverIndex, setOpenPopoverIndex] = useState(null); // Track which list item has the popover open - const listRef = useRef(); + const listRef = useRef(null); const [inputValue, setInputValue] = useState(''); const [filteredItems, setFilteredItems] = useState(groups); const [isLoading, setIsLoading] = useState(false); diff --git a/src/components/Group/Forum/GroupMail.tsx b/src/components/Group/Forum/GroupMail.tsx index 60bfd12..41f75ef 100644 --- a/src/components/Group/Forum/GroupMail.tsx +++ b/src/components/Group/Forum/GroupMail.tsx @@ -1,26 +1,17 @@ -import React, { - useCallback, - useEffect, - useMemo, - useRef, - useState, -} from 'react'; +import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { Avatar, Box, Popover, Typography, useTheme } from '@mui/material'; -// import { MAIL_SERVICE_TYPE, THREAD_SERVICE_TYPE } from "../../constants/mail"; import { Thread } from './Thread'; import { AllThreadP, ArrowDownIcon, ComposeContainer, ComposeContainerBlank, - ComposeIcon, ComposeP, GroupContainer, InstanceFooter, InstanceListContainer, InstanceListContainerRow, InstanceListContainerRowCheck, - InstanceListContainerRowCheckIcon, InstanceListContainerRowMain, InstanceListContainerRowMainP, InstanceListHeader, @@ -48,7 +39,6 @@ import { getTempPublish, handleUnencryptedPublishes, } from '../../Chat/GroupAnnouncements'; -import CheckSVG from '../../../assets/svgs/Check.svg'; import ArrowDownSVG from '../../../assets/svgs/ArrowDown.svg'; import { LoadingSnackbar } from '../../Snackbar/LoadingSnackbar'; import { executeEvent } from '../../../utils/events'; @@ -73,9 +63,9 @@ export const GroupMail = ({ hide, isPrivate, }) => { - const [viewedThreads, setViewedThreads] = React.useState({}); + const [viewedThreads, setViewedThreads] = useState({}); const [filterMode, setFilterMode] = useState('Recently active'); - const [currentThread, setCurrentThread] = React.useState(null); + const [currentThread, setCurrentThread] = useState(null); const [recentThreads, setRecentThreads] = useState([]); const [allThreads, setAllThreads] = useState([]); const [members, setMembers] = useState(null); @@ -178,7 +168,10 @@ export const GroupMail = ({ rej(response.error); }) .catch((error) => { - rej(error.message || 'An error occurred'); + rej( + error.message || + t('core:message.error.generic', { postProcess: 'capitalize' }) + ); }); }); } catch (error) { @@ -186,7 +179,7 @@ export const GroupMail = ({ } }; - const getAllThreads = React.useCallback( + const getAllThreads = useCallback( async (groupId: string, mode: string, isInitial?: boolean) => { try { setIsLoading(true); @@ -206,7 +199,7 @@ export const GroupMail = ({ }); const responseData = await response.json(); - let fullArrayMsg = isInitial ? [] : [...allThreads]; + const fullArrayMsg = isInitial ? [] : [...allThreads]; const getMessageForThreads = responseData.map(async (message: any) => { let fullObject: any = null; if (message?.metadata?.description) { @@ -271,13 +264,12 @@ export const GroupMail = ({ } finally { if (isInitial) { setIsLoading(false); - // dispatch(setIsLoadingCustom(null)); } } }, [allThreads, isPrivate] ); - const getMailMessages = React.useCallback( + const getMailMessages = useCallback( async (groupId: string, members: any) => { try { setIsLoading(true); @@ -315,7 +307,7 @@ export const GroupMail = ({ .sort((a, b) => b.created - a.created) .slice(0, 10); - let fullThreadArray: any = []; + const fullThreadArray: any = []; const getMessageForThreads = newArray.map(async (message: any) => { try { const identifierQuery = message.threadId; @@ -327,6 +319,7 @@ export const GroupMail = ({ }, }); const responseData = await response.json(); + if (responseData.length > 0) { const thread = responseData[0]; if (thread?.metadata?.description) { @@ -342,7 +335,7 @@ export const GroupMail = ({ }; fullThreadArray.push(fullObject); } else { - let threadRes = await Promise.race([ + const threadRes = await Promise.race([ getEncryptedResource( { name: thread.name, @@ -377,13 +370,12 @@ export const GroupMail = ({ console.log(error); } finally { setIsLoading(false); - // dispatch(setIsLoadingCustom(null)); } }, [secretKey, isPrivate] ); - const getMessages = React.useCallback(async () => { + const getMessages = useCallback(async () => { // if ( !groupId || members?.length === 0) return; if (!groupId || isPrivate === null) return; @@ -400,7 +392,6 @@ export const GroupMail = ({ if (filterModeRef.current !== filterMode) { firstMount.current = false; } - // if (groupId && !firstMount.current && members.length > 0) { if (groupId && !firstMount.current && isPrivate !== null) { if (filterMode === 'Recently active') { getMessages(); @@ -427,11 +418,6 @@ export const GroupMail = ({ if (groupData && Array.isArray(groupData?.members)) { for (const member of groupData.members) { if (member.member) { - // const res = await getNameInfo(member.member); - // const resAddress = await qortalRequest({ - // action: "GET_ACCOUNT_DATA", - // address: member.member, - // }); const name = res; const publicKey = resAddress.publicKey; if (name) { @@ -465,16 +451,6 @@ export const GroupMail = ({ [filterMode] ); - // useEffect(()=> { - // if(user?.name){ - // const threads = JSON.parse( - // localStorage.getItem(`qmail_threads_viewedtimestamp_${user.name}`) || "{}" - // ); - // setViewedThreads(threads) - - // } - // }, [user?.name, currentThread]) - const handleCloseThreadFilterList = () => { setIsOpenFilterList(false); }; @@ -596,7 +572,7 @@ export const GroupMail = ({ padding: '0px', }} > - + {filterOptions?.map((filter) => { return ( @@ -621,6 +597,7 @@ export const GroupMail = ({ /> )} + {filter} @@ -630,9 +607,10 @@ export const GroupMail = ({ ); })} - + + + + - last message:{' '} + {t('group:last_message', { + postProcess: 'capitalize', + })} + :{' '} {formatDate(thread?.created)} )} + { setTimeout(() => { @@ -834,6 +820,7 @@ export const GroupMail = ({ + { const { t } = useTranslation(['core', 'group']); - const { show } = React.useContext(MyContext); + const { show } = useContext(MyContext); const [isOpen, setIsOpen] = useState(false); const [value, setValue] = useState(''); const [isSending, setIsSending] = useState(false); const [threadTitle, setThreadTitle] = useState(''); - const [openSnack, setOpenSnack] = React.useState(false); - const [infoSnack, setInfoSnack] = React.useState(null); + const [openSnack, setOpenSnack] = useState(false); + const [infoSnack, setInfoSnack] = useState(null); const editorRef = useRef(null); const theme = useTheme(); const setEditorRef = (editorInstance) => { diff --git a/src/components/Group/Forum/ReadOnlySlate.tsx b/src/components/Group/Forum/ReadOnlySlate.tsx index 5724f92..15e1436 100644 --- a/src/components/Group/Forum/ReadOnlySlate.tsx +++ b/src/components/Group/Forum/ReadOnlySlate.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { createEditor } from 'slate'; import { withReact, @@ -96,7 +96,7 @@ interface ReadOnlySlateProps { content: any; mode?: string; } -const ReadOnlySlate: React.FC = ({ content, mode }) => { +const ReadOnlySlate: FC = ({ content, mode }) => { const [load, setLoad] = useState(false); const editor = useMemo(() => withReact(createEditor()), []); const value = useMemo(() => content, [content]); diff --git a/src/components/Group/Forum/ReusableModal.tsx b/src/components/Group/Forum/ReusableModal.tsx index 1bedccb..9bd25c7 100644 --- a/src/components/Group/Forum/ReusableModal.tsx +++ b/src/components/Group/Forum/ReusableModal.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import { FC } from 'react'; import { Box, Modal, useTheme } from '@mui/material'; interface MyModalProps { @@ -9,7 +9,7 @@ interface MyModalProps { customStyles?: any; } -export const ReusableModal: React.FC = ({ +export const ReusableModal: FC = ({ open, onClose, onSubmit, diff --git a/src/components/Group/Forum/ShowMessageWithoutModal.tsx b/src/components/Group/Forum/ShowMessageWithoutModal.tsx index 914b9c5..4b862d4 100644 --- a/src/components/Group/Forum/ShowMessageWithoutModal.tsx +++ b/src/components/Group/Forum/ShowMessageWithoutModal.tsx @@ -118,27 +118,6 @@ export const ShowMessage = ({ message, openNewPostWithQuote, myName }: any) => { width: 'auto', }} > - {/* - - - - {file?.originalFilename || file?.filename} - - */} {message?.attachments?.length > 1 && isFirst && ( { try { setTempPublishedList([]); @@ -328,7 +321,7 @@ export const Thread = ({ }, [messages, secretKey] ); - const getMessages = React.useCallback(async () => { + const getMessages = useCallback(async () => { if ( !currentThread || (!secretKey && isPrivate) || @@ -410,7 +403,7 @@ export const Thread = ({ const interval = useRef(null); - const checkNewMessages = React.useCallback( + const checkNewMessages = useCallback( async (groupInfo: any) => { try { let threadId = groupInfo.threadId; @@ -494,7 +487,7 @@ export const Thread = ({ firstMount.current = true; }; - React.useEffect(() => { + useEffect(() => { subscribeToEvent('threadFetchMode', threadFetchModeFunc); return () => { @@ -656,6 +649,7 @@ export const Thread = ({
+ {t('core:page.previous', { postProcess: 'capitalize' })} + + + + +