Skip to content

Commit d837833

Browse files
committed
feat: update decimals lenght for big eth amount
1 parent 592a6fa commit d837833

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

features/overview/shared/overview-item/overview-item-value.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { type FC, useMemo } from 'react';
33
import { InlineLoader } from 'shared/components';
44
import { FormatToken } from 'shared/formatters';
55
import { isBigint } from 'utils';
6+
import { WEI_PER_ETHER } from 'consts/tx';
67

78
import { ContentText } from './styles';
89

@@ -14,14 +15,18 @@ export interface ItemValueProps {
1415
textSize?: 'lg' | 'xl';
1516
}
1617

18+
const countMaxDecimalDigits = (amount: bigint) => {
19+
return amount / WEI_PER_ETHER > 1000 ? 1 : 4;
20+
};
21+
1722
export const OverviewItemValue: FC<ItemValueProps> = (props) => {
1823
const { content, isLoading, color, textSize = 'xl', symbol = '' } = props;
1924
const contentView = useMemo(
2025
() =>
2126
isBigint(content) ? (
2227
<FormatToken
2328
amount={content}
24-
maxDecimalDigits={4}
29+
maxDecimalDigits={countMaxDecimalDigits(content)}
2530
showAmountTip={false}
2631
symbol={symbol}
2732
/>

shared/components/layout/styles.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const LayoutStyles = styled(Container)<{ isError: boolean }>`
5656
min-height: 100vh;
5757
height: auto;
5858
59-
@media ${devicesHeaderMedia.tablet} {
59+
@media ${devicesHeaderMedia.laptop} {
6060
grid-template-columns: 200px 1fr;
6161
grid-template-areas: ${({ isError }) =>
6262
tabletTemplateAreas[isError ? 'withError' : 'default']};

styles/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export const NAV_MOBILE_HEIGHT = 60;
22
export const NAV_MOBILE_MAX_WIDTH = 880;
33
export const NAV_TABLET_MAX_WIDTH = 1024;
4+
export const NAV_LAPTOP_MAX_WIDTH = 1200;

styles/global.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import { createGlobalStyle } from 'styled-components';
22
import { ThemeName } from '@lidofinance/lido-ui';
33

44
import {
5+
NAV_LAPTOP_MAX_WIDTH,
56
NAV_MOBILE_HEIGHT,
67
NAV_MOBILE_MAX_WIDTH,
78
NAV_TABLET_MAX_WIDTH,
89
} from './constants';
910

1011
export const devicesHeaderMedia = {
12+
laptop: `screen and (max-width: ${NAV_LAPTOP_MAX_WIDTH}px)`,
1113
tablet: `screen and (max-width: ${NAV_TABLET_MAX_WIDTH}px)`,
1214
mobile: `screen and (max-width: ${NAV_MOBILE_MAX_WIDTH}px)`,
1315
};

0 commit comments

Comments
 (0)