Skip to content

Commit 88f05a5

Browse files
committed
Merge branch 'develop' into release/5.3.0
2 parents 85356f8 + 58e6a07 commit 88f05a5

24 files changed

+100
-224
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### Features
66

7-
- Show "To be defined" if date of the next Catalyst fund is in the past ([PR 3105](https://github.com/input-output-hk/daedalus/pull/3105))
7+
- Apply Catalyst API improvements ([PR 3136](https://github.com/input-output-hk/daedalus/pull/3136))
88
- Switched to the new Catalyst API ([PR 3129](https://github.com/input-output-hk/daedalus/pull/3129))
99

1010
### Fixes

source/renderer/app/components/voting/VotingNoWallets.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const messages = defineMessages({
1111
headLine: {
1212
id: 'voting.info.noWallets.headLine',
1313
defaultMessage:
14-
'!!!Voting registration for Fund{nextVotingFundNumber} is not available as you currently do not have any Shelley-compatible wallets.',
14+
'!!!Voting registration is not available as you currently do not have any Shelley-compatible wallets.',
1515
description: '"No wallets" headLine on the voting info page.',
1616
},
1717
instructions: {
@@ -30,7 +30,6 @@ const messages = defineMessages({
3030
type Props = {
3131
onGoToCreateWalletClick: (...args: Array<any>) => any;
3232
minVotingFunds: number;
33-
nextFundNumber: number;
3433
};
3534
export default class VotingNoWallets extends Component<Props> {
3635
static contextTypes = {
@@ -39,19 +38,11 @@ export default class VotingNoWallets extends Component<Props> {
3938

4039
render() {
4140
const { intl } = this.context;
42-
const {
43-
onGoToCreateWalletClick,
44-
minVotingFunds,
45-
nextFundNumber,
46-
} = this.props;
41+
const { onGoToCreateWalletClick, minVotingFunds } = this.props;
4742
return (
4843
<div className={styles.component}>
4944
<SVGInline svg={icon} className={styles.icon} />
50-
<h1>
51-
{intl.formatMessage(messages.headLine, {
52-
nextVotingFundNumber: nextFundNumber,
53-
})}
54-
</h1>
45+
<h1>{intl.formatMessage(messages.headLine)}</h1>
5546
<p>
5647
{intl.formatMessage(messages.instructions, {
5748
minVotingFunds: new BigNumber(minVotingFunds).toFormat(0),

source/renderer/app/components/voting/VotingRegistrationDialogWizard.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ type Props = {
4242
onRestart: (...args: Array<any>) => any;
4343
onExternalLinkClick: (...args: Array<any>) => any;
4444
hwDeviceStatus: HwDeviceStatus;
45-
nextFundNumber: number;
4645
};
4746

4847
@observer
@@ -76,7 +75,6 @@ class VotingRegistrationDialogWizard extends Component<Props> {
7675
hwDeviceStatus,
7776
isTrezor,
7877
isHardwareWallet,
79-
nextFundNumber,
8078
} = this.props;
8179
const selectedWalletId = get(selectedWallet, 'id', null);
8280
let content = null;
@@ -95,7 +93,6 @@ class VotingRegistrationDialogWizard extends Component<Props> {
9593
onSelectWallet={onSelectWallet}
9694
isWalletAcceptable={isWalletAcceptable}
9795
getStakePoolById={getStakePoolById}
98-
nextFundNumber={nextFundNumber}
9996
/>
10097
);
10198
break;
@@ -117,7 +114,6 @@ class VotingRegistrationDialogWizard extends Component<Props> {
117114
selectedWallet={selectedWallet}
118115
isTrezor={isTrezor}
119116
isHardwareWallet={isHardwareWallet}
120-
nextFundNumber={nextFundNumber}
121117
/>
122118
);
123119
break;
@@ -134,7 +130,6 @@ class VotingRegistrationDialogWizard extends Component<Props> {
134130
transactionError={transactionError}
135131
onConfirm={onContinue}
136132
onRestart={onRestart}
137-
nextFundNumber={nextFundNumber}
138133
/>
139134
);
140135
break;
@@ -146,7 +141,6 @@ class VotingRegistrationDialogWizard extends Component<Props> {
146141
onClose={onClose}
147142
stepsList={stepsList}
148143
activeStep={activeStep}
149-
nextFundNumber={nextFundNumber}
150144
/>
151145
);
152146
break;
@@ -159,7 +153,6 @@ class VotingRegistrationDialogWizard extends Component<Props> {
159153
onDownloadPDF={onDownloadPDF}
160154
stepsList={stepsList}
161155
activeStep={activeStep}
162-
nextFundNumber={nextFundNumber}
163156
/>
164157
);
165158
break;

source/renderer/app/components/voting/voting-info/RegisterToVote.messages.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { defineMessages } from 'react-intl';
22

33
export const messages = defineMessages({
4-
dateLabel: {
5-
id: 'voting.registerToVote.dateLabel',
6-
defaultMessage: '!!!Snapshot date:',
7-
description: 'Voting info snapshot date label',
4+
votingInstructions: {
5+
id: 'voting.registerToVote.votingInstructions',
6+
defaultMessage:
7+
'!!!If you are not registered yet, make sure to register to vote in the current fund before the snapshot date.',
8+
description: 'Voting instructions',
89
},
910
stepsTitle: {
1011
id: 'voting.registerToVote.stepsTitle',
@@ -27,10 +28,4 @@ export const messages = defineMessages({
2728
defaultMessage: '!!!Register to vote',
2829
description: 'Button Label for voting registration steps',
2930
},
30-
toBeDefined: {
31-
id: 'voting.resultsPhase.toBeDefined',
32-
defaultMessage: '!!!To be defined',
33-
description:
34-
'Text to show when Catalyst API is returning a past date value',
35-
},
3631
});

source/renderer/app/components/voting/voting-info/RegisterToVote.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
line-height: 1.33;
1313
}
1414

15-
.dateLabel {
15+
.votingInstructions {
1616
display: block;
17+
font-family: var(--font-light);
1718
margin-top: 11px;
1819
}
1920

@@ -24,6 +25,7 @@
2425

2526
.stepsTitle {
2627
font-family: var(--font-medium);
28+
margin-top: 14px;
2729
}
2830

2931
.step {

source/renderer/app/components/voting/voting-info/RegisterToVote.tsx

Lines changed: 9 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,33 @@
11
import React, { useState } from 'react';
22
import { injectIntl } from 'react-intl';
3-
import moment from 'moment';
43
import { Button } from 'react-polymorph/lib/components/Button';
54
import { Checkbox } from 'react-polymorph/lib/components/Checkbox';
6-
import {
7-
formattedDateTime,
8-
mapToLongDateTimeFormat,
9-
} from '../../../utils/formatters';
10-
import type { Locale } from '../../../../../common/types/locales.types';
115
import type { Intl } from '../../../types/i18nTypes';
126
import { messages } from './RegisterToVote.messages';
137
import { messages as votingMessages } from './VotingInfo.messages';
148
import styles from './RegisterToVote.scss';
15-
import votingStyles from './VotingInfo.scss';
16-
import type { CatalystFund } from '../../../api/voting/types';
17-
import { logger } from '../../../utils/logging';
189

1910
type Props = {
20-
currentLocale: Locale;
21-
currentDateFormat: string;
22-
currentTimeFormat: string;
23-
fundInfo: CatalystFund;
2411
intl: Intl;
2512
onRegisterToVoteClick: (...args: Array<any>) => any;
2613
};
2714

28-
const isFutureDate = (date: Date): boolean => {
29-
try {
30-
return moment().diff(date) < 0;
31-
} catch (error) {
32-
logger.error('Voting::NextFund::Invalid date', {
33-
error,
34-
});
35-
}
36-
return false;
37-
};
38-
39-
function RegisterToVote({
40-
currentLocale,
41-
currentDateFormat,
42-
currentTimeFormat,
43-
fundInfo,
44-
intl,
45-
onRegisterToVoteClick,
46-
}: Props) {
15+
function RegisterToVote({ intl, onRegisterToVoteClick }: Props) {
4716
const [step1, setStep1] = useState(false);
4817
const [step2, setStep2] = useState(false);
4918
const canRegister = step1 && step2;
50-
const nextSnapshotDateTime = fundInfo.next.registrationSnapshotTime;
51-
52-
const snapshotDate = isFutureDate(nextSnapshotDateTime)
53-
? formattedDateTime(nextSnapshotDateTime, {
54-
currentLocale,
55-
...mapToLongDateTimeFormat({
56-
currentLocale,
57-
currentDateFormat,
58-
currentTimeFormat,
59-
}),
60-
})
61-
: intl.formatMessage(messages.toBeDefined);
6219

6320
return (
6421
<div className={styles.root}>
65-
<span className={styles.title}>
66-
{intl.formatMessage(votingMessages.fundName, {
67-
votingFundNumber: fundInfo.next.number,
68-
})}
69-
</span>
70-
<span className={styles.dateLabel}>
71-
{intl.formatMessage(messages.dateLabel)}
72-
</span>
73-
<span className={styles.date}>{snapshotDate}</span>
74-
<hr className={votingStyles.separator} />
75-
<span className={styles.stepsTitle}>
22+
<div className={styles.title}>
23+
{intl.formatMessage(votingMessages.registerToVoteHeader)}
24+
</div>
25+
<div className={styles.votingInstructions}>
26+
{intl.formatMessage(messages.votingInstructions)}
27+
</div>
28+
<div className={styles.stepsTitle}>
7629
{intl.formatMessage(messages.stepsTitle)}
77-
</span>
30+
</div>
7831
<div className={styles.step}>
7932
<Checkbox
8033
checked={step1}

source/renderer/app/components/voting/voting-info/VotingInfo.messages.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ export const messages = defineMessages({
66
defaultMessage: '!!!Fund{votingFundNumber}',
77
description: 'Current fund name',
88
},
9+
registerToVoteHeader: {
10+
id: 'voting.registerToVote.header',
11+
defaultMessage: 'Register to vote',
12+
description: 'Right hand side section header',
13+
},
914
});

source/renderer/app/components/voting/voting-info/VotingInfo.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,7 @@ function VotingInfo({
5555
</div>
5656
</div>
5757
<div className={styles.rightContent}>
58-
<RegisterToVote
59-
fundInfo={fundInfo}
60-
currentLocale={currentLocale}
61-
currentDateFormat={currentDateFormat}
62-
currentTimeFormat={currentTimeFormat}
63-
onRegisterToVoteClick={onRegisterToVoteClick}
64-
/>
58+
<RegisterToVote onRegisterToVoteClick={onRegisterToVoteClick} />
6559
</div>
6660
</>
6761
)}

source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ type Props = {
7474
selectedWalletId: string | null | undefined;
7575
isWalletAcceptable: (...args: Array<any>) => any;
7676
getStakePoolById: (...args: Array<any>) => any;
77-
nextFundNumber: number;
7877
};
7978
type State = {
8079
selectedWalletId: string | null | undefined;
@@ -111,7 +110,6 @@ export default class VotingRegistrationStepsChooseWallet extends Component<
111110
isWalletAcceptable,
112111
numberOfStakePools,
113112
getStakePoolById,
114-
nextFundNumber,
115113
} = this.props;
116114
const buttonLabel = intl.formatMessage(messages.continueButtonLabel);
117115
const selectedWallet: Wallet | null | undefined = wallets.find(
@@ -168,7 +166,6 @@ export default class VotingRegistrationStepsChooseWallet extends Component<
168166
activeStep={activeStep}
169167
actions={actions}
170168
containerClassName={styles.component}
171-
nextFundNumber={nextFundNumber}
172169
>
173170
<p className={styles.description}>
174171
<FormattedHTMLMessage {...messages.description} />

source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsConfirm.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ type Props = {
8080
| (LocalizableError | null | undefined);
8181
onConfirm: (...args: Array<any>) => any;
8282
onRestart: (...args: Array<any>) => any;
83-
nextFundNumber: number;
8483
};
8584

8685
@observer
@@ -101,7 +100,6 @@ class VotingRegistrationStepsConfirm extends Component<Props> {
101100
transactionConfirmations,
102101
transactionError,
103102
onClose,
104-
nextFundNumber,
105103
} = this.props;
106104
const description = intl.formatMessage(messages.description);
107105
const descriptionRestart = (
@@ -156,7 +154,6 @@ class VotingRegistrationStepsConfirm extends Component<Props> {
156154
actions={actions}
157155
containerClassName={styles.component}
158156
hideSteps={!!transactionError}
159-
nextFundNumber={nextFundNumber}
160157
>
161158
{transactionError ? (
162159
<Fragment>

0 commit comments

Comments
 (0)