From 519ea734450c020963f9787adf28dbb4ea89e9c7 Mon Sep 17 00:00:00 2001 From: Martin Domajnko <35891136+martines3000@users.noreply.github.com> Date: Tue, 14 Jan 2025 12:08:25 +0100 Subject: [PATCH] chore: tooltip for info bowl, new banner (#239) --- .../DashboardView/AssetsTable/BorrowTable.tsx | 34 +-------- .../DashboardView/AssetsTable/LendTable.tsx | 34 +-------- .../DashboardView/Stats/InfoBowl.tsx | 38 ++++++---- .../components/MarketsView/MarketOverview.tsx | 70 ++----------------- .../components/MarketsView/MarketTableRow.tsx | 58 ++------------- apps/frontend/src/components/Navbar/index.tsx | 14 ++-- .../src/components/NetBorrowTooltip/index.tsx | 43 ++++++++++++ .../src/components/NetEarnTooltip/index.tsx | 43 ++++++++++++ 8 files changed, 134 insertions(+), 200 deletions(-) create mode 100644 apps/frontend/src/components/NetBorrowTooltip/index.tsx create mode 100644 apps/frontend/src/components/NetEarnTooltip/index.tsx diff --git a/apps/frontend/src/components/DashboardView/AssetsTable/BorrowTable.tsx b/apps/frontend/src/components/DashboardView/AssetsTable/BorrowTable.tsx index fcf882ca..2119f6b9 100644 --- a/apps/frontend/src/components/DashboardView/AssetsTable/BorrowTable.tsx +++ b/apps/frontend/src/components/DashboardView/AssetsTable/BorrowTable.tsx @@ -1,5 +1,6 @@ import { InfoIcon } from '@/components/InfoIcon'; import { Line } from '@/components/Line'; +import { NetBorrowTooltip } from '@/components/NetBorrowTooltip'; import { PointIcons } from '@/components/PointIcons'; import { POINTS_BORROW, @@ -343,38 +344,7 @@ export const BorrowTable = () => { preventDefault: () => any; }) => e.preventDefault()} > -
-
- Net Borrow APY -
-
-
-
Borrow APY
-
- {aprData?.borrowBaseApr.times(100).toFixed(2)}% -
-
-
-
-
Reward APY
-
- Distributed in $FUEL -
-
-
- - {aprData?.borrowRewardApr.times(100).toFixed(2)} - % -
-
-
- -
-
Net Borrow APY
-
- {aprData?.netBorrowApr.times(100).toFixed(2)}% -
-
-
+ diff --git a/apps/frontend/src/components/DashboardView/AssetsTable/LendTable.tsx b/apps/frontend/src/components/DashboardView/AssetsTable/LendTable.tsx index 06ee2361..0d078400 100644 --- a/apps/frontend/src/components/DashboardView/AssetsTable/LendTable.tsx +++ b/apps/frontend/src/components/DashboardView/AssetsTable/LendTable.tsx @@ -1,5 +1,6 @@ import { InfoIcon } from '@/components/InfoIcon'; import { Line } from '@/components/Line'; +import { NetEarnTooltip } from '@/components/NetEarnTooltip'; import { PointIcons } from '@/components/PointIcons'; import { POINTS_LEND, POINTS_LM } from '@/components/PointIcons/PointsTooltip'; import { Title } from '@/components/Title'; @@ -305,38 +306,7 @@ export const LendTable = () => { preventDefault: () => any; }) => e.preventDefault()} > -
-
- Net Earn APY -
-
-
-
Earn APY
-
- {aprData?.supplyBaseApr.times(100).toFixed(2)}% -
-
-
-
-
Reward APY
-
- Distributed in $FUEL -
-
-
- + {aprData?.supplyRewardApr.times(100).toFixed(2)} - % -
-
- -
-
Net Earn APY
-
- {aprData?.netSupplyApr.times(100).toFixed(2)}% -
-
-
-
+ diff --git a/apps/frontend/src/components/DashboardView/Stats/InfoBowl.tsx b/apps/frontend/src/components/DashboardView/Stats/InfoBowl.tsx index 4380bf70..c5b4d67c 100644 --- a/apps/frontend/src/components/DashboardView/Stats/InfoBowl.tsx +++ b/apps/frontend/src/components/DashboardView/Stats/InfoBowl.tsx @@ -1,3 +1,5 @@ +import { NetBorrowTooltip } from '@/components/NetBorrowTooltip'; +import { NetEarnTooltip } from '@/components/NetEarnTooltip'; import { Skeleton } from '@/components/ui/skeleton'; import { Tooltip, @@ -169,24 +171,36 @@ export const InfoBowl = () => { e.preventDefault()} > -
- - Liquidation Risk{' '} - - is a measure of how close your position is to being{' '} - liquidated. The - higher the percentage, the closer you are to liquidation. Upon - reaching 100%, - your position will be{' '} - liquidated. -
+ {bowlMode === 2 && ( +
+ + Liquidation Risk{' '} + + is a measure of how close your position is to being{' '} + liquidated. + The higher the percentage, the closer you are to liquidation. Upon + reaching 100% + , your position will be{' '} + liquidated. +
+ )} + {bowlMode === 1 && ( +
+ +
+ )} + {bowlMode === 0 && ( +
+ +
+ )}
diff --git a/apps/frontend/src/components/MarketsView/MarketOverview.tsx b/apps/frontend/src/components/MarketsView/MarketOverview.tsx index d6152e0d..96b3a9c3 100644 --- a/apps/frontend/src/components/MarketsView/MarketOverview.tsx +++ b/apps/frontend/src/components/MarketsView/MarketOverview.tsx @@ -27,6 +27,8 @@ import type React from 'react'; import { useMemo } from 'react'; import { IconPair } from '../IconPair'; import { Line } from '../Line'; +import { NetBorrowTooltip } from '../NetBorrowTooltip'; +import { NetEarnTooltip } from '../NetEarnTooltip'; import { Tooltip, TooltipContent, @@ -285,39 +287,7 @@ export default function MarketOverview({ preventDefault: () => any; }) => e.preventDefault()} > -
-
- Net Borrow APY -
-
-
-
Borrow APY
-
- {aprData?.borrowBaseApr.times(100).toFixed(2)}% -
-
-
-
-
Reward APY
-
- Distributed in $FUEL -
-
-
- -{' '} - {aprData?.borrowRewardApr.times(100).toFixed(2)} - % -
-
-
- -
-
Net Borrow APY
-
- {aprData?.netBorrowApr.times(100).toFixed(2)}% -
-
-
+ @@ -348,39 +318,7 @@ export default function MarketOverview({ preventDefault: () => any; }) => e.preventDefault()} > -
-
- Net Earn APY -
-
-
-
Earn APY
-
- {aprData?.supplyBaseApr.times(100).toFixed(2)}% -
-
-
-
-
Reward APY
-
- Distributed in $FUEL -
-
-
- +{' '} - {aprData?.supplyRewardApr.times(100).toFixed(2)} - % -
-
- -
-
Net Earn APY
-
- {aprData?.netSupplyApr.times(100).toFixed(2)}% -
-
-
-
+ diff --git a/apps/frontend/src/components/MarketsView/MarketTableRow.tsx b/apps/frontend/src/components/MarketsView/MarketTableRow.tsx index 758a3582..93caf300 100644 --- a/apps/frontend/src/components/MarketsView/MarketTableRow.tsx +++ b/apps/frontend/src/components/MarketsView/MarketTableRow.tsx @@ -28,6 +28,8 @@ import SWAY from '/public/tokens/sway.svg?url'; import { CircularProgressBar } from '../CircularProgressBar'; import { type Collateral, CollateralIcons } from '../CollateralIcons'; import { Line } from '../Line'; +import { NetBorrowTooltip } from '../NetBorrowTooltip'; +import { NetEarnTooltip } from '../NetEarnTooltip'; import { Skeleton } from '../ui/skeleton'; import { Tooltip, @@ -179,33 +181,7 @@ export const MarketTableRow = ({ preventDefault: () => any; }) => e.preventDefault()} > -
-
- Net Earn APY -
-
-
-
Earn APY
-
{aprData?.supplyBaseApr.times(100).toFixed(2)}%
-
-
-
-
Reward APY
-
- Distributed in $FUEL -
-
-
- + {aprData?.supplyRewardApr.times(100).toFixed(2)}% -
-
- -
-
Net Earn APY
-
{aprData?.netSupplyApr.times(100).toFixed(2)}%
-
-
-
+ @@ -228,33 +204,7 @@ export const MarketTableRow = ({ preventDefault: () => any; }) => e.preventDefault()} > -
-
- Net Borrow APY -
-
-
-
Borrow APY
-
{aprData?.borrowBaseApr.times(100).toFixed(2)}%
-
-
-
-
Reward APY
-
- Distributed in $FUEL -
-
-
- - {aprData?.borrowRewardApr.times(100).toFixed(2)}% -
-
-
- -
-
Net Borrow APY
-
{aprData?.netBorrowApr.times(100).toFixed(2)}%
-
-
+ diff --git a/apps/frontend/src/components/Navbar/index.tsx b/apps/frontend/src/components/Navbar/index.tsx index 658bdfb3..ef4a8c3f 100644 --- a/apps/frontend/src/components/Navbar/index.tsx +++ b/apps/frontend/src/components/Navbar/index.tsx @@ -59,16 +59,22 @@ export const Navbar = ({ mobile = false }: { mobile?: boolean }) => { return ( <> -
- SwayPoints are live! Start earning points now. +
+ Phase 2 & Fuel Points are over! 🎉 View your points - Learn more + here + . +
+
+ Fuel Season 1 starts NOW! Earn Fuel tokens by: Borrowing USDC using ETH, + FUEL, and USDT as collateral. Supplying USDC. Your journey to greater + rewards begins today. 🔥
{/* DESKTOP */}
diff --git a/apps/frontend/src/components/NetBorrowTooltip/index.tsx b/apps/frontend/src/components/NetBorrowTooltip/index.tsx new file mode 100644 index 00000000..4f90fd67 --- /dev/null +++ b/apps/frontend/src/components/NetBorrowTooltip/index.tsx @@ -0,0 +1,43 @@ +import BigNumber from 'bignumber.js'; +import { Line } from '../Line'; + +type NetBorrowTooltipProps = { + aprData: + | { + supplyBaseApr: BigNumber; + borrowBaseApr: BigNumber; + supplyRewardApr: BigNumber; + borrowRewardApr: BigNumber; + netSupplyApr: BigNumber; + netBorrowApr: BigNumber; + } + | undefined; +}; + +export const NetBorrowTooltip = ({ aprData }: NetBorrowTooltipProps) => { + return ( +
+
+ Net Borrow APY +
+
+
+
Borrow APY
+
{aprData?.borrowBaseApr.times(100).toFixed(2)}%
+
+
+
+
Reward APY
+
Distributed in $FUEL
+
+
- {aprData?.borrowRewardApr.times(100).toFixed(2)}%
+
+
+ +
+
Net Borrow APY
+
{aprData?.netBorrowApr.times(100).toFixed(2)}%
+
+
+ ); +}; diff --git a/apps/frontend/src/components/NetEarnTooltip/index.tsx b/apps/frontend/src/components/NetEarnTooltip/index.tsx new file mode 100644 index 00000000..48e74015 --- /dev/null +++ b/apps/frontend/src/components/NetEarnTooltip/index.tsx @@ -0,0 +1,43 @@ +import BigNumber from 'bignumber.js'; +import { Line } from '../Line'; + +type NetEarnTooltipProps = { + aprData: + | { + supplyBaseApr: BigNumber; + borrowBaseApr: BigNumber; + supplyRewardApr: BigNumber; + borrowRewardApr: BigNumber; + netSupplyApr: BigNumber; + netBorrowApr: BigNumber; + } + | undefined; +}; + +export const NetEarnTooltip = ({ aprData }: NetEarnTooltipProps) => { + return ( +
+
+ Net Earn APY +
+
+
+
Earn APY
+
{aprData?.supplyBaseApr.times(100).toFixed(2)}%
+
+
+
+
Reward APY
+
Distributed in $FUEL
+
+
+ {aprData?.supplyRewardApr.times(100).toFixed(2)}%
+
+ +
+
Net Earn APY
+
{aprData?.netSupplyApr.times(100).toFixed(2)}%
+
+
+
+ ); +};