Skip to content

Commit

Permalink
Merge pull request #395 from lidofinance/feature/si-906-inconsistency…
Browse files Browse the repository at this point in the history
…-of-approveunlock-wording

[Fix ] wording
  • Loading branch information
jake4take authored Jul 16, 2024
2 parents 545417d + e092409 commit 2423f8d
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 23 deletions.
48 changes: 30 additions & 18 deletions features/rewards/components/errorBlocks/ErrorBlockNoSteth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,34 @@ import { Box, Button } from '@lidofinance/lido-ui';
import { HOME_PATH } from 'consts/urls';
import { LocalLink } from 'shared/components/local-link';

export const ErrorBlockNoSteth = () => (
<Box
id="nothingStaked"
display="flex"
flexDirection="column"
alignItems="center"
pt="32px"
pb="18px"
>
<Box textAlign="center" pb="12px">
You don&apos;t have staked tokens. Stake now and receive daily rewards.
</Box>
<LocalLink href={HOME_PATH}>
<Box width="150px">
<Button>Stake now</Button>
type ErrorBlockNoStethProps = {
hasSteth?: boolean;
};

export const ErrorBlockNoSteth = ({ hasSteth }: ErrorBlockNoStethProps) => {
const text = hasSteth
? "You haven't received rewards on your staked tokens yet. Please check back later to see your rewards."
: "You don't have staked tokens. Stake now and receive daily rewards.";

return (
<Box
id="nothingStaked"
display="flex"
flexDirection="column"
alignItems="center"
pt="32px"
pb="18px"
>
<Box textAlign="center" pb="12px">
{text}
</Box>
</LocalLink>
</Box>
);
<LocalLink href={HOME_PATH}>
{!hasSteth && (
<Box width="150px">
<Button>Stake now</Button>
</Box>
)}
</LocalLink>
</Box>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import {
ErrorWrapper,
} from './RewardsListContentStyles';
import { RewardsTable } from 'features/rewards/components/rewardsTable';
import { useSTETHBalance } from '@lido-sdk/react';
import { STRATEGY_LAZY } from 'consts/swr-strategies';
import { Zero } from '@ethersproject/constants';

export const RewardsListContent: FC = () => {
const {
Expand All @@ -22,10 +25,17 @@ export const RewardsListContent: FC = () => {
setPage,
isLagging,
} = useRewardsHistory();
const { data: stethBalance, initialLoading: isStethBalanceLoading } =
useSTETHBalance(STRATEGY_LAZY);
const hasSteth = stethBalance?.gt(Zero);

if (!data && !initialLoading && !error) return <RewardsListsEmpty />;
// showing loading when canceling requests and empty response
if ((!data && !error) || (initialLoading && !data?.events.length)) {
if (
(!data && !error) ||
(initialLoading && !data?.events.length) ||
isStethBalanceLoading
) {
return (
<>
<Divider indents="lg" />
Expand All @@ -42,7 +52,9 @@ export const RewardsListContent: FC = () => {
</ErrorWrapper>
);
}
if (data && data.events.length === 0) return <ErrorBlockNoSteth />;

if (data && data.events.length === 0)
return <ErrorBlockNoSteth hasSteth={hasSteth} />;

return (
<TableWrapperStyle data-testid="rewardsContent">
Expand Down
2 changes: 1 addition & 1 deletion features/withdrawals/request/form/transaction-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const TransactionInfo = () => {
const token = useWatch<RequestFormInputType, 'token'>({ name: 'token' });
const { requests } = useValidationResults();
const unlockCostTooltip = isApprovalFlow ? undefined : (
<>Lido leverages gasless token approvals via ERC-2612 permits</>
<>Lido leverages gasless token unlocks via ERC-2612 permits</>
);
const { txPriceUsd: requestTxPriceInUsd, loading: requestTxPriceLoading } =
useRequestTxPrice({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type { TokensWithdrawable } from 'features/withdrawals/types/tokens-withd

const STAGE_APPROVE_ARGS = {
willReceiveToken: 'wstETH',
operationText: 'Approving',
operationText: 'Unlocking',
};

const STAGE_OPERATION_ARGS = {
Expand Down
2 changes: 1 addition & 1 deletion features/wsteth/wrap/hooks/use-tx-modal-stages-wrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { TokensWrappable } from 'features/wsteth/shared/types';

const STAGE_APPROVE_ARGS = {
willReceiveToken: 'wstETH',
operationText: 'Approving',
operationText: 'Unlocking',
};

const STAGE_OPERATION_ARGS = {
Expand Down

0 comments on commit 2423f8d

Please sign in to comment.