Skip to content

Commit

Permalink
🪄 [QA] Update stage environments (#662)
Browse files Browse the repository at this point in the history
This is a pull request that upon merging will update stage environments
with recent `main` changes.
The environments that will be updated:
* Stage live: https://stage-live--taho-development.netlify.app/
* Stage fork: https://stage-fork--taho-development.netlify.app/

Read more: [Deployment to Production
Flow](https://github.com/tahowallet/dapp/blob/main/docs/testing-env.md)
  • Loading branch information
andreachapman authored Nov 9, 2023
2 parents df4a5b3 + 04bd989 commit 6c3e2a0
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 34 deletions.
1 change: 1 addition & 0 deletions .env.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ UNS_API_KEY="4a77c949-511b-4c16-9862-6edfb6ae6012"
FILE_DIRECTORY_IPFS_HASH="QmYwYkRdYMBCtMqbimgaXjf7UL4RUb5zBQu4TDE67oZbq5"
PART_GLOSSARY_IPFS_HASH="bafybeibytsozn7qsvqgecogv5urg5en34r7v3zxo326vacumi56ckah5b4"
# RPC URLs
ARBITRUM_SEPOLIA_ALCHEMY_KEY=""
ARBITRUM_RPC_URL="https://sepolia-rollup.arbitrum.io/rpc"
ARBITRUM_RPC_FALLBACK_URL="https://arbitrum-sepolia.blockpi.network/v1/rpc/public"
TENDERLY_RPC_URL="https://rpc.tenderly.co/fork/2fc2cf12-5c58-439f-9b5e-967bfd02191a"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"os-browserify": "^0.3.0",
"patch-package": "^8.0.0",
"path-browserify": "^1.0.1",
"posthog-js": "^1.88.2",
"postinstall-postinstall": "^2.1.0",
"process": "^0.11.10",
"raf-schd": "^4.0.3",
Expand Down Expand Up @@ -77,7 +78,6 @@
"eslint-plugin-import": "^2.28.1",
"fork-ts-checker-webpack-plugin": "^8.0.0",
"html-webpack-plugin": "^5.5.3",
"posthog-js": "^1.85.3",
"prettier": "^2.8.1",
"typescript": "^5.0.2",
"webpack": "^5.88.1",
Expand Down
8 changes: 4 additions & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import ReactDOM from "react-dom/client"
import { Web3OnboardProvider } from "@web3-onboard/react"
import { Provider } from "react-redux"
import web3Onboard from "shared/utils/web3Onboard"
// Unfortunately the PostHog React package structure does not play nice with
// no-extraneous-dependencies.
// eslint-disable-next-line import/no-extraneous-dependencies
import { PostHogProvider } from "posthog-js/react"
import { BrowserRouter as Router } from "react-router-dom"
import DApp from "ui/DApps"
import reduxStore from "./redux-state"

Expand All @@ -31,7 +29,9 @@ function DAppProviders() {
},
}}
>
<DApp />
<Router>
<DApp />
</Router>
</PostHogProvider>
</Web3OnboardProvider>
</Provider>
Expand Down
3 changes: 3 additions & 0 deletions src/shared/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export const getArbitrumRpcUrl = () => {
}

if (process.env.USE_ARBITRUM_SEPOLIA === "true") {
if (process.env.ARBITRUM_SEPOLIA_ALCHEMY_KEY) {
return `https://arb-sepolia.g.alchemy.com/v2/${process.env.ARBITRUM_SEPOLIA_ALCHEMY_KEY}`
}
return process.env.ARBITRUM_RPC_URL
}

Expand Down
16 changes: 16 additions & 0 deletions src/shared/hooks/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { debounce } from "lodash"
import { useSpring } from "@react-spring/web"
import { getWindowDimensions } from "shared/utils"
import { MOBILE_BREAKPOINT } from "shared/constants"
import { usePostHog } from "posthog-js/react"
import { useLocation } from "react-router-dom"

type VoidFn = () => unknown

Expand Down Expand Up @@ -233,3 +235,17 @@ export function useMobileScreen() {

return width < MOBILE_BREAKPOINT
}

export function useTrackEvents() {
const location = useLocation()
const posthog = usePostHog()
const isMobile = useMobileScreen()

useEffect(() => {
posthog?.capture("$pageview", {
url: location.pathname,
data: { isMobile },
})
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
}
30 changes: 6 additions & 24 deletions src/ui/DApps/DesktopDApp.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { ReactNode, useEffect } from "react"
import { BrowserRouter as Router, useLocation } from "react-router-dom"
import React from "react"

import {
useBalanceFetch,
Expand All @@ -12,24 +11,9 @@ import {
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()
Expand All @@ -42,12 +26,10 @@ export default function DesktopDApp() {
useWalletChange()

return (
<Router>
<TrackEvents>
{!walletOnboarded && <Onboarding />}
{walletOnboarded && isConnected && <IslandView />}
<PrivacyPolicy />
</TrackEvents>
</Router>
<>
{!walletOnboarded && <Onboarding />}
{walletOnboarded && isConnected && <IslandView />}
<PrivacyPolicy />
</>
)
}
3 changes: 2 additions & 1 deletion src/ui/DApps/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from "react"
import { useMobileScreen } from "shared/hooks"
import { useMobileScreen, useTrackEvents } from "shared/hooks"
import GlobalStyles from "ui/GlobalStyles"
import MobileDApp from "./MobileDApp"
import DesktopDApp from "./DesktopDApp"

export default function DApp() {
const isMobileScreen = useMobileScreen()
useTrackEvents()

return (
<>
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8072,10 +8072,10 @@ pngjs@^5.0.0:
resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-5.0.0.tgz#e79dd2b215767fd9c04561c01236df960bce7fbb"
integrity sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==

posthog-js@^1.85.3:
version "1.85.3"
resolved "https://registry.yarnpkg.com/posthog-js/-/posthog-js-1.85.3.tgz#540f26d224b1a345a226d8f105f442bbeb5eb91a"
integrity sha512-RHWLDamFU1k4SjolS/DWr8tYbuWQaJUJywxlKTUJp/ESIe9bJz9SkWuDNqgTV58fJnxdjCCtD89o+gMimfOSGw==
posthog-js@^1.88.2:
version "1.88.2"
resolved "https://registry.yarnpkg.com/posthog-js/-/posthog-js-1.88.2.tgz#be1f0a9df6cf462886a8168b7d957e72a8df4986"
integrity sha512-lwYQMIvOmC1K+Y+8lMF+QnGIPMZsVvtZ28YxZrRlDrTlwVGt+/Is5BtD/25AUuU7KE1zNIBxmrXSEiNJrN1OiA==
dependencies:
fflate "^0.4.1"

Expand Down

0 comments on commit 6c3e2a0

Please sign in to comment.