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 #657

Merged
merged 36 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
32e58e3
Send XP claim transactions one by one
jagodarybacka Oct 31, 2023
e6f6644
Initial refactor of `BannerRewards` to move the claiming logic out
jagodarybacka Nov 1, 2023
e43050b
Refactor claiming XP to be triggered by separate buttons
jagodarybacka Nov 1, 2023
24fe5e6
Merge branch 'main' into xp-multi-claim-fixes
jagodarybacka Nov 1, 2023
154ced6
Rename and create global variable for XP claim tx id
jagodarybacka Nov 2, 2023
078095d
Refactor claim tx id with new utils
jagodarybacka Nov 2, 2023
614cb76
Refactor bigint to user amount utils
jagodarybacka Nov 2, 2023
21b4dc3
Fix XP symbol in the claim modal
jagodarybacka Nov 2, 2023
e4efa47
Fix typo
jagodarybacka Nov 2, 2023
8c2188e
Remove duplicated function
jagodarybacka Nov 2, 2023
c1a01c0
Avoid updating unclaimed drops array over the Claim modal lifespan
jagodarybacka Nov 2, 2023
12fb0f5
Ensure claim XP modal display correct tx status after claim is done
jagodarybacka Nov 2, 2023
b52916e
Display real xp allocatable in the realm modal
ioay Nov 6, 2023
bab3aec
Rename `unclaimedXpData` argument
jagodarybacka Nov 6, 2023
1cb5a00
Move floating point regex to a const
jagodarybacka Nov 6, 2023
4c0b0b5
Don't nest close function in props
jagodarybacka Nov 6, 2023
c33483c
Merge branch 'main' into xp-multi-claim-fixes
jagodarybacka Nov 6, 2023
6e3ac4b
Create resuable `Popup` component
xpaczka Nov 7, 2023
90baf29
Refactor `AssistantContent`
xpaczka Nov 7, 2023
f0f83aa
Make `Popup` x-axis position configurable
xpaczka Nov 7, 2023
db4f020
Add privacy policy
xpaczka Nov 7, 2023
2c398e9
Handle privacy policy popup in `localStorage`
xpaczka Nov 7, 2023
4a17fd7
Fix type-o
xpaczka Nov 7, 2023
5be3e4c
Remove unnecessary `Button` type
xpaczka Nov 7, 2023
5671e77
Use predefined wallet selector
jagodarybacka Nov 7, 2023
7606e51
Change x-axis position condition check
xpaczka Nov 7, 2023
4cb2931
Link to privacy policy + GDPR (#645)
jagodarybacka Nov 7, 2023
6603436
Fixes for claiming multiple XP drops (#605)
xpaczka Nov 7, 2023
47fdc33
xpAllocatable if 0
ioay Nov 7, 2023
caacb61
Display real xp allocatable in the realm modal (#639)
xpaczka Nov 8, 2023
a84b039
Refactor `DApps` folder
xpaczka Nov 8, 2023
2395dd0
Fix condition for displaying `Onboarding` component
xpaczka Nov 8, 2023
1e5df84
Do not load video if onboarding skipped (#654)
jagodarybacka Nov 8, 2023
7a35b49
Take testing address from `.env`
jagodarybacka Nov 8, 2023
909930f
Take testing address from `.env` (#655)
xpaczka Nov 8, 2023
a7c463d
🪄 [QA] Update stage environments (#647)
andreachapman Nov 8, 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
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import web3Onboard from "shared/utils/web3Onboard"
// no-extraneous-dependencies.
// eslint-disable-next-line import/no-extraneous-dependencies
import { PostHogProvider } from "posthog-js/react"
import DApp from "shared/components/DApps"
import DApp from "ui/DApps"
import reduxStore from "./redux-state"

function DAppProviders() {
Expand Down
23 changes: 21 additions & 2 deletions src/redux-state/selectors/xp.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { createSelector } from "@reduxjs/toolkit"
import { createIslandSelector } from "redux-state/selectors"
import { createIslandSelector, selectWallet } from "redux-state/selectors"
import { UnclaimedXpData } from "shared/types"
import { getClaimXpTransactionID } from "shared/utils"
import { selectTransactionStatusById } from "./wallet"

export const selectUnclaimedXp = createIslandSelector("unclaimedXp")

export const selectUnclaimedXpById = createSelector(
[(_, realmId: string) => realmId, selectUnclaimedXp],
(realmId, unclaimedXp) => unclaimedXp[realmId]
(realmId, unclaimedXp) => unclaimedXp[realmId] ?? []
)

export const selectUnclaimedXpSumById = createSelector(
Expand All @@ -14,3 +17,19 @@ export const selectUnclaimedXpSumById = createSelector(
unclaimedXp?.reduce((acc, item) => acc + BigInt(item.claim.amount), 0n) ??
0n
)

// We need to use stable instance of unclaimed drops array to ensure they are not causing
// rerenders while claims transaction modal is visible
export const selectXpClaimTransactionStatuses = createSelector(
[
(_, savedUnclaimedDrops: UnclaimedXpData[]) => savedUnclaimedDrops,
selectWallet,
],
(unclaimedXp, walletState) =>
Object.fromEntries(
unclaimedXp.map((data) => {
const id = getClaimXpTransactionID(data)
return [id, selectTransactionStatusById({ wallet: walletState }, id)]
})
)
)
29 changes: 11 additions & 18 deletions src/redux-state/thunks/island.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
import {
RealmContractDataWithId,
TransactionProgressStatus,
UnclaimedXpData,
} from "shared/types"
import { updateTransactionStatus } from "redux-state/slices/wallet"
import { bigIntToUserAmount, getAllowanceTransactionID } from "shared/utils"
Expand Down Expand Up @@ -359,33 +360,25 @@ export const claimXp = createDappAsyncThunk(
async (
{
id,
realmId,
unclaimedXpData,
}: {
id: string
realmId: string
unclaimedXpData: UnclaimedXpData
},
{ dispatch, getState, extra: { transactionService } }
{ dispatch, extra: { transactionService } }
) => {
const {
island: { unclaimedXp },
} = getState()
const claims = unclaimedXp[realmId] ?? []
const { distributorContractAddress, claim } = unclaimedXpData

if (!claims.length) {
const receipt = await transactionService.send(id, claimXpTokens, {
distributorContractAddress,
claim,
})

if (!receipt) {
return false
}

await Promise.allSettled(
claims.map(async ({ distributorContractAddress, claim }) => {
await transactionService.send(id, claimXpTokens, {
distributorContractAddress,
claim,
})
})
)

dispatch(fetchUnclaimedXp())

return true
}
)
23 changes: 22 additions & 1 deletion src/redux-state/thunks/wallet.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { resolveAddressToWalletData } from "shared/utils"
import {
isClaimXpTransactionID,
resolveAddressToWalletData,
} from "shared/utils"
import {
updateBalances,
updateConnectedWallet,
resetWalletState,
stopTrackingTransactionStatus,
} from "redux-state/slices/wallet"
import { resetClaiming, setClaimingUser } from "redux-state/slices/claim"
import { getBalance, getStakeUnlockTime } from "shared/contracts"
Expand Down Expand Up @@ -207,3 +211,20 @@ export const fetchWalletBalances = createDappAsyncThunk(
return balances
}
)

export const stopTrackingClaimTransactions = createDappAsyncThunk(
"wallet/stopTrackingClaimTransactions",
async (_, { getState, dispatch }) => {
const {
wallet: { transactionStatus },
} = getState()

const claimTransactionIds = Object.keys(transactionStatus).filter(
isClaimXpTransactionID
)

claimTransactionIds.forEach((id) => {
dispatch(stopTrackingTransactionStatus(id))
})
}
)
7 changes: 7 additions & 0 deletions src/shared/assets/icons/cookies.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/shared/assets/icons/s/new-tab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion src/shared/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactNode } from "react"
import React, { CSSProperties, ReactNode } from "react"
import classnames from "classnames"

type ButtonProps = {
Expand All @@ -21,6 +21,7 @@ type ButtonProps = {
iconSrc?: string
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void
onMouseDown?: (event: React.MouseEvent<HTMLButtonElement>) => void
style?: CSSProperties
}

export default function Button({
Expand All @@ -34,6 +35,7 @@ export default function Button({
iconSrc,
onClick,
onMouseDown,
style,
}: ButtonProps) {
return (
<>
Expand All @@ -54,6 +56,7 @@ export default function Button({
disabled: isDisabled,
inactive: isInactive,
})}
style={style}
>
{children}
{iconSrc && (
Expand Down
94 changes: 0 additions & 94 deletions src/shared/components/DApps/DesktopDApp.tsx

This file was deleted.

88 changes: 88 additions & 0 deletions src/shared/components/Popup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import React, { ReactNode } from "react"
import { animated } from "@react-spring/web"
import { useVisibilityTransition } from "shared/hooks"
import Icon from "shared/components/Icon"
import closeIcon from "shared/assets/icons/s/close.svg"

export type PopupProps = {
children: ReactNode
isVisible: boolean
close: () => void
leftPosition?: string | number
bottomPosition: string | number
rightPosition?: string | number
width: string | number
hasPointer?: boolean
style?: React.CSSProperties
}

type XAxisPsition = {
left?: string | number
right?: string | number
}

export default function Popup({
children,
isVisible,
close,
bottomPosition,
leftPosition,
rightPosition,
width,
hasPointer = true,
style,
}: PopupProps) {
const transition = useVisibilityTransition(isVisible)
const xPosition: XAxisPsition = {}

if (leftPosition !== null) xPosition.left = leftPosition
if (rightPosition !== null) xPosition.right = rightPosition

return (
<>
<animated.div
style={{
position: "absolute",
bottom: bottomPosition,
background: "#043937",
borderRadius: 16,
padding: "24px 32px 32px",
width,
pointerEvents: isVisible ? "all" : "none",
...transition,
...xPosition,
...style,
}}
>
<button
type="button"
className="close_button button_reset"
onClick={close}
>
<Icon src={closeIcon} width="16px" height="16px" />
</button>
<div className="content">{children}</div>
</animated.div>
<style jsx>{`
.close_button {
position: absolute;
top: 14px;
right: 16px;
padding: 0;
}
.content::after {
display: ${hasPointer ? "block" : "none"};
content: "";
background: #043937;
height: 12px;
width: 12px;
position: absolute;
bottom: -4px;
right: 26px;
border-radius: 2px;
rotate: 45deg;
}
`}</style>
</>
)
}
Loading
Loading