diff --git a/apps/namadillo/src/App/AccountOverview/AccountOverview.tsx b/apps/namadillo/src/App/AccountOverview/AccountOverview.tsx index 3e6d4eff9..f46c69a1e 100644 --- a/apps/namadillo/src/App/AccountOverview/AccountOverview.tsx +++ b/apps/namadillo/src/App/AccountOverview/AccountOverview.tsx @@ -29,8 +29,8 @@ export const AccountOverview = (): JSX.Element => {
{claimRewardsEnabled ?
-
- +
+ diff --git a/apps/namadillo/src/App/AccountOverview/NamBalanceContainer.tsx b/apps/namadillo/src/App/AccountOverview/NamBalanceContainer.tsx index ad32525e1..0499871a9 100644 --- a/apps/namadillo/src/App/AccountOverview/NamBalanceContainer.tsx +++ b/apps/namadillo/src/App/AccountOverview/NamBalanceContainer.tsx @@ -1,4 +1,4 @@ -import { Stack } from "@namada/components"; +import { SkeletonLoading, Stack } from "@namada/components"; import { AtomErrorBoundary } from "App/Common/AtomErrorBoundary"; import { BalanceChart } from "App/Common/BalanceChart"; import { NamCurrency } from "App/Common/NamCurrency"; @@ -12,12 +12,14 @@ type NamBalanceListItemProps = { title: string; color: string; amount: BigNumber; + isLoading: boolean; }; const NamBalanceListItem = ({ title, color, amount, + isLoading, }: NamBalanceListItemProps): JSX.Element => { return (
  • {title} - + {isLoading ? + + : + }
  • ); }; @@ -43,7 +48,6 @@ export const NamBalanceContainer = (): JSX.Element => { balanceQuery, stakeQuery, isLoading, - isSuccess, availableAmount, bondedAmount, shieldedAmount, @@ -53,16 +57,15 @@ export const NamBalanceContainer = (): JSX.Element => { } = useBalances(); return ( -
    +
    -
    +
    { title="Shielded Assets" color={colors.shielded} amount={shieldedAmount} + isLoading={isLoading} /> )}
    diff --git a/apps/namadillo/src/App/Common/BalanceChart.tsx b/apps/namadillo/src/App/Common/BalanceChart.tsx index d08f85fc8..633beef51 100644 --- a/apps/namadillo/src/App/Common/BalanceChart.tsx +++ b/apps/namadillo/src/App/Common/BalanceChart.tsx @@ -17,7 +17,6 @@ type BalanceChartProps = { shieldedAmount: BigNumber; totalAmount: BigNumber; isLoading: boolean; - isSuccess: boolean; }; export const BalanceChart = ({ @@ -29,7 +28,6 @@ export const BalanceChart = ({ shieldedAmount, totalAmount, isLoading, - isSuccess, }: BalanceChartProps): JSX.Element => { const getPiechartData = (): Array => { if (isLoading) { @@ -70,27 +68,25 @@ export const BalanceChart = ({ }; return ( -
    - {isLoading && ( +
    + {isLoading ? - )} - {isSuccess && ( - {view === "stake" && renderTextSummary("Total Staked Balance", bondedAmount)} {view === "total" && renderTextSummary("Total Balance", totalAmount)} - )} + }
    ); }; diff --git a/apps/namadillo/src/App/Masp/MaspOverview.tsx b/apps/namadillo/src/App/Masp/MaspOverview.tsx index 1693c967f..ef2a7cdd9 100644 --- a/apps/namadillo/src/App/Masp/MaspOverview.tsx +++ b/apps/namadillo/src/App/Masp/MaspOverview.tsx @@ -11,7 +11,7 @@ export const MaspOverview: React.FC = () => { return (
    {!userHasAccount && } -
    +
    diff --git a/apps/namadillo/src/App/Masp/ShieldedBalanceChart.tsx b/apps/namadillo/src/App/Masp/ShieldedBalanceChart.tsx index 7a5399bf1..6ffc18d51 100644 --- a/apps/namadillo/src/App/Masp/ShieldedBalanceChart.tsx +++ b/apps/namadillo/src/App/Masp/ShieldedBalanceChart.tsx @@ -17,35 +17,37 @@ export const ShieldedBalanceChart = (): JSX.Element => { const { data } = useAtomValue(totalShieldedBalanceAtom); return ( - -
    - {data ? - -
    - - Shielded Balance - -
    - +
    +
    + + {data !== undefined ? + +
    + + Shielded Balance + +
    + +
    -
    - - : - } + + : + } +
    - +
    ); }; diff --git a/apps/namadillo/src/App/Masp/ShieldedNamBalance.tsx b/apps/namadillo/src/App/Masp/ShieldedNamBalance.tsx index 771947703..f46ecffd3 100644 --- a/apps/namadillo/src/App/Masp/ShieldedNamBalance.tsx +++ b/apps/namadillo/src/App/Masp/ShieldedNamBalance.tsx @@ -2,6 +2,7 @@ import { SkeletonLoading, Stack, Tooltip } from "@namada/components"; import { AtomErrorBoundary } from "App/Common/AtomErrorBoundary"; import { NamCurrency } from "App/Common/NamCurrency"; import { namShieldedBalanceAtom, shieldedBalanceAtom } from "atoms/masp/atoms"; +import { applicationFeaturesAtom } from "atoms/settings/atoms"; import BigNumber from "bignumber.js"; import { useAtomValue } from "jotai"; import { GoInfo } from "react-icons/go"; @@ -31,6 +32,7 @@ const AsyncNamCurrency = ({ amount }: { amount?: BigNumber }): JSX.Element => { export const ShieldedNamBalance = (): JSX.Element => { const shieldedBalanceQuery = useAtomValue(shieldedBalanceAtom); const { data: namAmount } = useAtomValue(namShieldedBalanceAtom); + const { shieldingRewardsEnabled } = useAtomValue(applicationFeaturesAtom); return ( { className={twMerge( "relative", "flex flex-col gap-4 justify-between", - "rounded-sm bg-neutral-900 p-4 " + "rounded-sm bg-neutral-900 p-4", + !shieldingRewardsEnabled && + "opacity-25 pointer-events-none select-none" )} >
    @@ -93,14 +97,18 @@ export const ShieldedNamBalance = (): JSX.Element => {
    rewards per Epoch
    - + {shieldingRewardsEnabled ? + + :
    --
    }
    - Shielding more assets will increase your rewards + {shieldingRewardsEnabled ? + "Shielding more assets will increase your rewards" + : "Shielding Rewards will be enabled in phase 4"}
    diff --git a/apps/namadillo/src/App/Staking/StakingSummary.tsx b/apps/namadillo/src/App/Staking/StakingSummary.tsx index 277d038e0..356cde27d 100644 --- a/apps/namadillo/src/App/Staking/StakingSummary.tsx +++ b/apps/namadillo/src/App/Staking/StakingSummary.tsx @@ -16,7 +16,6 @@ export const StakingSummary = (): JSX.Element => { balanceQuery, stakeQuery, isLoading, - isSuccess, availableAmount, bondedAmount, shieldedAmount, @@ -26,8 +25,8 @@ export const StakingSummary = (): JSX.Element => { } = useBalances(); return ( -
      - +
        + { ((get) => { refetchInterval: enablePolling ? 1000 : false, queryKey: ["total-shielded-balance"], ...queryDependentFn(async () => { - if (!shieldedBalanceQuery.data) { + if (!shieldedBalanceQuery.data?.length) { return new BigNumber(0); } // TODO convert to fiat values @@ -71,7 +71,7 @@ export const namShieldedBalanceAtom = atomWithQuery((get) => { queryKey: ["nam-shielded-balance"], ...queryDependentFn(async () => { const namTokenAddress = namTokenAddressQuery.data; - if (!shieldedBalanceQuery.data || !namTokenAddress) { + if (!shieldedBalanceQuery.data?.length || !namTokenAddress) { return new BigNumber(0); } return BigNumber.sum( diff --git a/apps/namadillo/src/hooks/useBalances.ts b/apps/namadillo/src/hooks/useBalances.ts index ffcf7ff69..c75fc3a13 100644 --- a/apps/namadillo/src/hooks/useBalances.ts +++ b/apps/namadillo/src/hooks/useBalances.ts @@ -35,11 +35,9 @@ export const useBalances = (): useBalancesOutput => { isSuccess: isStakedBalanceLoaded, } = totalStakedBalance; - const { - data: shieldedBalance, - isLoading: isFetchingShieldedBalance, - isSuccess: isShieldedBalanceLoaded, - } = totalShieldedBalance; + const { data: shieldedBalance } = totalShieldedBalance; + const isFetchingShieldedBalance = shieldedBalance === undefined; + const isShieldedBalanceLoaded = !isFetchingShieldedBalance; const availableAmount = new BigNumber(balance || 0); const bondedAmount = new BigNumber(stakeBalance?.totalBonded || 0); diff --git a/packages/components/src/PieChart.tsx b/packages/components/src/PieChart.tsx index 6205b2e2a..6006ea329 100644 --- a/packages/components/src/PieChart.tsx +++ b/packages/components/src/PieChart.tsx @@ -35,7 +35,7 @@ export const PieChart = ({ onMouseLeave, ...svgProps }: PieChartProps): JSX.Element => { - const length = 2 * Math.PI * (radius - strokeWidth); + const length = 2 * Math.PI * (radius - strokeWidth / 2); const indexedData = data.map((dataItem, index) => ({ ...dataItem, originalIndex: index, // needed to preserve index when some values are 0 @@ -68,7 +68,7 @@ export const PieChart = ({ strokeWidth={strokeWidth} strokeDashoffset={offset} strokeDasharray={`${segmentLength} ${length}`} - r={radius - strokeWidth} + r={radius - strokeWidth / 2} stroke={dataItem.color} aria-label={dataItem.label || ""} onMouseEnter={