Skip to content

Commit 3364b53

Browse files
authored
fix: disable governance voting for unsynced node and wallets [LW-11919] (#3252)
Signed-off-by: Dominik Guzei <[email protected]>
1 parent d5f7e32 commit 3364b53

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

source/renderer/app/components/voting/VotingUnavailable.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
flex: 1;
88
flex-direction: column;
99
justify-content: center;
10-
margin-bottom: -40px;
11-
padding: 20px;
1210
text-align: center;
1311

1412
h1 {

source/renderer/app/components/voting/voting-governance/VotingPowerDelegation.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ function VotingPowerDelegation({
217217
placeholder={intl.formatMessage(messages.selectWalletPlaceholder)}
218218
value={state.selectedWallet?.id || null}
219219
getStakePoolById={getStakePoolById}
220+
disableSyncingWallets
220221
/>
221222

222223
{state.selectedWallet && (

source/renderer/app/components/widgets/forms/WalletsDropdown.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type Props = {
2727
value?: string;
2828
errorPosition?: string;
2929
disabled?: boolean;
30+
disableSyncingWallets?: boolean;
3031
wallets?: Array<Partial<Wallet>>;
3132
};
3233
export const onSearchWalletsDropdown = (
@@ -46,6 +47,7 @@ function WalletsDropdown({
4647
numberOfStakePools,
4748
onSearch = onSearchWalletsDropdown,
4849
wallets = [],
50+
disableSyncingWallets,
4951
...props
5052
}: Props) {
5153
const discreetModeFeature = useDiscreetModeFeature();
@@ -81,6 +83,7 @@ function WalletsDropdown({
8183
walletName: wallet.name,
8284
isSyncing,
8385
syncingProgress,
86+
isDisabled: disableSyncingWallets ? isSyncing : false,
8487
};
8588
});
8689
return (

source/renderer/app/containers/voting/VotingGovernancePage.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { InjectedProps } from '../../types/injectedPropsType';
44
import VotingPowerDelegation from '../../components/voting/voting-governance/VotingPowerDelegation';
55
import VotingPowerDelegationConfirmationDialog from '../../components/voting/voting-governance/VotingPowerDelegationConfirmationDialog';
66
import { ROUTES } from '../../routes-config';
7+
import VotingUnavailable from '../../components/voting/VotingUnavailable';
78

89
type Props = InjectedProps;
910

@@ -22,8 +23,21 @@ class VotingGovernancePage extends Component<Props> {
2223
app,
2324
voting,
2425
hardwareWallets,
26+
networkStatus,
2527
} = this.props.stores;
2628
const { openExternalLink } = app;
29+
const { isSynced, syncPercentage } = networkStatus;
30+
31+
if (!isSynced) {
32+
return (
33+
<VotingUnavailable
34+
syncPercentage={syncPercentage}
35+
// @ts-ignore ts-migrate(2322) FIXME: Type '{ syncPercentage: any; onExternalLinkClick: ... Remove this comment to see the full error message
36+
onExternalLinkClick={openExternalLink}
37+
/>
38+
);
39+
}
40+
2741
return (
2842
<VotingPowerDelegation
2943
onExternalLinkClick={openExternalLink}

0 commit comments

Comments
 (0)