Skip to content

Commit

Permalink
Remove welcome modal and simply start on Markets page
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenshively committed Feb 6, 2024
1 parent 8e4c89e commit ebaadf7
Showing 1 changed file with 2 additions and 23 deletions.
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

0 comments on commit ebaadf7

Please sign in to comment.