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 stage environments #872

Merged
merged 54 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
4e418f0
Add pull request template
xpaczka Dec 1, 2023
996db8d
Fix workflow `run` script
xpaczka Dec 1, 2023
0e26e21
Update template and remove workflow
xpaczka Dec 4, 2023
7711526
Simplify PR template
xpaczka Dec 6, 2023
9fb43b7
Add header for issues resolved
xpaczka Dec 6, 2023
97f1a54
Fix token input for typing balance value manually
jagodarybacka Dec 8, 2023
4e359e5
Fix expected results for wallet connections on the release checklist
michalinacienciala Dec 8, 2023
890df8d
Fix assistant messaging
xpaczka Dec 8, 2023
3fdc36e
Simplify import
xpaczka Dec 8, 2023
8da2675
Fix expected results for wallet connections on the release checklist …
jagodarybacka Dec 11, 2023
572a684
Change XP countdown text
xpaczka Dec 11, 2023
aece96f
Wrap `onRealmClick` in `useCallback`
xpaczka Dec 11, 2023
22ff5c9
Merge branch 'main' into assistant-fix
jagodarybacka Dec 11, 2023
83c41bf
Fix assistant messaging (#871)
jagodarybacka Dec 11, 2023
6d473c9
Add layout for beta end modal
xpaczka Dec 11, 2023
a74820d
Add feature flags for end of beta features
jagodarybacka Dec 11, 2023
968355f
Adjust UI for end of beta period
jagodarybacka Dec 11, 2023
87f9a6b
Add close button to beta end modal
xpaczka Dec 11, 2023
d3295ec
Merge branch 'end-of-beta' into beta-end
xpaczka Dec 11, 2023
abafc27
Close modal on button click
xpaczka Dec 11, 2023
38ef93f
Type-o fix
xpaczka Dec 11, 2023
d96ff90
End of beta - UI changes (#873)
xpaczka Dec 11, 2023
027a010
Add "Portal is closed" modal to onboarding page
xpaczka Dec 11, 2023
5b2b232
Change flags for closing the portal
xpaczka Dec 11, 2023
d57d1b4
Fix token input for typing balance value manually (#862)
michalinacienciala Dec 11, 2023
0ca5ba5
Adjust modal text to Figma design
xpaczka Dec 12, 2023
ed3111d
Prevent entering the map when `IS_PORTAL_CLOSED` is set to `true`
xpaczka Dec 12, 2023
b2e164e
Change countdown text info
xpaczka Dec 12, 2023
78c79eb
Automatically clear onboarded wallet if portal is closed
xpaczka Dec 12, 2023
d1cca1e
Update `useState`
xpaczka Dec 12, 2023
eacbbbd
Refactor code for beta end modal
xpaczka Dec 12, 2023
7f98bf5
Update claiming date
xpaczka Dec 12, 2023
1d63448
Create pull request template (#821)
jagodarybacka Dec 12, 2023
073cb2f
Add vertical line between beta end modal actions
xpaczka Dec 12, 2023
6bc7c6c
Type-o fix
xpaczka Dec 12, 2023
cb7d393
Beta end modal (#874)
jagodarybacka Dec 12, 2023
bd577de
Auto update ENS name on `storage` event
xpaczka Dec 12, 2023
5f977a6
Create `useCachedWalletName` hook
xpaczka Dec 12, 2023
9924e68
Merge branch 'main' into ens-names
xpaczka Dec 12, 2023
79681f4
Add logic for displaying sign up message
xpaczka Dec 12, 2023
f966618
Set up logic for sign up form
xpaczka Dec 13, 2023
d4a4b97
Refactor `useCachedWalletName` hook
xpaczka Dec 13, 2023
1374a17
Remove sign up message on input change
xpaczka Dec 13, 2023
20fc1a9
Fix typ-o
xpaczka Dec 13, 2023
2d9982a
Beta end sign up form (#880)
jagodarybacka Dec 13, 2023
d28514c
Do not update wallet name if is the same as cached one
xpaczka Dec 13, 2023
3eaa023
Modify default blocknative text when connecting with Taho
xpaczka Dec 13, 2023
7e9786d
Change default text in `web3Onboard` config
xpaczka Dec 13, 2023
61c4b45
Modify default blocknative text when connecting with Taho (#882)
michalinacienciala Dec 13, 2023
5090078
Change current week on beta close
xpaczka Dec 14, 2023
2f4775b
Change current week on beta close (#884)
jagodarybacka Dec 14, 2023
b3024e7
Update Galxe campaign link
jagodarybacka Dec 14, 2023
83cfdf4
Update Galxe campaign link (#885)
xpaczka Dec 14, 2023
80e931b
Fix ENS and UNS names not visible in UI (#879)
jagodarybacka Dec 14, 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: 5 additions & 2 deletions .env.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ ALLOW_TENDERLY_RESET="false"
# Analytics
ANALYTICS_ENV=DEV
POSTHOG_API_KEY=
# Lifecycle
IS_COMING_SOON="true"
IS_BETA_CLOSED="false"
IS_PORTAL_CLOSED="false"
# Misc
XP_HOSTING_BASE_URL="" # TBD
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"
SHOW_WAITLIST="true"
SHOW_WAITLIST="true"
15 changes: 15 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Issues connected

Resolves

## What has been done

- Change 1

## Testing

- [ ] Test 1

## Screenshots / images / videos

Please provide assets necessary for the PR (remove if not applicable)
10 changes: 5 additions & 5 deletions .github/workflows/test-list/release-test-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ environment 🚀**
- [ ] with Taho and MM installed and Taho not set as a default - only Taho
connection should be possible
- [ ] with Taho not installed and MM installed - should show both options -
Taho directs to the Chrome store, MM opens method connection screen and
allows connecting
- [ ] with Taho not installed and no other - should be directed to the Chrome
store to download Taho & given a message in the dapp to do so

Taho directs to the Chrome store, MM opens the connection method screen
and allows connecting
- [ ] with Taho not installed and no other - should show both options - Taho
directs to the Chrome store, MM opens the connection method screen and
directs to the Chrome store
10. XP

- [ ] an account with XP to claim sees that under Claimable Rewards on the Realm modal (in pre-prod we can see this on stage-live but might be easiest to only test this when we're testing XP drops)
Expand Down
14 changes: 14 additions & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,17 @@ declare namespace NodeJS {
interface Navigator {
brave?: { isBrave: () => boolean }
}

interface Window {
_cio: {
identify: ({
id,
email,
created_at,
}: {
id: string
email: string
created_at: number
}) => void
}
}
17 changes: 17 additions & 0 deletions src/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Subscape</title>
<!-- Script for sending data to customer.io -->
<script type="text/javascript">
var _cio = _cio || [];
(function() {
var a,b,c;a=function(f){return function(){_cio.push([f].
concat(Array.prototype.slice.call(arguments,0)))}};b=["load","identify",
"sidentify","track","page"];for(c=0;c<b.length;c++){_cio[b[c]]=a(b[c])};
var t = document.createElement('script'),
s = document.getElementsByTagName('script')[0];
t.async = true;
t.id = 'cio-tracker';
t.setAttribute('data-site-id', '27aa7555738fc28e5fe8');
t.src = 'https://assets.customer.io/assets/track.js';
s.parentNode.insertBefore(t, s);
})();
</script>
<!-- Script for sending data to customer.io -->
<style>
body {
background: #142D2B;
Expand Down
16 changes: 5 additions & 11 deletions src/shared/components/Interface/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,12 @@ import React, { CSSProperties, ReactNode } from "react"
import classnames from "classnames"

type ButtonProps = {
children: ReactNode
/**
* @default "primary"
*/
children?: ReactNode
type?: "primary" | "secondary" | "tertiary" | "twitter" | "reject" | "close"
/**
* @default "medium"
*/
buttonType?: "button" | "submit"
size?: "medium" | "large"
isDisabled?: boolean
isInactive?: boolean
/**
* @default "right"
*/
iconPosition?: "left" | "right"
iconSize?: "medium" | "large"
iconSrc?: string
Expand All @@ -27,6 +19,7 @@ type ButtonProps = {
export default function Button({
children,
type = "primary",
buttonType = "button",
size = "medium",
isDisabled = false,
isInactive = false,
Expand All @@ -40,7 +33,8 @@ export default function Button({
return (
<>
<button
type="button"
// eslint-disable-next-line react/button-has-type
type={buttonType}
onClick={onClick}
onMouseDown={onMouseDown}
className={classnames({
Expand Down
42 changes: 23 additions & 19 deletions src/shared/components/Interface/TokenAmountInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,28 @@ export default function TokenAmountInput({
[balance, onValidate]
)

useEffect(() => {
const textToBigIntAmount =
textAmount === "" ? null : userAmountToBigInt(textAmount) ?? 0n

const bigIntToTextAmount = bigIntToPreciseUserAmount(balance)

// As we may be loosing some precision, we need to compare the values.
// Clicking "Max" button may result in bigint that is too big to be
// represented as a float number. In this case we need to compare values to
// not override the external value that stores the bigint using greater precision.
if (textToBigIntAmount !== amount && textAmount !== bigIntToTextAmount) {
onChange(textToBigIntAmount)
}

// Make sure this is working only one way:
// from the text provided by input to the parent component
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [textAmount, onChange])
const internalOnChange = useCallback(
(newValue: string) => {
setTextAmount(newValue)

const newValueBigIntAmount =
newValue === "" ? null : userAmountToBigInt(newValue) ?? 0n

const balanceTextAmount = bigIntToPreciseUserAmount(balance)

// As we may be loosing some precision, we need to compare the values.
// Clicking "Max" button may result in bigint that is too big to be
// represented as a float number. In this case we need to compare values to
// not override the external value that stores the bigint using greater precision.
if (
newValueBigIntAmount !== amount &&
(newValue !== balanceTextAmount || newValueBigIntAmount === balance)
) {
onChange(newValueBigIntAmount)
}
},
[amount, balance, onChange]
)

useEffect(() => {
// Allow clearing the input from parent componentthis should be the only case
Expand All @@ -115,7 +119,7 @@ export default function TokenAmountInput({
label={inputLabel}
value={textAmount}
disabled={disabled}
onChange={setTextAmount}
onChange={internalOnChange}
validate={validate}
rightComponent={
<Button
Expand Down
1 change: 1 addition & 0 deletions src/shared/constants/external-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export default {
"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",
PRIVACY_POLICY: "https://taho.xyz/privacy",
GALXE_NFT: "https://galxe.com/taho/campaign/GC17xttozQ",
}
3 changes: 2 additions & 1 deletion src/shared/constants/game.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const WEEKLY_XP_ALLOCATION = 1_000_000
export const WEEKLY_XP_ALLOCATION =
process.env.IS_BETA_CLOSED === "true" ? 0 : 1_000_000
export const WEEKLY_XP_BOOST = 1.2
export const MOBILE_BREAKPOINT = 854
export const TABLET_BREAKPOINT = 1152
Expand Down
1 change: 1 addition & 0 deletions src/shared/constants/local-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export const LOCAL_STORAGE_BRAVE = "taho.brave"
export const LOCAL_STORAGE_COOKIES = "taho.cookies"
export const LOCAL_STORAGE_DISPLAYED_REALMS = "taho.displayedRealm"
export const LOCAL_STORAGE_DISPLAYED_CHALLENGES = "taho.displayedChallenges"
export const LOCAL_STORAGE_CACHED_NAMES = "taho.cachedNames"
5 changes: 5 additions & 0 deletions src/shared/constants/regex.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/* eslint-disable no-useless-escape */

// Matches floating point numbers with optional thousands separators
export const FLOATING_POINT_REGEX = /^[^0-9]*([0-9,]+)(?:\.([0-9]*))?$/

// Matches number values and empty string
export const NUMBER_INPUT_REGEX = /^-?[0-9]*\.?[0-9]*$/

// Matches valid email
export const EMAIL_REGEX = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/g
26 changes: 21 additions & 5 deletions src/shared/hooks/assistant.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useEffect } from "react"
import { LOCAL_STORAGE_ASSISTANT } from "shared/constants"
import { selectStakingRealmId, useDappSelector } from "redux-state"
import { useLocalStorageChange } from "./helpers"
Expand All @@ -17,15 +18,30 @@ export function useAssistant(): {
} {
const isStakedInRealm = useDappSelector(selectStakingRealmId)

const { value, updateStorage } = useLocalStorageChange<Assistant>(
LOCAL_STORAGE_ASSISTANT
)
const { value: assistantState, updateStorage: updateAssistantState } =
useLocalStorageChange<Assistant>(LOCAL_STORAGE_ASSISTANT)

useEffect(() => {
if (!assistantState) {
if (!isStakedInRealm) {
updateAssistantState({ visible: true, type: "welcome" })
} else {
updateAssistantState({ visible: false, type: "default" })
}
}
}, [assistantState, updateAssistantState, isStakedInRealm])

const assistantVisible = (type: AssistantType): boolean => {
if ((type === "welcome" || type === "first-realm") && isStakedInRealm)
return false
return value ? value.visible && value.type === type : false
return assistantState
? assistantState.visible && assistantState.type === type
: false
}

return { assistant: value, updateAssistant: updateStorage, assistantVisible }
return {
assistant: assistantState,
updateAssistant: updateAssistantState,
assistantVisible,
}
}
45 changes: 43 additions & 2 deletions src/shared/hooks/realm.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { easings, useSpring } from "@react-spring/web"
import { useCallback, useMemo } from "react"
import {
selectDisplayedRealmId,
selectRealmPanelVisible,
setDisplayedRealmId,
setRealmPanelVisible,
useDappDispatch,
useDappSelector,
} from "redux-state"
import { REALM_PANEL_ANIMATION_TIME } from "shared/constants"
import { useTabletScreen } from "./helpers"
import {
LOCAL_STORAGE_VISITED_REALM,
REALM_PANEL_ANIMATION_TIME,
} from "shared/constants"
import { useLocalStorageChange, useTabletScreen } from "./helpers"
import { useAssistant } from "./assistant"

export function useRealmPanelTransition(position: "left" | "right") {
const realmPanelVisible = useDappSelector(selectRealmPanelVisible)
Expand Down Expand Up @@ -94,3 +99,39 @@ export function usePanelRealmClose() {

return handlePanelClose
}

export function useOnRealmClick() {
const realmId = useDappSelector(selectDisplayedRealmId)
const dispatch = useDappDispatch()
const { updateAssistant, assistantVisible } = useAssistant()

const { value: visitedRealm, updateStorage: updateVisitedRealm } =
useLocalStorageChange<boolean>(LOCAL_STORAGE_VISITED_REALM)

const onRealmClick = useCallback(
(id: string) => {
if (!realmId) {
dispatch(setDisplayedRealmId(String(id)))
dispatch(setRealmPanelVisible(true))

if (assistantVisible("welcome"))
updateAssistant({ visible: false, type: "default" })

if (!visitedRealm) {
updateVisitedRealm(true)
updateAssistant({ visible: true, type: "first-realm" })
}
}
},
[
assistantVisible,
dispatch,
realmId,
updateAssistant,
updateVisitedRealm,
visitedRealm,
]
)

return onRealmClick
}
46 changes: 46 additions & 0 deletions src/shared/hooks/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ import {
selectDisplayedRealmId,
connectArbitrumProviderFallback,
fetchPopulation,
updateConnectedWallet,
selectWalletName,
} from "redux-state"
import {
ARBITRUM_SEPOLIA,
ARBITRUM_SEPOLIA_RPC_FALLBACK,
BALANCE_UPDATE_INTERVAL,
LOCAL_STORAGE_CACHED_NAMES,
LOCAL_STORAGE_WALLET,
POPULATION_FETCH_INTERVAL,
} from "shared/constants"
Expand All @@ -27,6 +30,10 @@ import { usePostHog } from "posthog-js/react"
import { useAssistant } from "./assistant"
import { useInterval, useLocalStorageChange } from "./helpers"

type CachedNames = {
[key: string]: { ens?: { name: string }; uns?: { name: string } }
}

class StaticJsonBatchRpcProvider extends ethers.providers.JsonRpcBatchProvider {
override async detectNetwork(): Promise<Network> {
let { network } = this
Expand Down Expand Up @@ -169,6 +176,13 @@ export function useWalletOnboarding(): {
const { value, updateStorage } =
useLocalStorageChange<string>(LOCAL_STORAGE_WALLET)

// Automatically clear the onboarded wallet if portal is closed
useEffect(() => {
if (value && process.env.IS_PORTAL_CLOSED === "true") {
updateStorage("")
}
}, [value, updateStorage])

return { walletOnboarded: value, updateWalletOnboarding: updateStorage }
}

Expand Down Expand Up @@ -263,3 +277,35 @@ export function useWalletChange() {
isStaked,
])
}

export function useCachedWalletName() {
const address = useDappSelector(selectWalletAddress)
const walletName = useDappSelector(selectWalletName)
const dispatch = useDappDispatch()

useEffect(() => {
const handleCachedNamesUpdate = () => {
if (!address) return

const cachedNames = localStorage.getItem(LOCAL_STORAGE_CACHED_NAMES)
if (!cachedNames) return

const parsedCachedNames: CachedNames = JSON.parse(cachedNames)
const { ens, uns } = parsedCachedNames[address]

if (ens || uns) {
// If cached name and redux wallet name are the same do not dispatch wallet update action
if (walletName === ens?.name || walletName === uns?.name) return

dispatch(
updateConnectedWallet({ address, name: ens?.name ?? uns?.name })
)
}
}

handleCachedNamesUpdate()
window.addEventListener("storage", handleCachedNamesUpdate)

return () => window.removeEventListener("storage", handleCachedNamesUpdate)
}, [address, walletName, dispatch])
}
Loading
Loading