Skip to content

Commit

Permalink
fix: MET-1630 display absolute slot
Browse files Browse the repository at this point in the history
  • Loading branch information
Sotatek-TrungHoang committed Oct 4, 2023
1 parent 89bf4df commit bc5a7e2
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const mockTransaction = {
confirmation: 10,
fee: 100,
totalOutput: 1000,
maxEpochSlot: 1000
maxEpochSlot: 1000,
slotNo: 1000
},
summary: {
stakeAddress: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const mockTransaction = {
confirmation: 10,
fee: 100,
totalOutput: 1000,
maxEpochSlot: 1000
maxEpochSlot: 1000,
slotNo: 1000
},
summary: {
stakeAddress: [
Expand Down
10 changes: 3 additions & 7 deletions src/components/TransactionDetail/TransactionOverview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import DropdownDetail from "src/components/commons/DropdownDetail";
import CustomTooltip from "src/components/commons/CustomTooltip";
import ADAicon from "src/components/commons/ADAIcon";

import { MaxSlot, StyledLink, TitleCard } from "./styles";
import { StyledLink, TitleCard } from "./styles";

interface Props {
data: Transaction | null;
Expand Down Expand Up @@ -231,15 +231,11 @@ const TransactionOverview: React.FC<Props> = ({ data, loading }) => {
title: (
<Box display={"flex"} alignItems="center">
<TitleCard height={24} mr={1}>
{t("common.slot")}
{`${t("common.slot")} - ${t("glossary.absoluteSlot")}`}
</TitleCard>
</Box>
),
value: (
<>
{data?.tx?.epochSlot || 0}/<MaxSlot>{MAX_SLOT_EPOCH}</MaxSlot>
</>
)
value: `${data?.tx?.epochSlot} - ${data?.tx?.slotNo || 0}`
}
];
return (
Expand Down
37 changes: 22 additions & 15 deletions src/components/TransactionLists/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,31 @@ const TransactionList: React.FC<TransactionListProps> = ({
render: (r) => {
const { blockName, tooltip } = formatNameBlockNo(r.blockNo, r.epochNo) || getShortHash(r.blockHash);
return (
<Box>
<Box>
<StyledLink to={details.block(r.blockNo || r.blockHash)}>
<CustomTooltip title={tooltip}>
<span>{blockName}</span>
</CustomTooltip>
</StyledLink>
</Box>
<Box mt={1}>
<StyledLink to={details.epoch(r.epochNo)}>{r.epochNo}</StyledLink>/
<Box color={({ palette }) => palette.secondary.light} component={"span"}>
{r.epochSlotNo}
</Box>
</Box>
</Box>
<StyledLink to={details.block(r.blockNo || r.blockHash)}>
<CustomTooltip title={tooltip}>
<span>{blockName}</span>
</CustomTooltip>
</StyledLink>
);
}
},
{
title: t("glossary.epoch"),
key: "epochNo",
minWidth: 60,
render: (r) => <StyledLink to={details.epoch(r.epochNo)}>{r.epochNo}</StyledLink>
},
{
title: t("glossary.slot"),
key: "epochSlotNo",
minWidth: 60,
render: (r) => r.epochSlotNo
},
{
title: t("glossary.absoluteSlot"),
key: "slot",
minWidth: 60
},
{
title: t("common.fees"),
key: "fee",
Expand Down
1 change: 1 addition & 0 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"page.dashboard": "Dashboard",
"glossary.blockchain": "Blockchain",
"glossary.epochs": "Epochs",
"glossary.absoluteSlot": "Absolute Slot",
"glossary.blocks": "Blocks",
"glossary.transactions": "Transactions",
"glossary.nativeTokens": "Native Tokens",
Expand Down
28 changes: 15 additions & 13 deletions src/pages/BlockList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useSelector } from "react-redux";
import { useEffect, useState, useRef } from "react";
import { stringify } from "qs";
import { useHistory, useLocation } from "react-router-dom";
import { Box } from "@mui/material";
import { useTranslation } from "react-i18next";

import { Column } from "src/types/table";
Expand Down Expand Up @@ -65,25 +64,28 @@ const BlockList = () => {
{
title: <Capitalize>{t("glossary.blockID")}</Capitalize>,
key: "blockId",
minWidth: "150px",
minWidth: "50px",
render: (r) => (
<CustomTooltip title={r.hash}>
<StyledLink to={details.block(r.blockNo || r.hash)}>{getShortHash(`${r.hash}`)}</StyledLink>
</CustomTooltip>
)
},
{
title: <Capitalize>{t("glossary.EpochSlot")}</Capitalize>,
key: "epoch",
minWidth: "150px",
render: (r) => (
<>
<StyledLink to={details.epoch(r.epochNo)}>{r.epochNo}</StyledLink>/
<Box component={"span"} color={({ palette }) => palette.secondary.light}>
{r.epochSlotNo}
</Box>
</>
)
title: <Capitalize>{t("glossary.epoch")}</Capitalize>,
key: "epochNo",
minWidth: "50px",
render: (r) => <StyledLink to={details.epoch(r.epochNo)}>{r.epochNo}</StyledLink>
},
{
title: <Capitalize>{t("glossary.slot")}</Capitalize>,
key: "epochSlotNo",
minWidth: "100px"
},
{
title: <Capitalize>{t("glossary.absoluteSlot")}</Capitalize>,
key: "slotNo",
minWidth: "100px"
},
{
title: <Capitalize>{t("createdAt")}</Capitalize>,
Expand Down
3 changes: 2 additions & 1 deletion src/pages/TransactionDetail/TransactionDetail.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const transaction = {
confirmation: 10,
fee: 100,
totalOutput: 1000,
maxEpochSlot: 1000
maxEpochSlot: 1000,
slotNo: 1000
},
summary: {
stakeAddress: [
Expand Down
1 change: 1 addition & 0 deletions src/types/transactions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ interface Transaction {
fee: number;
totalOutput: number;
maxEpochSlot: number;
slotNo: number;
};
summary: {
stakeAddress: {
Expand Down

0 comments on commit bc5a7e2

Please sign in to comment.