From 86936e0f240c877305fdf1b36961e0aeefd9b4e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=A2=E3=83=AC=E3=82=AF=E3=82=B5=E3=83=B3=E3=83=80?= =?UTF-8?q?=E3=83=BC=2Eeth?= <4975670+0x4007@users.noreply.github.com> Date: Mon, 9 Sep 2024 22:00:57 +0900 Subject: [PATCH] Revert "feat: vertically stacked permits" --- cypress/e2e/claim-portal-failure.cy.ts | 18 +- cypress/e2e/claim-portal-non-web3.cy.ts | 12 +- cypress/e2e/claim-portal-success.cy.ts | 45 ++--- static/index.html | 61 +++--- static/scripts/rewards/app-state.ts | 28 ++- static/scripts/rewards/init.ts | 2 +- .../claim-rewards-pagination.ts | 21 ++ .../render-transaction/insert-table-data.ts | 140 ++++++-------- .../read-claim-data-from-url.ts | 73 +++---- .../render-transaction/render-ens-name.ts | 7 +- .../render-transaction/render-token-symbol.ts | 16 -- .../render-transaction/render-transaction.ts | 74 +++---- .../rewards/render-transaction/utils.ts | 5 + static/scripts/rewards/toaster.ts | 13 +- static/scripts/rewards/web3/connect-wallet.ts | 27 +-- static/scripts/rewards/web3/erc20-permit.ts | 183 ++++++++---------- static/scripts/rewards/web3/erc721-permit.ts | 23 +-- .../web3/handle-if-on-correct-network.ts | 7 +- .../rewards/web3/not-on-correct-network.ts | 5 +- static/scripts/rewards/web3/switch-network.ts | 5 +- .../scripts/rewards/web3/use-rpc-handler.ts | 8 +- .../rewards/web3/verify-current-network.ts | 5 +- static/styles/rewards/claim-table.css | 130 ++++++------- static/styles/rewards/light-mode.css | 15 +- static/styles/rewards/pay.css | 7 +- 25 files changed, 455 insertions(+), 475 deletions(-) create mode 100644 static/scripts/rewards/render-transaction/claim-rewards-pagination.ts create mode 100644 static/scripts/rewards/render-transaction/utils.ts diff --git a/cypress/e2e/claim-portal-failure.cy.ts b/cypress/e2e/claim-portal-failure.cy.ts index d20cd09e..96ab8dd4 100644 --- a/cypress/e2e/claim-portal-failure.cy.ts +++ b/cypress/e2e/claim-portal-failure.cy.ts @@ -18,12 +18,12 @@ describe("Claims Portal Failures", () => { }); it("should handle no connected signer", () => { - cy.get(".additional-details", { timeout: 15000 }).first().should("be.visible").invoke("click"); + cy.get("#additionalDetails", { timeout: 15000 }).should("be.visible").invoke("click"); - cy.get("button.make-claim").first().should("be.visible").click(); - cy.get(".invalidator").should("not.be.visible"); - cy.get(".claim-loader").should("not.be.visible"); - cy.get(".view-claim").should("not.be.visible").and("include.text", "View Claim"); + cy.get("button[id='make-claim']").should("be.visible").click(); + cy.get("#invalidator").should("not.be.visible"); + cy.get("#claim-loader").should("not.be.visible"); + cy.get("#view-claim").should("not.be.visible").and("include.text", "View Claim"); cy.get("body").should("contain.text", "Please connect your wallet to claim this reward."); }); @@ -46,11 +46,11 @@ describe("Claims Portal Failures", () => { }); it("should handle feedback for a failed wallet provider transaction", () => { - cy.get(".additional-details", { timeout: 15000 }).first().should("be.visible").invoke("click"); + cy.get("#additionalDetails", { timeout: 15000 }).should("be.visible").invoke("click"); - cy.get("button.make-claim").first().should("be.visible").click(); - cy.get(".claim-loader").first().should("be.visible"); - cy.get(".invalidator").first().should("not.be.visible"); + cy.get("button[id='make-claim']").should("be.visible").click(); + cy.get("#claim-loader").should("be.visible"); + cy.get("#invalidator").should("not.be.visible"); // cy.get("#claim-loader").should("not.be.visible"); // gets stuck here }); }); diff --git a/cypress/e2e/claim-portal-non-web3.cy.ts b/cypress/e2e/claim-portal-non-web3.cy.ts index e5cd9bf0..c1a51c50 100644 --- a/cypress/e2e/claim-portal-non-web3.cy.ts +++ b/cypress/e2e/claim-portal-non-web3.cy.ts @@ -14,9 +14,9 @@ describe("Claims Portal Non-Web3", () => { cy.visit(`/${claimUrl}`); cy.wait(2000); - cy.get(".invalidator").should("not.be.visible"); - cy.get(".claim-loader").should("not.be.visible"); - cy.get(".view-claim").should("not.be.visible"); + cy.get("#invalidator").should("not.be.visible"); + cy.get("#claim-loader").should("not.be.visible"); + cy.get("#view-claim").should("not.be.visible"); cy.get("body", { timeout: 3000 }).should("contain.text", "Please use a web3 enabled browser to collect this reward."); }); @@ -79,9 +79,9 @@ function testUserAgent(userAgent: string) { }); cy.wait(2000); - cy.get(".invalidator").should("not.be.visible"); - cy.get(".claim-loader").should("not.be.visible"); - cy.get(".view-claim").should("not.be.visible"); + cy.get("#invalidator").should("not.be.visible"); + cy.get("#claim-loader").should("not.be.visible"); + cy.get("#view-claim").should("not.be.visible"); cy.get("body", { timeout: 3000 }).should("contain.text", "Please use a mobile-friendly Web3 browser such as MetaMask to collect this reward"); } diff --git a/cypress/e2e/claim-portal-success.cy.ts b/cypress/e2e/claim-portal-success.cy.ts index b9cb6263..1f715b3e 100644 --- a/cypress/e2e/claim-portal-success.cy.ts +++ b/cypress/e2e/claim-portal-success.cy.ts @@ -17,21 +17,21 @@ describe("Claims Portal Success", () => { }); describe("Success", () => { it("should successfully claim a permit", () => { - cy.get(".additional-details", { timeout: 15000 }).first().should("be.visible").invoke("click"); + cy.get("#additionalDetails", { timeout: 15000 }).should("be.visible").invoke("click"); - cy.get('table[data-make-claim="ok"]').first().should("exist").and("include.text", "337888.4 WXDAI"); + cy.get('table[data-make-claim="ok"]').should("exist").and("include.text", "337888.4 WXDAI"); - cy.get("button[class='make-claim']").first().invoke("click"); + cy.get("button[id='make-claim']").invoke("click"); - cy.get(".invalidator").first().should("not.be.visible"); + cy.get("#invalidator").should("not.be.visible"); - cy.get(".claim-loader").first().should("be.visible").as("loader"); + cy.get("#claim-loader").should("be.visible").as("loader"); cy.wait(5000); // required for the action to complete - cy.get("@loader").first().should("not.be.visible"); + cy.get("@loader").should("not.be.visible"); - cy.get(".view-claim").first().should("be.visible").and("include.text", "View Claim"); + cy.get("#view-claim").should("be.visible").and("include.text", "View Claim"); // anvil confirms it instantly so there is two notifications cy.get("body", { timeout: 15000 }).should("contain.text", "Transaction sent"); @@ -41,13 +41,10 @@ describe("Claims Portal Success", () => { win.open = cy.stub().as("open"); }); - cy.get(".view-claim") - .first() + cy.get("#view-claim") .invoke("click") .then(() => { - cy.get("@open") - .first() - .should("be.calledWithMatch", /https:\/\/blockscan.com\/tx/); + cy.get("@open").should("be.calledWithMatch", /https:\/\/blockscan.com\/tx/); }); }); }); @@ -57,17 +54,17 @@ describe("Claims Portal Success", () => { cy.visit(`/${notMeantForYouPermit}`).then(() => { cy.wait(2000); }); - cy.get(".additional-details", { timeout: 15000 }).first().should("be.visible").invoke("click"); + cy.get("#additionalDetails", { timeout: 15000 }).should("be.visible").invoke("click"); - cy.get('table[data-make-claim="ok"]').first().should("exist"); + cy.get('table[data-make-claim="ok"]').should("exist"); - cy.get("button[class='make-claim']").first().invoke("click"); + cy.get("button[id='make-claim']").invoke("click"); - cy.get(".invalidator").first().should("not.be.visible"); + cy.get("#invalidator").should("not.be.visible"); - cy.get(".claim-loader").first().should("be.visible"); + cy.get("#claim-loader").should("be.visible"); - cy.get(".view-claim").first().should("not.be.visible"); + cy.get("#view-claim").should("not.be.visible"); cy.get("body", { timeout: 15000 }).should("contain.text", "This reward is not for you"); }); @@ -82,16 +79,16 @@ describe("Claims Portal Success", () => { cy.visit(`/${notMeantForYouPermit}`).then(() => { cy.wait(2000); }); - cy.get(".additional-details", { timeout: 15000 }).first().should("be.visible").invoke("click"); + cy.get("#additionalDetails", { timeout: 15000 }).should("be.visible").invoke("click"); - cy.get('table[data-make-claim="ok"]').first().should("exist"); + cy.get('table[data-make-claim="ok"]').should("exist"); - cy.get(".invalidator").should("be.visible").first().invoke("click"); + cy.get("#invalidator").should("be.visible").invoke("click"); - cy.get(".claim-loader").first().should("not.be.visible"); - cy.get(".view-claim").first().should("not.be.visible"); + cy.get("#claim-loader").should("not.be.visible"); + cy.get("#view-claim").should("not.be.visible"); - cy.get("body", { timeout: 15000 }).first().should("contain.text", "Nonce invalidation transaction sent"); + cy.get("body", { timeout: 15000 }).should("contain.text", "Nonce invalidation transaction sent"); }); }); }); diff --git a/static/index.html b/static/index.html index f1bde35d..44363c76 100644 --- a/static/index.html +++ b/static/index.html @@ -25,7 +25,6 @@ Ubiquity Rewards | Ubiquity DAO -
@@ -63,19 +62,19 @@ - +
Amount
- +
Loading
- +
Token
- +
@@ -84,11 +83,11 @@ - +
For
- +
@@ -100,10 +99,10 @@ - +
- - - -
-