From 4e418f0d6a19af95d500d32dd9cd4c2b6ad89f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Paczy=C5=84ski?= Date: Fri, 1 Dec 2023 15:51:56 +0100 Subject: [PATCH 01/40] Add pull request template --- .github/pull_request_template.md | 36 ++++++++++++++++++++++++ .github/workflows/create-pr-template.yml | 33 ++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/create-pr-template.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..d5be499e9 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,36 @@ +## Issues connected + +Please provide a list of issues connected to this PR (resolves / closes or ref if not closing the selected issue) + +## Description + +Please include a summary of the changes + +## Pull request type + +- [ ] Bug fix +- [ ] New feature +- [ ] Code refactoring / code cleanup +- [ ] Other + +If type is "other" make sure to explicitly define the solved problem in the PR description + +## Screenshots / images / videos + +Please provide assets necessary for the PR (remove if not applicable) + +## What has been done + +Please provide a list of changes that were done (functions, components, JSONs, etc.) + +- Change 1 +- Change 2 +- Change 3 + +## Testing + +Please provide a testing checklist + +- [ ] Test 1 +- [ ] Test 2 +- [ ] Test 3 diff --git a/.github/workflows/create-pr-template.yml b/.github/workflows/create-pr-template.yml new file mode 100644 index 000000000..19072a3f0 --- /dev/null +++ b/.github/workflows/create-pr-template.yml @@ -0,0 +1,33 @@ +# This workflow creates an universal and cofigurable template for all dapp pull requests +name: Apply PR Template + +on: + pull_request: + types: + - opened + branches: main + +jobs: + create_pr_template: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Set PR Body + run: | + TEMPLATE=$(<.github/pull_request_template.md) + PR_BODY=$(echo "TEMPLATE" | sed -e 's/^/ /') + jq -n --arg body "$PR_BODY" '{body: $body}' > pr_body.json + - name: Apply PR Body + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const fs = require('fs'); + const prBody = JSON.parse(fs.readFileSync('pr_body.json', 'utf8')); + github.pulls.update({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + body: prBody.body + }); From 996db8d5b6bda192f62b0b624f2ee1b87ad8610d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Paczy=C5=84ski?= Date: Fri, 1 Dec 2023 16:11:07 +0100 Subject: [PATCH 02/40] Fix workflow `run` script --- .github/workflows/create-pr-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-pr-template.yml b/.github/workflows/create-pr-template.yml index 19072a3f0..1dee342eb 100644 --- a/.github/workflows/create-pr-template.yml +++ b/.github/workflows/create-pr-template.yml @@ -17,7 +17,7 @@ jobs: run: | TEMPLATE=$(<.github/pull_request_template.md) PR_BODY=$(echo "TEMPLATE" | sed -e 's/^/ /') - jq -n --arg body "$PR_BODY" '{body: $body}' > pr_body.json + echo "{\"body\": \"$PR_BODY\"}" > pr_body.json - name: Apply PR Body uses: actions/github-script@v6 with: From 0e26e212905ce35be2f078a27190463349c22d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Paczy=C5=84ski?= Date: Mon, 4 Dec 2023 12:27:07 +0100 Subject: [PATCH 03/40] Update template and remove workflow --- .github/pull_request_template.md | 1 + .github/workflows/create-pr-template.yml | 33 ------------------------ 2 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 .github/workflows/create-pr-template.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d5be499e9..6c9f35977 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -11,6 +11,7 @@ Please include a summary of the changes - [ ] Bug fix - [ ] New feature - [ ] Code refactoring / code cleanup +- [ ] DevOps - [ ] Other If type is "other" make sure to explicitly define the solved problem in the PR description diff --git a/.github/workflows/create-pr-template.yml b/.github/workflows/create-pr-template.yml deleted file mode 100644 index 1dee342eb..000000000 --- a/.github/workflows/create-pr-template.yml +++ /dev/null @@ -1,33 +0,0 @@ -# This workflow creates an universal and cofigurable template for all dapp pull requests -name: Apply PR Template - -on: - pull_request: - types: - - opened - branches: main - -jobs: - create_pr_template: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - name: Set PR Body - run: | - TEMPLATE=$(<.github/pull_request_template.md) - PR_BODY=$(echo "TEMPLATE" | sed -e 's/^/ /') - echo "{\"body\": \"$PR_BODY\"}" > pr_body.json - - name: Apply PR Body - uses: actions/github-script@v6 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - const fs = require('fs'); - const prBody = JSON.parse(fs.readFileSync('pr_body.json', 'utf8')); - github.pulls.update({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number, - body: prBody.body - }); From 7711526b4600f48eaa0f5d2ccd0b8509ff9aba98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Paczy=C5=84ski?= Date: Wed, 6 Dec 2023 14:06:18 +0100 Subject: [PATCH 04/40] Simplify PR template --- .github/pull_request_template.md | 34 +++++--------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6c9f35977..35112129f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,37 +1,13 @@ -## Issues connected - -Please provide a list of issues connected to this PR (resolves / closes or ref if not closing the selected issue) - -## Description - -Please include a summary of the changes - -## Pull request type - -- [ ] Bug fix -- [ ] New feature -- [ ] Code refactoring / code cleanup -- [ ] DevOps -- [ ] Other - -If type is "other" make sure to explicitly define the solved problem in the PR description - -## Screenshots / images / videos - -Please provide assets necessary for the PR (remove if not applicable) +Resolves ## What has been done -Please provide a list of changes that were done (functions, components, JSONs, etc.) - - Change 1 -- Change 2 -- Change 3 ## Testing -Please provide a testing checklist - - [ ] Test 1 -- [ ] Test 2 -- [ ] Test 3 + +## Screenshots / images / videos + +Please provide assets necessary for the PR (remove if not applicable) From 9fb43b7db8b629ec48c564d1bd94463ec92393de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Paczy=C5=84ski?= Date: Wed, 6 Dec 2023 14:07:26 +0100 Subject: [PATCH 05/40] Add header for issues resolved --- .github/pull_request_template.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 35112129f..2ff02496b 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,3 +1,5 @@ +## Issues connected + Resolves ## What has been done From 97f1a546be15068fb2dc6e036d1aa02cba37b3d5 Mon Sep 17 00:00:00 2001 From: Jagoda Berry Rybacka Date: Fri, 8 Dec 2023 14:40:03 +0100 Subject: [PATCH 06/40] Fix token input for typing balance value manually When user was typing the balance amount manually then input was not updating values correctly. We moved to `useCallback` instead of `useEffect` and fixed the condition for updating parent component with new values. --- .../components/Interface/TokenAmountInput.tsx | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/shared/components/Interface/TokenAmountInput.tsx b/src/shared/components/Interface/TokenAmountInput.tsx index 160a28069..b013082fc 100644 --- a/src/shared/components/Interface/TokenAmountInput.tsx +++ b/src/shared/components/Interface/TokenAmountInput.tsx @@ -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 @@ -115,7 +119,7 @@ export default function TokenAmountInput({ label={inputLabel} value={textAmount} disabled={disabled} - onChange={setTextAmount} + onChange={internalOnChange} validate={validate} rightComponent={ + + + + ) +} diff --git a/src/ui/Island/Modals/BetaEndModal/index.tsx b/src/ui/Island/Modals/BetaEndModal/index.tsx new file mode 100644 index 000000000..ad405caf6 --- /dev/null +++ b/src/ui/Island/Modals/BetaEndModal/index.tsx @@ -0,0 +1,57 @@ +import React, { ReactNode } from "react" +import Modal from "shared/components/Dialogs/Modal" +import GetUpdates from "./GetUpdates" +import ClaimYourNFT from "./ClaimYourNFT" + +type BetaEndModalProps = { + header: ReactNode + description: ReactNode +} + +export default function BetaEndModal({ + header, + description, +}: BetaEndModalProps) { + return ( + <> + + +
+

