Skip to content

Commit

Permalink
hub fix
Browse files Browse the repository at this point in the history
  • Loading branch information
damienen committed May 29, 2023
1 parent 1fbda96 commit e2f81d2
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions src/AppHarness/AppHarnessMultiversX.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import { useLocalStorage } from "libs/hooks";
import { contractsForChain } from "libs/util";
import { useChainMeta } from "store/ChainMetaContext";
import { useUser } from "store/UserContext";
import { useSearchParams } from "react-router-dom";

function CustomLoader() {
return (
<div
style={{
display: 'flex',
alignItems: 'center',
minHeight: '100vh'
}}
>
display: "flex",
alignItems: "center",
minHeight: "100vh",
}}>
<Box margin="auto !important">
<Spinner size="xl" color="teal.200" margin="auto !important" />
<Text mt="5">Loading</Text>
Expand All @@ -29,6 +29,7 @@ const baseUserContext = {
}; // this is needed as context is updating async in this comp using _user is out of sync - @TODO improve pattern

function AppHarnessMx({ launchEnvironment, handleLaunchMode }: { launchEnvironment: any; handleLaunchMode: any }) {
const [searchParams] = useSearchParams();
const { user: _user, setUser } = useUser();
const { setChainMeta } = useChainMeta();
const { chainMeta: _chainMeta } = useChainMeta();
Expand All @@ -39,8 +40,10 @@ function AppHarnessMx({ launchEnvironment, handleLaunchMode }: { launchEnvironme
const [isLoading, setIsLoading] = useState<boolean>(true);

useEffect(() => {
const networkId = launchEnvironment === "mainnet" ? "E1" : "ED";

let networkId = launchEnvironment === "mainnet" ? "E1" : "ED";
if (searchParams.get("accessToken")) {
networkId = "E1";
}
setChainMeta({
networkId,
contracts: contractsForChain(networkId),
Expand Down Expand Up @@ -70,16 +73,16 @@ function AppHarnessMx({ launchEnvironment, handleLaunchMode }: { launchEnvironme
setChainMeta({});
};

return (
isLoading ?
<CustomLoader />
: <AppMx
onLaunchMode={handleLaunchMode}
resetAppContexts={resetAppContexts}
appConfig={{
mxEnvironment: launchEnvironment,
}}
/>
return isLoading ? (
<CustomLoader />
) : (
<AppMx
onLaunchMode={handleLaunchMode}
resetAppContexts={resetAppContexts}
appConfig={{
mxEnvironment: launchEnvironment,
}}
/>
);
}

Expand Down

0 comments on commit e2f81d2

Please sign in to comment.