Merge pull request #36 from Qortal/feature/optimizations

Feature/optimizations
This commit is contained in:
Phillip 2025-04-30 03:04:54 +03:00 committed by GitHub
commit 4d888e832f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
40 changed files with 269 additions and 268 deletions

View File

@ -104,9 +104,11 @@ import {
groupsPropertiesAtom, groupsPropertiesAtom,
hasSettingsChangedAtom, hasSettingsChangedAtom,
isDisabledEditorEnterAtom, isDisabledEditorEnterAtom,
isRunningPublicNodeAtom,
isUsingImportExportSettingsAtom, isUsingImportExportSettingsAtom,
lastPaymentSeenTimestampAtom, lastPaymentSeenTimestampAtom,
mailsAtom, mailsAtom,
memberGroupsAtom,
mutedGroupsAtom, mutedGroupsAtom,
oldPinnedAppsAtom, oldPinnedAppsAtom,
qMailLastEnteredTimestampAtom, qMailLastEnteredTimestampAtom,
@ -114,6 +116,7 @@ import {
settingsQDNLastUpdatedAtom, settingsQDNLastUpdatedAtom,
sortablePinnedAppsAtom, sortablePinnedAppsAtom,
timestampEnterDataAtom, timestampEnterDataAtom,
txListAtom,
} from './atoms/global'; } from './atoms/global';
import { NotAuthenticated } from './ExtStates/NotAuthenticated'; import { NotAuthenticated } from './ExtStates/NotAuthenticated';
import { handleGetFileFromIndexedDB } from './utils/indexedDB'; import { handleGetFileFromIndexedDB } from './utils/indexedDB';
@ -161,10 +164,6 @@ type extStates =
| 'group'; | 'group';
interface MyContextInterface { interface MyContextInterface {
txList: any[];
memberGroups: any[];
setTxList: (val) => void;
setMemberGroups: (val) => void;
isShow: boolean; isShow: boolean;
onCancel: () => void; onCancel: () => void;
onOk: () => void; onOk: () => void;
@ -173,10 +172,6 @@ interface MyContextInterface {
} }
const defaultValues: MyContextInterface = { const defaultValues: MyContextInterface = {
txList: [],
memberGroups: [],
setTxList: () => {},
setMemberGroups: () => {},
isShow: false, isShow: false,
onCancel: () => {}, onCancel: () => {},
onOk: () => {}, onOk: () => {},
@ -245,9 +240,6 @@ const defaultValuesGlobal = {
export const MyContext = createContext<MyContextInterface>(defaultValues); export const MyContext = createContext<MyContextInterface>(defaultValues);
export const GlobalContext =
createContext<MyContextInterface>(defaultValuesGlobal);
export let globalApiKey: string | null = null; export let globalApiKey: string | null = null;
export const getBaseApiReact = (customApi?: string) => { export const getBaseApiReact = (customApi?: string) => {
@ -327,15 +319,13 @@ function App() {
useState<string>(''); useState<string>('');
const [walletToBeDecryptedError, setWalletToBeDecryptedError] = const [walletToBeDecryptedError, setWalletToBeDecryptedError] =
useState<string>(''); useState<string>('');
const [txList, setTxList] = useState([]);
const [memberGroups, setMemberGroups] = useState([]);
const [isFocused, setIsFocused] = useState(true); const [isFocused, setIsFocused] = useState(true);
const [hasSettingsChanged, setHasSettingsChanged] = useAtom( const [hasSettingsChanged, setHasSettingsChanged] = useAtom(
hasSettingsChangedAtom hasSettingsChangedAtom
); );
const balanceSetIntervalRef = useRef(null); const balanceSetIntervalRef = useRef(null);
const { downloadResource } = useFetchResources(); const downloadResource = useFetchResources();
const holdRefExtState = useRef<extStates>('not-authenticated'); const holdRefExtState = useRef<extStates>('not-authenticated');
const isFocusedRef = useRef<boolean>(true); const isFocusedRef = useRef<boolean>(true);
const { const {
@ -375,8 +365,7 @@ function App() {
isShow: isShowQortalRequestExtension, isShow: isShowQortalRequestExtension,
message: messageQortalRequestExtension, message: messageQortalRequestExtension,
} = useModal(); } = useModal();
const setIsRunningPublicNode = useSetAtom(isRunningPublicNodeAtom);
const [isRunningPublicNode, setIsRunningPublicNode] = useState(false);
const [infoSnack, setInfoSnack] = useState(null); const [infoSnack, setInfoSnack] = useState(null);
const [openSnack, setOpenSnack] = useState(false); const [openSnack, setOpenSnack] = useState(false);
@ -386,7 +375,6 @@ function App() {
const [apiKey, setApiKey] = useState(''); const [apiKey, setApiKey] = useState('');
const [isOpenSendQort, setIsOpenSendQort] = useState(false); const [isOpenSendQort, setIsOpenSendQort] = useState(false);
const [isOpenSendQortSuccess, setIsOpenSendQortSuccess] = useState(false); const [isOpenSendQortSuccess, setIsOpenSendQortSuccess] = useState(false);
const [rootHeight, setRootHeight] = useState('100%');
const { const {
isUserBlocked, isUserBlocked,
addToBlockList, addToBlockList,
@ -402,7 +390,7 @@ function App() {
const [isSettingsOpen, setIsSettingsOpen] = useState(false); const [isSettingsOpen, setIsSettingsOpen] = useState(false);
const [showSeed, setShowSeed] = useState(false); const [showSeed, setShowSeed] = useState(false);
const [creationStep, setCreationStep] = useState(1); const [creationStep, setCreationStep] = useState(1);
const { getIndividualUserInfo } = useHandleUserInfo(); const getIndividualUserInfo = useHandleUserInfo();
const qortalRequestCheckbox1Ref = useRef(null); const qortalRequestCheckbox1Ref = useRef(null);
useRetrieveDataLocalStorage(userInfo?.address); useRetrieveDataLocalStorage(userInfo?.address);
useQortalGetSaveSettings(userInfo?.name, extState === 'authenticated'); useQortalGetSaveSettings(userInfo?.name, extState === 'authenticated');
@ -482,6 +470,8 @@ function App() {
const resetMutedGroupsAtom = useResetAtom(mutedGroupsAtom); const resetMutedGroupsAtom = useResetAtom(mutedGroupsAtom);
const resetGroupChatTimestampsAtom = useResetAtom(groupChatTimestampsAtom); const resetGroupChatTimestampsAtom = useResetAtom(groupChatTimestampsAtom);
const resetTimestampEnterAtom = useResetAtom(timestampEnterDataAtom); const resetTimestampEnterAtom = useResetAtom(timestampEnterDataAtom);
const resettxListAtomAtom = useResetAtom(txListAtom);
const resetmemberGroupsAtomAtom = useResetAtom(memberGroupsAtom);
const resetAllRecoil = () => { const resetAllRecoil = () => {
resetAtomSortablePinnedAppsAtom(); resetAtomSortablePinnedAppsAtom();
@ -499,8 +489,59 @@ function App() {
resetMutedGroupsAtom(); resetMutedGroupsAtom();
resetGroupChatTimestampsAtom(); resetGroupChatTimestampsAtom();
resetTimestampEnterAtom(); resetTimestampEnterAtom();
resettxListAtomAtom();
resetmemberGroupsAtomAtom();
}; };
const contextValue = useMemo(
() => ({
isShow,
onCancel,
onOk,
show,
userInfo,
message,
showInfo,
openSnackGlobal: openSnack,
setOpenSnackGlobal: setOpenSnack,
infoSnackCustom: infoSnack,
setInfoSnackCustom: setInfoSnack,
downloadResource,
getIndividualUserInfo,
isUserBlocked,
addToBlockList,
removeBlockFromList,
getAllBlockedUsers,
showTutorial,
openTutorialModal,
setOpenTutorialModal,
hasSeenGettingStarted,
}),
[
isShow,
onCancel,
onOk,
show,
userInfo,
message,
showInfo,
openSnack,
setOpenSnack,
infoSnack,
setInfoSnack,
downloadResource,
getIndividualUserInfo,
isUserBlocked,
addToBlockList,
removeBlockFromList,
getAllBlockedUsers,
showTutorial,
openTutorialModal,
setOpenTutorialModal,
hasSeenGettingStarted,
]
);
const handleSetGlobalApikey = (key) => { const handleSetGlobalApikey = (key) => {
globalApiKey = key; globalApiKey = key;
}; };
@ -985,7 +1026,7 @@ function App() {
} }
}; };
const logoutFunc = async () => { const logoutFunc = useCallback(async () => {
try { try {
if (hasSettingsChanged) { if (hasSettingsChanged) {
await showUnsavedChanges({ await showUnsavedChanges({
@ -1014,7 +1055,7 @@ function App() {
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
}; }, [hasSettingsChanged, extState]);
const returnToMain = () => { const returnToMain = () => {
setPaymentTo(''); setPaymentTo('');
@ -1059,8 +1100,6 @@ function App() {
setWalletToBeDownloadedError(''); setWalletToBeDownloadedError('');
setSendqortState(null); setSendqortState(null);
setHasLocalNode(false); setHasLocalNode(false);
setTxList([]);
setMemberGroups([]);
resetAllRecoil(); resetAllRecoil();
if (balanceSetIntervalRef?.current) { if (balanceSetIntervalRef?.current) {
clearInterval(balanceSetIntervalRef?.current); clearInterval(balanceSetIntervalRef?.current);
@ -1758,36 +1797,10 @@ function App() {
}} }}
> >
{extState === 'authenticated' && isMainWindow && ( {extState === 'authenticated' && isMainWindow && (
<MyContext.Provider <>
value={{
txList,
setTxList,
memberGroups,
setMemberGroups,
isShow,
onCancel,
onOk,
show,
userInfo,
message,
rootHeight,
showInfo,
openSnackGlobal: openSnack,
setOpenSnackGlobal: setOpenSnack,
infoSnackCustom: infoSnack,
setInfoSnackCustom: setInfoSnack,
downloadResource,
getIndividualUserInfo,
isUserBlocked,
addToBlockList,
removeBlockFromList,
getAllBlockedUsers,
isRunningPublicNode,
}}
>
<TaskManager getUserInfo={getUserInfo} /> <TaskManager getUserInfo={getUserInfo} />
<GlobalActions memberGroups={memberGroups} /> <GlobalActions />
</MyContext.Provider> </>
)} )}
<Spacer height="20px" /> <Spacer height="20px" />
@ -1955,15 +1968,7 @@ function App() {
}} }}
> >
<PdfViewer /> <PdfViewer />
<GlobalContext.Provider <MyContext.Provider value={contextValue}>
value={{
showTutorial,
openTutorialModal,
setOpenTutorialModal,
downloadResource,
hasSeenGettingStarted,
}}
>
<Tutorials /> <Tutorials />
{extState === 'not-authenticated' && ( {extState === 'not-authenticated' && (
<NotAuthenticated <NotAuthenticated
@ -1984,33 +1989,6 @@ function App() {
<button onClick={logoutFunc}>logout</button> <button onClick={logoutFunc}>logout</button>
)} */} )} */}
{extState === 'authenticated' && isMainWindow && ( {extState === 'authenticated' && isMainWindow && (
<MyContext.Provider
value={{
txList,
setTxList,
memberGroups,
setMemberGroups,
isShow,
onCancel,
onOk,
show,
userInfo,
message,
rootHeight,
showInfo,
openSnackGlobal: openSnack,
setOpenSnackGlobal: setOpenSnack,
infoSnackCustom: infoSnack,
setInfoSnackCustom: setInfoSnack,
downloadResource,
getIndividualUserInfo,
isUserBlocked,
addToBlockList,
removeBlockFromList,
getAllBlockedUsers,
isRunningPublicNode,
}}
>
<Box <Box
sx={{ sx={{
display: 'flex', display: 'flex',
@ -2033,7 +2011,6 @@ function App() {
/> />
{renderProfile()} {renderProfile()}
</Box> </Box>
</MyContext.Provider>
)} )}
{isOpenSendQort && isMainWindow && ( {isOpenSendQort && isMainWindow && (
<Box <Box
@ -2063,6 +2040,7 @@ function App() {
style={{ style={{
cursor: 'pointer', cursor: 'pointer',
height: '24px', height: '24px',
width: 'auto',
}} }}
onClick={returnToMain} onClick={returnToMain}
/> />
@ -2560,6 +2538,7 @@ function App() {
style={{ style={{
cursor: 'pointer', cursor: 'pointer',
height: '24px', height: '24px',
width: 'auto',
}} }}
onClick={() => { onClick={() => {
setRawWallet(null); setRawWallet(null);
@ -2593,6 +2572,7 @@ function App() {
style={{ style={{
cursor: 'pointer', cursor: 'pointer',
height: '24px', height: '24px',
width: 'auto',
}} }}
onClick={() => { onClick={() => {
setRawWallet(null); setRawWallet(null);
@ -2722,6 +2702,7 @@ function App() {
style={{ style={{
cursor: 'pointer', cursor: 'pointer',
height: '24px', height: '24px',
width: 'auto',
}} }}
onClick={() => { onClick={() => {
if (creationStep === 2) { if (creationStep === 2) {
@ -3604,13 +3585,12 @@ function App() {
<RegisterName <RegisterName
balance={balance} balance={balance}
show={show} show={show}
setTxList={setTxList}
userInfo={userInfo} userInfo={userInfo}
setOpenSnack={setOpenSnack} setOpenSnack={setOpenSnack}
setInfoSnack={setInfoSnack} setInfoSnack={setInfoSnack}
/> />
<BuyQortInformation balance={balance} /> <BuyQortInformation balance={balance} />
</GlobalContext.Provider> </MyContext.Provider>
{extState === 'create-wallet' && walletToBeDownloaded && ( {extState === 'create-wallet' && walletToBeDownloaded && (
<ButtonBase <ButtonBase
onClick={() => { onClick={() => {
@ -3632,11 +3612,8 @@ function App() {
{isOpenMinting && ( {isOpenMinting && (
<Minting <Minting
setIsOpenMinting={setIsOpenMinting} setIsOpenMinting={setIsOpenMinting}
groups={memberGroups}
myAddress={address} myAddress={address}
show={show} show={show}
setTxList={setTxList}
txList={txList}
/> />
)} )}

View File

@ -27,11 +27,11 @@ import Logo1Dark from '../assets/svgs/Logo1Dark.svg';
import HelpIcon from '@mui/icons-material/Help'; import HelpIcon from '@mui/icons-material/Help';
import { CustomizedSnackbars } from '../components/Snackbar/Snackbar'; import { CustomizedSnackbars } from '../components/Snackbar/Snackbar';
import { cleanUrl, gateways } from '../background'; import { cleanUrl, gateways } from '../background';
import { GlobalContext } from '../App';
import Tooltip, { TooltipProps, tooltipClasses } from '@mui/material/Tooltip'; import Tooltip, { TooltipProps, tooltipClasses } from '@mui/material/Tooltip';
import ThemeSelector from '../components/Theme/ThemeSelector'; import ThemeSelector from '../components/Theme/ThemeSelector';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import LanguageSelector from '../components/Language/LanguageSelector'; import LanguageSelector from '../components/Language/LanguageSelector';
import { MyContext } from '../App';
const manifestData = { const manifestData = {
version: '0.5.3', version: '0.5.3',
@ -85,7 +85,7 @@ export const NotAuthenticated = ({
const [enteredApiKey, setEnteredApiKey] = useState(''); const [enteredApiKey, setEnteredApiKey] = useState('');
const [customNodeToSaveIndex, setCustomNodeToSaveIndex] = const [customNodeToSaveIndex, setCustomNodeToSaveIndex] =
React.useState(null); React.useState(null);
const { showTutorial, hasSeenGettingStarted } = useContext(GlobalContext); const { showTutorial, hasSeenGettingStarted } = useContext(MyContext);
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation(['auth', 'core']); const { t } = useTranslation(['auth', 'core']);

View File

@ -31,7 +31,7 @@ import { crypto } from './constants/decryptWallet';
import { LoadingButton } from '@mui/lab'; import { LoadingButton } from '@mui/lab';
import { PasswordField } from './components'; import { PasswordField } from './components';
import { HtmlTooltip } from './ExtStates/NotAuthenticated'; import { HtmlTooltip } from './ExtStates/NotAuthenticated';
import { GlobalContext } from './App'; import { MyContext } from './App';
const parsefilenameQortal = (filename) => { const parsefilenameQortal = (filename) => {
return filename.startsWith('qortal_backup_') ? filename.slice(14) : filename; return filename.startsWith('qortal_backup_') ? filename.slice(14) : filename;
@ -43,7 +43,7 @@ export const Wallets = ({ setExtState, setRawWallet, rawWallet }) => {
const [seedValue, setSeedValue] = useState(''); const [seedValue, setSeedValue] = useState('');
const [seedName, setSeedName] = useState(''); const [seedName, setSeedName] = useState('');
const [seedError, setSeedError] = useState(''); const [seedError, setSeedError] = useState('');
const { hasSeenGettingStarted } = useContext(GlobalContext); const { hasSeenGettingStarted } = useContext(MyContext);
const [password, setPassword] = useState(''); const [password, setPassword] = useState('');
const [isOpenSeedModal, setIsOpenSeedModal] = useState(false); const [isOpenSeedModal, setIsOpenSeedModal] = useState(false);

View File

@ -8,9 +8,9 @@ export const Return: React.FC<SVGProps> = ({ color, opacity, ...children }) => {
return ( return (
<svg <svg
{...children}
width="20" width="20"
height="16" height="16"
{...children}
viewBox="0 0 20 16" viewBox="0 0 20 16"
fill="none" fill="none"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"

View File

@ -46,6 +46,10 @@ export const mutedGroupsAtom = atomWithReset([]);
export const groupChatTimestampsAtom = atomWithReset({}); export const groupChatTimestampsAtom = atomWithReset({});
export const timestampEnterDataAtom = atomWithReset({}); export const timestampEnterDataAtom = atomWithReset({});
export const txListAtom = atomWithReset([]);
export const memberGroupsAtom = atomWithReset([]);
export const isRunningPublicNodeAtom = atomWithReset(false);
// Atom Families (replacing selectorFamily) // Atom Families (replacing selectorFamily)
export const resourceKeySelector = atomFamily((key) => export const resourceKeySelector = atomFamily((key) =>
atom((get) => get(resourceDownloadControllerAtom)[key] || null) atom((get) => get(resourceDownloadControllerAtom)[key] || null)

View File

@ -1742,7 +1742,7 @@ export async function decryptSingleFunc({
const responseData = uint8ArrayToObject(decryptToUnit8Array); const responseData = uint8ArrayToObject(decryptToUnit8Array);
holdMessages.push({ ...message, decryptedData: responseData }); holdMessages.push({ ...message, decryptedData: responseData });
} catch (error) { } catch (error) {
console.log(error); console.error(error);
} }
} }
return holdMessages; return holdMessages;
@ -1766,7 +1766,7 @@ export async function decryptSingleForPublishes({
const responseData = uint8ArrayToObject(decryptToUnit8Array); const responseData = uint8ArrayToObject(decryptToUnit8Array);
holdMessages.push({ ...message, decryptedData: responseData }); holdMessages.push({ ...message, decryptedData: responseData });
} catch (error) { } catch (error) {
console.log(error); console.error(error);
} }
} }
return holdMessages; return holdMessages;
@ -1795,7 +1795,7 @@ export async function decryptDirectFunc({ messages, involvingAddress }) {
const parsedMessage = JSON.parse(decodedMessage); const parsedMessage = JSON.parse(decodedMessage);
holdMessages.push({ ...message, ...parsedMessage }); holdMessages.push({ ...message, ...parsedMessage });
} catch (error) { } catch (error) {
console.log(error); console.error(error);
} }
} }
return holdMessages; return holdMessages;

View File

@ -163,5 +163,5 @@ export const useFetchResources = () => {
[setResources] [setResources]
); );
return { downloadResource }; return downloadResource;
}; };

View File

@ -1,64 +1,50 @@
import { useRef, useState } from 'react'; import { useRef, useState, useCallback, useMemo } from 'react';
interface State { interface State {
isShow: boolean; isShow: boolean;
} }
export const useModal = () => { export const useModal = () => {
const [state, setState] = useState<State>({ const [state, setState] = useState<State>({ isShow: false });
isShow: false, const [message, setMessage] = useState({ publishFee: '', message: '' });
});
const [message, setMessage] = useState({
publishFee: "",
message: ""
});
const promiseConfig = useRef<any>(null); const promiseConfig = useRef<any>(null);
const show = async (data) => {
setMessage(data) const show = useCallback((data) => {
setMessage(data);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
promiseConfig.current = { promiseConfig.current = { resolve, reject };
resolve, setState({ isShow: true });
reject,
};
setState({
isShow: true,
}); });
}); }, []);
};
const hide = () => { const hide = useCallback(() => {
setState({ setState({ isShow: false });
isShow: false, setMessage({ publishFee: '', message: '' });
}); }, []);
setMessage({
publishFee: "",
message: ""
})
};
const onOk = (payload:any) => { const onOk = useCallback(
const { resolve } = promiseConfig.current; (payload: any) => {
setMessage({ const { resolve } = promiseConfig.current || {};
publishFee: "",
message: ""
})
hide(); hide();
resolve(payload); resolve?.(payload);
}; },
[hide]
);
const onCancel = () => { const onCancel = useCallback(() => {
const { reject } = promiseConfig.current; const { reject } = promiseConfig.current || {};
hide(); hide();
reject(); reject?.();
setMessage({ }, [hide]);
publishFee: "",
message: "" return useMemo(
}) () => ({
};
return {
show, show,
onOk, onOk,
onCancel, onCancel,
isShow: state.isShow, isShow: state.isShow,
message message,
}; }),
[show, onOk, onCancel, state.isShow, message]
);
}; };

View File

@ -1,6 +1,6 @@
import React, { useContext, useEffect, useMemo, useState } from 'react'; import React, { useEffect, useMemo, useState } from 'react';
import { Box } from '@mui/material'; import { Box } from '@mui/material';
import { MyContext, getBaseApiReact } from '../../App'; import { getBaseApiReact } from '../../App';
import { subscribeToEvent, unsubscribeFromEvent } from '../../utils/events'; import { subscribeToEvent, unsubscribeFromEvent } from '../../utils/events';
import { useFrame } from 'react-frame-component'; import { useFrame } from 'react-frame-component';
import { useQortalMessageListener } from './useQortalMessageListener'; import { useQortalMessageListener } from './useQortalMessageListener';
@ -8,7 +8,6 @@ import { useThemeContext } from '../Theme/ThemeContext';
export const AppViewer = React.forwardRef( export const AppViewer = React.forwardRef(
({ app, hide, isDevMode, skipAuth }, iframeRef) => { ({ app, hide, isDevMode, skipAuth }, iframeRef) => {
const { rootHeight } = useContext(MyContext);
// const iframeRef = useRef(null); // const iframeRef = useRef(null);
const { window: frameWindow } = useFrame(); const { window: frameWindow } = useFrame();
const { path, history, changeCurrentIndex, resetHistory } = const { path, history, changeCurrentIndex, resetHistory } =

View File

@ -5,8 +5,6 @@ import { MyContext } from '../../App';
const AppViewerContainer = React.forwardRef( const AppViewerContainer = React.forwardRef(
({ app, isSelected, hide, isDevMode, customHeight, skipAuth }, ref) => { ({ app, isSelected, hide, isDevMode, customHeight, skipAuth }, ref) => {
const { rootHeight } = useContext(MyContext);
return ( return (
<Frame <Frame
id={`browser-iframe-${app?.tabId}`} id={`browser-iframe-${app?.tabId}`}

View File

@ -1,4 +1,4 @@
import { useContext, useEffect, useMemo, useRef, useState } from 'react'; import { useEffect, useMemo, useRef, useState } from 'react';
import { import {
AppLibrarySubTitle, AppLibrarySubTitle,
AppsDesktopLibraryBody, AppsDesktopLibraryBody,
@ -10,7 +10,6 @@ import {
AppsWidthLimiter, AppsWidthLimiter,
} from './Apps-styles'; } from './Apps-styles';
import { ButtonBase, InputBase, styled, useTheme } from '@mui/material'; import { ButtonBase, InputBase, styled, useTheme } from '@mui/material';
import { MyContext } from '../../App';
import SearchIcon from '@mui/icons-material/Search'; import SearchIcon from '@mui/icons-material/Search';
import IconClearInput from '../../assets/svgs/ClearInput.svg'; import IconClearInput from '../../assets/svgs/ClearInput.svg';
import { Spacer } from '../../common/Spacer'; import { Spacer } from '../../common/Spacer';
@ -59,7 +58,6 @@ export const AppsCategoryDesktop = ({
const [searchValue, setSearchValue] = useState(''); const [searchValue, setSearchValue] = useState('');
const virtuosoRef = useRef(); const virtuosoRef = useRef();
const theme = useTheme(); const theme = useTheme();
const { rootHeight } = useContext(MyContext);
const categoryList = useMemo(() => { const categoryList = useMemo(() => {
if (category?.id === 'all') return availableQapps; if (category?.id === 'all') return availableQapps;

View File

@ -1,7 +1,7 @@
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react'; import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
import { AppsHomeDesktop } from './AppsHomeDesktop'; import { AppsHomeDesktop } from './AppsHomeDesktop';
import { Spacer } from '../../common/Spacer'; import { Spacer } from '../../common/Spacer';
import { GlobalContext, getBaseApiReact } from '../../App'; import { MyContext, getBaseApiReact } from '../../App';
import { AppInfo } from './AppInfo'; import { AppInfo } from './AppInfo';
import { import {
executeEvent, executeEvent,
@ -49,7 +49,7 @@ export const AppsDesktop = ({
const iframeRefs = useRef({}); const iframeRefs = useRef({});
const [isEnabledDevMode, setIsEnabledDevMode] = useAtom(enabledDevModeAtom); const [isEnabledDevMode, setIsEnabledDevMode] = useAtom(enabledDevModeAtom);
const { showTutorial } = useContext(GlobalContext); const { showTutorial } = useContext(MyContext);
const theme = useTheme(); const theme = useTheme();
const myApp = useMemo(() => { const myApp = useMemo(() => {

View File

@ -17,6 +17,7 @@ import { useDropzone } from 'react-dropzone';
import { useHandlePrivateApps } from './useHandlePrivateApps'; import { useHandlePrivateApps } from './useHandlePrivateApps';
import { import {
groupsPropertiesAtom, groupsPropertiesAtom,
memberGroupsAtom,
myGroupsWhereIAmAdminAtom, myGroupsWhereIAmAdminAtom,
} from '../../atoms/global'; } from '../../atoms/global';
import { Label } from '../Group/AddGroup'; import { Label } from '../Group/AddGroup';
@ -56,8 +57,10 @@ export const AppsPrivate = ({ myName }) => {
}, [myGroupsWhereIAmAdminFromGlobal, groupsProperties]); }, [myGroupsWhereIAmAdminFromGlobal, groupsProperties]);
const [isOpenPrivateModal, setIsOpenPrivateModal] = useState(false); const [isOpenPrivateModal, setIsOpenPrivateModal] = useState(false);
const { show, setInfoSnackCustom, setOpenSnackGlobal, memberGroups } = const { show, setInfoSnackCustom, setOpenSnackGlobal } =
useContext(MyContext); useContext(MyContext);
const [memberGroups] = useAtom(memberGroupsAtom);
const theme = useTheme(); const theme = useTheme();
const myGroupsPrivate = useMemo(() => { const myGroupsPrivate = useMemo(() => {

View File

@ -121,6 +121,7 @@ export const DownloadWallet = ({
style={{ style={{
cursor: 'pointer', cursor: 'pointer',
height: '24px', height: '24px',
width: 'auto',
}} }}
onClick={returnToMain} onClick={returnToMain}
/> />

View File

@ -18,7 +18,6 @@ export const AdminSpace = ({
balance, balance,
isOwner, isOwner,
}) => { }) => {
const { rootHeight } = useContext(MyContext);
const [isMoved, setIsMoved] = useState(false); const [isMoved, setIsMoved] = useState(false);
useEffect(() => { useEffect(() => {
if (hide) { if (hide) {

View File

@ -70,7 +70,7 @@ export const AdminSpaceInner = ({
const [groupSecretKeyPublishDetails, setGroupSecretKeyPublishDetails] = const [groupSecretKeyPublishDetails, setGroupSecretKeyPublishDetails] =
useState(null); useState(null);
const [isLoadingPublishKey, setIsLoadingPublishKey] = useState(false); const [isLoadingPublishKey, setIsLoadingPublishKey] = useState(false);
const { show, setTxList, setInfoSnackCustom, setOpenSnackGlobal } = const { show, setInfoSnackCustom, setOpenSnackGlobal } =
useContext(MyContext); useContext(MyContext);
const getAdminGroupSecretKey = useCallback(async () => { const getAdminGroupSecretKey = useCallback(async () => {

View File

@ -16,6 +16,8 @@ import {
} from '../Group/Group'; } from '../Group/Group';
import { base64ToUint8Array } from '../../qdn/encryption/group-encryption'; import { base64ToUint8Array } from '../../qdn/encryption/group-encryption';
import { uint8ArrayToObject } from '../../backgroundFunctions/encryption'; import { uint8ArrayToObject } from '../../backgroundFunctions/encryption';
import { useSetAtom } from 'jotai';
import { txListAtom } from '../../atoms/global';
export const CreateCommonSecret = ({ export const CreateCommonSecret = ({
groupId, groupId,
@ -29,7 +31,8 @@ export const CreateCommonSecret = ({
setIsForceShowCreationKeyPopup, setIsForceShowCreationKeyPopup,
isForceShowCreationKeyPopup, isForceShowCreationKeyPopup,
}) => { }) => {
const { show, setTxList } = useContext(MyContext); const { show } = useContext(MyContext);
const setTxList = useSetAtom(txListAtom);
const [openSnack, setOpenSnack] = React.useState(false); const [openSnack, setOpenSnack] = React.useState(false);
const [infoSnack, setInfoSnack] = React.useState(null); const [infoSnack, setInfoSnack] = React.useState(null);

View File

@ -138,7 +138,7 @@ export const GroupAnnouncements = ({
const [selectedAnnouncement, setSelectedAnnouncement] = useState(null); const [selectedAnnouncement, setSelectedAnnouncement] = useState(null);
const [isFocusedParent, setIsFocusedParent] = useState(false); const [isFocusedParent, setIsFocusedParent] = useState(false);
const { show, rootHeight } = 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);
const hasInitialized = useRef(false); const hasInitialized = useRef(false);

View File

@ -1,6 +1,5 @@
import { useContext, useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { GroupMail } from '../Group/Forum/GroupMail'; import { GroupMail } from '../Group/Forum/GroupMail';
import { MyContext } from '../../App';
export const GroupForum = ({ export const GroupForum = ({
selectedGroup, selectedGroup,
@ -14,7 +13,6 @@ export const GroupForum = ({
setDefaultThread, setDefaultThread,
isPrivate, isPrivate,
}) => { }) => {
const { rootHeight } = useContext(MyContext);
const [isMoved, setIsMoved] = useState(false); const [isMoved, setIsMoved] = useState(false);
useEffect(() => { useEffect(() => {

View File

@ -17,7 +17,7 @@ import { Refresh } from '@mui/icons-material';
import { Menu, MenuItem } from '@mui/material'; import { Menu, MenuItem } from '@mui/material';
import { MoreVert as MoreIcon } from '@mui/icons-material'; import { MoreVert as MoreIcon } from '@mui/icons-material';
import { GlobalContext, getBaseApiReact } from '../../App'; import { MyContext, getBaseApiReact } from '../../App';
import { resourceKeySelector } from '../../atoms/global'; import { resourceKeySelector } from '../../atoms/global';
import { useAtomValue } from 'jotai'; import { useAtomValue } from 'jotai';
@ -84,7 +84,7 @@ export const VideoPlayer: React.FC<VideoPlayerProps> = ({
const download = useAtomValue(resourceKeySelector(keyIdentifier)); const download = useAtomValue(resourceKeySelector(keyIdentifier));
const { downloadResource } = useContext(GlobalContext); const { downloadResource } = useContext(MyContext);
const videoRef = useRef<HTMLVideoElement | null>(null); const videoRef = useRef<HTMLVideoElement | null>(null);
const [playing, setPlaying] = useState(false); const [playing, setPlaying] = useState(false);

View File

@ -1,10 +1,10 @@
import React from 'react' import React from 'react';
import { JoinGroup } from './JoinGroup' import { JoinGroup } from './JoinGroup';
export const GlobalActions = ({memberGroups}) => { export const GlobalActions = () => {
return ( return (
<> <>
<JoinGroup memberGroups={memberGroups} /> <JoinGroup />
</> </>
) );
} };

View File

@ -16,9 +16,13 @@ import { getBaseApiReact, MyContext } from '../../App';
import { getFee } from '../../background'; import { getFee } from '../../background';
import { CustomizedSnackbars } from '../Snackbar/Snackbar'; import { CustomizedSnackbars } from '../Snackbar/Snackbar';
import { FidgetSpinner } from 'react-loader-spinner'; import { FidgetSpinner } from 'react-loader-spinner';
import { useAtom, useSetAtom } from 'jotai';
import { memberGroupsAtom, txListAtom } from '../../atoms/global';
export const JoinGroup = ({ memberGroups }) => { export const JoinGroup = () => {
const { show, setTxList } = useContext(MyContext); const { show } = useContext(MyContext);
const setTxList = useSetAtom(txListAtom);
const [memberGroups] = useAtom(memberGroupsAtom);
const [openSnack, setOpenSnack] = useState(false); const [openSnack, setOpenSnack] = useState(false);
const [infoSnack, setInfoSnack] = useState(null); const [infoSnack, setInfoSnack] = useState(null);
const [groupInfo, setGroupInfo] = useState(null); const [groupInfo, setGroupInfo] = useState(null);

View File

@ -38,6 +38,8 @@ import { getFee } from '../../background';
import { MyContext } from '../../App'; import { MyContext } from '../../App';
import { subscribeToEvent, unsubscribeFromEvent } from '../../utils/events'; import { subscribeToEvent, unsubscribeFromEvent } from '../../utils/events';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useSetAtom } from 'jotai';
import { txListAtom } from '../../atoms/global';
export const Label = styled('label')` export const Label = styled('label')`
display: block; display: block;
@ -57,7 +59,9 @@ const Transition = forwardRef(function Transition(
}); });
export const AddGroup = ({ address, open, setOpen }) => { export const AddGroup = ({ address, open, setOpen }) => {
const { show, setTxList } = useContext(MyContext); const { show } = useContext(MyContext);
const setTxList = useSetAtom(txListAtom);
const [openAdvance, setOpenAdvance] = useState(false); const [openAdvance, setOpenAdvance] = useState(false);
const [name, setName] = useState(''); const [name, setName] = useState('');
const [description, setDescription] = useState(''); const [description, setDescription] = useState('');

View File

@ -30,6 +30,8 @@ import LockIcon from '@mui/icons-material/Lock';
import NoEncryptionGmailerrorredIcon from '@mui/icons-material/NoEncryptionGmailerrorred'; import NoEncryptionGmailerrorredIcon from '@mui/icons-material/NoEncryptionGmailerrorred';
import { Spacer } from '../../common/Spacer'; import { Spacer } from '../../common/Spacer';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useAtom, useSetAtom } from 'jotai';
import { memberGroupsAtom, txListAtom } from '../../atoms/global';
const cache = new CellMeasurerCache({ const cache = new CellMeasurerCache({
fixedWidth: true, fixedWidth: true,
@ -37,7 +39,11 @@ const cache = new CellMeasurerCache({
}); });
export const AddGroupList = ({ setInfoSnack, setOpenSnack }) => { export const AddGroupList = ({ setInfoSnack, setOpenSnack }) => {
const { memberGroups, show, setTxList } = useContext(MyContext); const { show } = useContext(MyContext);
const [memberGroups] = useAtom(memberGroupsAtom);
const setTxList = useSetAtom(txListAtom);
const { t } = useTranslation(['core', 'group']); const { t } = useTranslation(['core', 'group']);
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

View File

@ -11,7 +11,6 @@ import {
} from '@mui/material'; } from '@mui/material';
import React, { import React, {
useCallback, useCallback,
useContext,
useEffect, useEffect,
useMemo, useMemo,
useRef, useRef,
@ -33,7 +32,6 @@ import { Spacer } from '../../common/Spacer';
import { ManageMembers } from './ManageMembers'; import { ManageMembers } from './ManageMembers';
import MarkChatUnreadIcon from '@mui/icons-material/MarkChatUnread'; import MarkChatUnreadIcon from '@mui/icons-material/MarkChatUnread';
import { import {
MyContext,
clearAllQueues, clearAllQueues,
getArbitraryEndpointReact, getArbitraryEndpointReact,
getBaseApiReact, getBaseApiReact,
@ -73,6 +71,7 @@ import {
groupsOwnerNamesAtom, groupsOwnerNamesAtom,
groupsPropertiesAtom, groupsPropertiesAtom,
isOpenBlockedModalAtom, isOpenBlockedModalAtom,
memberGroupsAtom,
mutedGroupsAtom, mutedGroupsAtom,
selectedGroupIdAtom, selectedGroupIdAtom,
timestampEnterDataAtom, timestampEnterDataAtom,
@ -413,8 +412,9 @@ export const Group = ({
const [openAddGroup, setOpenAddGroup] = useState(false); const [openAddGroup, setOpenAddGroup] = useState(false);
const [isInitialGroups, setIsInitialGroups] = useState(false); const [isInitialGroups, setIsInitialGroups] = useState(false);
const [openManageMembers, setOpenManageMembers] = useState(false); const [openManageMembers, setOpenManageMembers] = useState(false);
const { setMemberGroups, rootHeight, isRunningPublicNode } =
useContext(MyContext); const setMemberGroups = useSetAtom(memberGroupsAtom);
const lastGroupNotification = useRef<null | number>(null); const lastGroupNotification = useRef<null | number>(null);
const [timestampEnterData, setTimestampEnterData] = useAtom( const [timestampEnterData, setTimestampEnterData] = useAtom(
timestampEnterDataAtom timestampEnterDataAtom
@ -1309,7 +1309,6 @@ export const Group = ({
setOpenAddGroup(false); setOpenAddGroup(false);
setIsInitialGroups(false); setIsInitialGroups(false);
setOpenManageMembers(false); setOpenManageMembers(false);
setMemberGroups([]); // Assuming you're clearing the context here as well
setTimestampEnterData({}); setTimestampEnterData({});
setChatMode('groups'); setChatMode('groups');
setNewChat(false); setNewChat(false);
@ -1931,7 +1930,6 @@ export const Group = ({
selectedGroup={selectedGroup} selectedGroup={selectedGroup}
getUserSettings={getUserSettings} getUserSettings={getUserSettings}
setOpenAddGroup={setOpenAddGroup} setOpenAddGroup={setOpenAddGroup}
isRunningPublicNode={isRunningPublicNode}
setIsOpenBlockedUserModal={setIsOpenBlockedUserModal} setIsOpenBlockedUserModal={setIsOpenBlockedUserModal}
myAddress={myAddress} myAddress={myAddress}
/> />

View File

@ -9,12 +9,12 @@ import GroupAddIcon from '@mui/icons-material/GroupAdd';
import { executeEvent } from '../../utils/events'; import { executeEvent } from '../../utils/events';
import { Box, ButtonBase, Collapse, Typography, useTheme } from '@mui/material'; import { Box, ButtonBase, Collapse, Typography, useTheme } from '@mui/material';
import { CustomLoader } from '../../common/CustomLoader'; import { CustomLoader } from '../../common/CustomLoader';
import { MyContext, getBaseApiReact } from '../../App'; import { getBaseApiReact } from '../../App';
import { myGroupsWhereIAmAdminAtom } from '../../atoms/global'; import { myGroupsWhereIAmAdminAtom, txListAtom } from '../../atoms/global';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import ExpandLessIcon from '@mui/icons-material/ExpandLess'; import ExpandLessIcon from '@mui/icons-material/ExpandLess';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useSetAtom } from 'jotai'; import { useAtom, useSetAtom } from 'jotai';
export const requestQueueGroupJoinRequests = new RequestQueueWithPromise(2); export const requestQueueGroupJoinRequests = new RequestQueueWithPromise(2);
export const GroupJoinRequests = ({ export const GroupJoinRequests = ({
@ -33,7 +33,8 @@ export const GroupJoinRequests = ({
[] []
); );
const [loading, setLoading] = React.useState(true); const [loading, setLoading] = React.useState(true);
const { txList, setTxList } = React.useContext(MyContext); const [txList] = useAtom(txListAtom);
const setMyGroupsWhereIAmAdmin = useSetAtom(myGroupsWhereIAmAdminAtom); const setMyGroupsWhereIAmAdmin = useSetAtom(myGroupsWhereIAmAdminAtom);
const theme = useTheme(); const theme = useTheme();

View File

@ -26,11 +26,12 @@ import {
groupChatTimestampSelector, groupChatTimestampSelector,
groupPropertySelector, groupPropertySelector,
groupsOwnerNamesSelector, groupsOwnerNamesSelector,
isRunningPublicNodeAtom,
timestampEnterDataSelector, timestampEnterDataSelector,
} from '../../atoms/global'; } from '../../atoms/global';
import { timeDifferenceForNotificationChats } from './Group'; import { timeDifferenceForNotificationChats } from './Group';
import { useAtomValue } from 'jotai'; import { useAtom, useAtomValue } from 'jotai';
export const GroupList = ({ export const GroupList = ({
selectGroupFunc, selectGroupFunc,
@ -44,11 +45,12 @@ export const GroupList = ({
selectedGroup, selectedGroup,
getUserSettings, getUserSettings,
setOpenAddGroup, setOpenAddGroup,
isRunningPublicNode,
setIsOpenBlockedUserModal, setIsOpenBlockedUserModal,
myAddress, myAddress,
}) => { }) => {
const theme = useTheme(); const theme = useTheme();
const [isRunningPublicNode] = useAtom(isRunningPublicNodeAtom);
return ( return (
<div <div
style={{ style={{

View File

@ -39,6 +39,7 @@ import {
myGroupsWhereIAmAdminAtom, myGroupsWhereIAmAdminAtom,
promotionTimeIntervalAtom, promotionTimeIntervalAtom,
promotionsAtom, promotionsAtom,
txListAtom,
} from '../../atoms/global'; } from '../../atoms/global';
import { Label } from './AddGroup'; import { Label } from './AddGroup';
import ShortUniqueId from 'short-unique-id'; import ShortUniqueId from 'short-unique-id';
@ -49,7 +50,7 @@ import ErrorBoundary from '../../common/ErrorBoundary';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import ExpandLessIcon from '@mui/icons-material/ExpandLess'; import ExpandLessIcon from '@mui/icons-material/ExpandLess';
import { getFee } from '../../background'; import { getFee } from '../../background';
import { useAtom } from 'jotai'; import { useAtom, useSetAtom } from 'jotai';
export const requestQueuePromos = new RequestQueueWithPromise(3); export const requestQueuePromos = new RequestQueueWithPromise(3);
export function utf8ToBase64(inputString: string): string { export function utf8ToBase64(inputString: string): string {
@ -93,7 +94,9 @@ export const ListOfGroupPromotions = () => {
const [fee, setFee] = useState(null); const [fee, setFee] = useState(null);
const [isLoadingJoinGroup, setIsLoadingJoinGroup] = useState(false); const [isLoadingJoinGroup, setIsLoadingJoinGroup] = useState(false);
const [isLoadingPublish, setIsLoadingPublish] = useState(false); const [isLoadingPublish, setIsLoadingPublish] = useState(false);
const { show, setTxList } = useContext(MyContext); const { show } = useContext(MyContext);
const setTxList = useSetAtom(txListAtom);
const theme = useTheme(); const theme = useTheme();
const listRef = useRef(); const listRef = useRef();
const rowVirtualizer = useVirtualizer({ const rowVirtualizer = useVirtualizer({

View File

@ -1,4 +1,4 @@
import { useContext, useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import { import {
Avatar, Avatar,
Box, Box,
@ -17,7 +17,9 @@ import {
import { getNameInfo } from './Group'; import { getNameInfo } from './Group';
import { getBaseApi, getFee } from '../../background'; import { getBaseApi, getFee } from '../../background';
import { LoadingButton } from '@mui/lab'; import { LoadingButton } from '@mui/lab';
import { MyContext, getBaseApiReact } from '../../App'; import { getBaseApiReact } from '../../App';
import { txListAtom } from '../../atoms/global';
import { useAtom } from 'jotai';
export const getMemberInvites = async (groupNumber) => { export const getMemberInvites = async (groupNumber) => {
const response = await fetch( const response = await fetch(
@ -56,7 +58,7 @@ export const ListOfJoinRequests = ({
show, show,
}) => { }) => {
const [invites, setInvites] = useState([]); const [invites, setInvites] = useState([]);
const { txList, setTxList } = useContext(MyContext); const [txList, setTxList] = useAtom(txListAtom);
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

View File

@ -23,6 +23,8 @@ import { LoadingButton } from '@mui/lab';
import { subscribeToEvent, unsubscribeFromEvent } from '../../utils/events'; import { subscribeToEvent, unsubscribeFromEvent } from '../../utils/events';
import { Spacer } from '../../common/Spacer'; import { Spacer } from '../../common/Spacer';
import InsertLinkIcon from '@mui/icons-material/InsertLink'; import InsertLinkIcon from '@mui/icons-material/InsertLink';
import { useSetAtom } from 'jotai';
import { txListAtom } from '../../atoms/global';
function a11yProps(index: number) { function a11yProps(index: number) {
return { return {
@ -61,7 +63,8 @@ export const ManageMembers = ({
setValue(newValue); setValue(newValue);
}; };
const theme = useTheme(); const theme = useTheme();
const { show, setTxList } = React.useContext(MyContext); const { show } = React.useContext(MyContext);
const setTxList = useSetAtom(txListAtom);
const handleClose = () => { const handleClose = () => {
setOpen(false); setOpen(false);

View File

@ -20,6 +20,8 @@ import { getFee } from '../../background';
import LockIcon from '@mui/icons-material/Lock'; import LockIcon from '@mui/icons-material/Lock';
import NoEncryptionGmailerrorredIcon from '@mui/icons-material/NoEncryptionGmailerrorred'; import NoEncryptionGmailerrorredIcon from '@mui/icons-material/NoEncryptionGmailerrorred';
import { Spacer } from '../../common/Spacer'; import { Spacer } from '../../common/Spacer';
import { useSetAtom } from 'jotai';
import { txListAtom } from '../../atoms/global';
const cache = new CellMeasurerCache({ const cache = new CellMeasurerCache({
fixedWidth: true, fixedWidth: true,
@ -52,7 +54,9 @@ export const UserListOfInvites = ({
setInfoSnack, setInfoSnack,
setOpenSnack, setOpenSnack,
}) => { }) => {
const { txList, setTxList, show } = useContext(MyContext); const { show } = useContext(MyContext);
const setTxList = useSetAtom(txListAtom);
const [invites, setInvites] = useState<any[]>([]); const [invites, setInvites] = useState<any[]>([]);
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const theme = useTheme(); const theme = useTheme();

View File

@ -1,4 +1,4 @@
import { useCallback, useEffect, useRef } from 'react'; import { useCallback, useEffect, useMemo, useRef } from 'react';
export const useBlockedAddresses = () => { export const useBlockedAddresses = () => {
const userBlockedRef = useRef({}); const userBlockedRef = useRef({});
@ -191,10 +191,13 @@ export const useBlockedAddresses = () => {
} }
}, []); }, []);
return { return useMemo(
() => ({
isUserBlocked, isUserBlocked,
addToBlockList, addToBlockList,
removeBlockFromList, removeBlockFromList,
getAllBlockedUsers, getAllBlockedUsers,
}; }),
[isUserBlocked, addToBlockList, removeBlockFromList, getAllBlockedUsers]
);
}; };

View File

@ -26,7 +26,5 @@ export const useHandleUserInfo = () => {
} }
}, []); }, []);
return { return getIndividualUserInfo;
getIndividualUserInfo,
};
}; };

View File

@ -25,15 +25,13 @@ import { getFee, getNameOrAddress } from '../../background';
import { Spacer } from '../../common/Spacer'; import { Spacer } from '../../common/Spacer';
import { FidgetSpinner } from 'react-loader-spinner'; import { FidgetSpinner } from 'react-loader-spinner';
import { useModal } from '../../common/useModal'; import { useModal } from '../../common/useModal';
import { useAtom, useSetAtom } from 'jotai';
import { memberGroupsAtom, txListAtom } from '../../atoms/global';
export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
const setTxList = useSetAtom(txListAtom);
const [groups] = useAtom(memberGroupsAtom);
export const Minting = ({
setIsOpenMinting,
myAddress,
groups,
show,
setTxList,
txList,
}) => {
const [mintingAccounts, setMintingAccounts] = useState([]); const [mintingAccounts, setMintingAccounts] = useState([]);
const [accountInfo, setAccountInfo] = useState(null); const [accountInfo, setAccountInfo] = useState(null);
const [rewardSharePublicKey, setRewardSharePublicKey] = useState(''); const [rewardSharePublicKey, setRewardSharePublicKey] = useState('');

View File

@ -34,6 +34,8 @@ import { subscribeToEvent, unsubscribeFromEvent } from '../utils/events';
import { BarSpinner } from '../common/Spinners/BarSpinner/BarSpinner'; import { BarSpinner } from '../common/Spinners/BarSpinner/BarSpinner';
import CheckIcon from '@mui/icons-material/Check'; import CheckIcon from '@mui/icons-material/Check';
import ErrorIcon from '@mui/icons-material/Error'; import ErrorIcon from '@mui/icons-material/Error';
import { useSetAtom } from 'jotai';
import { txListAtom } from '../atoms/global';
enum Availability { enum Availability {
NULL = 'null', NULL = 'null',
@ -46,9 +48,10 @@ export const RegisterName = ({
setInfoSnack, setInfoSnack,
userInfo, userInfo,
show, show,
setTxList,
balance, balance,
}) => { }) => {
const setTxList = useSetAtom(txListAtom);
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
const [registerNameValue, setRegisterNameValue] = useState(''); const [registerNameValue, setRegisterNameValue] = useState('');
const [isLoadingRegisterName, setIsLoadingRegisterName] = useState(false); const [isLoadingRegisterName, setIsLoadingRegisterName] = useState(false);

View File

@ -7,16 +7,21 @@ import {
IconButton, IconButton,
useTheme, useTheme,
} from '@mui/material'; } from '@mui/material';
import React, { useContext, useEffect, useRef } from 'react'; import React, { useEffect, useRef } from 'react';
import PendingIcon from '@mui/icons-material/Pending'; import PendingIcon from '@mui/icons-material/Pending';
import TaskAltIcon from '@mui/icons-material/TaskAlt'; import TaskAltIcon from '@mui/icons-material/TaskAlt';
import ExpandLess from '@mui/icons-material/ExpandLess'; import ExpandLess from '@mui/icons-material/ExpandLess';
import ExpandMore from '@mui/icons-material/ExpandMore'; import ExpandMore from '@mui/icons-material/ExpandMore';
import { MyContext, getBaseApiReact } from '../../App'; import { getBaseApiReact } from '../../App';
import { executeEvent } from '../../utils/events'; import { executeEvent } from '../../utils/events';
import { useAtom } from 'jotai';
import { memberGroupsAtom, txListAtom } from '../../atoms/global';
export const TaskManager = ({ getUserInfo }) => { export const TaskManager = ({ getUserInfo }) => {
const { txList, setTxList, memberGroups } = useContext(MyContext); const [memberGroups] = useAtom(memberGroupsAtom);
const [txList, setTxList] = useAtom(txListAtom);
const [open, setOpen] = React.useState(false); const [open, setOpen] = React.useState(false);
const intervals = useRef({}); const intervals = useRef({});
const theme = useTheme(); const theme = useTheme();

View File

@ -1,5 +1,5 @@
import { useContext, useState } from 'react'; import { useContext, useState } from 'react';
import { GlobalContext } from '../../App'; import { MyContext } from '../../App';
import { import {
Button, Button,
Dialog, Dialog,
@ -16,7 +16,7 @@ import { VideoPlayer } from '../Embeds/VideoPlayer';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
export const Tutorials = () => { export const Tutorials = () => {
const { openTutorialModal, setOpenTutorialModal } = useContext(GlobalContext); const { openTutorialModal, setOpenTutorialModal } = useContext(MyContext);
const [multiNumber, setMultiNumber] = useState(0); const [multiNumber, setMultiNumber] = useState(0);
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation(['core', 'tutorial']); const { t } = useTranslation(['core', 'tutorial']);

View File

@ -1,4 +1,4 @@
import { useCallback, useEffect, useState } from 'react'; import { useCallback, useEffect, useMemo, useState } from 'react';
import { saveToLocalStorage } from '../Apps/AppsNavBarDesktop'; import { saveToLocalStorage } from '../Apps/AppsNavBarDesktop';
import creationImg from './img/creation.webp'; import creationImg from './img/creation.webp';
import dashboardImg from './img/dashboard.webp'; import dashboardImg from './img/dashboard.webp';
@ -196,7 +196,8 @@ export const useHandleTutorials = () => {
}, },
[shownTutorials] [shownTutorials]
); );
return { return useMemo(
() => ({
showTutorial, showTutorial,
hasSeenGettingStarted: hasSeenGettingStarted:
shownTutorials === null shownTutorials === null
@ -205,5 +206,7 @@ export const useHandleTutorials = () => {
openTutorialModal, openTutorialModal,
setOpenTutorialModal, setOpenTutorialModal,
shownTutorialsInitiated: !!shownTutorials, shownTutorialsInitiated: !!shownTutorials,
}; }),
[showTutorial, openTutorialModal, setOpenTutorialModal, shownTutorials]
);
}; };

View File

@ -8,10 +8,13 @@ import {
} from '@mui/material'; } from '@mui/material';
import { executeEvent } from '../utils/events'; import { executeEvent } from '../utils/events';
import { MyContext } from '../App'; import { MyContext } from '../App';
import { useAtom } from 'jotai';
import { isRunningPublicNodeAtom } from '../atoms/global';
export const WrapperUserAction = ({ children, address, name, disabled }) => { export const WrapperUserAction = ({ children, address, name, disabled }) => {
const theme = useTheme(); const theme = useTheme();
const { isRunningPublicNode } = useContext(MyContext); const [isRunningPublicNode] = useAtom(isRunningPublicNodeAtom);
const [anchorEl, setAnchorEl] = useState(null); const [anchorEl, setAnchorEl] = useState(null);
// Handle child element click to open Popover // Handle child element click to open Popover

View File

@ -1,5 +0,0 @@
export const getRootHeight = ()=> {
return document?.getElementById('root')?.style?.height || '100%'
}