{header}

+

{description}

+
+
+ + +
+
+
+ + + ) +} From a74820d75dce3f464a417840f5fbc66e6692c4ae Mon Sep 17 00:00:00 2001 From: Jagoda Berry Rybacka Date: Mon, 11 Dec 2023 13:47:27 +0100 Subject: [PATCH 13/40] Add feature flags for end of beta features --- .env.defaults | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.env.defaults b/.env.defaults index 6620eb475..70e56de9a 100644 --- a/.env.defaults +++ b/.env.defaults @@ -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" \ No newline at end of file +SHOW_WAITLIST="true" From 968355f7b474485fa020bcaf5b1cad7d683f5932 Mon Sep 17 00:00:00 2001 From: Jagoda Berry Rybacka Date: Mon, 11 Dec 2023 13:47:40 +0100 Subject: [PATCH 14/40] Adjust UI for end of beta period --- src/shared/constants/game.ts | 3 ++- .../RealmDetailsPanel/RealmDetailsContent.tsx | 21 ++++++++++++----- .../RealmDetailsPanel/RealmDetailsHeader.tsx | 9 ++++++-- .../RealmDetailsPanel/RealmDetailsRewards.tsx | 10 +++++++- .../Island/RealmPanel/RealmPanelCountdown.tsx | 23 ++++++++++++------- src/ui/Island/Staking/StakeForm.tsx | 1 + 6 files changed, 49 insertions(+), 18 deletions(-) diff --git a/src/shared/constants/game.ts b/src/shared/constants/game.ts index 70877c573..8ef49149e 100644 --- a/src/shared/constants/game.ts +++ b/src/shared/constants/game.ts @@ -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 diff --git a/src/ui/Island/RealmPanel/RealmDetailsPanel/RealmDetailsContent.tsx b/src/ui/Island/RealmPanel/RealmDetailsPanel/RealmDetailsContent.tsx index 81b6dc6fa..d318c45be 100644 --- a/src/ui/Island/RealmPanel/RealmDetailsPanel/RealmDetailsContent.tsx +++ b/src/ui/Island/RealmPanel/RealmDetailsPanel/RealmDetailsContent.tsx @@ -31,13 +31,22 @@ export default function RealmDetailsContent({ return ( - + {process.env.IS_BETA_CLOSED === "true" || ( + + )} - - + {process.env.IS_BETA_CLOSED === "true" || ( + <> + + + + )} ) } diff --git a/src/ui/Island/RealmPanel/RealmDetailsPanel/RealmDetailsHeader.tsx b/src/ui/Island/RealmPanel/RealmDetailsPanel/RealmDetailsHeader.tsx index 873b26580..82f97e1be 100644 --- a/src/ui/Island/RealmPanel/RealmDetailsPanel/RealmDetailsHeader.tsx +++ b/src/ui/Island/RealmPanel/RealmDetailsPanel/RealmDetailsHeader.tsx @@ -31,7 +31,9 @@ export default function RealmDetailsHeader({

