Skip to content

Commit

Permalink
fix: adjust height of points box and fix decimal format
Browse files Browse the repository at this point in the history
  • Loading branch information
rozanagy committed Nov 4, 2024
1 parent c58c46d commit f0d404b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CustomSkeleton } from '@components/custom-skeleton/custom-skeleton';
import { ProtocolRewards } from '@models/points.models';
import { unshiftValue } from 'dlc-btc-lib/utilities';

import { formatNumber } from '@shared/utils';
import { formatNumber, formatToThreeDecimals } from '@shared/utils';

export function PointsTableItem(pointsTableItem: ProtocolRewards): React.JSX.Element {
const isMobile = useBreakpointValue({ base: true, md: false });
Expand Down Expand Up @@ -49,7 +49,7 @@ export function PointsTableItem(pointsTableItem: ProtocolRewards): React.JSX.Ele
<HStack w={'25%'}>
<Image src={'/images/logos/dlc-btc-logo.svg'} alt={'dlc BTC logo'} boxSize={'25px'} />
<Text color={'white'} fontSize={'sm'} fontWeight={800}>
{unshiftValue(currentTokens)}
{formatToThreeDecimals(unshiftValue(currentTokens))}
</Text>
</HStack>
<HStack w={'50%'}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface PointsTableProps {
}

export function PointsTable({ items }: PointsTableProps): React.JSX.Element {
const dynamicHeight = items ? items.length * 59 + 20 : 20;
const dynamicHeight = items ? items.length * 59 + 50 : 20;
const isMobile = useBreakpointValue({ base: true, md: false });

return (
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/points/points.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function Points(): React.JSX.Element {
<TokenStatsBoardLayout>
<Stack
w={'100%'}
alignItems={'flex-start'}
alignItems={'center'}
direction={isMobile ? 'column' : 'row'}
p={isMobile ? '15px' : '0px'}
gap={isMobile ? '10px' : '0px'}
Expand Down Expand Up @@ -103,7 +103,7 @@ export function Points(): React.JSX.Element {
<Divider
orientation={isMobile ? 'horizontal' : 'vertical'}
px={isMobile ? '0px' : '5px'}
height={isMobile ? '1px' : '300px'}
height={isMobile ? '1px' : '320px'}
variant={'thick'}
/>
<PointsTable items={userPoints?.protocols} />
Expand Down
4 changes: 4 additions & 0 deletions src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,9 @@ export function formatEvent(event: DetailedEvent): FormattedEvent {
};
}

export function formatToThreeDecimals(value: number): number {
return parseFloat(value.toFixed(3));
}

export const breakpoints = ['300px', '400px', '600px', '850px', '1280px', '1400px'];
export const titleTextSize = ['2xl', '2xl', '4xl', '6xl'];

0 comments on commit f0d404b

Please sign in to comment.