Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove welcome modal and simply start on Markets page #798

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 2 additions & 23 deletions earn/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { Suspense, useEffect } from 'react';

import { ApolloClient, InMemoryCache, HttpLink, gql } from '@apollo/react-hooks';
import { Route, Routes, Navigate, useNavigate } from 'react-router-dom';
import { Route, Routes, Navigate } from 'react-router-dom';
import AccountBlockedModal from 'shared/lib/components/common/AccountBlockedModal';
import Footer from 'shared/lib/components/common/Footer';
import { Text } from 'shared/lib/components/common/Typography';
import WelcomeModal from 'shared/lib/components/common/WelcomeModal';
import WagmiProvider from 'shared/lib/components/WagmiProvider';
import { AccountRiskResult } from 'shared/lib/data/AccountRisk';
import { screenAddress } from 'shared/lib/data/AccountRisk';
Expand All @@ -16,7 +15,6 @@ import { useChainDependentState } from 'shared/lib/data/hooks/UseChainDependentS
import useEffectOnce from 'shared/lib/data/hooks/UseEffectOnce';
import { GeoFencingContext, useGeoFencing } from 'shared/lib/data/hooks/UseGeoFencing';
import useSafeState from 'shared/lib/data/hooks/UseSafeState';
import { getLocalStorageBoolean, setLocalStorageBoolean } from 'shared/lib/util/LocalStorage';
import ScrollToTop from 'shared/lib/util/ScrollToTop';
import { useAccount, useNetwork, useProvider } from 'wagmi';
import { Chain } from 'wagmi/chains';
Expand Down Expand Up @@ -99,11 +97,8 @@ export const ChainContext = React.createContext({
});

function AppBodyWrapper() {
const [isWelcomeModalOpen, setIsWelcomeModalOpen] = React.useState(false);
const { activeChain, setActiveChain } = React.useContext(ChainContext);
const account = useAccount();
const network = useNetwork();
const navigate = useNavigate();
const isAllowed = useGeoFencing(activeChain);
const { isBlocked: isAccountBlocked, isLoading: isAccountRiskLoading } = useAccountRisk();

Expand All @@ -113,13 +108,6 @@ function AppBodyWrapper() {
}
}, [activeChain, network.chain, setActiveChain]);

useEffect(() => {
const hasSeenWelcomeModal = getLocalStorageBoolean('hasSeenWelcomeModal');
if (!account?.isConnecting && !account?.isConnected && !hasSeenWelcomeModal) {
setIsWelcomeModalOpen(true);
}
}, [account?.isConnecting, account?.isConnected]);

if (isAccountRiskLoading) {
return null;
}
Expand All @@ -146,20 +134,11 @@ function AppBodyWrapper() {
</>
)}
<Route path='/claim' element={<ClaimPage />} />
<Route path='/' element={<Navigate replace to='/portfolio' />} />
<Route path='/' element={<Navigate replace to='/markets' />} />
<Route path='*' element={<Navigate to='/' />} />
</Routes>
</main>
<Footer />
<WelcomeModal
isOpen={isWelcomeModalOpen}
activeChain={activeChain}
checkboxes={CONNECT_WALLET_CHECKBOXES}
account={account}
setIsOpen={() => setIsWelcomeModalOpen(false)}
onAcknowledged={() => setLocalStorageBoolean('hasSeenWelcomeModal', true)}
onSkip={() => navigate('/markets')}
/>
<AccountBlockedModal isOpen={isAccountBlocked} setIsOpen={() => {}} />
</AppBody>
);
Expand Down
Loading