Skip to content

Commit

Permalink
fix: mobile navbar links (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
tadejpodrekar authored Jan 13, 2025
1 parent 1a9f30c commit 4271104
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,16 @@ const CollateralTableRow = ({
collateralConfiguration.supply_cap.toString()
),
decimals
)
),
2
)}{' '}
{appConfig.assets[assetId]}
</div>
</div>
<div className="text-md flex justify-between">
<div className="text-lavender">Total Supplied</div>
<div className="font-semibold text-moon">
{getFormattedNumber(collateralAmount)}{' '}
{getFormattedNumber(collateralAmount, 2)}{' '}
{appConfig.assets[assetId]}
</div>
</div>
Expand Down Expand Up @@ -229,7 +230,8 @@ const CollateralTableRow = ({
collateralConfiguration.supply_cap.toString()
),
decimals
)
),
2
)}{' '}
{appConfig.assets[assetId]}
</div>
Expand All @@ -251,7 +253,7 @@ const CollateralTableRow = ({
<div className="text-md flex justify-between">
<div className="text-lavender">Total Supplied</div>
<div className="font-semibold text-moon">
{getFormattedNumber(collateralAmount)}{' '}
{getFormattedNumber(collateralAmount, 2)}{' '}
{appConfig.assets[assetId]}
</div>
</div>
Expand Down
39 changes: 22 additions & 17 deletions apps/frontend/src/components/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,24 +278,29 @@ export const Navbar = ({ mobile = false }: { mobile?: boolean }) => {
Dashboard
</div>
</Link>
{NAVBAR_LINKS.map(({ href, label }) => (
<Link
key={href}
href={href}
onMouseDown={() => setOpen(false)}
prefetch={false}
>
<div
className={cn(
pathname === href ? 'text-primary' : 'text-lavender',
pathname !== href && 'hover:text-lavender/80',
'flex font-bold text-xl items-center gap-x-2 h-full'
)}
{NAVBAR_LINKS.map(({ href, label }) => {
if (mobile && href === '/markets') return null;
return (
<Link
key={href}
href={href}
onMouseDown={() => setOpen(false)}
prefetch={false}
>
{label}
</div>
</Link>
))}
<div
className={cn(
pathname === href
? 'text-primary'
: 'text-lavender',
pathname !== href && 'hover:text-lavender/80',
'flex font-bold text-xl items-center gap-x-2 h-full'
)}
>
{label}
</div>
</Link>
);
})}
</div>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion apps/frontend/src/utils/price.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const getFormattedPrice = (number: BigNumber): string => {

export const getFormattedNumber = (
number: BigNumber,
decimals = 4,
positive?: boolean
): string => {
if (!number || number.isNaN() || number.eq(0)) return '0.0';
Expand All @@ -35,5 +36,5 @@ export const getFormattedNumber = (
return '0.0';
}

return `${number.toFixed(4, BigNumber.ROUND_FLOOR)}`;
return `${number.toFixed(decimals, BigNumber.ROUND_FLOOR)}`;
};

0 comments on commit 4271104

Please sign in to comment.