-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not load video if onboarding skipped (#654)
Resolves #652 What has been done: - Moves `DApps` to ui folder - Video is only loaded when user is not onboarded
- Loading branch information
Showing
6 changed files
with
103 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, { ReactNode, useEffect } from "react" | ||
import { BrowserRouter as Router, useLocation } from "react-router-dom" | ||
|
||
import { | ||
useBalanceFetch, | ||
useConnect, | ||
useGameDataFetch, | ||
useGameLoadDataFetch, | ||
usePopulationFetch, | ||
useWallet, | ||
useWalletChange, | ||
useWalletOnboarding, | ||
} from "shared/hooks" | ||
import Onboarding from "ui/Onboarding" | ||
|
||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { usePostHog } from "posthog-js/react" | ||
import PrivacyPolicy from "../../shared/components/PrivacyPolicy" | ||
import IslandView from "./IslandView" | ||
|
||
function TrackEvents({ children }: { children: ReactNode[] }) { | ||
const location = useLocation() | ||
const posthog = usePostHog() | ||
|
||
useEffect(() => { | ||
posthog?.capture("$pageview", { url: location.pathname }) | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []) | ||
|
||
return children | ||
} | ||
|
||
export default function DesktopDApp() { | ||
const { walletOnboarded } = useWalletOnboarding() | ||
const { isConnected } = useConnect() | ||
|
||
useWallet() | ||
useGameLoadDataFetch() | ||
useBalanceFetch() | ||
usePopulationFetch() | ||
useGameDataFetch() | ||
useWalletChange() | ||
|
||
return ( | ||
<Router> | ||
<TrackEvents> | ||
{!walletOnboarded && <Onboarding />} | ||
{walletOnboarded && isConnected && <IslandView />} | ||
<PrivacyPolicy /> | ||
</TrackEvents> | ||
</Router> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from "react" | ||
import IslandComponent from "ui/Island" | ||
import TestingPanel from "testing/components/TestingPanel" | ||
import Nav from "ui/Nav" | ||
import { ROUTES } from "shared/constants" | ||
import Claim from "ui/Claim" | ||
import Referrals from "ui/Referrals" | ||
import LiquidityPool from "ui/LiquidityPool" | ||
import Footer from "ui/Footer" | ||
import { | ||
selectHasLoadedBalances, | ||
selectHasLoadedRealmData, | ||
selectHasLoadedSeasonInfo, | ||
selectIslandMode, | ||
useDappSelector, | ||
} from "redux-state" | ||
import FullPageLoader from "shared/components/FullPageLoader" | ||
import { Route, Switch } from "react-router-dom" | ||
|
||
export default function IslandView() { | ||
const islandMode = useDappSelector(selectIslandMode) | ||
const hasLoadedRealmData = useDappSelector(selectHasLoadedRealmData) | ||
const hasLoadedSeasonInfo = useDappSelector(selectHasLoadedSeasonInfo) | ||
const hasBalances = useDappSelector(selectHasLoadedBalances) | ||
|
||
return ( | ||
<> | ||
<FullPageLoader | ||
loaded={hasLoadedRealmData && hasLoadedSeasonInfo && hasBalances} | ||
/> | ||
<IslandComponent /> | ||
<TestingPanel /> | ||
{islandMode === "default" && <Nav />} | ||
<Switch> | ||
<Route path={ROUTES.CLAIM.HOME}> | ||
<Claim /> | ||
</Route> | ||
<Route path={ROUTES.REFERRALS}> | ||
<Referrals /> | ||
</Route> | ||
{/* TODO should be removed or defined later */} | ||
<Route path={ROUTES.LP}> | ||
<LiquidityPool /> | ||
</Route> | ||
</Switch> | ||
<Footer /> | ||
</> | ||
) | ||
} |
File renamed without changes.
File renamed without changes.