{realm?.name} Realm

- +
@@ -49,7 +51,10 @@ export default function RealmDetailsHeader({
This weeks reward pool -
+
Claim XP + {process.env.IS_BETA_CLOSED === "true" && ( +
+ + Claiming will be live till Dec 18 2023 + +
+ )}
- + {process.env.IS_BETA_CLOSED === "true" || ( + + )}
Week {seasonWeek}{" "} @@ -37,7 +39,12 @@ export default function RealmPanelCountdown() { / {seasonDuration}
-
{timeRemaining}
+ +
+ {process.env.IS_BETA_CLOSED === "true" + ? "Beta is over, claim xp till Dec 18 2023" + : timeRemaining} +
From 6bc7c6c923619406a0070028aaae50ea56a3282c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Paczy=C5=84ski?= Date: Tue, 12 Dec 2023 12:59:38 +0100 Subject: [PATCH 28/40] Type-o fix --- src/ui/Island/Modals/BetaEndModal/ClaimYourNFT.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/Island/Modals/BetaEndModal/ClaimYourNFT.tsx b/src/ui/Island/Modals/BetaEndModal/ClaimYourNFT.tsx index d91735469..39cb846c1 100644 --- a/src/ui/Island/Modals/BetaEndModal/ClaimYourNFT.tsx +++ b/src/ui/Island/Modals/BetaEndModal/ClaimYourNFT.tsx @@ -11,7 +11,7 @@ export default function ClaimYourNFT() { >

Claim your NFT

- participate in the beta? See if you are + Participated in the beta? See if you are
eligible to claim the NFT awards.

From bd577de506cb1b4a7550cab3f7f06f65a5c921c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Paczy=C5=84ski?= Date: Tue, 12 Dec 2023 13:20:16 +0100 Subject: [PATCH 29/40] Auto update ENS name on `storage` event --- src/shared/utils/names.ts | 1 + src/ui/Nav/AccountInfo.tsx | 8 ++++++-- src/ui/Nav/index.tsx | 27 +++++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/shared/utils/names.ts b/src/shared/utils/names.ts index d2d6ad90e..d45b28719 100644 --- a/src/shared/utils/names.ts +++ b/src/shared/utils/names.ts @@ -42,6 +42,7 @@ const addCachedName = ({ name, avatar, address, type }: NameWithProvider) => { }) localStorage.setItem(NAMES_CACHE_STRORAGE_KEY, newCache) + window.dispatchEvent(new Event("storage")) } const resolveENSPromise = (address: string) => diff --git a/src/ui/Nav/AccountInfo.tsx b/src/ui/Nav/AccountInfo.tsx index 6ea0ff9bb..37133a261 100644 --- a/src/ui/Nav/AccountInfo.tsx +++ b/src/ui/Nav/AccountInfo.tsx @@ -10,7 +10,11 @@ import { getRealmColor } from "shared/constants" import Avatar from "shared/components/Media/Avatar" import AccountDropdown from "./AccountDropdown" -export default function AccountInfo() { +type AccountInfoProps = { + accountName: string | null +} + +export default function AccountInfo({ accountName }: AccountInfoProps) { const [isDropdownOpen, setIsDropdownOpen] = useState(false) const dropdownTriggerRef = useRef(null) @@ -41,7 +45,7 @@ export default function AccountInfo() { onClick={() => setIsDropdownOpen((prev) => !prev)} ref={dropdownTriggerRef} > - {name} + {accountName ?? name} (null) + const walletAddress = useDappSelector(selectWalletAddress) + + useEffect(() => { + window.addEventListener("storage", () => { + if (!walletAddress) return + + const cachedNames = localStorage.getItem("taho.cachedNames") + if (!cachedNames) return + + const parsedCachedNames: CachedNames = JSON.parse(cachedNames) + const { ens, uns } = parsedCachedNames[walletAddress] + + if (ens) setAccountName(ens.name) + if (uns) setAccountName(uns.name) + }) + }, [walletAddress]) + return ( <> @@ -30,7 +53,7 @@ export default function Nav(): JSX.Element {
{isConnected ? ( - + ) : ( @@ -29,17 +79,31 @@ export default function GetUpdatesForm() { font-size: 16px; line-height: 24px; background: var(--primary-p1-100); - padding: 12px 16px; + padding: 12px 32px 12px 16px; outline: none; border-radius: 4px; border: 1.5px solid var(--green-60); font-family: var(--sans); color: var(--secondary-s1-100); + width: 207px; } modal_actions_input:focus, modal_actions_input:active { border-color: var(--secondary-s1-100); } + .modal_actions_input_message { + position: absolute; + left: 0; + top: 100%; + padding: 4px 8px; + gap: 4px; + color: ${signUpMessage === SignUpMessage.SUCCESS + ? "var(--trading-in)" + : "var(--semantic-error)"}; + } + .modal_actions_input_message > span { + font-size: 14px; + } `} ) From f966618dc7c813318c1a07b3e5911855f1fdb11c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Paczy=C5=84ski?= Date: Wed, 13 Dec 2023 09:18:09 +0100 Subject: [PATCH 32/40] Set up logic for sign up form --- src/env.d.ts | 14 ++++++++++ src/public/index.html | 17 +++++++++++ .../Modals/BetaEndModal/GetUpdatesForm.tsx | 28 ++++++++++--------- 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/src/env.d.ts b/src/env.d.ts index 7c2f29878..44ba2fe88 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -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 + } +} diff --git a/src/public/index.html b/src/public/index.html index 0906f2cc6..a3e183d07 100644 --- a/src/public/index.html +++ b/src/public/index.html @@ -4,6 +4,23 @@ Subscape + + +