Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

fix: display value cost model in ios #3100

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/commons/utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -39,7 +40,7 @@ const ProtocolUpdate: React.FC<IProps> = ({ data }) => {
onClick={() => r.protocol === "costModel" && setCostModelScript(r.oldValue?.toString() || "")}
color={({ palette }) => (r.protocol === "costModel" ? palette.primary.main : "unset")}
>
<LimitCell> {r.oldValue}</LimitCell>
<LimitCell>{getShortValue(r.oldValue?.toString())}</LimitCell>
</UpdatedValue>
</CustomTooltip>
);
Expand All @@ -59,7 +60,7 @@ const ProtocolUpdate: React.FC<IProps> = ({ data }) => {
onClick={() => r.protocol === "costModel" && setCostModelScript(r.value?.toString() || "")}
color={({ palette }) => (r.protocol === "costModel" ? palette.primary.main : "unset")}
>
<LimitCell>{r.value}</LimitCell>
<LimitCell>{getShortValue(r.value?.toString())}</LimitCell>
</UpdatedValue>
</CustomTooltip>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
`;
Loading