mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-17 13:21:22 +00:00
Refactor imports
This commit is contained in:
parent
55c042c02b
commit
13f6651caa
@ -42,6 +42,7 @@
|
|||||||
"invitees_list": "invitees list",
|
"invitees_list": "invitees list",
|
||||||
"join_link": "join group link",
|
"join_link": "join group link",
|
||||||
"join_requests": "join requests",
|
"join_requests": "join requests",
|
||||||
|
"last_message": "last message",
|
||||||
"latest_mails": "latest Q-Mails",
|
"latest_mails": "latest Q-Mails",
|
||||||
"message": {
|
"message": {
|
||||||
"generic": {
|
"generic": {
|
||||||
|
@ -56,7 +56,7 @@ export const AppsCategoryDesktop = ({
|
|||||||
isShow,
|
isShow,
|
||||||
}) => {
|
}) => {
|
||||||
const [searchValue, setSearchValue] = useState('');
|
const [searchValue, setSearchValue] = useState('');
|
||||||
const virtuosoRef = useRef();
|
const virtuosoRef = useRef(null);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
const categoryList = useMemo(() => {
|
const categoryList = useMemo(() => {
|
||||||
|
@ -102,7 +102,7 @@ export const AppsLibraryDesktop = ({
|
|||||||
getQapps,
|
getQapps,
|
||||||
}) => {
|
}) => {
|
||||||
const [searchValue, setSearchValue] = useState('');
|
const [searchValue, setSearchValue] = useState('');
|
||||||
const virtuosoRef = useRef();
|
const virtuosoRef = useRef(null);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
const officialApps = useMemo(() => {
|
const officialApps = useMemo(() => {
|
||||||
|
@ -18,7 +18,7 @@ export const AnnouncementList = ({
|
|||||||
loadMore,
|
loadMore,
|
||||||
myName,
|
myName,
|
||||||
}) => {
|
}) => {
|
||||||
const listRef = useRef();
|
const listRef = useRef(null);
|
||||||
const [messages, setMessages] = useState(initialMessages);
|
const [messages, setMessages] = useState(initialMessages);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -23,7 +23,7 @@ export const ChatList = ({
|
|||||||
hasSecretKey,
|
hasSecretKey,
|
||||||
isPrivate,
|
isPrivate,
|
||||||
}) => {
|
}) => {
|
||||||
const parentRef = useRef();
|
const parentRef = useRef(null);
|
||||||
const [messages, setMessages] = useState(initialMessages);
|
const [messages, setMessages] = useState(initialMessages);
|
||||||
const [showScrollButton, setShowScrollButton] = useState(false);
|
const [showScrollButton, setShowScrollButton] = useState(false);
|
||||||
const [showScrollDownButton, setShowScrollDownButton] = useState(false);
|
const [showScrollDownButton, setShowScrollDownButton] = useState(false);
|
||||||
|
@ -60,8 +60,8 @@ export const ChatOptions = ({
|
|||||||
const [searchValue, setSearchValue] = useState('');
|
const [searchValue, setSearchValue] = useState('');
|
||||||
const [selectedMember, setSelectedMember] = useState(0);
|
const [selectedMember, setSelectedMember] = useState(0);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const parentRef = useRef();
|
const parentRef = useRef(null);
|
||||||
const parentRefMentions = useRef();
|
const parentRefMentions = useRef(null);
|
||||||
const [lastMentionTimestamp, setLastMentionTimestamp] = useState(null);
|
const [lastMentionTimestamp, setLastMentionTimestamp] = useState(null);
|
||||||
const [debouncedValue, setDebouncedValue] = useState(''); // Debounced value
|
const [debouncedValue, setDebouncedValue] = useState(''); // Debounced value
|
||||||
const messages = useMemo(() => {
|
const messages = useMemo(() => {
|
||||||
|
@ -452,6 +452,7 @@ export const AddGroup = ({ address, open, setOpen }) => {
|
|||||||
<MenuItem value={100}>100%</MenuItem>
|
<MenuItem value={100}>100%</MenuItem>
|
||||||
</Select>
|
</Select>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -464,6 +465,7 @@ export const AddGroup = ({ address, open, setOpen }) => {
|
|||||||
postProcess: 'capitalize',
|
postProcess: 'capitalize',
|
||||||
})}
|
})}
|
||||||
</Label>
|
</Label>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
labelId="demo-simple-select-label"
|
labelId="demo-simple-select-label"
|
||||||
id="demo-simple-select"
|
id="demo-simple-select"
|
||||||
@ -509,6 +511,7 @@ export const AddGroup = ({ address, open, setOpen }) => {
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Select>
|
</Select>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -521,6 +524,7 @@ export const AddGroup = ({ address, open, setOpen }) => {
|
|||||||
postProcess: 'capitalize',
|
postProcess: 'capitalize',
|
||||||
})}
|
})}
|
||||||
</Label>
|
</Label>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
labelId="demo-simple-select-label"
|
labelId="demo-simple-select-label"
|
||||||
id="demo-simple-select"
|
id="demo-simple-select"
|
||||||
@ -564,6 +568,7 @@ export const AddGroup = ({ address, open, setOpen }) => {
|
|||||||
</Select>
|
</Select>
|
||||||
</Box>
|
</Box>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
@ -48,7 +48,7 @@ export const AddGroupList = ({ setInfoSnack, setOpenSnack }) => {
|
|||||||
const [groups, setGroups] = useState([]);
|
const [groups, setGroups] = useState([]);
|
||||||
const [popoverAnchor, setPopoverAnchor] = useState(null); // Track which list item the popover is anchored to
|
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 [openPopoverIndex, setOpenPopoverIndex] = useState(null); // Track which list item has the popover open
|
||||||
const listRef = useRef();
|
const listRef = useRef(null);
|
||||||
const [inputValue, setInputValue] = useState('');
|
const [inputValue, setInputValue] = useState('');
|
||||||
const [filteredItems, setFilteredItems] = useState(groups);
|
const [filteredItems, setFilteredItems] = useState(groups);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
@ -1,26 +1,17 @@
|
|||||||
import React, {
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
useCallback,
|
|
||||||
useEffect,
|
|
||||||
useMemo,
|
|
||||||
useRef,
|
|
||||||
useState,
|
|
||||||
} from 'react';
|
|
||||||
import { Avatar, Box, Popover, Typography, useTheme } from '@mui/material';
|
import { Avatar, Box, Popover, Typography, useTheme } from '@mui/material';
|
||||||
// import { MAIL_SERVICE_TYPE, THREAD_SERVICE_TYPE } from "../../constants/mail";
|
|
||||||
import { Thread } from './Thread';
|
import { Thread } from './Thread';
|
||||||
import {
|
import {
|
||||||
AllThreadP,
|
AllThreadP,
|
||||||
ArrowDownIcon,
|
ArrowDownIcon,
|
||||||
ComposeContainer,
|
ComposeContainer,
|
||||||
ComposeContainerBlank,
|
ComposeContainerBlank,
|
||||||
ComposeIcon,
|
|
||||||
ComposeP,
|
ComposeP,
|
||||||
GroupContainer,
|
GroupContainer,
|
||||||
InstanceFooter,
|
InstanceFooter,
|
||||||
InstanceListContainer,
|
InstanceListContainer,
|
||||||
InstanceListContainerRow,
|
InstanceListContainerRow,
|
||||||
InstanceListContainerRowCheck,
|
InstanceListContainerRowCheck,
|
||||||
InstanceListContainerRowCheckIcon,
|
|
||||||
InstanceListContainerRowMain,
|
InstanceListContainerRowMain,
|
||||||
InstanceListContainerRowMainP,
|
InstanceListContainerRowMainP,
|
||||||
InstanceListHeader,
|
InstanceListHeader,
|
||||||
@ -48,7 +39,6 @@ import {
|
|||||||
getTempPublish,
|
getTempPublish,
|
||||||
handleUnencryptedPublishes,
|
handleUnencryptedPublishes,
|
||||||
} from '../../Chat/GroupAnnouncements';
|
} from '../../Chat/GroupAnnouncements';
|
||||||
import CheckSVG from '../../../assets/svgs/Check.svg';
|
|
||||||
import ArrowDownSVG from '../../../assets/svgs/ArrowDown.svg';
|
import ArrowDownSVG from '../../../assets/svgs/ArrowDown.svg';
|
||||||
import { LoadingSnackbar } from '../../Snackbar/LoadingSnackbar';
|
import { LoadingSnackbar } from '../../Snackbar/LoadingSnackbar';
|
||||||
import { executeEvent } from '../../../utils/events';
|
import { executeEvent } from '../../../utils/events';
|
||||||
@ -73,9 +63,9 @@ export const GroupMail = ({
|
|||||||
hide,
|
hide,
|
||||||
isPrivate,
|
isPrivate,
|
||||||
}) => {
|
}) => {
|
||||||
const [viewedThreads, setViewedThreads] = React.useState<any>({});
|
const [viewedThreads, setViewedThreads] = useState<any>({});
|
||||||
const [filterMode, setFilterMode] = useState<string>('Recently active');
|
const [filterMode, setFilterMode] = useState<string>('Recently active');
|
||||||
const [currentThread, setCurrentThread] = React.useState(null);
|
const [currentThread, setCurrentThread] = useState(null);
|
||||||
const [recentThreads, setRecentThreads] = useState<any[]>([]);
|
const [recentThreads, setRecentThreads] = useState<any[]>([]);
|
||||||
const [allThreads, setAllThreads] = useState<any[]>([]);
|
const [allThreads, setAllThreads] = useState<any[]>([]);
|
||||||
const [members, setMembers] = useState<any>(null);
|
const [members, setMembers] = useState<any>(null);
|
||||||
@ -178,7 +168,10 @@ export const GroupMail = ({
|
|||||||
rej(response.error);
|
rej(response.error);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
rej(error.message || 'An error occurred');
|
rej(
|
||||||
|
error.message ||
|
||||||
|
t('core:message.error.generic', { postProcess: 'capitalize' })
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -186,7 +179,7 @@ export const GroupMail = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getAllThreads = React.useCallback(
|
const getAllThreads = useCallback(
|
||||||
async (groupId: string, mode: string, isInitial?: boolean) => {
|
async (groupId: string, mode: string, isInitial?: boolean) => {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
@ -206,7 +199,7 @@ export const GroupMail = ({
|
|||||||
});
|
});
|
||||||
const responseData = await response.json();
|
const responseData = await response.json();
|
||||||
|
|
||||||
let fullArrayMsg = isInitial ? [] : [...allThreads];
|
const fullArrayMsg = isInitial ? [] : [...allThreads];
|
||||||
const getMessageForThreads = responseData.map(async (message: any) => {
|
const getMessageForThreads = responseData.map(async (message: any) => {
|
||||||
let fullObject: any = null;
|
let fullObject: any = null;
|
||||||
if (message?.metadata?.description) {
|
if (message?.metadata?.description) {
|
||||||
@ -271,13 +264,12 @@ export const GroupMail = ({
|
|||||||
} finally {
|
} finally {
|
||||||
if (isInitial) {
|
if (isInitial) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
// dispatch(setIsLoadingCustom(null));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[allThreads, isPrivate]
|
[allThreads, isPrivate]
|
||||||
);
|
);
|
||||||
const getMailMessages = React.useCallback(
|
const getMailMessages = useCallback(
|
||||||
async (groupId: string, members: any) => {
|
async (groupId: string, members: any) => {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
@ -315,7 +307,7 @@ export const GroupMail = ({
|
|||||||
.sort((a, b) => b.created - a.created)
|
.sort((a, b) => b.created - a.created)
|
||||||
.slice(0, 10);
|
.slice(0, 10);
|
||||||
|
|
||||||
let fullThreadArray: any = [];
|
const fullThreadArray: any = [];
|
||||||
const getMessageForThreads = newArray.map(async (message: any) => {
|
const getMessageForThreads = newArray.map(async (message: any) => {
|
||||||
try {
|
try {
|
||||||
const identifierQuery = message.threadId;
|
const identifierQuery = message.threadId;
|
||||||
@ -327,6 +319,7 @@ export const GroupMail = ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const responseData = await response.json();
|
const responseData = await response.json();
|
||||||
|
|
||||||
if (responseData.length > 0) {
|
if (responseData.length > 0) {
|
||||||
const thread = responseData[0];
|
const thread = responseData[0];
|
||||||
if (thread?.metadata?.description) {
|
if (thread?.metadata?.description) {
|
||||||
@ -342,7 +335,7 @@ export const GroupMail = ({
|
|||||||
};
|
};
|
||||||
fullThreadArray.push(fullObject);
|
fullThreadArray.push(fullObject);
|
||||||
} else {
|
} else {
|
||||||
let threadRes = await Promise.race([
|
const threadRes = await Promise.race([
|
||||||
getEncryptedResource(
|
getEncryptedResource(
|
||||||
{
|
{
|
||||||
name: thread.name,
|
name: thread.name,
|
||||||
@ -377,13 +370,12 @@ export const GroupMail = ({
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
// dispatch(setIsLoadingCustom(null));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[secretKey, isPrivate]
|
[secretKey, isPrivate]
|
||||||
);
|
);
|
||||||
|
|
||||||
const getMessages = React.useCallback(async () => {
|
const getMessages = useCallback(async () => {
|
||||||
// if ( !groupId || members?.length === 0) return;
|
// if ( !groupId || members?.length === 0) return;
|
||||||
if (!groupId || isPrivate === null) return;
|
if (!groupId || isPrivate === null) return;
|
||||||
|
|
||||||
@ -400,7 +392,6 @@ export const GroupMail = ({
|
|||||||
if (filterModeRef.current !== filterMode) {
|
if (filterModeRef.current !== filterMode) {
|
||||||
firstMount.current = false;
|
firstMount.current = false;
|
||||||
}
|
}
|
||||||
// if (groupId && !firstMount.current && members.length > 0) {
|
|
||||||
if (groupId && !firstMount.current && isPrivate !== null) {
|
if (groupId && !firstMount.current && isPrivate !== null) {
|
||||||
if (filterMode === 'Recently active') {
|
if (filterMode === 'Recently active') {
|
||||||
getMessages();
|
getMessages();
|
||||||
@ -427,11 +418,6 @@ export const GroupMail = ({
|
|||||||
if (groupData && Array.isArray(groupData?.members)) {
|
if (groupData && Array.isArray(groupData?.members)) {
|
||||||
for (const member of groupData.members) {
|
for (const member of groupData.members) {
|
||||||
if (member.member) {
|
if (member.member) {
|
||||||
// const res = await getNameInfo(member.member);
|
|
||||||
// const resAddress = await qortalRequest({
|
|
||||||
// action: "GET_ACCOUNT_DATA",
|
|
||||||
// address: member.member,
|
|
||||||
// });
|
|
||||||
const name = res;
|
const name = res;
|
||||||
const publicKey = resAddress.publicKey;
|
const publicKey = resAddress.publicKey;
|
||||||
if (name) {
|
if (name) {
|
||||||
@ -465,16 +451,6 @@ export const GroupMail = ({
|
|||||||
[filterMode]
|
[filterMode]
|
||||||
);
|
);
|
||||||
|
|
||||||
// useEffect(()=> {
|
|
||||||
// if(user?.name){
|
|
||||||
// const threads = JSON.parse(
|
|
||||||
// localStorage.getItem(`qmail_threads_viewedtimestamp_${user.name}`) || "{}"
|
|
||||||
// );
|
|
||||||
// setViewedThreads(threads)
|
|
||||||
|
|
||||||
// }
|
|
||||||
// }, [user?.name, currentThread])
|
|
||||||
|
|
||||||
const handleCloseThreadFilterList = () => {
|
const handleCloseThreadFilterList = () => {
|
||||||
setIsOpenFilterList(false);
|
setIsOpenFilterList(false);
|
||||||
};
|
};
|
||||||
@ -596,7 +572,7 @@ export const GroupMail = ({
|
|||||||
padding: '0px',
|
padding: '0px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<InstanceListHeader></InstanceListHeader>
|
<InstanceListHeader />
|
||||||
<InstanceListContainer>
|
<InstanceListContainer>
|
||||||
{filterOptions?.map((filter) => {
|
{filterOptions?.map((filter) => {
|
||||||
return (
|
return (
|
||||||
@ -621,6 +597,7 @@ export const GroupMail = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</InstanceListContainerRowCheck>
|
</InstanceListContainerRowCheck>
|
||||||
|
|
||||||
<InstanceListContainerRowMain>
|
<InstanceListContainerRowMain>
|
||||||
<InstanceListContainerRowMainP>
|
<InstanceListContainerRowMainP>
|
||||||
{filter}
|
{filter}
|
||||||
@ -630,9 +607,10 @@ export const GroupMail = ({
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</InstanceListContainer>
|
</InstanceListContainer>
|
||||||
<InstanceFooter></InstanceFooter>
|
<InstanceFooter />
|
||||||
</InstanceListParent>
|
</InstanceListParent>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|
||||||
<ThreadContainerFullWidth>
|
<ThreadContainerFullWidth>
|
||||||
<ThreadContainer>
|
<ThreadContainer>
|
||||||
<Box
|
<Box
|
||||||
@ -674,7 +652,9 @@ export const GroupMail = ({
|
|||||||
)}
|
)}
|
||||||
</ComposeContainerBlank>
|
</ComposeContainerBlank>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Spacer height="30px" />
|
<Spacer height="30px" />
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@ -700,10 +680,12 @@ export const GroupMail = ({
|
|||||||
viewedThreads[
|
viewedThreads[
|
||||||
`qmail_threads_${thread?.threadData?.groupId}_${thread?.threadId}`
|
`qmail_threads_${thread?.threadData?.groupId}_${thread?.threadId}`
|
||||||
];
|
];
|
||||||
|
|
||||||
const shouldAppearLighter =
|
const shouldAppearLighter =
|
||||||
hasViewedRecent &&
|
hasViewedRecent &&
|
||||||
filterMode === 'Recently active' &&
|
filterMode === 'Recently active' &&
|
||||||
thread?.threadData?.createdAt < hasViewedRecent?.timestamp;
|
thread?.threadData?.createdAt < hasViewedRecent?.timestamp;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SingleThreadParent
|
<SingleThreadParent
|
||||||
sx={{
|
sx={{
|
||||||
@ -771,13 +753,17 @@ export const GroupMail = ({
|
|||||||
>
|
>
|
||||||
<ThreadSingleLastMessageP>
|
<ThreadSingleLastMessageP>
|
||||||
<ThreadSingleLastMessageSpanP>
|
<ThreadSingleLastMessageSpanP>
|
||||||
last message:{' '}
|
{t('group:last_message', {
|
||||||
|
postProcess: 'capitalize',
|
||||||
|
})}
|
||||||
|
:{' '}
|
||||||
</ThreadSingleLastMessageSpanP>
|
</ThreadSingleLastMessageSpanP>
|
||||||
{formatDate(thread?.created)}
|
{formatDate(thread?.created)}
|
||||||
</ThreadSingleLastMessageP>
|
</ThreadSingleLastMessageP>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<CustomButton
|
<CustomButton
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -834,6 +820,7 @@ export const GroupMail = ({
|
|||||||
</Box>
|
</Box>
|
||||||
</ThreadContainer>
|
</ThreadContainer>
|
||||||
</ThreadContainerFullWidth>
|
</ThreadContainerFullWidth>
|
||||||
|
|
||||||
<LoadingSnackbar
|
<LoadingSnackbar
|
||||||
open={isLoading}
|
open={isLoading}
|
||||||
info={{
|
info={{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useRef, useState } from 'react';
|
import { useContext, useEffect, useRef, useState } from 'react';
|
||||||
import { Box, CircularProgress, Input, useTheme } from '@mui/material';
|
import { Box, CircularProgress, Input, useTheme } from '@mui/material';
|
||||||
import ShortUniqueId from 'short-unique-id';
|
import ShortUniqueId from 'short-unique-id';
|
||||||
import {
|
import {
|
||||||
@ -8,7 +8,6 @@ import {
|
|||||||
InstanceFooter,
|
InstanceFooter,
|
||||||
InstanceListContainer,
|
InstanceListContainer,
|
||||||
InstanceListHeader,
|
InstanceListHeader,
|
||||||
NewMessageCloseImg,
|
|
||||||
NewMessageHeaderP,
|
NewMessageHeaderP,
|
||||||
NewMessageInputRow,
|
NewMessageInputRow,
|
||||||
NewMessageSendButton,
|
NewMessageSendButton,
|
||||||
@ -143,13 +142,13 @@ export const NewThread = ({
|
|||||||
isPrivate,
|
isPrivate,
|
||||||
}: NewMessageProps) => {
|
}: NewMessageProps) => {
|
||||||
const { t } = useTranslation(['core', 'group']);
|
const { t } = useTranslation(['core', 'group']);
|
||||||
const { show } = React.useContext(MyContext);
|
const { show } = useContext(MyContext);
|
||||||
const [isOpen, setIsOpen] = useState<boolean>(false);
|
const [isOpen, setIsOpen] = useState<boolean>(false);
|
||||||
const [value, setValue] = useState('');
|
const [value, setValue] = useState('');
|
||||||
const [isSending, setIsSending] = useState(false);
|
const [isSending, setIsSending] = useState(false);
|
||||||
const [threadTitle, setThreadTitle] = useState<string>('');
|
const [threadTitle, setThreadTitle] = useState<string>('');
|
||||||
const [openSnack, setOpenSnack] = React.useState(false);
|
const [openSnack, setOpenSnack] = useState(false);
|
||||||
const [infoSnack, setInfoSnack] = React.useState(null);
|
const [infoSnack, setInfoSnack] = useState(null);
|
||||||
const editorRef = useRef(null);
|
const editorRef = useRef(null);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const setEditorRef = (editorInstance) => {
|
const setEditorRef = (editorInstance) => {
|
||||||
|
@ -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 { createEditor } from 'slate';
|
||||||
import {
|
import {
|
||||||
withReact,
|
withReact,
|
||||||
@ -96,7 +96,7 @@ interface ReadOnlySlateProps {
|
|||||||
content: any;
|
content: any;
|
||||||
mode?: string;
|
mode?: string;
|
||||||
}
|
}
|
||||||
const ReadOnlySlate: React.FC<ReadOnlySlateProps> = ({ content, mode }) => {
|
const ReadOnlySlate: FC<ReadOnlySlateProps> = ({ content, mode }) => {
|
||||||
const [load, setLoad] = useState(false);
|
const [load, setLoad] = useState(false);
|
||||||
const editor = useMemo(() => withReact(createEditor()), []);
|
const editor = useMemo(() => withReact(createEditor()), []);
|
||||||
const value = useMemo(() => content, [content]);
|
const value = useMemo(() => content, [content]);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import { FC } from 'react';
|
||||||
import { Box, Modal, useTheme } from '@mui/material';
|
import { Box, Modal, useTheme } from '@mui/material';
|
||||||
|
|
||||||
interface MyModalProps {
|
interface MyModalProps {
|
||||||
@ -9,7 +9,7 @@ interface MyModalProps {
|
|||||||
customStyles?: any;
|
customStyles?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ReusableModal: React.FC<MyModalProps> = ({
|
export const ReusableModal: FC<MyModalProps> = ({
|
||||||
open,
|
open,
|
||||||
onClose,
|
onClose,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
|
@ -118,27 +118,6 @@ export const ShowMessage = ({ message, openNewPostWithQuote, myName }: any) => {
|
|||||||
width: 'auto',
|
width: 'auto',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* <FileElement
|
|
||||||
fileInfo={{ ...file, mimeTypeSaved: file?.type }}
|
|
||||||
title={file?.filename}
|
|
||||||
mode="mail"
|
|
||||||
otherUser={message?.user}
|
|
||||||
>
|
|
||||||
<MailAttachmentImg src={AttachmentMailSVG} />
|
|
||||||
|
|
||||||
<Typography
|
|
||||||
sx={{
|
|
||||||
fontSize: "16px",
|
|
||||||
transition: '0.2s all',
|
|
||||||
"&:hover": {
|
|
||||||
color: 'rgba(255, 255, 255, 0.90)',
|
|
||||||
textDecoration: 'underline'
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{file?.originalFilename || file?.filename}
|
|
||||||
</Typography>
|
|
||||||
</FileElement> */}
|
|
||||||
{message?.attachments?.length > 1 && isFirst && (
|
{message?.attachments?.length > 1 && isFirst && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
import React, {
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
useCallback,
|
|
||||||
useEffect,
|
|
||||||
useMemo,
|
|
||||||
useRef,
|
|
||||||
useState,
|
|
||||||
} from 'react';
|
|
||||||
import {
|
import {
|
||||||
Avatar,
|
Avatar,
|
||||||
Box,
|
Box,
|
||||||
@ -18,7 +12,6 @@ import {
|
|||||||
ComposeP,
|
ComposeP,
|
||||||
GroupContainer,
|
GroupContainer,
|
||||||
GroupNameP,
|
GroupNameP,
|
||||||
MailIconImg,
|
|
||||||
ShowMessageReturnButton,
|
ShowMessageReturnButton,
|
||||||
SingleThreadParent,
|
SingleThreadParent,
|
||||||
ThreadContainer,
|
ThreadContainer,
|
||||||
@ -222,7 +215,7 @@ export const Thread = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMailMessages = React.useCallback(
|
const getMailMessages = useCallback(
|
||||||
async (groupInfo: any, before, after, isReverse, groupId) => {
|
async (groupInfo: any, before, after, isReverse, groupId) => {
|
||||||
try {
|
try {
|
||||||
setTempPublishedList([]);
|
setTempPublishedList([]);
|
||||||
@ -328,7 +321,7 @@ export const Thread = ({
|
|||||||
},
|
},
|
||||||
[messages, secretKey]
|
[messages, secretKey]
|
||||||
);
|
);
|
||||||
const getMessages = React.useCallback(async () => {
|
const getMessages = useCallback(async () => {
|
||||||
if (
|
if (
|
||||||
!currentThread ||
|
!currentThread ||
|
||||||
(!secretKey && isPrivate) ||
|
(!secretKey && isPrivate) ||
|
||||||
@ -410,7 +403,7 @@ export const Thread = ({
|
|||||||
|
|
||||||
const interval = useRef<any>(null);
|
const interval = useRef<any>(null);
|
||||||
|
|
||||||
const checkNewMessages = React.useCallback(
|
const checkNewMessages = useCallback(
|
||||||
async (groupInfo: any) => {
|
async (groupInfo: any) => {
|
||||||
try {
|
try {
|
||||||
let threadId = groupInfo.threadId;
|
let threadId = groupInfo.threadId;
|
||||||
@ -494,7 +487,7 @@ export const Thread = ({
|
|||||||
firstMount.current = true;
|
firstMount.current = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
subscribeToEvent('threadFetchMode', threadFetchModeFunc);
|
subscribeToEvent('threadFetchMode', threadFetchModeFunc);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
@ -656,6 +649,7 @@ export const Thread = ({
|
|||||||
<div ref={threadBeginningRef} />
|
<div ref={threadBeginningRef} />
|
||||||
<ThreadContainer>
|
<ThreadContainer>
|
||||||
<Spacer height={'30px'} />
|
<Spacer height={'30px'} />
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@ -715,6 +709,7 @@ export const Thread = ({
|
|||||||
>
|
>
|
||||||
{t('core:page.previous', { postProcess: 'capitalize' })}
|
{t('core:page.previous', { postProcess: 'capitalize' })}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
sx={{
|
sx={{
|
||||||
textTransformation: 'capitalize',
|
textTransformation: 'capitalize',
|
||||||
@ -733,6 +728,7 @@ export const Thread = ({
|
|||||||
>
|
>
|
||||||
{t('core:page.next', { postProcess: 'capitalize' })}
|
{t('core:page.next', { postProcess: 'capitalize' })}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
sx={{
|
sx={{
|
||||||
textTransformation: 'capitalize',
|
textTransformation: 'capitalize',
|
||||||
@ -1006,6 +1002,7 @@ export const Thread = ({
|
|||||||
>
|
>
|
||||||
{t('core:page.first', { postProcess: 'capitalize' })}
|
{t('core:page.first', { postProcess: 'capitalize' })}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
sx={{
|
sx={{
|
||||||
textTransformation: 'capitalize',
|
textTransformation: 'capitalize',
|
||||||
@ -1024,6 +1021,7 @@ export const Thread = ({
|
|||||||
>
|
>
|
||||||
{t('core:page.previous', { postProcess: 'capitalize' })}
|
{t('core:page.previous', { postProcess: 'capitalize' })}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
sx={{
|
sx={{
|
||||||
textTransformation: 'capitalize',
|
textTransformation: 'capitalize',
|
||||||
@ -1042,6 +1040,7 @@ export const Thread = ({
|
|||||||
>
|
>
|
||||||
{t('core:page.next', { postProcess: 'capitalize' })}
|
{t('core:page.next', { postProcess: 'capitalize' })}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
sx={{
|
sx={{
|
||||||
textTransformation: 'capitalize',
|
textTransformation: 'capitalize',
|
||||||
@ -1061,12 +1060,14 @@ export const Thread = ({
|
|||||||
{t('core:page.last', { postProcess: 'capitalize' })}
|
{t('core:page.last', { postProcess: 'capitalize' })}
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Spacer height="30px" />
|
<Spacer height="30px" />
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<div ref={containerRef} />
|
<div ref={containerRef} />
|
||||||
</ThreadContainer>
|
</ThreadContainer>
|
||||||
</ThreadContainerFullWidth>
|
</ThreadContainerFullWidth>
|
||||||
|
|
||||||
<LoadingSnackbar
|
<LoadingSnackbar
|
||||||
open={isLoading}
|
open={isLoading}
|
||||||
info={{
|
info={{
|
||||||
|
@ -54,7 +54,7 @@ export const ListOfBans = ({ groupId, setInfoSnack, setOpenSnack, show }) => {
|
|||||||
const [bans, setBans] = useState([]);
|
const [bans, setBans] = useState([]);
|
||||||
const [popoverAnchor, setPopoverAnchor] = useState(null); // Track which list item the popover is anchored to
|
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 [openPopoverIndex, setOpenPopoverIndex] = useState(null); // Track which list item has the popover open
|
||||||
const listRef = useRef();
|
const listRef = useRef(null);
|
||||||
const [isLoadingUnban, setIsLoadingUnban] = useState(false);
|
const [isLoadingUnban, setIsLoadingUnban] = useState(false);
|
||||||
const { t } = useTranslation(['core', 'group']);
|
const { t } = useTranslation(['core', 'group']);
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ export const ListOfGroupPromotions = () => {
|
|||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { t } = useTranslation(['core', 'group']);
|
const { t } = useTranslation(['core', 'group']);
|
||||||
const listRef = useRef();
|
const listRef = useRef(null);
|
||||||
const rowVirtualizer = useVirtualizer({
|
const rowVirtualizer = useVirtualizer({
|
||||||
count: promotions.length,
|
count: promotions.length,
|
||||||
getItemKey: React.useCallback(
|
getItemKey: React.useCallback(
|
||||||
|
@ -228,7 +228,6 @@ const ExportPrivateKey = ({ rawWallet }) => {
|
|||||||
const [password, setPassword] = useState('');
|
const [password, setPassword] = useState('');
|
||||||
const [privateKey, setPrivateKey] = useState('');
|
const [privateKey, setPrivateKey] = useState('');
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
|
||||||
const { setOpenSnackGlobal, setInfoSnackCustom } = useContext(MyContext);
|
const { setOpenSnackGlobal, setInfoSnackCustom } = useContext(MyContext);
|
||||||
const { t } = useTranslation(['core', 'group']);
|
const { t } = useTranslation(['core', 'group']);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as React from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
import List from '@mui/material/List';
|
import List from '@mui/material/List';
|
||||||
import ListItem from '@mui/material/ListItem';
|
import ListItem from '@mui/material/ListItem';
|
||||||
import ListItemButton from '@mui/material/ListItemButton';
|
import ListItemButton from '@mui/material/ListItemButton';
|
||||||
@ -17,27 +17,27 @@ export const ThingsToDoInitial = ({
|
|||||||
balance,
|
balance,
|
||||||
userInfo,
|
userInfo,
|
||||||
}) => {
|
}) => {
|
||||||
const [checked1, setChecked1] = React.useState(false);
|
const [checked1, setChecked1] = useState(false);
|
||||||
const [checked2, setChecked2] = React.useState(false);
|
const [checked2, setChecked2] = useState(false);
|
||||||
const { t } = useTranslation(['core', 'tutorial']);
|
const { t } = useTranslation(['core', 'tutorial']);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
if (balance && +balance >= 6) {
|
if (balance && +balance >= 6) {
|
||||||
setChecked1(true);
|
setChecked1(true);
|
||||||
}
|
}
|
||||||
}, [balance]);
|
}, [balance]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
if (name) setChecked2(true);
|
if (name) setChecked2(true);
|
||||||
}, [name]);
|
}, [name]);
|
||||||
|
|
||||||
const isLoaded = React.useMemo(() => {
|
const isLoaded = useMemo(() => {
|
||||||
if (userInfo !== null) return true;
|
if (userInfo !== null) return true;
|
||||||
return false;
|
return false;
|
||||||
}, [userInfo]);
|
}, [userInfo]);
|
||||||
|
|
||||||
const hasDoneNameAndBalanceAndIsLoaded = React.useMemo(() => {
|
const hasDoneNameAndBalanceAndIsLoaded = useMemo(() => {
|
||||||
if (isLoaded && checked1 && checked2) return true;
|
if (isLoaded && checked1 && checked2) return true;
|
||||||
return false;
|
return false;
|
||||||
}, [checked1, isLoaded, checked2]);
|
}, [checked1, isLoaded, checked2]);
|
||||||
|
@ -64,7 +64,7 @@ export const UserListOfInvites = ({
|
|||||||
const { t } = useTranslation(['core', 'group']);
|
const { t } = useTranslation(['core', 'group']);
|
||||||
const [popoverAnchor, setPopoverAnchor] = useState(null); // Track which list item the popover is anchored to
|
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 [openPopoverIndex, setOpenPopoverIndex] = useState(null); // Track which list item has the popover open
|
||||||
const listRef = useRef();
|
const listRef = useRef(null);
|
||||||
|
|
||||||
const getRequests = async () => {
|
const getRequests = async () => {
|
||||||
try {
|
try {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Box, ButtonBase, Divider, Typography, useTheme } from '@mui/material';
|
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
|
import { Box, ButtonBase, Divider, Typography, useTheme } from '@mui/material';
|
||||||
import CloseIcon from '@mui/icons-material/Close';
|
import CloseIcon from '@mui/icons-material/Close';
|
||||||
import AppViewerContainer from '../Apps/AppViewerContainer';
|
import AppViewerContainer from '../Apps/AppViewerContainer';
|
||||||
import {
|
import {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user