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

🚀 [QA] Update release environment #549

Merged
merged 60 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
d5b8139
Adjust fetching XP to new approach
jagodarybacka Oct 24, 2023
238500d
Fix displayed XP reward amount
jagodarybacka Oct 25, 2023
f444064
Remove redundant map on leaderboard data
jagodarybacka Oct 25, 2023
13791b6
Don't throw errors if there are no links to leadeboard or xp files
jagodarybacka Oct 25, 2023
aaaa4ba
Cleanup test xp drop files
jagodarybacka Oct 25, 2023
78c002d
Renamed `data` folder to `assets`
jagodarybacka Oct 25, 2023
8d8a259
Update on the start of the season
xpaczka Oct 25, 2023
d8e8b46
Fix disappearing XP claim congrats modal
jagodarybacka Oct 25, 2023
16cf8d3
Get season start from env
xpaczka Oct 25, 2023
d3c748b
Fix XP amount displayed on the congrats modal
jagodarybacka Oct 25, 2023
5f43fcc
Use a fallback provider for arbitrum sepolia
Oct 25, 2023
ad1762e
Add extra check for `AssistantFirstRealm`
xpaczka Oct 25, 2023
bb853c0
Adjust XP allocation
xpaczka Oct 25, 2023
99f653d
Save provider fallback in `TransactionService`
Oct 25, 2023
9049383
Add PostHog pageview tracking
Shadowfiend Oct 25, 2023
6d605f9
Track realm opens in PostHog
Shadowfiend Oct 25, 2023
ee744a1
An attempt at tracking realm staking and unstaking in PostHog
Shadowfiend Oct 25, 2023
4f852d1
Add a missing `await`
Oct 26, 2023
86451cf
Use `providerFallback` only once
Oct 26, 2023
c904640
Calculate xp allocation based on season week
xpaczka Oct 26, 2023
730a6f2
Fix conditions for running job adding the testlist
michalinacienciala Oct 26, 2023
97c96e6
Fix conditions for running job adding the testlist (#532)
jagodarybacka Oct 26, 2023
7003f3d
Display the correct number of xp allocations (#511)
Oct 26, 2023
9552d32
Merge branch 'main' into season
Oct 26, 2023
4b47299
Change favicon
xpaczka Oct 26, 2023
22eba7d
Update on the start of the season (#505)
Oct 26, 2023
0aa977f
Add extra check for `AssistantFirstRealm` (#510)
jagodarybacka Oct 26, 2023
303d73e
Rename "Council" -> "Guardians"
xpaczka Oct 26, 2023
10ce8a5
Add "Realm" word to realm name
xpaczka Oct 26, 2023
12783e0
Open rulebook in new tab
xpaczka Oct 26, 2023
35d1852
Change Gitcoin realm color
xpaczka Oct 26, 2023
bae326e
Adjust fetching XP to new approach (#491)
Oct 26, 2023
60a12f2
Onboarding `ConnectWallet` rename
xpaczka Oct 26, 2023
f927189
Realm modal UI changes (#535)
Oct 26, 2023
3f436d4
Move rpc fallback to env variables
jagodarybacka Oct 26, 2023
52cdadc
Improvements for the RPC (#500)
jagodarybacka Oct 26, 2023
d4baa48
Change animation on realm modal
xpaczka Oct 26, 2023
c5903df
Assistants fixes & copy
ioay Oct 26, 2023
20d7acd
Rename in "connect wallet" screen (#538)
Oct 26, 2023
83f78fa
Change favicon (#534)
jagodarybacka Oct 26, 2023
002b52f
Island UI changes (#536)
jagodarybacka Oct 26, 2023
c4c2264
Hiding circuit animations
ioay Oct 26, 2023
19a4960
Hiding circuit animations (#540)
xpaczka Oct 26, 2023
09bbda5
Weekly quests copy
ioay Oct 26, 2023
50d79d8
Fix button `Go to settlement` to `go to realm`
jagodarybacka Oct 26, 2023
8f4d137
Weekly quests copy (#541)
Oct 26, 2023
55143dd
Typo: comma
ioay Oct 26, 2023
6bf20e5
Show rewards banner next to other banners if needed
jagodarybacka Oct 26, 2023
99ee249
Update Enter Subscape copy
ioay Oct 26, 2023
77c20c3
Typo: comma (#542)
Oct 26, 2023
68aa914
Update Enter Subscape copy (#544)
xpaczka Oct 26, 2023
5d7646d
Xp UX fixes (#543)
Oct 26, 2023
3951601
Review changes
ioay Oct 26, 2023
c296e6f
Assistants fixes & copy (#539)
jagodarybacka Oct 26, 2023
48a5ae5
Hardcode the weekly reward
Oct 26, 2023
b532a2e
Realm modal changes (#545)
jagodarybacka Oct 26, 2023
da374f0
Hardcode the weekly reward (#546)
xpaczka Oct 26, 2023
01a9ff5
Fix text for posthog
Oct 26, 2023
64c8546
Posting hogs: Add PostHog support to the dApp (#519)
Oct 26, 2023
8c7898c
🪄 [QA] Update stage environments (#533)
michalinacienciala Oct 26, 2023
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
7 changes: 6 additions & 1 deletion .env.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ FILE_DIRECTORY_IPFS_HASH="QmYwYkRdYMBCtMqbimgaXjf7UL4RUb5zBQu4TDE67oZbq5"
PART_GLOSSARY_IPFS_HASH="bafybeibytsozn7qsvqgecogv5urg5en34r7v3zxo326vacumi56ckah5b4"
# RPC URLs
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"
LOCALHOST_RPC_URL="http://localhost:8545"
ETHEREUM_RPC_URL="https://1rpc.io/eth"
Expand All @@ -16,8 +17,12 @@ USE_ARBITRUM_SEPOLIA="false"
TENDERLY_USER=thesis
TENDERLY_PROJECT=development
ALLOW_TENDERLY_RESET="false"
# Analytics
ANALYTICS_ENV=DEV
POSTHOG_API_KEY=
# Misc
SEASON_LENGTH_IN_WEEKS=8
CONTRACT_DEPLOYMENT_BLOCK_NUMBER=553443
SEASON_START_DATE="2023-10-26"
SKIP_REACT_STRICT_MODE="false"
IS_COMING_SOON="true"
IS_COMING_SOON="true"
2 changes: 1 addition & 1 deletion .github/workflows/test-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
jobs:
add-release-test-list:
runs-on: ubuntu-latest
if: github.head_ref == 'refs/heads/stage-live'
if: github.head_ref == 'stage-live'
permissions:
pull-requests: write
steps:
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "1.0.0",
"prettier": "@thesis/prettier-config",
"scripts": {
"start": "yarn write-types && patch-package && webpack serve --mode=development",
"start": "yarn write-types && patch-package && webpack serve --mode=development --https",
"build": "yarn write-types && patch-package && webpack build --mode=production",
"write-types": "node scripts/write-taho-types.mjs",
"lint:eslint": "eslint .",
Expand All @@ -15,6 +15,7 @@
"postinstall": "patch-package"
},
"dependencies": {
"@ethersproject/networks": "^5.7.1",
"@react-spring/konva": "^9.7.3",
"@react-spring/web": "^9.7.3",
"@reduxjs/toolkit": "^1.9.5",
Expand All @@ -29,7 +30,6 @@
"crypto-browserify": "^3.12.0",
"emittery": "^1.0.1",
"ethers": "^5",
"@ethersproject/networks": "^5.7.1",
"gifler": "^0.1.0",
"https-browserify": "^1.0.0",
"konva": "^9.2.0",
Expand Down Expand Up @@ -77,6 +77,7 @@
"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
File renamed without changes.
22 changes: 22 additions & 0 deletions src/assets/xp-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"4": {
"xp": [],
"leaderboard": null
},
"7": {
"xp": [],
"leaderboard": null
},
"9": {
"xp": [],
"leaderboard": null
},
"19": {
"xp": [],
"leaderboard": null
},
"22": {
"xp": [],
"leaderboard": null
}
}
48 changes: 43 additions & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import React from "react"
import React, { ReactNode, useEffect } from "react"
import ReactDOM from "react-dom/client"
import { BrowserRouter as Router, Switch, Route } from "react-router-dom"
import {
BrowserRouter as Router,
Switch,
Route,
useLocation,
} from "react-router-dom"
import { Web3OnboardProvider } from "@web3-onboard/react"
import { Provider } from "react-redux"
import {
Expand Down Expand Up @@ -32,8 +37,23 @@ import { ROUTES } from "shared/constants"
import Onboarding from "ui/Onboarding"
import FullPageLoader from "shared/components/FullPageLoader"
import MobileScreen from "ui/MobileScreen"
// Unfortunately the PostHog React package structure does not play nice with
// no-extraneous-dependencies.
// eslint-disable-next-line import/no-extraneous-dependencies
import { PostHogProvider, usePostHog } from "posthog-js/react"
import reduxStore from "./redux-state"

function TrackEvents({ children }: { children: ReactNode[] }) {
const location = useLocation()
const posthog = usePostHog()

useEffect(() => {
posthog?.capture("$pageview", { url: location.pathname })
}, [])

return children
}

function DApp() {
const islandMode = useDappSelector(selectIslandMode)
const { isConnected } = useConnect()
Expand All @@ -56,7 +76,7 @@ function DApp() {
<Router>
{(!walletOnboarded || !isConnected) && <Onboarding />}
{walletOnboarded && isConnected && (
<>
<TrackEvents>
<FullPageLoader
loaded={hasLoadedRealmData && hasLoadedSeasonInfo && hasBalances}
/>
Expand All @@ -76,7 +96,7 @@ function DApp() {
</Route>
</Switch>
<Footer />
</>
</TrackEvents>
)}
</Router>
</>
Expand All @@ -87,7 +107,25 @@ function DAppProviders() {
return (
<Provider store={reduxStore}>
<Web3OnboardProvider web3Onboard={web3Onboard}>
<DApp />
<PostHogProvider
apiKey={process.env.POSTHOG_API_KEY}
options={{
persistence: "localStorage",
autocapture: false,
capture_pageview: false,
disable_session_recording: true,
sanitize_properties(properties) {
return {
...properties,
// The extension has set an expectation that the lib is set to
// the analytics env.
$lib: process.env.ANALYTICS_ENV,
}
},
}}
>
<DApp />
</PostHogProvider>
</Web3OnboardProvider>
</Provider>
)
Expand Down
13 changes: 8 additions & 5 deletions src/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions src/redux-state/selectors/island.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export const selectSeasonWeek = createSelector(
if (isEndOfSeason) return durationInWeeks

if (seasonStartTimestamp && durationInWeeks) {
const hasSeasonStarted = seasonStartTimestamp < Date.now()
if (!hasSeasonStarted) return 1 // if the start date is placed in the future, set season week to 1

return Math.trunc((Date.now() - seasonStartTimestamp) / (7 * DAY) + 1)
}

Expand Down Expand Up @@ -153,10 +156,8 @@ export const selectUnclaimedXpById = createSelector(
export const selectUnclaimedXpSumById = createSelector(
[selectUnclaimedXpById],
(unclaimedXp) =>
unclaimedXp?.reduce(
(acc, item) => acc + parseInt(item.claim.amount, 16),
0
) ?? 0
unclaimedXp?.reduce((acc, item) => acc + BigInt(item.claim.amount), 0n) ??
0n
)
/* Population - selectors */
export const selectSortedPopulation = createSelector(selectRealms, (realms) => {
Expand Down
50 changes: 20 additions & 30 deletions src/redux-state/thunks/island.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ import {
import { updateTransactionStatus } from "redux-state/slices/wallet"
import { bigIntToUserAmount, getAllowanceTransactionID } from "shared/utils"
import {
convertXpData,
getRealmLeaderboardData,
getRealmXpSorted,
getUserLeaderboardRank,
} from "shared/utils/xp"
import { getXpAllocatable } from "shared/contracts/xp"
Expand Down Expand Up @@ -291,17 +289,12 @@ export const fetchLeaderboardData = createDappAsyncThunk(

await Promise.allSettled(
Object.keys(realms).map(async (realmId) => {
const xpData = await getRealmLeaderboardData(realmId)
const leaderboardData = await getRealmLeaderboardData(realmId)

if (xpData) {
const converted = convertXpData(xpData)
const sorted = getRealmXpSorted(converted)
const leaderboard = sorted.slice(0, 10).map((item, index) => ({
...item,
rank: index + 1,
}))
if (leaderboardData) {
const leaderboard = leaderboardData.slice(0, 10)

const currentUser = getUserLeaderboardRank(sorted, address)
const currentUser = getUserLeaderboardRank(leaderboardData, address)

dispatch(
setLeaderboardData({
Expand All @@ -328,27 +321,24 @@ export const fetchUnclaimedXp = createDappAsyncThunk(
if (!account) return false

await Promise.allSettled(
Object.entries(realms).map(
async ([realmId, { realmContractAddress, xpToken }]) => {
const unclaimedXp = await transactionService.read(
getUnclaimedXpDistributions,
{
realmAddress: realmContractAddress,
xpAddress: xpToken.contractAddress,
account,
}
)

if (unclaimedXp) {
dispatch(
setUnclaimedXpData({
id: realmId,
data: unclaimedXp,
})
)
Object.keys(realms).map(async (realmId) => {
const unclaimedXp = await transactionService.read(
getUnclaimedXpDistributions,
{
realmId,
account,
}
)

if (unclaimedXp) {
dispatch(
setUnclaimedXpData({
id: realmId,
data: unclaimedXp,
})
)
}
)
})
)

return true
Expand Down
16 changes: 16 additions & 0 deletions src/redux-state/thunks/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@ export const connectArbitrumProvider = createDappAsyncThunk(
}
)

export const connectArbitrumProviderFallback = createDappAsyncThunk(
"wallet/connectArbitrumProviderFallback",
async (
{
arbitrumProviderFallback,
}: {
arbitrumProviderFallback: ethers.providers.JsonRpcBatchProvider
},
{ extra: { transactionService } }
) => {
await transactionService.setArbitrumProviderFallback(
arbitrumProviderFallback
)
}
)

export const prepareForWalletChange = createDappAsyncThunk(
"wallet/prepareForWalletChange",
async (_, { dispatch }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/RealmModal/RealmHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function RealmHeader() {
<div className="realm_thumb">
<RealmCutout />
</div>
<h1>{realm?.name}</h1>
<h1>{realm?.name} Realm</h1>
<div className="realm_details_header column">
<div className="tags row">
<div className="tag column">
Expand Down
4 changes: 2 additions & 2 deletions src/shared/components/RealmModal/RealmModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function RealmModalContent({
}

return (
<Modal.AnimatedContent>
<Modal.Content>
<div className="modal">
<div
className={classNames("modal_header", {
Expand Down Expand Up @@ -88,6 +88,6 @@ export default function RealmModalContent({
}
`}
</style>
</Modal.AnimatedContent>
</Modal.Content>
)
}
11 changes: 2 additions & 9 deletions src/shared/components/RealmModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,8 @@ export default function RealmModal({

const [props] = useSpring(
() => ({
from: {
transform: "translate3d(0,38.5%,0) scale(0.8)",
opacity: 0,
},
to: {
transform: "translate3d(0,0,0) scale(1)",
opacity: 1,
position: "relative",
},
from: { opacity: 0 },
to: { opacity: 1, position: "relative" },
config: { duration: 300, easing: easings.easeInOutCubic },
}),
[]
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 @@ -51,3 +51,6 @@ export const CONTRACT_DEPLOYMENT_BLOCK_NUMBER = process.env
.CONTRACT_DEPLOYMENT_BLOCK_NUMBER
? parseInt(process.env.CONTRACT_DEPLOYMENT_BLOCK_NUMBER, 10)
: undefined

export const ARBITRUM_SEPOLIA_RPC_FALLBACK =
process.env.ARBITRUM_RPC_FALLBACK_URL
1 change: 1 addition & 0 deletions src/shared/constants/external-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export default {
DOCS: "https://docs.taho.xyz/app/",
BRAVE_SUPPORT:
"https://support.brave.com/hc/en-us/articles/360023646212-How-do-I-configure-global-and-site-specific-Shields-settings-",
FEEDBACK: "https://tahowallet.typeform.com/subscapebeta",
}
2 changes: 2 additions & 0 deletions src/shared/constants/game.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// eslint-disable-next-line import/prefer-default-export
export const WEEKLY_XP_ALLOCATION = 1_000_000
1 change: 1 addition & 0 deletions src/shared/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export { default as ROUTES } from "./routes"
export * from "./time"
export * from "./local-storage"
export { default as LINKS } from "./external-links"
export * from "./game"
2 changes: 1 addition & 1 deletion src/shared/constants/realms-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const realm4 = {
},
],
realmType: "realm",
color: "#C6CB60",
color: "#D1F5F5",
labelX: 380,
labelY: 216.5,
partnerLogo: partners.gitcoin,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/constants/realms.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RealmQuestlineData, RealmMapData } from "shared/types"
import { realm19, realm22, realm4, realm7, realm9 } from "./realms-data"
import QUESTLINE_DATA from "../../data/questline-data.json"
import QUESTLINE_DATA from "../../assets/questline-data.json"

// TODO: names and ids may change
export const REALMS_WITH_CONTRACT_NAME: {
Expand Down
Loading
Loading