Skip to content

Commit

Permalink
fix: disable governance voting for unsynced node and wallets [LW-1191…
Browse files Browse the repository at this point in the history
…9] (#3252)

Signed-off-by: Dominik Guzei <[email protected]>
  • Loading branch information
DominikGuzei authored Dec 3, 2024
1 parent d5f7e32 commit 3364b53
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 0 additions & 2 deletions source/renderer/app/components/voting/VotingUnavailable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
flex: 1;
flex-direction: column;
justify-content: center;
margin-bottom: -40px;
padding: 20px;
text-align: center;

h1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ function VotingPowerDelegation({
placeholder={intl.formatMessage(messages.selectWalletPlaceholder)}
value={state.selectedWallet?.id || null}
getStakePoolById={getStakePoolById}
disableSyncingWallets
/>

{state.selectedWallet && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type Props = {
value?: string;
errorPosition?: string;
disabled?: boolean;
disableSyncingWallets?: boolean;
wallets?: Array<Partial<Wallet>>;
};
export const onSearchWalletsDropdown = (
Expand All @@ -46,6 +47,7 @@ function WalletsDropdown({
numberOfStakePools,
onSearch = onSearchWalletsDropdown,
wallets = [],
disableSyncingWallets,
...props
}: Props) {
const discreetModeFeature = useDiscreetModeFeature();
Expand Down Expand Up @@ -81,6 +83,7 @@ function WalletsDropdown({
walletName: wallet.name,
isSyncing,
syncingProgress,
isDisabled: disableSyncingWallets ? isSyncing : false,
};
});
return (
Expand Down
14 changes: 14 additions & 0 deletions source/renderer/app/containers/voting/VotingGovernancePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { InjectedProps } from '../../types/injectedPropsType';
import VotingPowerDelegation from '../../components/voting/voting-governance/VotingPowerDelegation';
import VotingPowerDelegationConfirmationDialog from '../../components/voting/voting-governance/VotingPowerDelegationConfirmationDialog';
import { ROUTES } from '../../routes-config';
import VotingUnavailable from '../../components/voting/VotingUnavailable';

type Props = InjectedProps;

Expand All @@ -22,8 +23,21 @@ class VotingGovernancePage extends Component<Props> {
app,
voting,
hardwareWallets,
networkStatus,
} = this.props.stores;
const { openExternalLink } = app;
const { isSynced, syncPercentage } = networkStatus;

if (!isSynced) {
return (
<VotingUnavailable
syncPercentage={syncPercentage}
// @ts-ignore ts-migrate(2322) FIXME: Type '{ syncPercentage: any; onExternalLinkClick: ... Remove this comment to see the full error message
onExternalLinkClick={openExternalLink}
/>
);
}

return (
<VotingPowerDelegation
onExternalLinkClick={openExternalLink}
Expand Down

0 comments on commit 3364b53

Please sign in to comment.