Skip to content

Commit f7c80d3

Browse files
authored
Merge pull request #2771 from input-output-hk/feature/ddw-796-Implement-catalyst-state-snapshot-phase
[DDW-796] Implement catalyst state snapshot phase
2 parents 516f47b + 8303429 commit f7c80d3

29 files changed

+790
-567
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ mainnet-genesis-dryrun-with-stakeholders.json
8686

8787
# nix-build results
8888
result*
89+
!result*.js
90+
!result*.jsx
91+
!result*.ts
92+
!result*.tsx
8993

9094
# Npm
9195
package-lock.json

source/renderer/app/components/staking/delegation-center/WalletRow.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,16 @@ const messages = defineMessages({
8282
type Props = {
8383
wallet: Wallet,
8484
delegatedStakePool?: ?StakePool,
85-
numberOfStakePools: number,
8685
numberOfRankedStakePools: number,
8786
onDelegate: Function,
8887
onUndelegate: Function,
8988
getStakePoolById: Function,
9089
nextEpochNumber: number,
9190
futureEpochNumber: number,
92-
onSelect?: Function,
93-
selectedPoolId?: ?number,
94-
isListActive?: boolean,
9591
currentTheme: string,
9692
onOpenExternalLink: Function,
9793
showWithSelectButton?: boolean,
9894
containerClassName: string,
99-
setListActive?: Function,
100-
listName?: string,
10195
};
10296

10397
type WalletRowState = {
Lines changed: 19 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,30 @@
11
// @flow
2-
import React, { Component } from 'react';
2+
import React from 'react';
33
import { observer } from 'mobx-react';
4-
import {
5-
defineMessages,
6-
intlShape,
7-
FormattedMessage,
8-
FormattedHTMLMessage,
9-
} from 'react-intl';
10-
import BigNumber from 'bignumber.js';
11-
import { Link } from 'react-polymorph/lib/components/Link';
4+
import { FormattedHTMLMessage } from 'react-intl';
125
import globalMessages from '../../i18n/global-messages';
136
import LoadingSpinner from '../widgets/LoadingSpinner';
14-
import {
15-
CURRENT_VOTING_FUND_NUMBER,
16-
NEXT_VOTING_FUND_NUMBER,
17-
} from '../../config/votingConfig';
187
import styles from './VotingUnavailable.scss';
19-
20-
const messages = defineMessages({
21-
heading: {
22-
id: 'voting.unavailable.heading',
23-
defaultMessage: '!!!Project Catalyst voting registration',
24-
description: 'Headline for the "Voting unavailable" screen',
25-
},
26-
paragraph1: {
27-
id: 'voting.unavailable.paragraph1',
28-
defaultMessage:
29-
'!!!Project Catalyst Fund{currentVotingFundNumber} has now ended. Fund{nextVotingFundNumber} is currently in preparation, voting registration is not available yet.',
30-
description: 'First paragraph on the "Voting unavailable" screen',
31-
},
32-
paragraph2: {
33-
id: 'voting.unavailable.paragraph2',
34-
defaultMessage:
35-
'!!!Join our {link1} and {link2} Telegram channels for the latest updates (English language only).',
36-
description: 'Second paragraph on the "Voting unavailable" screen',
37-
},
38-
link1Text: {
39-
id: 'voting.unavailable.link1Text',
40-
defaultMessage: '!!!Catalyst Announcements',
41-
description: 'First link text on the "Voting unavailable" screen',
42-
},
43-
link2Text: {
44-
id: 'voting.unavailable.link2Text',
45-
defaultMessage: '!!!Project Catalyst Chat',
46-
description: 'Second link text on the "Voting unavailable" screen',
47-
},
48-
link1Url: {
49-
id: 'voting.unavailable.link1Url',
50-
defaultMessage: '!!!https://t.me/cardanocatalyst',
51-
description: 'First link URL on the "Voting unavailable" screen',
52-
},
53-
link2Url: {
54-
id: 'voting.unavailable.link2Url',
55-
defaultMessage: '!!!https://t.me/ProjectCatalystChat',
56-
description: 'Second link URL on the "Voting unavailable" screen',
57-
},
58-
});
8+
import { formattedNumber } from '../../utils/formatters';
599

6010
type Props = {
6111
syncPercentage: number,
62-
isVotingRegistrationAvailable: boolean,
63-
onExternalLinkClick: Function,
6412
};
6513

66-
@observer
67-
export default class VotingUnavailable extends Component<Props> {
68-
static contextTypes = {
69-
intl: intlShape.isRequired,
70-
};
71-
72-
render() {
73-
const { intl } = this.context;
74-
const {
75-
syncPercentage,
76-
isVotingRegistrationAvailable,
77-
onExternalLinkClick,
78-
} = this.props;
79-
80-
const heading = intl.formatMessage(messages.heading);
81-
const paragraph1 = intl.formatMessage(messages.paragraph1, {
82-
currentFundNumber: CURRENT_VOTING_FUND_NUMBER,
83-
nextVotingFundNumber: NEXT_VOTING_FUND_NUMBER,
84-
});
85-
const link1 = (
86-
<Link
87-
className={styles.link}
88-
label={intl.formatMessage(messages.link1Text)}
89-
onClick={() =>
90-
onExternalLinkClick(intl.formatMessage(messages.link1Url))
91-
}
92-
/>
93-
);
94-
const link2 = (
95-
<Link
96-
className={styles.link}
97-
label={intl.formatMessage(messages.link2Text)}
98-
onClick={() =>
99-
onExternalLinkClick(intl.formatMessage(messages.link2Url))
100-
}
101-
/>
102-
);
103-
104-
return (
105-
<div className={styles.component}>
106-
{isVotingRegistrationAvailable ? (
107-
<>
108-
<LoadingSpinner big />
109-
<div className={styles.description}>
110-
<FormattedHTMLMessage
111-
{...globalMessages.featureUnavailableWhileSyncing}
112-
values={{
113-
syncPercentage: new BigNumber(syncPercentage).toFormat(2),
114-
}}
115-
/>
116-
</div>
117-
</>
118-
) : (
119-
<>
120-
<h1>{heading}</h1>
121-
<p>{paragraph1}</p>
122-
<FormattedMessage
123-
{...messages.paragraph2}
124-
values={{ link1, link2 }}
125-
tagName="p"
126-
/>
127-
</>
128-
)}
14+
const VotingUnavailable = ({ syncPercentage }: Props) => {
15+
return (
16+
<div className={styles.component}>
17+
<LoadingSpinner big />
18+
<div className={styles.description}>
19+
<FormattedHTMLMessage
20+
{...globalMessages.featureUnavailableWhileSyncing}
21+
values={{
22+
syncPercentage: formattedNumber(syncPercentage, 2),
23+
}}
24+
/>
12925
</div>
130-
);
131-
}
132-
}
26+
</div>
27+
);
28+
};
29+
30+
export default observer(VotingUnavailable);

source/renderer/app/components/voting/voting-info/CurrentFund.js

Lines changed: 0 additions & 70 deletions
This file was deleted.

source/renderer/app/components/voting/voting-info/CurrentFund.messages.js

Lines changed: 0 additions & 25 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
@import '../votingConfig';
22

3-
.component {
3+
.root {
44
@extend %regularText;
55
align-items: start;
66
background-color: var(--theme-button-flat-background-color);
77
border-radius: 5px;
88
display: flex;
99
flex-direction: column;
10-
height: 175px;
1110
padding: 20px;
1211
width: 271px;
1312

@@ -16,23 +15,30 @@
1615
font-family: var(--font-bold);
1716
font-size: 18px;
1817
line-height: 1.33;
18+
margin-bottom: 11px;
1919
}
2020

21-
.endDateBlock {
21+
.block {
2222
align-items: start;
2323
display: flex;
2424
flex-direction: column;
25-
margin-bottom: 20px;
26-
margin-top: 11px;
2725

28-
.endDateText {
26+
.label {
2927
color: var(--theme-button-flat-text-color);
3028
display: block;
3129
}
3230

33-
.endDate {
31+
.value {
3432
color: var(--theme-button-flat-text-color);
3533
font-family: var(--font-medium);
3634
}
35+
36+
& + .block {
37+
margin-top: 11px;
38+
}
39+
}
40+
41+
.resultsButton {
42+
margin-top: 20px;
3743
}
3844
}

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { injectIntl } from 'react-intl';
44
import { Button } from 'react-polymorph/lib/components/Button';
55
import { Checkbox } from 'react-polymorph/lib/components/Checkbox';
66
import {
7-
VOTING_REGISTRATION_END_DATE,
7+
VOTING_NEW_SNAPSHOT_DATE,
88
NEXT_VOTING_FUND_NUMBER,
99
} from '../../../config/votingConfig';
1010
import {
@@ -13,8 +13,10 @@ import {
1313
} from '../../../utils/formatters';
1414
import type { Locale } from '../../../../../common/types/locales.types';
1515
import type { Intl } from '../../../types/i18nTypes';
16-
import styles from './RegisterToVote.scss';
1716
import { messages } from './RegisterToVote.messages';
17+
import { messages as votingMessages } from './VotingInfo.messages';
18+
import styles from './RegisterToVote.scss';
19+
import votingStyles from './VotingInfo.scss';
1820

1921
type Props = {
2022
currentLocale: Locale,
@@ -34,7 +36,7 @@ function RegisterToVote({
3436
const [step1, setStep1] = useState(false);
3537
const [step2, setStep2] = useState(false);
3638
const canRegister = step1 && step2;
37-
const castEndDate = formattedDateTime(VOTING_REGISTRATION_END_DATE, {
39+
const castEndDate = formattedDateTime(VOTING_NEW_SNAPSHOT_DATE, {
3840
currentLocale,
3941
...mapToLongDateTimeFormat({
4042
currentLocale,
@@ -46,15 +48,15 @@ function RegisterToVote({
4648
return (
4749
<div className={styles.root}>
4850
<span className={styles.title}>
49-
{intl.formatMessage(messages.name, {
50-
nextVotingFundNumber: NEXT_VOTING_FUND_NUMBER,
51+
{intl.formatMessage(votingMessages.fundName, {
52+
votingFundNumber: NEXT_VOTING_FUND_NUMBER,
5153
})}
5254
</span>
5355
<span className={styles.dateLabel}>
5456
{intl.formatMessage(messages.dateLabel)}
5557
</span>
5658
<span className={styles.date}>{castEndDate}</span>
57-
<div className={styles.separator} />
59+
<hr className={votingStyles.separator} />
5860
<span className={styles.stepsTitle}>
5961
{intl.formatMessage(messages.stepsTitle)}
6062
</span>

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

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

44
export const messages = defineMessages({
5-
name: {
6-
id: 'voting.registerToVote.name',
7-
defaultMessage: '!!!Fund{nextVotingFundNumber}',
8-
description: 'Regiter to fund name',
9-
},
105
dateLabel: {
116
id: 'voting.registerToVote.dateLabel',
127
defaultMessage: '!!!Snapshot date:',

0 commit comments

Comments
 (0)