Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/voting balance improvements #173

Merged
merged 4 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const Detail = ({
</i>
{unlockable?.gt(0) && (
<Button onClick={unlock} classes="h-[24px]">
<Pill classes={inModal ? 'bg-primary' : 'bg-secondary'}>Unlock</Pill>
<Pill classes={'bg-action-primary-regular text-white'}>Unlock</Pill>
</Button>
)}
</div>
Expand Down Expand Up @@ -81,6 +81,7 @@ const CurrentVotingBalanceDetails = ({
const bothZero = lockedVoteBalance?.eq(0) && lockedStCeloInVoting?.eq(0);

const unlock = useCallback(() => {
setIsCalloutModalOpened(true);
void unlockVoteBalance?.({
onSent: () => {
setIsCalloutModalOpened(false);
Expand Down
7 changes: 5 additions & 2 deletions src/features/swap/components/BalanceTools.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { WidthTransition } from 'src/components/transitions/WidthTransition';
import { Token } from 'src/utils/tokens';
import { Mode } from 'src/types';
import { Token } from 'src/utils/tokens';

interface BalanceToolsProps {
mode: Mode;
Expand All @@ -11,7 +11,10 @@ interface BalanceToolsProps {
export const BalanceTools = ({ mode, balance, onClickUseMax }: BalanceToolsProps) => {
return (
<div className="text-color-secondary text-[15px] leading-[24px] font-regular">
<WidthTransition id={mode}>{balance.displayAsBase()} balance</WidthTransition>
<WidthTransition id={mode}>
{balance.displayAsBase()} balance
{mode === Mode.unstake ? <span className="text-[12px]">*</span> : null}
</WidthTransition>
<span className="mx-[6px]">&bull;</span>
<button type="button" title="Use full balance" className="underline" onClick={onClickUseMax}>
Max
Expand Down
12 changes: 10 additions & 2 deletions src/features/swap/components/SwapForm.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FormEventHandler, useCallback, useState } from 'react';
import NumberFormat, { NumberFormatValues } from 'react-number-format';
import { TransactionCalloutModal } from 'src/components/TransactionCalloutModal';
import { SubmitButton } from 'src/components/buttons/SubmitButton';
import { ThemedIcon } from 'src/components/icons/ThemedIcon';
import { TransactionCalloutModal } from 'src/components/TransactionCalloutModal';
import { OpacityTransition } from 'src/components/transitions/OpacityTransition';
import { DISPLAY_DECIMALS } from 'src/config/consts';
import { TxCallbacks } from 'src/contexts/blockchain/useBlockchain';
Expand Down Expand Up @@ -151,7 +151,15 @@ const SwapFormInput = ({
inputMode="decimal"
/>
}
infoChild={<BalanceTools mode={mode} onClickUseMax={setMaxAmount} balance={balance} />}
infoChild={
<div>
<BalanceTools mode={mode} onClickUseMax={setMaxAmount} balance={balance} />
<i className="text-[10px] text-color-secondary relative">
<span className="absolute left-[-0.5rem] top-0">*</span>
Only unlocked funds are shown above. For Locked funds see the Govern tab.
</i>
</div>
}
nicolasbrugneaux marked this conversation as resolved.
Show resolved Hide resolved
/>
);
};
2 changes: 1 addition & 1 deletion src/features/wallet/components/AccountModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const AccountModal = ({ isOpen, close }: { isOpen: boolean; close: () =>
<ThemedIcon name="clipboard" alt={`Copy to clipboard`} height={16} width={16} />
</Button>
</div>
<div className="cursor-pointer bg-tertiary rounded-full flex center p-1">
<div className="cursor-pointer bg-tertiary rounded-full flex center p-1" onClick={close}>
<ThemedIcon name="close" alt="Dismiss" width={24} height={24} />
</div>
</div>
Expand Down