Skip to content

Commit

Permalink
fix(suite): staking fraction buttons tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasklim committed Oct 17, 2024
1 parent 67ebaa5 commit 24931a9
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 49 deletions.
68 changes: 36 additions & 32 deletions packages/suite/src/components/suite/FormFractionButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,67 +53,71 @@ export const FormFractionButtons = ({
<Flex>
<Tooltip
content={
<Translation
id="TR_STAKE_MIN_AMOUNT_TOOLTIP"
values={{
amount: MIN_ETH_AMOUNT_FOR_STAKING.toString(),
symbol: symbol.toUpperCase(),
}}
/>
is10PercentDisabled && (
<Translation
id="TR_STAKE_MIN_AMOUNT_TOOLTIP"
values={{
amount: MIN_ETH_AMOUNT_FOR_STAKING.toString(),
symbol: symbol.toUpperCase(),
}}
/>
)
}
cursor="pointer"
disabled={!is10PercentDisabled}
>
<TinyButton isDisabled={is10PercentDisabled} onClick={() => setRatioAmount(10)}>
10%
</TinyButton>
</Tooltip>
<Tooltip
content={
<Translation
id="TR_STAKE_MIN_AMOUNT_TOOLTIP"
values={{
amount: MIN_ETH_AMOUNT_FOR_STAKING.toString(),
symbol: symbol.toUpperCase(),
}}
/>
is25PercentDisabled && (
<Translation
id="TR_STAKE_MIN_AMOUNT_TOOLTIP"
values={{
amount: MIN_ETH_AMOUNT_FOR_STAKING.toString(),
symbol: symbol.toUpperCase(),
}}
/>
)
}
cursor="pointer"
disabled={!is25PercentDisabled}
>
<TinyButton isDisabled={is25PercentDisabled} onClick={() => setRatioAmount(4)}>
25%
</TinyButton>
</Tooltip>
<Tooltip
content={
<Translation
id="TR_STAKE_MIN_AMOUNT_TOOLTIP"
values={{
amount: MIN_ETH_AMOUNT_FOR_STAKING.toString(),
symbol: symbol.toUpperCase(),
}}
/>
is50PercentDisabled && (
<Translation
id="TR_STAKE_MIN_AMOUNT_TOOLTIP"
values={{
amount: MIN_ETH_AMOUNT_FOR_STAKING.toString(),
symbol: symbol.toUpperCase(),
}}
/>
)
}
cursor="pointer"
disabled={!is50PercentDisabled}
>
<TinyButton isDisabled={is50PercentDisabled} onClick={() => setRatioAmount(2)}>
50%
</TinyButton>
</Tooltip>
<Tooltip
content={
<Translation
id="TR_STAKE_MIN_AMOUNT_TOOLTIP"
values={{
amount: MIN_ETH_AMOUNT_FOR_STAKING.toString(),
symbol: symbol.toUpperCase(),
}}
/>
isMaxDisabled && (
<Translation
id="TR_STAKE_MIN_AMOUNT_TOOLTIP"
values={{
amount: MIN_ETH_AMOUNT_FOR_STAKING.toString(),
symbol: symbol.toUpperCase(),
}}
/>
)
}
cursor="pointer"
disabled={!is50PercentDisabled}
>
<TinyButton isDisabled={isDisabled || isMaxDisabled} onClick={setMax}>
<Translation id="TR_STAKE_MAX" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,6 @@ export const Inputs = () => {

const shouldShowAmountForWithdrawalWarning =
isLessAmountForWithdrawalWarningShown || isAmountForWithdrawalWarningShown;
const amountForWithdrawalTranslation = isLessAmountForWithdrawalWarningShown ? (
<Translation
id="TR_STAKE_LEFT_SMALL_AMOUNT_FOR_WITHDRAWAL"
values={{
symbol: account.symbol.toUpperCase(),
}}
/>
) : (
<Translation
id="TR_STAKE_LEFT_AMOUNT_FOR_WITHDRAWAL"
values={{
amount: MIN_ETH_FOR_WITHDRAWALS.toString(),
symbol: account.symbol.toUpperCase(),
}}
/>
);

return (
<Column>
Expand Down Expand Up @@ -123,7 +107,19 @@ export const Inputs = () => {
)}

{shouldShowAmountForWithdrawalWarning && (
<Banner variant="info">{amountForWithdrawalTranslation}</Banner>
<Banner variant="info">
<Translation
id={
isLessAmountForWithdrawalWarningShown
? 'TR_STAKE_LEFT_SMALL_AMOUNT_FOR_WITHDRAWAL'
: 'TR_STAKE_LEFT_AMOUNT_FOR_WITHDRAWAL'
}
values={{
amount: MIN_ETH_FOR_WITHDRAWALS.toString(),
symbol: account.symbol.toUpperCase(),
}}
/>
</Banner>
)}

{isAdviceForWithdrawalWarningShown && (
Expand Down

0 comments on commit 24931a9

Please sign in to comment.