diff --git a/nym-wallet/src/components/Rewards/RewardsSummary.tsx b/nym-wallet/src/components/Rewards/RewardsSummary.tsx
index c6e48b395c..75f7da4a7b 100644
--- a/nym-wallet/src/components/Rewards/RewardsSummary.tsx
+++ b/nym-wallet/src/components/Rewards/RewardsSummary.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { CircularProgress, Stack, Typography } from '@mui/material';
+import { CircularProgress, Stack, StackProps, Typography, useMediaQuery } from '@mui/material';
import { useTheme } from '@mui/material/styles';
import { useDelegationContext } from 'src/context/delegations';
import { InfoTooltip } from '../InfoToolTip';
@@ -9,34 +9,63 @@ export const RewardsSummary: FCWithChildren<{
totalDelegation?: string;
totalRewards?: string;
}> = ({ isLoading, totalDelegation, totalRewards }) => {
- const theme = useTheme();
-
const { totalDelegationsAndRewards } = useDelegationContext();
return (
-
-
- Total delegations:
-
- {isLoading ? : totalDelegationsAndRewards || '-'}
-
-
-
-
- Original delegations:
-
- {isLoading ? : totalDelegation || '-'}
-
-
-
-
- Total rewards:
-
- {isLoading ? : totalRewards || '-'}
-
-
+
+ }
+ />
+ }
+ />
+
+ }
+ />
);
};
+
+const RewardSummaryField = ({
+ title,
+ value,
+ Tooltip,
+ isLoading,
+}: {
+ title: string;
+ value: string;
+ Tooltip?: React.ReactNode;
+ isLoading?: boolean;
+}) => {
+ const breakpoint = useMediaQuery(useTheme().breakpoints.down('xl'));
+ const alignProps: { gap: number; direction: StackProps['direction'] } = {
+ gap: breakpoint ? 0 : 1,
+ direction: breakpoint ? 'column' : 'row',
+ };
+
+ return (
+
+
+ {Tooltip}
+ {title}:
+
+
+ {isLoading ? : value}
+
+
+ );
+};
diff --git a/nym-wallet/src/pages/delegation/index.tsx b/nym-wallet/src/pages/delegation/index.tsx
index 8f934cb83c..64a24b41db 100644
--- a/nym-wallet/src/pages/delegation/index.tsx
+++ b/nym-wallet/src/pages/delegation/index.tsx
@@ -9,6 +9,7 @@ import { TPoolOption } from 'src/components';
import { Console } from 'src/utils/console';
import { OverSaturatedBlockerModal } from 'src/components/Delegation/DelegateBlocker';
import { getSpendableCoins, userBalance } from 'src/requests';
+import { LoadingModal } from 'src/components/Modals/LoadingModal';
import { getIntervalAsDate, toPercentIntegerString } from 'src/utils';
import { RewardsSummary } from '../../components/Rewards/RewardsSummary';
import { DelegationContextProvider, TDelegations, useDelegationContext } from '../../context/delegations';
@@ -302,14 +303,16 @@ export const Delegation: FC<{ isStorybook?: boolean }> = ({ isStorybook }) => {
};
const delegationsComponent = (delegationItems: TDelegations | undefined) => {
- return (
-
- );
+ if (delegationItems && Boolean(delegationItems?.length)) {
+ return (
+
+ );
+ }
return (
@@ -342,6 +345,10 @@ export const Delegation: FC<{ isStorybook?: boolean }> = ({ isStorybook }) => {
);
};
+ if (isLoading) {
+ return ;
+ }
+
return (
<>