Skip to content

Commit

Permalink
feat(ui-ux): include link to metascan for transaction and block detai…
Browse files Browse the repository at this point in the history
…ls pages (#1929)

* added view on metachain button for transaction details page

* passed link to blocks page

* updated the design

* standardized naming to metachainTxUrl

* update for mobile & tablet design

* update for light and dark mode

* used vmmap for block too

* removed unused variable

* added testid

* added e2e tests for transaction details page

* removed console.log

* updated to always use block height in vmmap method

* added e2e for blockId

* pr comments

* minimized reusing of functions/variables

* Update src/components/commons/MetascanLinkButton.tsx

Co-authored-by: Pierre Gee <pierre@cakedefi.com>

* Update src/utils/commons/getNetworkParams.ts

Co-authored-by: Pierre Gee <pierre@cakedefi.com>

* added hover style

* used useMemo

* pr comment

* updated for 1024px screens

---------

Co-authored-by: Pierre Gee <pierre@cakedefi.com>
  • Loading branch information
nattadex and Pierre Gee authored Mar 4, 2024
1 parent 8cb5029 commit bfb422f
Show file tree
Hide file tree
Showing 8 changed files with 324 additions and 75 deletions.
58 changes: 43 additions & 15 deletions cypress/e2e/pages/blocks/[blockId].spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
context("/blocks/[blockId] on desktop", () => {
beforeEach(() => {
cy.visit(
"/blocks/f66c334c4aa6ea3f3dd18187447d16ae2c6f73941d80eab3ef0e2f1b10acd4c7?network=MainNet"
"/blocks/f66c334c4aa6ea3f3dd18187447d16ae2c6f73941d80eab3ef0e2f1b10acd4c7?network=MainNet",
);
cy.viewport("macbook-13");
});
Expand All @@ -13,7 +13,7 @@ context("/blocks/[blockId] on desktop", () => {
it("should have block hash", () => {
cy.findByTestId("block-hash").should(
"have.text",
"f66c334c4aa6ea3f3dd18187447d16ae2c6f73941d80eab3ef0e2f1b10acd4c7"
"f66c334c4aa6ea3f3dd18187447d16ae2c6f73941d80eab3ef0e2f1b10acd4c7",
);
});

Expand All @@ -28,7 +28,7 @@ context("/blocks/[blockId] on desktop", () => {
it("should have block detail timestamp", () => {
cy.findByTestId("block-detail-timestamp").should(
"have.text",
"Aug 25, 2021, 3:33:51 AM"
"Aug 25, 2021, 3:33:51 AM",
);
});

Expand All @@ -39,21 +39,21 @@ context("/blocks/[blockId] on desktop", () => {
it("should have block detail minter", () => {
cy.findByTestId("block-detail-minter").should(
"have.text",
"8Xy1uEVp4WQkktYAmKJ5mmpWTE9fQ8zuCj"
"8Xy1uEVp4WQkktYAmKJ5mmpWTE9fQ8zuCj",
);
cy.findByTestId("block-detail-minter")
.find("a")
.should(
"have.attr",
"href",
"/address/8Xy1uEVp4WQkktYAmKJ5mmpWTE9fQ8zuCj"
"/address/8Xy1uEVp4WQkktYAmKJ5mmpWTE9fQ8zuCj",
);
});

it("should have block detail difficulty", () => {
cy.findByTestId("block-detail-difficulty").should(
"have.text",
"16893394709.78455"
"16893394709.78455",
);
});

Expand All @@ -68,7 +68,7 @@ context("/blocks/[blockId] on desktop", () => {
it("should have block detail merkle root", () => {
cy.findByTestId("block-detail-merkle-root").should(
"have.text",
"c0bf8aa08389c89f17296ba1d813f4741e25b7096ba924e0a141b6ea7d48f39e"
"c0bf8aa08389c89f17296ba1d813f4741e25b7096ba924e0a141b6ea7d48f39e",
);
});

Expand All @@ -93,12 +93,26 @@ context("/blocks/[blockId] on desktop", () => {
});
});
});

it("should have view on metachain button on non transfer domain transactions", () => {
cy.visit(
"/blocks/02f761b10b6c08d9f383af56bf2f97873ba8cbb307759e1c307ed014808a2304",
);
cy.findByTestId("metascan-link-button").should("exist");
});

it("should have view on metachain button on transfer domain transactions", () => {
cy.visit(
"/blocks/5d1f906b3050814aabe3fe32d996f0f232573485686b9f38439d66709c0167e0",
);
cy.findByTestId("metascan-link-button").should("exist");
});
});

context("/blocks/[blockId] on mobile", () => {
beforeEach(() => {
cy.visit(
"/blocks/f66c334c4aa6ea3f3dd18187447d16ae2c6f73941d80eab3ef0e2f1b10acd4c7?network=MainNet"
"/blocks/f66c334c4aa6ea3f3dd18187447d16ae2c6f73941d80eab3ef0e2f1b10acd4c7?network=MainNet",
);
cy.viewport("iphone-x");
});
Expand All @@ -110,7 +124,7 @@ context("/blocks/[blockId] on mobile", () => {
it("should have heading", () => {
cy.findByTestId("block-hash").should(
"have.text",
"f66c334c4aa6ea3f3dd18187447d16ae2c6f73941d80eab3ef0e2f1b10acd4c7"
"f66c334c4aa6ea3f3dd18187447d16ae2c6f73941d80eab3ef0e2f1b10acd4c7",
);
});

Expand All @@ -123,7 +137,7 @@ context("/blocks/[blockId] on mobile", () => {
it("should have block hash", () => {
cy.findByTestId("block-hash").should(
"have.text",
"f66c334c4aa6ea3f3dd18187447d16ae2c6f73941d80eab3ef0e2f1b10acd4c7"
"f66c334c4aa6ea3f3dd18187447d16ae2c6f73941d80eab3ef0e2f1b10acd4c7",
);
});

Expand All @@ -138,7 +152,7 @@ context("/blocks/[blockId] on mobile", () => {
it("should have block detail timestamp", () => {
cy.findByTestId("block-detail-timestamp").should(
"have.text",
"Aug 25, 2021, 3:33:51 AM"
"Aug 25, 2021, 3:33:51 AM",
);
});

Expand All @@ -149,21 +163,21 @@ context("/blocks/[blockId] on mobile", () => {
it("should have block detail minter", () => {
cy.findByTestId("block-detail-minter").should(
"have.text",
"8Xy1uEVp4WQkktYAmKJ5mmpWTE9fQ8zuCj"
"8Xy1uEVp4WQkktYAmKJ5mmpWTE9fQ8zuCj",
);
cy.findByTestId("block-detail-minter")
.find("a")
.should(
"have.attr",
"href",
"/address/8Xy1uEVp4WQkktYAmKJ5mmpWTE9fQ8zuCj"
"/address/8Xy1uEVp4WQkktYAmKJ5mmpWTE9fQ8zuCj",
);
});

it("should have block detail difficulty", () => {
cy.findByTestId("block-detail-difficulty").should(
"have.text",
"16893394709.78455"
"16893394709.78455",
);
});

Expand All @@ -178,7 +192,7 @@ context("/blocks/[blockId] on mobile", () => {
it("should have block detail merkle root", () => {
cy.findByTestId("block-detail-merkle-root").should(
"have.text",
"c0bf8aa08389c89f17296ba1d813f4741e25b7096ba924e0a141b6ea7d48f39e"
"c0bf8aa08389c89f17296ba1d813f4741e25b7096ba924e0a141b6ea7d48f39e",
);
});

Expand All @@ -194,4 +208,18 @@ context("/blocks/[blockId] on mobile", () => {
});
});
});

it("should have view on metachain button on non transfer domain transactions", () => {
cy.visit(
"/blocks/02f761b10b6c08d9f383af56bf2f97873ba8cbb307759e1c307ed014808a2304",
);
cy.findByTestId("metascan-link-button").should("exist");
});

it("should have view on metachain button on transfer domain transactions", () => {
cy.visit(
"/blocks/5d1f906b3050814aabe3fe32d996f0f232573485686b9f38439d66709c0167e0",
);
cy.findByTestId("metascan-link-button").should("exist");
});
});
Loading

0 comments on commit bfb422f

Please sign in to comment.