diff --git a/src/commons/utils/helper.ts b/src/commons/utils/helper.ts index 27fe247b10..afababd3b5 100644 --- a/src/commons/utils/helper.ts +++ b/src/commons/utils/helper.ts @@ -30,6 +30,9 @@ export const getShortHashXs = (address = "", firstpart?: number, lastPart?: numb if (address?.length <= 18) return address; return address ? `${address.slice(0, firstpart ? firstpart : 7)}...${address.slice(-(lastPart ? lastPart : 5))}` : ""; }; +export const getShortValue = (address = "", length = 50) => { + return address.slice(0, length); +}; export const LARGE_NUMBER_ABBREVIATIONS = ["", "K", "M", "B", "T", "q", "Q", "s", "S"]; diff --git a/src/components/TransactionDetail/TransactionMetadata/ProtocolUpdate/index.tsx b/src/components/TransactionDetail/TransactionMetadata/ProtocolUpdate/index.tsx index 773c7273a0..a26f229e75 100644 --- a/src/components/TransactionDetail/TransactionMetadata/ProtocolUpdate/index.tsx +++ b/src/components/TransactionDetail/TransactionMetadata/ProtocolUpdate/index.tsx @@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next"; import { Column } from "src/components/commons/Table"; import ParseScriptModal from "src/components/ParseScriptModal"; import CustomTooltip from "src/components/commons/CustomTooltip"; +import { getShortValue } from "src/commons/utils/helper"; import { LimitCell, TableProtocol, UpdatedValue, Wrapper } from "./styles"; @@ -39,7 +40,7 @@ const ProtocolUpdate: React.FC = ({ data }) => { onClick={() => r.protocol === "costModel" && setCostModelScript(r.oldValue?.toString() || "")} color={({ palette }) => (r.protocol === "costModel" ? palette.primary.main : "unset")} > - {r.oldValue} + {getShortValue(r.oldValue?.toString())} ); @@ -59,7 +60,7 @@ const ProtocolUpdate: React.FC = ({ data }) => { onClick={() => r.protocol === "costModel" && setCostModelScript(r.value?.toString() || "")} color={({ palette }) => (r.protocol === "costModel" ? palette.primary.main : "unset")} > - {r.value} + {getShortValue(r.value?.toString())} ); diff --git a/src/components/TransactionDetail/TransactionMetadata/ProtocolUpdate/styles.ts b/src/components/TransactionDetail/TransactionMetadata/ProtocolUpdate/styles.ts index f2723c33f5..2020d44642 100644 --- a/src/components/TransactionDetail/TransactionMetadata/ProtocolUpdate/styles.ts +++ b/src/components/TransactionDetail/TransactionMetadata/ProtocolUpdate/styles.ts @@ -47,4 +47,10 @@ export const LimitCell = styled(Box)` overflow: hidden; white-space: nowrap; text-overflow: ellipsis; + ${({ theme }) => theme.breakpoints.between("xs", "sm")} { + max-width: 120px; + } + ${({ theme }) => theme.breakpoints.between("sm", "md")} { + max-width: 220px; + } `;