diff --git a/src/renderer/entities/governance/ui/BalanceDiff.tsx b/src/renderer/entities/governance/ui/BalanceDiff.tsx index 265685982..a0ca10514 100644 --- a/src/renderer/entities/governance/ui/BalanceDiff.tsx +++ b/src/renderer/entities/governance/ui/BalanceDiff.tsx @@ -34,6 +34,7 @@ export const BalanceDiff = memo(({ from, to, asset, lock = BN_ZERO }: Props) => to={} diff={} suffix={asset.symbol} + equal={diff.isZero()} positive={diff.gten(0)} /> ); diff --git a/src/renderer/entities/governance/ui/DiffValue.tsx b/src/renderer/entities/governance/ui/DiffValue.tsx index 59dfbd47a..7b9cc4934 100644 --- a/src/renderer/entities/governance/ui/DiffValue.tsx +++ b/src/renderer/entities/governance/ui/DiffValue.tsx @@ -10,9 +10,10 @@ type Props = { suffix?: ReactNode; diff: ReactNode; positive?: boolean; + equal?: boolean; }; -export const DiffValue = ({ className, from, to, diff, suffix = null, positive }: Props) => { +export const DiffValue = ({ className, from, to, diff, suffix = null, equal, positive }: Props) => { return (
@@ -22,11 +23,12 @@ export const DiffValue = ({ className, from, to, diff, suffix = null, positive } {suffix} - {positive ? ( - - ) : ( - - )} + {!equal && + (positive ? ( + + ) : ( + + ))} {diff}
diff --git a/src/renderer/entities/governance/ui/LockPeriodDiff.tsx b/src/renderer/entities/governance/ui/LockPeriodDiff.tsx index fe9377c45..f7d87cfe0 100644 --- a/src/renderer/entities/governance/ui/LockPeriodDiff.tsx +++ b/src/renderer/entities/governance/ui/LockPeriodDiff.tsx @@ -40,6 +40,7 @@ export const LockPeriodDiff = memo(({ from, to, unlock = false, lockPeriods }: P diff={t('time.days', { count: parseInt(formatDistanceStrict(lockPeriods[to], lockPeriods[from], { unit: 'day', locale: dateLocale })), })} + equal={from === to} positive={lockPeriods[to] - lockPeriods[from] >= 0} /> ); diff --git a/src/renderer/entities/governance/ui/LockValueDiff.tsx b/src/renderer/entities/governance/ui/LockValueDiff.tsx index cc2214934..71b1d9a62 100644 --- a/src/renderer/entities/governance/ui/LockValueDiff.tsx +++ b/src/renderer/entities/governance/ui/LockValueDiff.tsx @@ -30,6 +30,7 @@ export const LockValueDiff = ({ from, to, asset }: Props) => { to={} diff={} suffix={asset.symbol} + equal={diff.isZero()} positive={diff.gten(0)} /> ); diff --git a/src/renderer/widgets/EditDelegationModal/model/form-model.ts b/src/renderer/widgets/EditDelegationModal/model/form-model.ts index 2d12f0f2a..4ace84003 100644 --- a/src/renderer/widgets/EditDelegationModal/model/form-model.ts +++ b/src/renderer/widgets/EditDelegationModal/model/form-model.ts @@ -66,6 +66,7 @@ const $shards = createStore([]); const $delegateBalanceRange = createStore(ZERO_BALANCE); const $signatoryBalance = createStore(ZERO_BALANCE); const $proxyBalance = createStore(ZERO_BALANCE); +const $previousConviction = createStore('None'); const $availableSignatories = createStore([]); const $proxyAccount = createStore(null); @@ -382,6 +383,17 @@ sample({ target: $delegateForm.fields.isUnchanged.onChange, }); +sample({ + clock: formInitiated, + source: $networkStore, + fn: (network, { activeDelegations, shards }) => { + const address = toAddress(shards[0].accountId, { prefix: network!.chain.addressPrefix }); + + return activeDelegations[address].conviction; + }, + target: $previousConviction, +}); + sample({ clock: txWrapperChanged, target: spread({ @@ -488,6 +500,7 @@ export const formModel = { $accountsBalances, $delegateBalanceRange, $proxyBalance, + $previousConviction, $feeData, $isFeeLoading, diff --git a/src/renderer/widgets/EditDelegationModal/ui/DelegateForm.tsx b/src/renderer/widgets/EditDelegationModal/ui/DelegateForm.tsx index 6fe992409..ad46d510b 100644 --- a/src/renderer/widgets/EditDelegationModal/ui/DelegateForm.tsx +++ b/src/renderer/widgets/EditDelegationModal/ui/DelegateForm.tsx @@ -207,6 +207,7 @@ const FeeSection = () => { const isFeeLoading = useUnit(formModel.$isFeeLoading); const isMultisig = useUnit(formModel.$isMultisig); const accounts = useUnit(formModel.$accounts); + const previousConviction = useUnit(formModel.$previousConviction); const lockPeriods = useStoreMap({ store: lockPeriodsModel.$lockPeriods, @@ -242,7 +243,7 @@ const FeeSection = () => { - + )}