From effc7ecba985691e6e3d87ebc64b91209f823353 Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Thu, 3 Feb 2022 19:31:55 -0300 Subject: [PATCH 01/23] [DDW-675] Fetch fund information from catalyst backend --- source/renderer/app/api/api.ts | 32 +++++++++++++++++ .../api/voting/requests/getCatalystFund.ts | 14 ++++++++ source/renderer/app/api/voting/types.ts | 16 +++++++++ source/renderer/app/config/urlsConfig.ts | 2 ++ source/renderer/app/stores/VotingStore.ts | 36 +++++++++++++------ 5 files changed, 90 insertions(+), 10 deletions(-) create mode 100644 source/renderer/app/api/voting/requests/getCatalystFund.ts diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index 6bc010c987..814858f8e7 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -40,6 +40,7 @@ import { getPublicKey } from './transactions/requests/getPublicKey'; import { getICOPublicKey } from './transactions/requests/getICOPublicKey'; // Voting requests import { createWalletSignature } from './voting/requests/createWalletSignature'; +import { getCatalystFund } from './voting/requests/getCatalystFund'; // Wallets requests import { updateSpendingPassword } from './wallets/requests/updateSpendingPassword'; import { updateByronSpendingPassword } from './wallets/requests/updateByronSpendingPassword'; @@ -204,6 +205,8 @@ import type { import type { CreateVotingRegistrationRequest, CreateWalletSignatureRequest, + GetCatalystFundResponse, + CatalystFund, } from './voting/types'; import type { StakePoolProps } from '../domains/StakePool'; import type { FaultInjectionIpcRequest } from '../../../common/types/cardano-node.types'; @@ -2931,6 +2934,35 @@ export default class AdaApi { fakeStakePoolsJson: Array ) => void; setStakePoolsFetchingFailed: () => void; + getCatalystFund = async (): Promise => { + logger.debug('AdaApi::getCatalystFund called', {}); + + try { + const catalystFundRaw = await getCatalystFund(); + const catalystFund: GetCatalystFundResponse = JSON.parse(catalystFundRaw); + + logger.debug('AdaApi::getCatalystFund success', { + catalystFund, + }); + return { + fundEndTime: new Date(catalystFund.fund_end_time), + fundStartTime: new Date(catalystFund.fund_start_time), + nextFundStartTime: new Date(catalystFund.next_fund_start_time), + nextRegistrationSnapshotTime: new Date( + catalystFund.next_registration_snapshot_time + ), + registrationSnapshotTime: new Date( + catalystFund.registration_snapshot_time + ), + fundName: catalystFund.fund_name, + }; + } catch (error) { + logger.error('AdaApi::getCatalystFund error', { + error, + }); + throw new Error('Unable to fetch news'); + } + }; } // ========== TRANSFORM SERVER DATA INTO FRONTEND MODELS ========= const _createWalletFromServerData = action( diff --git a/source/renderer/app/api/voting/requests/getCatalystFund.ts b/source/renderer/app/api/voting/requests/getCatalystFund.ts new file mode 100644 index 0000000000..dd7e4bf2b1 --- /dev/null +++ b/source/renderer/app/api/voting/requests/getCatalystFund.ts @@ -0,0 +1,14 @@ +import { externalRequest } from '../../utils/externalRequest'; +import { MAINNET_SERVICING_STATION_URL } from '../../../config/urlsConfig'; +// import { GetCatalystFundResponse } from '../types'; + +export const getCatalystFund = (): Promise => + externalRequest( + { + hostname: MAINNET_SERVICING_STATION_URL, + path: '/api/v0/fund', + method: 'GET', + protocol: 'https', + }, + true + ); diff --git a/source/renderer/app/api/voting/types.ts b/source/renderer/app/api/voting/types.ts index 288409ff2d..73263b2b09 100644 --- a/source/renderer/app/api/voting/types.ts +++ b/source/renderer/app/api/voting/types.ts @@ -27,3 +27,19 @@ export type SignatureParams = { passphrase: string; }; }; +export type GetCatalystFundResponse = { + fund_end_time: string; + fund_name: string; + fund_start_time: string; + next_fund_start_time: string; + next_registration_snapshot_time: string; + registration_snapshot_time: string; +}; +export type CatalystFund = { + fundEndTime: Date; + fundName: string; + fundStartTime: Date; + nextFundStartTime: Date; + nextRegistrationSnapshotTime: Date; + registrationSnapshotTime: Date; +}; diff --git a/source/renderer/app/config/urlsConfig.ts b/source/renderer/app/config/urlsConfig.ts index 0344d70c5b..47834dbec7 100644 --- a/source/renderer/app/config/urlsConfig.ts +++ b/source/renderer/app/config/urlsConfig.ts @@ -11,6 +11,7 @@ export const DEVELOPMENT_NEWS_HASH_URL = 'newsfeed.daedaluswallet.io'; export const MAINNET_NEWS_HASH_URL = 'newsfeed.daedaluswallet.io'; export const TESTNET_NEWS_HASH_URL = 'newsfeed.daedaluswallet.io'; export const STAGING_NEWS_HASH_URL = 'newsfeed.daedaluswallet.io'; +export const MAINNET_SERVICING_STATION_URL = 'servicing-station.vit.iohk.io'; export const ALLOWED_EXTERNAL_HOSTNAMES = [ MAINNET_EXPLORER_URL, STAGING_EXPLORER_URL, @@ -24,4 +25,5 @@ export const ALLOWED_EXTERNAL_HOSTNAMES = [ TESTNET_NEWS_HASH_URL, STAGING_NEWS_HASH_URL, coingeckoConfig.hostname, + MAINNET_SERVICING_STATION_URL, ]; diff --git a/source/renderer/app/stores/VotingStore.ts b/source/renderer/app/stores/VotingStore.ts index 13e13f7bb4..a052cdac69 100644 --- a/source/renderer/app/stores/VotingStore.ts +++ b/source/renderer/app/stores/VotingStore.ts @@ -1,4 +1,4 @@ -import { action, computed, observable } from 'mobx'; +import { action, computed, observable, runInAction } from 'mobx'; import { get } from 'lodash'; import Store from './lib/Store'; import Request from './lib/LocalizedRequest'; @@ -10,8 +10,6 @@ import { import { formattedArrayBufferToHexString } from '../utils/formatters'; import walletUtils from '../utils/walletUtils'; import { - VOTING_CAST_START_DATE, - VOTING_CAST_END_DATE, VOTING_RESULTS_DATE, VOTING_PHASE_CHECK_INTERVAL, VOTING_REGISTRATION_TRANSACTION_POLLING_INTERVAL, @@ -25,6 +23,7 @@ import type { GetTransactionRequest, VotingMetadataType, } from '../api/transactions/types'; +import type { CatalystFund } from '../api/voting/types'; export type VotingRegistrationKeyType = { bytes: (...args: Array) => any; @@ -69,12 +68,14 @@ export default class VotingStore extends Store { isConfirmationDialogOpen = false; @observable fundPhase: FundPhase = FundPhases.SNAPSHOT; + @observable + catalystFund: CatalystFund | null = null; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'IntervalID'. transactionPollingInterval: IntervalID | null | undefined = null; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'IntervalID'. fundPhaseInterval: IntervalID | null | undefined = null; - setup() { + async setup() { const { voting: votingActions } = this.actions; votingActions.selectWallet.listen(this._setSelectedWalletId); votingActions.sendTransaction.listen(this._sendTransaction); @@ -89,6 +90,14 @@ export default class VotingStore extends Store { votingActions.closeConfirmationDialog.listen(this._closeConfirmationDialog); this._initializeFundPhaseInterval(); + + // @ts-ignore ts-migrate(1320) FIXME: Type of 'await' operand must either be a valid pro... Remove this comment to see the full error message + await this.getCatalystFundRequest.execute(); + const catalystFund = this.getCatalystFundRequest.result; + runInAction('Initialize fund', () => { + this.catalystFund = catalystFund; + this._checkFundPhase(new Date()); + }); } // REQUESTS @@ -108,6 +117,11 @@ export default class VotingStore extends Store { getTransactionRequest: Request = new Request( this.api.ada.getTransaction ); + @observable + getCatalystFundRequest: Request = new Request( + this.api.ada.getCatalystFund + ); + // ACTIONS @action _showConfirmationDialog = () => { @@ -463,17 +477,19 @@ export default class VotingStore extends Store { @action _checkFundPhase = (now: Date) => { const phaseValidation = { - [FundPhases.SNAPSHOT]: (date: Date) => date < VOTING_CAST_START_DATE, + [FundPhases.SNAPSHOT]: (date: Date) => + date < this.catalystFund?.fundStartTime, [FundPhases.VOTING]: (date: Date) => - now >= VOTING_CAST_START_DATE && date < VOTING_CAST_END_DATE, + date >= this.catalystFund?.fundStartTime && + date < this.catalystFund?.fundEndTime, [FundPhases.TALLYING]: (date: Date) => - now >= VOTING_CAST_END_DATE && date < VOTING_RESULTS_DATE, + date >= this.catalystFund?.fundEndTime && date < VOTING_RESULTS_DATE, [FundPhases.RESULTS]: (date: Date) => date >= VOTING_RESULTS_DATE, }; this.fundPhase = - Object.keys(FundPhases) - .map((key) => FundPhases[key]) - .find((phase) => phaseValidation[phase](now)) || FundPhases.SNAPSHOT; + Object.values(FundPhases).find((phase: FundPhase) => + phaseValidation[phase](now) + ) || FundPhases.SNAPSHOT; }; _generateVotingRegistrationKey = async () => { const { Ed25519ExtendedPrivate: extendedPrivateKey } = await walletUtils; From 3b87bdb7223fb9ca0d6850d18ec1153a357abb91 Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Fri, 4 Feb 2022 16:39:18 -0300 Subject: [PATCH 02/23] [DDW-675] Get fund number and results date --- source/renderer/app/api/api.ts | 6 +- source/renderer/app/api/voting/types.ts | 8 +- .../app/components/voting/VotingNoWallets.tsx | 10 +- .../voting/VotingRegistrationDialogWizard.tsx | 7 + .../voting/voting-info/RegisterToVote.tsx | 11 +- .../voting/voting-info/ResultsPhase.tsx | 11 +- .../voting/voting-info/SnapshotPhase.tsx | 17 +-- .../voting/voting-info/TallyingPhase.tsx | 14 +- .../voting/voting-info/VotingInfo.tsx | 5 + .../voting/voting-info/VotingPhase.tsx | 14 +- .../VotingRegistrationStepsChooseWallet.tsx | 3 + .../VotingRegistrationStepsConfirm.tsx | 3 + .../VotingRegistrationStepsEnterPinCode.tsx | 11 +- .../VotingRegistrationStepsQrCode.tsx | 13 +- .../VotingRegistrationStepsRegister.tsx | 6 +- .../widgets/ConfirmationDialog.tsx | 8 +- .../widgets/VotingRegistrationDialog.tsx | 5 +- source/renderer/app/config/votingConfig.ts | 11 -- .../voting/VotingRegistrationPage.tsx | 2 + .../VotingRegistrationDialogContainer.tsx | 3 + .../app/i18n/locales/defaultMessages.json | 128 +++++++++--------- .../renderer/app/stores/VotingStore.spec.ts | 49 ++++--- source/renderer/app/stores/VotingStore.ts | 12 +- storybook/stories/voting/Voting.stories.tsx | 18 +++ 24 files changed, 217 insertions(+), 158 deletions(-) diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index 814858f8e7..1f4f43bf72 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -2945,8 +2945,13 @@ export default class AdaApi { catalystFund, }); return { + fundNumber: catalystFund.id + 1, + nextFundNumber: catalystFund.id + 2, fundEndTime: new Date(catalystFund.fund_end_time), fundStartTime: new Date(catalystFund.fund_start_time), + fundResults: new Date( + catalystFund.chain_vote_plans?.[0]?.chain_committee_end_time + ), nextFundStartTime: new Date(catalystFund.next_fund_start_time), nextRegistrationSnapshotTime: new Date( catalystFund.next_registration_snapshot_time @@ -2954,7 +2959,6 @@ export default class AdaApi { registrationSnapshotTime: new Date( catalystFund.registration_snapshot_time ), - fundName: catalystFund.fund_name, }; } catch (error) { logger.error('AdaApi::getCatalystFund error', { diff --git a/source/renderer/app/api/voting/types.ts b/source/renderer/app/api/voting/types.ts index 73263b2b09..53ff202449 100644 --- a/source/renderer/app/api/voting/types.ts +++ b/source/renderer/app/api/voting/types.ts @@ -28,17 +28,23 @@ export type SignatureParams = { }; }; export type GetCatalystFundResponse = { + id: number; fund_end_time: string; fund_name: string; fund_start_time: string; next_fund_start_time: string; next_registration_snapshot_time: string; registration_snapshot_time: string; + chain_vote_plans: Array<{ + chain_committee_end_time: string; + }>; }; export type CatalystFund = { + fundNumber: number; + nextFundNumber: number; fundEndTime: Date; - fundName: string; fundStartTime: Date; + fundResults: Date; nextFundStartTime: Date; nextRegistrationSnapshotTime: Date; registrationSnapshotTime: Date; diff --git a/source/renderer/app/components/voting/VotingNoWallets.tsx b/source/renderer/app/components/voting/VotingNoWallets.tsx index 1ba1bbf948..8dcad17955 100644 --- a/source/renderer/app/components/voting/VotingNoWallets.tsx +++ b/source/renderer/app/components/voting/VotingNoWallets.tsx @@ -8,7 +8,6 @@ import { ButtonSkin } from 'react-polymorph/lib/skins/simple/ButtonSkin'; import styles from './VotingNoWallets.scss'; // @ts-ignore ts-migrate(2307) FIXME: Cannot find module '../../assets/images/attention-... Remove this comment to see the full error message import icon from '../../assets/images/attention-big-thin.inline.svg'; -import { NEXT_VOTING_FUND_NUMBER } from '../../config/votingConfig'; const messages = defineMessages({ headLine: { @@ -33,6 +32,7 @@ const messages = defineMessages({ type Props = { onGoToCreateWalletClick: (...args: Array) => any; minVotingFunds: number; + nextFundNumber?: number; }; export default class VotingNoWallets extends Component { static contextTypes = { @@ -41,13 +41,17 @@ export default class VotingNoWallets extends Component { render() { const { intl } = this.context; - const { onGoToCreateWalletClick, minVotingFunds } = this.props; + const { + onGoToCreateWalletClick, + minVotingFunds, + nextFundNumber, + } = this.props; return (

{intl.formatMessage(messages.headLine, { - nextVotingFundNumber: NEXT_VOTING_FUND_NUMBER, + nextVotingFundNumber: nextFundNumber, })}

diff --git a/source/renderer/app/components/voting/VotingRegistrationDialogWizard.tsx b/source/renderer/app/components/voting/VotingRegistrationDialogWizard.tsx index 66b11a6838..49effc8815 100644 --- a/source/renderer/app/components/voting/VotingRegistrationDialogWizard.tsx +++ b/source/renderer/app/components/voting/VotingRegistrationDialogWizard.tsx @@ -42,6 +42,7 @@ type Props = { onRestart: (...args: Array) => any; onExternalLinkClick: (...args: Array) => any; hwDeviceStatus: HwDeviceStatus; + nextFundNumber?: number; }; @observer @@ -75,6 +76,7 @@ class VotingRegistrationDialogWizard extends Component { hwDeviceStatus, isTrezor, isHardwareWallet, + nextFundNumber, } = this.props; const selectedWalletId = get(selectedWallet, 'id', null); let content = null; @@ -93,6 +95,7 @@ class VotingRegistrationDialogWizard extends Component { onSelectWallet={onSelectWallet} isWalletAcceptable={isWalletAcceptable} getStakePoolById={getStakePoolById} + nextFundNumber={nextFundNumber} /> ); break; @@ -114,6 +117,7 @@ class VotingRegistrationDialogWizard extends Component { selectedWallet={selectedWallet} isTrezor={isTrezor} isHardwareWallet={isHardwareWallet} + nextFundNumber={nextFundNumber} /> ); break; @@ -130,6 +134,7 @@ class VotingRegistrationDialogWizard extends Component { transactionError={transactionError} onConfirm={onContinue} onRestart={onRestart} + nextFundNumber={nextFundNumber} /> ); break; @@ -141,6 +146,7 @@ class VotingRegistrationDialogWizard extends Component { onClose={onClose} stepsList={stepsList} activeStep={activeStep} + nextFundNumber={nextFundNumber} /> ); break; @@ -153,6 +159,7 @@ class VotingRegistrationDialogWizard extends Component { onDownloadPDF={onDownloadPDF} stepsList={stepsList} activeStep={activeStep} + nextFundNumber={nextFundNumber} /> ); break; diff --git a/source/renderer/app/components/voting/voting-info/RegisterToVote.tsx b/source/renderer/app/components/voting/voting-info/RegisterToVote.tsx index d56267a43d..4f648bf5f0 100644 --- a/source/renderer/app/components/voting/voting-info/RegisterToVote.tsx +++ b/source/renderer/app/components/voting/voting-info/RegisterToVote.tsx @@ -2,10 +2,6 @@ import React, { useState } from 'react'; import { injectIntl } from 'react-intl'; import { Button } from 'react-polymorph/lib/components/Button'; import { Checkbox } from 'react-polymorph/lib/components/Checkbox'; -import { - VOTING_NEW_SNAPSHOT_DATE, - NEXT_VOTING_FUND_NUMBER, -} from '../../../config/votingConfig'; import { formattedDateTime, mapToLongDateTimeFormat, @@ -18,11 +14,13 @@ import { messages as votingMessages } from './VotingInfo.messages'; import styles from './RegisterToVote.scss'; // @ts-ignore ts-migrate(2307) FIXME: Cannot find module './VotingInfo.scss' or its corr... Remove this comment to see the full error message import votingStyles from './VotingInfo.scss'; +import type { CatalystFund } from '../../../api/voting/types'; type Props = { currentLocale: Locale; currentDateFormat: string; currentTimeFormat: string; + fundInfo: CatalystFund; intl: Intl; onRegisterToVoteClick: (...args: Array) => any; }; @@ -31,13 +29,14 @@ function RegisterToVote({ currentLocale, currentDateFormat, currentTimeFormat, + fundInfo, intl, onRegisterToVoteClick, }: Props) { const [step1, setStep1] = useState(false); const [step2, setStep2] = useState(false); const canRegister = step1 && step2; - const castEndDate = formattedDateTime(VOTING_NEW_SNAPSHOT_DATE, { + const castEndDate = formattedDateTime(fundInfo.nextRegistrationSnapshotTime, { currentLocale, ...mapToLongDateTimeFormat({ currentLocale, @@ -49,7 +48,7 @@ function RegisterToVote({

{intl.formatMessage(votingMessages.fundName, { - votingFundNumber: NEXT_VOTING_FUND_NUMBER, + votingFundNumber: fundInfo.nextFundNumber, })} diff --git a/source/renderer/app/components/voting/voting-info/ResultsPhase.tsx b/source/renderer/app/components/voting/voting-info/ResultsPhase.tsx index 3969ff9999..43e991a31c 100644 --- a/source/renderer/app/components/voting/voting-info/ResultsPhase.tsx +++ b/source/renderer/app/components/voting/voting-info/ResultsPhase.tsx @@ -1,10 +1,6 @@ import React from 'react'; import { observer } from 'mobx-react'; import { injectIntl } from 'react-intl'; -import { - VOTING_CAST_END_DATE, - CURRENT_VOTING_FUND_NUMBER, -} from '../../../config/votingConfig'; import { formattedDateTime, mapToLongDateTimeFormat, @@ -16,12 +12,14 @@ import { messages } from './ResultsPhase.messages'; import { messages as votingMessages } from './VotingInfo.messages'; // @ts-ignore ts-migrate(2307) FIXME: Cannot find module './CurrentPhase.scss' or its co... Remove this comment to see the full error message import styles from './CurrentPhase.scss'; +import type { CatalystFund } from '../../../api/voting/types'; type Props = { currentLocale: Locale; currentDateFormat: string; currentTimeFormat: string; onExternalLinkClick: (...args: Array) => any; + fundInfo: CatalystFund; intl: Intl; }; @@ -29,6 +27,7 @@ function ResultsPhase({ currentLocale, currentDateFormat, currentTimeFormat, + fundInfo, onExternalLinkClick, intl, }: Props) { @@ -37,7 +36,7 @@ function ResultsPhase({ currentDateFormat, currentTimeFormat, }); - const endDate = formattedDateTime(VOTING_CAST_END_DATE, { + const endDate = formattedDateTime(fundInfo.fundEndTime, { currentLocale, currentDateFormat: mappedFormats.currentDateFormat, currentTimeFormat: mappedFormats.currentTimeFormat, @@ -46,7 +45,7 @@ function ResultsPhase({

{intl.formatMessage(votingMessages.fundName, { - votingFundNumber: CURRENT_VOTING_FUND_NUMBER, + votingFundNumber: fundInfo.fundNumber, })}

diff --git a/source/renderer/app/components/voting/voting-info/SnapshotPhase.tsx b/source/renderer/app/components/voting/voting-info/SnapshotPhase.tsx index ecb5c87a91..607f98ebfe 100644 --- a/source/renderer/app/components/voting/voting-info/SnapshotPhase.tsx +++ b/source/renderer/app/components/voting/voting-info/SnapshotPhase.tsx @@ -1,12 +1,6 @@ import React from 'react'; import { observer } from 'mobx-react'; import { injectIntl } from 'react-intl'; -import { - CURRENT_VOTING_FUND_NUMBER, - VOTING_SNAPSHOT_DATE, - VOTING_CAST_START_DATE, - VOTING_CAST_END_DATE, -} from '../../../config/votingConfig'; import { formattedDateTime, mapToLongDateTimeFormat, @@ -17,11 +11,13 @@ import type { Intl } from '../../../types/i18nTypes'; import styles from './CurrentPhase.scss'; import { messages } from './SnapshotPhase.messages'; import { messages as votingMessages } from './VotingInfo.messages'; +import type { CatalystFund } from '../../../api/voting/types'; type Props = { currentLocale: Locale; currentDateFormat: string; currentTimeFormat: string; + fundInfo: CatalystFund; intl: Intl; }; @@ -29,6 +25,7 @@ function SnapshotPhase({ currentLocale, currentDateFormat, currentTimeFormat, + fundInfo, intl, }: Props) { const mappedFormats = mapToLongDateTimeFormat({ @@ -36,16 +33,16 @@ function SnapshotPhase({ currentDateFormat, currentTimeFormat, }); - const snapshotDate = formattedDateTime(VOTING_SNAPSHOT_DATE, { + const snapshotDate = formattedDateTime(fundInfo.registrationSnapshotTime, { currentLocale, currentDateFormat: mappedFormats.currentDateFormat, currentTimeFormat: mappedFormats.currentTimeFormat, }); - const startDate = formattedDateTime(VOTING_CAST_START_DATE, { + const startDate = formattedDateTime(fundInfo.fundStartTime, { currentLocale, currentDateFormat: mappedFormats.currentDateFormat, }); - const endDate = formattedDateTime(VOTING_CAST_END_DATE, { + const endDate = formattedDateTime(fundInfo.fundEndTime, { currentLocale, currentDateFormat: mappedFormats.currentDateFormat, }); @@ -53,7 +50,7 @@ function SnapshotPhase({

{intl.formatMessage(votingMessages.fundName, { - votingFundNumber: CURRENT_VOTING_FUND_NUMBER, + votingFundNumber: fundInfo.fundNumber, })}

diff --git a/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx b/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx index 19d4b4bc51..302823ede9 100644 --- a/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx +++ b/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx @@ -1,11 +1,6 @@ import React from 'react'; import { observer } from 'mobx-react'; import { injectIntl } from 'react-intl'; -import { - CURRENT_VOTING_FUND_NUMBER, - VOTING_RESULTS_DATE, - VOTING_CAST_END_DATE, -} from '../../../config/votingConfig'; import { formattedDateTime, mapToLongDateTimeFormat, @@ -16,11 +11,13 @@ import type { Intl } from '../../../types/i18nTypes'; import styles from './CurrentPhase.scss'; import { messages } from './TallyingPhase.messages'; import { messages as votingMessages } from './VotingInfo.messages'; +import type { CatalystFund } from '../../../api/voting/types'; type Props = { currentLocale: Locale; currentDateFormat: string; currentTimeFormat: string; + fundInfo: CatalystFund; intl: Intl; }; @@ -28,6 +25,7 @@ function TallyingPhase({ currentLocale, currentDateFormat, currentTimeFormat, + fundInfo, intl, }: Props) { const mappedFormats = mapToLongDateTimeFormat({ @@ -35,11 +33,11 @@ function TallyingPhase({ currentDateFormat, currentTimeFormat, }); - const endDated = formattedDateTime(VOTING_CAST_END_DATE, { + const endDated = formattedDateTime(fundInfo.fundEndTime, { currentLocale, currentDateFormat: mappedFormats.currentDateFormat, }); - const resultsDate = formattedDateTime(VOTING_RESULTS_DATE, { + const resultsDate = formattedDateTime(fundInfo.fundResults, { currentLocale, currentDateFormat: mappedFormats.currentDateFormat, }); @@ -47,7 +45,7 @@ function TallyingPhase({

{intl.formatMessage(votingMessages.fundName, { - votingFundNumber: CURRENT_VOTING_FUND_NUMBER, + votingFundNumber: fundInfo.fundNumber, })}

diff --git a/source/renderer/app/components/voting/voting-info/VotingInfo.tsx b/source/renderer/app/components/voting/voting-info/VotingInfo.tsx index 9586d9516f..a6d1cb3c0d 100644 --- a/source/renderer/app/components/voting/voting-info/VotingInfo.tsx +++ b/source/renderer/app/components/voting/voting-info/VotingInfo.tsx @@ -13,12 +13,14 @@ import AppStore from './AppStore'; import RegisterToVote from './RegisterToVote'; import { FundPhases } from '../../../stores/VotingStore'; import type { FundPhase } from '../../../stores/VotingStore'; +import type { CatalystFund } from '../../../api/voting/types'; type Props = { currentLocale: Locale; currentDateFormat: string; currentTimeFormat: string; fundPhase: FundPhase; + fundInfo: CatalystFund; onRegisterToVoteClick: (...args: Array) => any; onExternalLinkClick: (...args: Array) => any; }; @@ -34,6 +36,7 @@ const VotingInfo = ({ currentDateFormat, currentTimeFormat, fundPhase, + fundInfo, onRegisterToVoteClick, onExternalLinkClick, }: Props) => { @@ -46,6 +49,7 @@ const VotingInfo = ({

{intl.formatMessage(votingMessages.fundName, { - votingFundNumber: CURRENT_VOTING_FUND_NUMBER, + votingFundNumber: fundInfo.fundNumber, })}

diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx index 284f7e49a7..690aeb4d24 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx @@ -75,6 +75,7 @@ type Props = { selectedWalletId: string | null | undefined; isWalletAcceptable: (...args: Array) => any; getStakePoolById: (...args: Array) => any; + nextFundNumber?: number; }; type State = { selectedWalletId: string | null | undefined; @@ -111,6 +112,7 @@ export default class VotingRegistrationStepsChooseWallet extends Component< isWalletAcceptable, numberOfStakePools, getStakePoolById, + nextFundNumber, } = this.props; const buttonLabel = intl.formatMessage(messages.continueButtonLabel); const selectedWallet: Wallet | null | undefined = wallets.find( @@ -167,6 +169,7 @@ export default class VotingRegistrationStepsChooseWallet extends Component< activeStep={activeStep} actions={actions} containerClassName={styles.component} + nextFundNumber={nextFundNumber} >

diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsConfirm.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsConfirm.tsx index 4bf86ac35b..0667e3eb9c 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsConfirm.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsConfirm.tsx @@ -80,6 +80,7 @@ type Props = { | (LocalizableError | null | undefined); onConfirm: (...args: Array) => any; onRestart: (...args: Array) => any; + nextFundNumber?: number; }; @observer @@ -100,6 +101,7 @@ class VotingRegistrationStepsConfirm extends Component { transactionConfirmations, transactionError, onClose, + nextFundNumber, } = this.props; const description = intl.formatMessage(messages.description); const descriptionRestart = ( @@ -154,6 +156,7 @@ class VotingRegistrationStepsConfirm extends Component { actions={actions} containerClassName={styles.component} hideSteps={!!transactionError} + nextFundNumber={nextFundNumber} > {transactionError ? ( diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx index 7fd55c0956..9f62b0e71c 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx @@ -9,10 +9,7 @@ import { isValidRepeatPinCode, } from '../../../utils/validations'; import { FORM_VALIDATION_DEBOUNCE_WAIT } from '../../../config/timingConfig'; -import { - VOTING_REGISTRATION_PIN_CODE_LENGTH, - NEXT_VOTING_FUND_NUMBER, -} from '../../../config/votingConfig'; +import { VOTING_REGISTRATION_PIN_CODE_LENGTH } from '../../../config/votingConfig'; // @ts-ignore ts-migrate(2307) FIXME: Cannot find module './VotingRegistrationStepsEnter... Remove this comment to see the full error message import styles from './VotingRegistrationStepsEnterPinCode.scss'; import VotingRegistrationDialog from './widgets/VotingRegistrationDialog'; @@ -66,6 +63,7 @@ type Props = { stepsList: Array; activeStep: number; onSetPinCode: (...args: Array) => any; + nextFundNumber?: number; }; @observer @@ -137,7 +135,7 @@ class VotingRegistrationStepsEnterPinCode extends Component { render() { const { form } = this; const { intl } = this.context; - const { onClose, stepsList, activeStep } = this.props; + const { onClose, stepsList, activeStep, nextFundNumber } = this.props; const buttonLabel = intl.formatMessage(messages.continueButtonLabel); const enterPinCodeLabel = intl.formatMessage(messages.enterPinCodeLabel); const repeatPinCodeLabel = intl.formatMessage(messages.repeatPinCodeLabel); @@ -165,12 +163,13 @@ class VotingRegistrationStepsEnterPinCode extends Component { activeStep={activeStep} actions={actions} containerClassName={styles.component} + nextFundNumber={nextFundNumber} >

diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx index ce48d1805d..0df668d4c1 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx @@ -5,7 +5,6 @@ import { set } from 'lodash'; import { observer } from 'mobx-react'; import { Checkbox } from 'react-polymorph/lib/components/Checkbox'; import VotingRegistrationDialog from './widgets/VotingRegistrationDialog'; -import { NEXT_VOTING_FUND_NUMBER } from '../../../config/votingConfig'; // @ts-ignore ts-migrate(2307) FIXME: Cannot find module './VotingRegistrationStepsQrCod... Remove this comment to see the full error message import styles from './VotingRegistrationStepsQrCode.scss'; @@ -68,6 +67,7 @@ type Props = { stepsList: Array; activeStep: number; qrCode: string | null | undefined; + nextFundNumber?: number; }; type State = { isCheckbox1Accepted: boolean; @@ -96,14 +96,20 @@ class VotingRegistrationStepsQrCode extends Component { render() { const { intl } = this.context; const { isCheckbox1Accepted, isCheckbox2Accepted } = this.state; - const { stepsList, activeStep, qrCode, onDownloadPDF } = this.props; + const { + stepsList, + activeStep, + qrCode, + onDownloadPDF, + nextFundNumber, + } = this.props; const qrCodeTitle = intl.formatMessage(messages.qrCodeTitle); const qrCodeDescription1 = intl.formatMessage(messages.qrCodeDescription1); const qrCodeDescription2 = intl.formatMessage(messages.qrCodeDescription2); const qrCodeWarning = ; const checkbox1Label = intl.formatMessage(messages.checkbox1Label); const checkbox2Label = intl.formatMessage(messages.checkbox2Label, { - nextVotingFundNumber: NEXT_VOTING_FUND_NUMBER, + nextVotingFundNumber: nextFundNumber, }); const closeButtonLabel = intl.formatMessage(messages.closeButtonLabel); const saveAsPdfButtonLabel = intl.formatMessage( @@ -142,6 +148,7 @@ class VotingRegistrationStepsQrCode extends Component { actions={actions} containerClassName={styles.component} hideCloseButton={!areBothCheckboxesAccepted} + nextFundNumber={nextFundNumber} >
{qrCode && ( diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx index dddb75284b..4a9dbd07a5 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx @@ -21,7 +21,6 @@ import styles from './VotingRegistrationStepsRegister.scss'; import VotingRegistrationDialog from './widgets/VotingRegistrationDialog'; import Wallet, { HwDeviceStatuses } from '../../../domains/Wallet'; import HardwareWalletStatus from '../../hardware-wallet/HardwareWalletStatus'; -import { NEXT_VOTING_FUND_NUMBER } from '../../../config/votingConfig'; import type { HwDeviceStatus } from '../../../domains/Wallet'; const messages = defineMessages({ @@ -78,6 +77,7 @@ type Props = { transactionError?: LocalizableError | null | undefined; hwDeviceStatus: HwDeviceStatus; selectedWallet: Wallet | null | undefined; + nextFundNumber?: number; isTrezor: boolean; isHardwareWallet: boolean; isSubmitting: boolean; @@ -156,6 +156,7 @@ class VotingRegistrationStepsRegister extends Component { selectedWallet, isTrezor, isHardwareWallet, + nextFundNumber, } = this.props; // @ts-ignore ts-migrate(2339) FIXME: Property '$' does not exist on type 'ReactToolboxM... Remove this comment to see the full error message const spendingPasswordField = form.$('spendingPassword'); @@ -185,12 +186,13 @@ class VotingRegistrationStepsRegister extends Component { actions={actions} onBack={onBack} containerClassName={styles.component} + nextFundNumber={nextFundNumber} >

diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx index 6e96094b99..d7be2ea37d 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx @@ -3,7 +3,6 @@ import { observer } from 'mobx-react'; import classnames from 'classnames'; import { defineMessages, intlShape } from 'react-intl'; import Dialog from '../../../widgets/Dialog'; -import { NEXT_VOTING_FUND_NUMBER } from '../../../../config/votingConfig'; // @ts-ignore ts-migrate(2307) FIXME: Cannot find module './ConfirmationDialog.scss' or ... Remove this comment to see the full error message import styles from './ConfirmationDialog.scss'; @@ -37,6 +36,7 @@ const messages = defineMessages({ }, }); type Props = { + nextFundNumber?: number; onConfirm: (...args: Array) => any; onCancel: (...args: Array) => any; }; @@ -49,7 +49,7 @@ class ConfirmationDialog extends Component { render() { const { intl } = this.context; - const { onConfirm, onCancel } = this.props; + const { nextFundNumber, onConfirm, onCancel } = this.props; const dialogClasses = classnames([styles.component, 'ConfirmDialog']); const confirmButtonClasses = classnames([ 'confirmButton', // 'attention', @@ -72,7 +72,7 @@ class ConfirmationDialog extends Component { { >

{intl.formatMessage(messages.content, { - nextVotingFundNumber: NEXT_VOTING_FUND_NUMBER, + nextVotingFundNumber: nextFundNumber, })}

diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/VotingRegistrationDialog.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/VotingRegistrationDialog.tsx index cb41e79d2e..6a6446d4c1 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/VotingRegistrationDialog.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/VotingRegistrationDialog.tsx @@ -12,7 +12,6 @@ import Dialog from '../../../widgets/Dialog'; import DialogCloseButton from '../../../widgets/DialogCloseButton'; import DialogBackButton from '../../../widgets/DialogBackButton'; import type { DialogActions } from '../../../widgets/Dialog'; -import { NEXT_VOTING_FUND_NUMBER } from '../../../../config/votingConfig'; const messages = defineMessages({ dialogTitle: { @@ -37,6 +36,7 @@ type Props = { contentClassName?: string | null | undefined; hideCloseButton?: boolean; hideSteps?: boolean; + nextFundNumber?: number; }; @observer @@ -61,6 +61,7 @@ class VotingRegistrationDialog extends Component { contentClassName, hideCloseButton, hideSteps, + nextFundNumber, } = this.props; const containerStyles = classnames([styles.container, containerClassName]); const contentStyles = classnames([styles.content, contentClassName]); @@ -77,7 +78,7 @@ class VotingRegistrationDialog extends Component { { if (!wallets.allWallets.length) { return ( @@ -53,6 +54,7 @@ class VotingRegistrationPage extends Component { const { currentTimeFormat, currentDateFormat, currentLocale } = profile; return ( { isTransactionConfirmed, transactionConfirmations, qrCode, + catalystFund, } = voting; const { openExternalLink } = app; const { @@ -227,9 +228,11 @@ class VotingRegistrationDialogContainer extends Component { onExternalLinkClick={openExternalLink} isTrezor={isTrezor} isHardwareWallet={isHardwareWallet} + nextFundNumber={catalystFund?.nextFundNumber} /> {isConfirmationDialogOpen && ( { this.props.actions.dialogs.closeActiveDialog.trigger(); diff --git a/source/renderer/app/i18n/locales/defaultMessages.json b/source/renderer/app/i18n/locales/defaultMessages.json index 934bf3a14e..bb8877122b 100644 --- a/source/renderer/app/i18n/locales/defaultMessages.json +++ b/source/renderer/app/i18n/locales/defaultMessages.json @@ -8692,13 +8692,13 @@ "description": "Description on the voting registration \"enter pin code\" step.", "end": { "column": 3, - "line": 27 + "line": 24 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx", "id": "voting.votingRegistration.enterPinCode.step.description", "start": { "column": 15, - "line": 21 + "line": 18 } }, { @@ -8706,13 +8706,13 @@ "description": "Reminder on the voting registration \"enter pin code\" step.", "end": { "column": 3, - "line": 33 + "line": 30 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx", "id": "voting.votingRegistration.enterPinCode.step.reminder", "start": { "column": 12, - "line": 28 + "line": 25 } }, { @@ -8720,13 +8720,13 @@ "description": "Label for pin code input on the voting registration \"enter pin code\" step.", "end": { "column": 3, - "line": 39 + "line": 36 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx", "id": "voting.votingRegistration.enterPinCode.step.enterPinCodeLabel", "start": { "column": 21, - "line": 34 + "line": 31 } }, { @@ -8734,13 +8734,13 @@ "description": "Label for repeat pin code on the voting registration \"enter pin code\" step.", "end": { "column": 3, - "line": 45 + "line": 42 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx", "id": "voting.votingRegistration.enterPinCode.step.repeatPinCodeLabel", "start": { "column": 22, - "line": 40 + "line": 37 } }, { @@ -8748,13 +8748,13 @@ "description": "Error message shown when repeat pin code is invalid.", "end": { "column": 3, - "line": 50 + "line": 47 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx", "id": "voting.votingRegistration.enterPinCode.step.errors.invalidPinCode", "start": { "column": 18, - "line": 46 + "line": 43 } }, { @@ -8762,13 +8762,13 @@ "description": "Error message shown when repeat pin code is invalid.", "end": { "column": 3, - "line": 56 + "line": 53 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx", "id": "voting.votingRegistration.enterPinCode.step.errors.invalidRepeatPinCode", "start": { "column": 24, - "line": 51 + "line": 48 } }, { @@ -8776,13 +8776,13 @@ "description": "Label for continue button on the voting registration \"enter pin code\" step.", "end": { "column": 3, - "line": 62 + "line": 59 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx", "id": "voting.votingRegistration.enterPinCode.step.continueButtonLabel", "start": { "column": 23, - "line": 57 + "line": 54 } } ], @@ -8795,13 +8795,13 @@ "description": "Qr code title on the voting registration \"qr code\" step.", "end": { "column": 3, - "line": 17 + "line": 16 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx", "id": "voting.votingRegistration.qrCode.step.qrCodeTitle", "start": { "column": 15, - "line": 13 + "line": 12 } }, { @@ -8809,13 +8809,13 @@ "description": "Part 1 of Qr code description of use on the voting registration \"qr code\" step.", "end": { "column": 3, - "line": 24 + "line": 23 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx", "id": "voting.votingRegistration.qrCode.step.qrCodeDescription1", "start": { "column": 22, - "line": 18 + "line": 17 } }, { @@ -8823,13 +8823,13 @@ "description": "Part 2 of Qr code description of use on the voting registration \"qr code\" step.", "end": { "column": 3, - "line": 31 + "line": 30 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx", "id": "voting.votingRegistration.qrCode.step.qrCodeDescription2", "start": { "column": 22, - "line": 25 + "line": 24 } }, { @@ -8837,13 +8837,13 @@ "description": "Qr code warning on the voting registration \"qr code\" step.", "end": { "column": 3, - "line": 37 + "line": 36 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx", "id": "voting.votingRegistration.qrCode.step.qrCodeWarning", "start": { "column": 17, - "line": 32 + "line": 31 } }, { @@ -8851,13 +8851,13 @@ "description": "First checkbox label on the voting registration \"qr code\" step.", "end": { "column": 3, - "line": 44 + "line": 43 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx", "id": "voting.votingRegistration.qrCode.step.checkbox1Label", "start": { "column": 18, - "line": 38 + "line": 37 } }, { @@ -8865,13 +8865,13 @@ "description": "Second checkbox label on the voting registration \"qr code\" step.", "end": { "column": 3, - "line": 51 + "line": 50 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx", "id": "voting.votingRegistration.qrCode.step.checkbox2Label", "start": { "column": 18, - "line": 45 + "line": 44 } }, { @@ -8879,13 +8879,13 @@ "description": "\"Close\" button label on the voting registration \"qr code\" step.", "end": { "column": 3, - "line": 57 + "line": 56 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx", "id": "voting.votingRegistration.qrCode.step.closeButtonLabel", "start": { "column": 20, - "line": 52 + "line": 51 } }, { @@ -8893,13 +8893,13 @@ "description": "\"Save as PDF\" button label on the voting registration \"qr code\" step.", "end": { "column": 3, - "line": 63 + "line": 62 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx", "id": "voting.votingRegistration.qrCode.step.saveAsPdfButtonLabel", "start": { "column": 24, - "line": 58 + "line": 57 } } ], @@ -8912,13 +8912,13 @@ "description": "Description on the voting registration \"sign\" step.", "end": { "column": 3, - "line": 33 + "line": 32 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx", "id": "voting.votingRegistration.register.step.description", "start": { "column": 15, - "line": 28 + "line": 27 } }, { @@ -8926,13 +8926,13 @@ "description": "Label for continue button on the voting registration \"sign\" step.", "end": { "column": 3, - "line": 39 + "line": 38 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx", "id": "voting.votingRegistration.register.step.continueButtonLabel", "start": { "column": 23, - "line": 34 + "line": 33 } }, { @@ -8940,13 +8940,13 @@ "description": "Fees label on the voting registration \"sign\" step.", "end": { "column": 3, - "line": 44 + "line": 43 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx", "id": "voting.votingRegistration.register.step.feesLabel", "start": { "column": 13, - "line": 40 + "line": 39 } }, { @@ -8954,13 +8954,13 @@ "description": "Placeholder for \"spending password\"", "end": { "column": 3, - "line": 49 + "line": 48 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx", "id": "voting.votingRegistration.register.step.spendingPasswordPlaceholder", "start": { "column": 31, - "line": 45 + "line": 44 } }, { @@ -8968,13 +8968,13 @@ "description": "Label for \"spending password\"", "end": { "column": 3, - "line": 54 + "line": 53 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx", "id": "voting.votingRegistration.register.step.spendingPasswordLabel", "start": { "column": 25, - "line": 50 + "line": 49 } }, { @@ -8982,13 +8982,13 @@ "description": "\"Calculating fees\" message in the \"sign\" step.", "end": { "column": 3, - "line": 59 + "line": 58 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx", "id": "voting.votingRegistration.register.step.calculatingFees", "start": { "column": 19, - "line": 55 + "line": 54 } }, { @@ -8996,13 +8996,13 @@ "description": "\"Learn more\" link on the \"sign\" step.", "end": { "column": 3, - "line": 64 + "line": 63 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx", "id": "voting.votingRegistration.register.step.learnMoreLink", "start": { "column": 17, - "line": 60 + "line": 59 } }, { @@ -9010,13 +9010,13 @@ "description": "Learn more\" link URL on the \"sign\" step.", "end": { "column": 3, - "line": 70 + "line": 69 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx", "id": "voting.votingRegistration.register.step.learntMoreLinkUrl", "start": { "column": 21, - "line": 65 + "line": 64 } } ], @@ -9029,13 +9029,13 @@ "description": "Headline for the voting registration cancellation confirmation dialog.", "end": { "column": 3, - "line": 16 + "line": 15 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx", "id": "voting.votingRegistration.dialog.confirmation.headline", "start": { "column": 12, - "line": 11 + "line": 10 } }, { @@ -9043,13 +9043,13 @@ "description": "Content for the voting registration cancellation confirmation dialog.", "end": { "column": 3, - "line": 23 + "line": 22 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx", "id": "voting.votingRegistration.dialog.confirmation.content", "start": { "column": 11, - "line": 17 + "line": 16 } }, { @@ -9057,13 +9057,13 @@ "description": "\"Cancel registration\" button label for the voting registration cancellation confirmation dialog.", "end": { "column": 3, - "line": 30 + "line": 29 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx", "id": "voting.votingRegistration.dialog.confirmation.button.cancelButtonLabel", "start": { "column": 21, - "line": 24 + "line": 23 } }, { @@ -9071,13 +9071,13 @@ "description": "\"Continue registration\" button label for the voting registration cancellation confirmation dialog.", "end": { "column": 3, - "line": 37 + "line": 36 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx", "id": "voting.votingRegistration.dialog.confirmation.button.confirmButtonLabel", "start": { "column": 22, - "line": 31 + "line": 30 } } ], @@ -9090,13 +9090,13 @@ "description": "Tile \"Register to vote\" for voting registration", "end": { "column": 3, - "line": 22 + "line": 21 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/VotingRegistrationDialog.tsx", "id": "voting.votingRegistration.dialog.dialogTitle", "start": { "column": 15, - "line": 18 + "line": 17 } }, { @@ -9104,13 +9104,13 @@ "description": "Sub title for voting registration", "end": { "column": 3, - "line": 27 + "line": 26 }, "file": "source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/VotingRegistrationDialog.tsx", "id": "voting.votingRegistration.dialog.subtitle", "start": { "column": 12, - "line": 23 + "line": 22 } } ], @@ -9184,13 +9184,13 @@ "description": "\"No wallets\" headLine on the voting info page.", "end": { "column": 3, - "line": 19 + "line": 18 }, "file": "source/renderer/app/components/voting/VotingNoWallets.tsx", "id": "voting.info.noWallets.headLine", "start": { "column": 12, - "line": 14 + "line": 13 } }, { @@ -9198,13 +9198,13 @@ "description": "\"No wallets\" instructions on the voting info page.", "end": { "column": 3, - "line": 25 + "line": 24 }, "file": "source/renderer/app/components/voting/VotingNoWallets.tsx", "id": "voting.info.noWallets.instructions", "start": { "column": 16, - "line": 20 + "line": 19 } }, { @@ -9212,13 +9212,13 @@ "description": "Label for \"Create New Wallet\" button on the voting info page.", "end": { "column": 3, - "line": 31 + "line": 30 }, "file": "source/renderer/app/components/voting/VotingNoWallets.tsx", "id": "voting.info.noWallets.createWalletButtonLabel", "start": { "column": 27, - "line": 26 + "line": 25 } } ], diff --git a/source/renderer/app/stores/VotingStore.spec.ts b/source/renderer/app/stores/VotingStore.spec.ts index d078b5307c..55c1a4161c 100644 --- a/source/renderer/app/stores/VotingStore.spec.ts +++ b/source/renderer/app/stores/VotingStore.spec.ts @@ -1,12 +1,18 @@ import type { Api } from '../api/index'; import type { ActionsMap } from '../actions/index'; import VotingStore, { FundPhases } from './VotingStore'; -import { - VOTING_CAST_END_DATE, - VOTING_CAST_START_DATE, - VOTING_RESULTS_DATE, - VOTING_SNAPSHOT_DATE, -} from '../config/votingConfig'; +import type { CatalystFund } from '../api/voting/types'; + +const mockFundInfo: CatalystFund = { + fundNumber: 7, + nextFundNumber: 8, + fundEndTime: new Date('Feb 3, 2022, 11:00 UTC'), + fundStartTime: new Date('Jan 20, 2022, 11:00 UTC'), + fundResults: new Date('Feb 10, 2022'), + nextRegistrationSnapshotTime: new Date('Apr 7, 2022, 11:00 UTC'), + registrationSnapshotTime: new Date('Jan 6, 2022, 11:00 UTC'), + nextFundStartTime: new Date('Jan 6, 2022, 11:00 UTC'), +}; describe('VotingStore', () => { const api: Api = { @@ -14,22 +20,31 @@ describe('VotingStore', () => { } as any; const actions: ActionsMap = jest.fn() as any; const cases = [ - [new Date(VOTING_SNAPSHOT_DATE.getTime() - 60000), FundPhases.SNAPSHOT], - [VOTING_SNAPSHOT_DATE, FundPhases.SNAPSHOT], - [new Date(VOTING_CAST_START_DATE.getTime() - 60000), FundPhases.SNAPSHOT], - [VOTING_CAST_START_DATE, FundPhases.VOTING], - [new Date(VOTING_CAST_END_DATE.getTime() - 60000), FundPhases.VOTING], - [VOTING_CAST_END_DATE, FundPhases.TALLYING], - [new Date(VOTING_RESULTS_DATE.getTime() - 60000), FundPhases.TALLYING], - [VOTING_RESULTS_DATE, FundPhases.RESULTS], + [ + new Date(mockFundInfo.registrationSnapshotTime.getTime() - 60000), + FundPhases.SNAPSHOT, + ], + [mockFundInfo.registrationSnapshotTime, FundPhases.SNAPSHOT], + [ + new Date(mockFundInfo.fundStartTime.getTime() - 60000), + FundPhases.SNAPSHOT, + ], + [mockFundInfo.fundStartTime, FundPhases.VOTING], + [new Date(mockFundInfo.fundEndTime.getTime() - 60000), FundPhases.VOTING], + [mockFundInfo.fundEndTime, FundPhases.TALLYING], + [new Date(mockFundInfo.fundResults.getTime() - 60000), FundPhases.TALLYING], + [mockFundInfo.fundResults, FundPhases.RESULTS], ]; + const votingStore = new VotingStore(api, actions); + + beforeAll(() => { + votingStore.catalystFund = mockFundInfo; + }); + test.each(cases)( `should have correct fund phase for date %s - %s phase`, (date, expected) => { - const votingStore = new VotingStore(api, actions); - votingStore._checkFundPhase(date); - expect(votingStore.fundPhase).toEqual(expected); } ); diff --git a/source/renderer/app/stores/VotingStore.ts b/source/renderer/app/stores/VotingStore.ts index a052cdac69..0ea63557ff 100644 --- a/source/renderer/app/stores/VotingStore.ts +++ b/source/renderer/app/stores/VotingStore.ts @@ -10,11 +10,9 @@ import { import { formattedArrayBufferToHexString } from '../utils/formatters'; import walletUtils from '../utils/walletUtils'; import { - VOTING_RESULTS_DATE, VOTING_PHASE_CHECK_INTERVAL, VOTING_REGISTRATION_TRANSACTION_POLLING_INTERVAL, VOTING_REGISTRATION_MIN_TRANSACTION_CONFIRMATIONS, - NEXT_VOTING_FUND_NUMBER, } from '../config/votingConfig'; import { votingPDFGenerator } from '../utils/votingPDFGenerator'; import { i18nContext } from '../utils/i18nContext'; @@ -69,7 +67,7 @@ export default class VotingStore extends Store { @observable fundPhase: FundPhase = FundPhases.SNAPSHOT; @observable - catalystFund: CatalystFund | null = null; + catalystFund: Partial = {}; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'IntervalID'. transactionPollingInterval: IntervalID | null | undefined = null; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'IntervalID'. @@ -420,7 +418,7 @@ export default class VotingStore extends Store { currentDateFormat, currentTimeFormat, } = this.stores.profile; - const nextVotingFundNumber = NEXT_VOTING_FUND_NUMBER; + const nextVotingFundNumber = this.catalystFund?.nextFundNumber; const { network, isMainnet } = this.environment; const intl = i18nContext(currentLocale); @@ -483,8 +481,10 @@ export default class VotingStore extends Store { date >= this.catalystFund?.fundStartTime && date < this.catalystFund?.fundEndTime, [FundPhases.TALLYING]: (date: Date) => - date >= this.catalystFund?.fundEndTime && date < VOTING_RESULTS_DATE, - [FundPhases.RESULTS]: (date: Date) => date >= VOTING_RESULTS_DATE, + date >= this.catalystFund?.fundEndTime && + date < this.catalystFund?.fundResults, + [FundPhases.RESULTS]: (date: Date) => + date >= this.catalystFund?.fundResults, }; this.fundPhase = Object.values(FundPhases).find((phase: FundPhase) => diff --git a/storybook/stories/voting/Voting.stories.tsx b/storybook/stories/voting/Voting.stories.tsx index c0b611304d..cb22658402 100644 --- a/storybook/stories/voting/Voting.stories.tsx +++ b/storybook/stories/voting/Voting.stories.tsx @@ -12,6 +12,7 @@ import VotingRegistrationStepsEnterPinCode from '../../../source/renderer/app/co import VotingRegistrationStepsQrCode from '../../../source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode'; import VotingInfo from '../../../source/renderer/app/components/voting/voting-info/VotingInfo'; import { FundPhases } from '../../../source/renderer/app/stores/VotingStore'; +import { CatalystFund } from '../../../source/renderer/app/api/voting/types'; import { VotingFooterLinks } from '../../../source/renderer/app/components/voting/VotingFooterLinks'; import { LANGUAGE_OPTIONS, @@ -30,6 +31,17 @@ import { import { HwDeviceStatuses } from '../../../source/renderer/app/domains/Wallet'; import VerticalFlexContainer from '../../../source/renderer/app/components/layout/VerticalFlexContainer'; +const mockFundInfo: CatalystFund = { + fundNumber: 7, + nextFundNumber: 8, + fundEndTime: new Date('Feb 3, 2022, 11:00 UTC'), + fundStartTime: new Date('Jan 20, 2022, 11:00 UTC'), + fundResults: new Date('Feb 10, 2022'), + nextRegistrationSnapshotTime: new Date('Apr 7, 2022, 11:00 UTC'), + registrationSnapshotTime: new Date('Jan 6, 2022, 11:00 UTC'), + nextFundStartTime: new Date('Jan 6, 2022, 11:00 UTC'), +}; + const assets = { available: [ { @@ -96,6 +108,7 @@ storiesOf('Voting|Voting Registration Wizard', module) selectedWalletId={WALLETS[0].id} isWalletAcceptable={action('isWalletAcceptable')} getStakePoolById={action('getStakePoolById')} + nextFundNumber={8} /> )) .add('Voting Registration - Step 2', () => ( @@ -104,6 +117,7 @@ storiesOf('Voting|Voting Registration Wizard', module) onBack={action('onBack')} stepsList={stepsList} activeStep={2} + nextFundNumber={8} transactionFee={ new BigNumber( number('transactionFee', 0.3, { @@ -136,6 +150,7 @@ storiesOf('Voting|Voting Registration Wizard', module) onConfirm={action('onConfirm')} onRestart={action('onRestart')} transactionError={boolean('transactionError', false)} + nextFundNumber={8} /> )) .add('Voting Registration - Step 4', () => ( @@ -144,6 +159,7 @@ storiesOf('Voting|Voting Registration Wizard', module) stepsList={stepsList} activeStep={4} onSetPinCode={action('onSetPinCode')} + nextFundNumber={8} /> )) .add('Voting Registration - Step 5', () => ( @@ -153,6 +169,7 @@ storiesOf('Voting|Voting Registration Wizard', module) stepsList={stepsList} activeStep={2} qrCode="djkhfkwdjhfkwdhfkwjdhfkwdhf9wdyf9wdh9u3h03hd0f3hd0h30hf30dhf03dhf03dhf03dhf03dhf0u3dhf0u3dhf0u3dfh30uhfd30uh" + nextFundNumber={8} /> )); storiesOf('Voting|Voting Info', module) @@ -161,6 +178,7 @@ storiesOf('Voting|Voting Info', module) .add('Voting Info', () => ( Date: Mon, 7 Feb 2022 10:18:22 -0300 Subject: [PATCH 03/23] [DDW-675] Fix log --- source/renderer/app/api/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index 1f4f43bf72..cf269e4147 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -2964,7 +2964,7 @@ export default class AdaApi { logger.error('AdaApi::getCatalystFund error', { error, }); - throw new Error('Unable to fetch news'); + throw new Error('Unable to fetch catalyst fund'); } }; } // ========== TRANSFORM SERVER DATA INTO FRONTEND MODELS ========= From 1ac2126ace9a7f32e8ec327b1a94ae10e6af249d Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Mon, 7 Feb 2022 10:19:10 -0300 Subject: [PATCH 04/23] [DDW-675] CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c90ba3a421..af7c2f79b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Features +- Implemented catalyst dynamic content ([PR 2856](https://github.com/input-output-hk/daedalus/pull/2856)) - Unified CPU info in diagnostics dialog ([PR 2818](https://github.com/input-output-hk/daedalus/pull/2818)) - Implemented wallet sorting on sidebar menu ([PR 2775](https://github.com/input-output-hk/daedalus/pull/2775)) - Implemented new token picker ([PR 2787](https://github.com/input-output-hk/daedalus/pull/2787)) From 1b5f927eec045750d28664ab7b1904aa921bf80b Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Mon, 7 Feb 2022 17:33:00 -0300 Subject: [PATCH 05/23] [DDW-675] API error message --- .../voting/voting-info/ApiError.messages.ts | 20 +++++++ .../voting/voting-info/ApiError.scss | 24 ++++++++ .../voting/voting-info/ApiError.tsx | 24 ++++++++ .../voting/voting-info/VotingInfo.tsx | 55 +++++++++++-------- .../app/i18n/locales/defaultMessages.json | 47 ++++++++++++++++ source/renderer/app/i18n/locales/en-US.json | 3 + source/renderer/app/i18n/locales/ja-JP.json | 3 + source/renderer/app/stores/VotingStore.ts | 12 ++-- 8 files changed, 158 insertions(+), 30 deletions(-) create mode 100644 source/renderer/app/components/voting/voting-info/ApiError.messages.ts create mode 100644 source/renderer/app/components/voting/voting-info/ApiError.scss create mode 100644 source/renderer/app/components/voting/voting-info/ApiError.tsx diff --git a/source/renderer/app/components/voting/voting-info/ApiError.messages.ts b/source/renderer/app/components/voting/voting-info/ApiError.messages.ts new file mode 100644 index 0000000000..52488d2df5 --- /dev/null +++ b/source/renderer/app/components/voting/voting-info/ApiError.messages.ts @@ -0,0 +1,20 @@ +import { defineMessages } from 'react-intl'; + +export const messages = defineMessages({ + title: { + id: 'voting.apiError.title', + defaultMessage: '!!!Catalyst API unavailable', + description: 'Title', + }, + description1: { + id: 'voting.apiError.description1', + defaultMessage: + '!!!We could not fetch the API to fetch the Catalyst Project dates', + description: 'Description 1', + }, + description2: { + id: 'voting.apiError.description2', + defaultMessage: '!!!Please, try again later', + description: 'Description 2', + }, +}); diff --git a/source/renderer/app/components/voting/voting-info/ApiError.scss b/source/renderer/app/components/voting/voting-info/ApiError.scss new file mode 100644 index 0000000000..8ea822c144 --- /dev/null +++ b/source/renderer/app/components/voting/voting-info/ApiError.scss @@ -0,0 +1,24 @@ +@import '../votingConfig'; + +.root { + @extend %regularText; + align-items: start; + background-color: var(--theme-button-flat-background-color); + border-radius: 5px; + display: flex; + flex-direction: column; + padding: 20px; + width: 100%; + + .title { + color: var(--theme-button-flat-text-color); + font-family: var(--font-bold); + font-size: 18px; + line-height: 1.33; + margin-bottom: 11px; + } + + .description1 { + font-family: var(--font-medium); + } +} diff --git a/source/renderer/app/components/voting/voting-info/ApiError.tsx b/source/renderer/app/components/voting/voting-info/ApiError.tsx new file mode 100644 index 0000000000..15e4597b24 --- /dev/null +++ b/source/renderer/app/components/voting/voting-info/ApiError.tsx @@ -0,0 +1,24 @@ +import React from 'react'; +import { injectIntl } from 'react-intl'; +import type { Intl } from '../../../types/i18nTypes'; +// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './CurrentPhase.scss' or its co... Remove this comment to see the full error message +import styles from './ApiError.scss'; +import { messages } from './ApiError.messages'; + +type Props = { + intl: Intl; +}; + +function ApiError({ intl }: Props) { + return ( +
+

{intl.formatMessage(messages.title)}

+ + {intl.formatMessage(messages.description1)} + + {intl.formatMessage(messages.description2)} +
+ ); +} + +export default injectIntl(ApiError); diff --git a/source/renderer/app/components/voting/voting-info/VotingInfo.tsx b/source/renderer/app/components/voting/voting-info/VotingInfo.tsx index a6d1cb3c0d..7c087aae0c 100644 --- a/source/renderer/app/components/voting/voting-info/VotingInfo.tsx +++ b/source/renderer/app/components/voting/voting-info/VotingInfo.tsx @@ -11,6 +11,7 @@ import TallyingPhase from './TallyingPhase'; import Headline from './Headline'; import AppStore from './AppStore'; import RegisterToVote from './RegisterToVote'; +import ApiError from './ApiError'; import { FundPhases } from '../../../stores/VotingStore'; import type { FundPhase } from '../../../stores/VotingStore'; import type { CatalystFund } from '../../../api/voting/types'; @@ -47,30 +48,36 @@ const VotingInfo = ({
-
- -
- -
-
-
- -
+ {!fundPhase ? ( + + ) : ( + <> +
+ +
+ +
+
+
+ +
+ + )}
diff --git a/source/renderer/app/i18n/locales/defaultMessages.json b/source/renderer/app/i18n/locales/defaultMessages.json index bb8877122b..0e84ef8018 100644 --- a/source/renderer/app/i18n/locales/defaultMessages.json +++ b/source/renderer/app/i18n/locales/defaultMessages.json @@ -8089,6 +8089,53 @@ ], "path": "source/renderer/app/components/status/DaedalusDiagnostics.json" }, + { + "descriptors": [ + { + "defaultMessage": "!!!Catalyst API unavailable", + "description": "Title", + "end": { + "column": 3, + "line": 8 + }, + "file": "source/renderer/app/components/voting/voting-info/ApiError.messages.ts", + "id": "voting.apiError.title", + "start": { + "column": 9, + "line": 4 + } + }, + { + "defaultMessage": "!!!We could not fetch the API to fetch the Catalyst Project dates", + "description": "Description 1", + "end": { + "column": 3, + "line": 14 + }, + "file": "source/renderer/app/components/voting/voting-info/ApiError.messages.ts", + "id": "voting.apiError.description1", + "start": { + "column": 16, + "line": 9 + } + }, + { + "defaultMessage": "!!!Please, try again later", + "description": "Description 2", + "end": { + "column": 3, + "line": 19 + }, + "file": "source/renderer/app/components/voting/voting-info/ApiError.messages.ts", + "id": "voting.apiError.description2", + "start": { + "column": 16, + "line": 15 + } + } + ], + "path": "source/renderer/app/components/voting/voting-info/ApiError.messages.json" + }, { "descriptors": [ { diff --git a/source/renderer/app/i18n/locales/en-US.json b/source/renderer/app/i18n/locales/en-US.json index 97bb656371..405b855d19 100755 --- a/source/renderer/app/i18n/locales/en-US.json +++ b/source/renderer/app/i18n/locales/en-US.json @@ -639,6 +639,9 @@ "test.environment.shelleyQaLabel": "Shelley QA", "test.environment.stagingLabel": "Staging", "test.environment.testnetLabel": "Testnet", + "voting.apiError.description1": "We could not fetch the API to fetch the Catalyst Project dates", + "voting.apiError.description2": "Please, try again later", + "voting.apiError.title": "Catalyst API unavailable", "voting.catalyst.descriptionRow1": "Decide which innovative ideas for Cardano will receive funding.", "voting.catalyst.descriptionRow2": "${reward} worth of ada rewards will be distributed between ada holders who register their vote.", "voting.catalyst.heading": "Project Catalyst", diff --git a/source/renderer/app/i18n/locales/ja-JP.json b/source/renderer/app/i18n/locales/ja-JP.json index 35a713f8bf..f08a34993a 100755 --- a/source/renderer/app/i18n/locales/ja-JP.json +++ b/source/renderer/app/i18n/locales/ja-JP.json @@ -639,6 +639,9 @@ "test.environment.shelleyQaLabel": "Shelley QA", "test.environment.stagingLabel": "ステージング", "test.environment.testnetLabel": "テストネット", + "voting.apiError.description1": "!!!We could not fetch the API to fetch the Catalyst Project dates", + "voting.apiError.description2": "!!!Please, try again later", + "voting.apiError.title": "!!!Catalyst API unavailable", "voting.catalyst.descriptionRow1": "Cardanoの革新的なアイデアの中で、どのアイデアに資金を提供するか決定します。", "voting.catalyst.descriptionRow2": "{reward}米ドル相当のADA報酬が、有権者登録を行ったADA保有者に分配されます。", "voting.catalyst.heading": "Project Catalyst", diff --git a/source/renderer/app/stores/VotingStore.ts b/source/renderer/app/stores/VotingStore.ts index 0ea63557ff..9f0c91b50b 100644 --- a/source/renderer/app/stores/VotingStore.ts +++ b/source/renderer/app/stores/VotingStore.ts @@ -65,9 +65,9 @@ export default class VotingStore extends Store { @observable isConfirmationDialogOpen = false; @observable - fundPhase: FundPhase = FundPhases.SNAPSHOT; + fundPhase?: FundPhase; @observable - catalystFund: Partial = {}; + catalystFund: CatalystFund; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'IntervalID'. transactionPollingInterval: IntervalID | null | undefined = null; // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'IntervalID'. @@ -92,6 +92,7 @@ export default class VotingStore extends Store { // @ts-ignore ts-migrate(1320) FIXME: Type of 'await' operand must either be a valid pro... Remove this comment to see the full error message await this.getCatalystFundRequest.execute(); const catalystFund = this.getCatalystFundRequest.result; + runInAction('Initialize fund', () => { this.catalystFund = catalystFund; this._checkFundPhase(new Date()); @@ -486,10 +487,9 @@ export default class VotingStore extends Store { [FundPhases.RESULTS]: (date: Date) => date >= this.catalystFund?.fundResults, }; - this.fundPhase = - Object.values(FundPhases).find((phase: FundPhase) => - phaseValidation[phase](now) - ) || FundPhases.SNAPSHOT; + this.fundPhase = Object.values(FundPhases).find((phase) => + phaseValidation[phase](now) + ); }; _generateVotingRegistrationKey = async () => { const { Ed25519ExtendedPrivate: extendedPrivateKey } = await walletUtils; From 557f5dbd8f0a53fe45f9741899a8652bec1b949e Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Tue, 8 Feb 2022 11:40:58 -0300 Subject: [PATCH 06/23] [DDW-675] Update translations --- .../app/components/voting/voting-info/ApiError.messages.ts | 2 +- source/renderer/app/i18n/locales/defaultMessages.json | 2 +- source/renderer/app/i18n/locales/en-US.json | 2 +- source/renderer/app/i18n/locales/ja-JP.json | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/renderer/app/components/voting/voting-info/ApiError.messages.ts b/source/renderer/app/components/voting/voting-info/ApiError.messages.ts index 52488d2df5..4670fd5a4f 100644 --- a/source/renderer/app/components/voting/voting-info/ApiError.messages.ts +++ b/source/renderer/app/components/voting/voting-info/ApiError.messages.ts @@ -9,7 +9,7 @@ export const messages = defineMessages({ description1: { id: 'voting.apiError.description1', defaultMessage: - '!!!We could not fetch the API to fetch the Catalyst Project dates', + '!!!Unable to communicate with the API that retrieves the Catalyst date information', description: 'Description 1', }, description2: { diff --git a/source/renderer/app/i18n/locales/defaultMessages.json b/source/renderer/app/i18n/locales/defaultMessages.json index 0e84ef8018..cda953c803 100644 --- a/source/renderer/app/i18n/locales/defaultMessages.json +++ b/source/renderer/app/i18n/locales/defaultMessages.json @@ -8106,7 +8106,7 @@ } }, { - "defaultMessage": "!!!We could not fetch the API to fetch the Catalyst Project dates", + "defaultMessage": "!!!Unable to communicate with the API that retrieves the Catalyst date information", "description": "Description 1", "end": { "column": 3, diff --git a/source/renderer/app/i18n/locales/en-US.json b/source/renderer/app/i18n/locales/en-US.json index 405b855d19..d64f5268d3 100755 --- a/source/renderer/app/i18n/locales/en-US.json +++ b/source/renderer/app/i18n/locales/en-US.json @@ -639,7 +639,7 @@ "test.environment.shelleyQaLabel": "Shelley QA", "test.environment.stagingLabel": "Staging", "test.environment.testnetLabel": "Testnet", - "voting.apiError.description1": "We could not fetch the API to fetch the Catalyst Project dates", + "voting.apiError.description1": "Unable to communicate with the API that retrieves the Catalyst date information", "voting.apiError.description2": "Please, try again later", "voting.apiError.title": "Catalyst API unavailable", "voting.catalyst.descriptionRow1": "Decide which innovative ideas for Cardano will receive funding.", diff --git a/source/renderer/app/i18n/locales/ja-JP.json b/source/renderer/app/i18n/locales/ja-JP.json index f08a34993a..064197d92d 100755 --- a/source/renderer/app/i18n/locales/ja-JP.json +++ b/source/renderer/app/i18n/locales/ja-JP.json @@ -639,9 +639,9 @@ "test.environment.shelleyQaLabel": "Shelley QA", "test.environment.stagingLabel": "ステージング", "test.environment.testnetLabel": "テストネット", - "voting.apiError.description1": "!!!We could not fetch the API to fetch the Catalyst Project dates", - "voting.apiError.description2": "!!!Please, try again later", - "voting.apiError.title": "!!!Catalyst API unavailable", + "voting.apiError.description1": "Catalystの日付情報を取得するAPIと通信できません", + "voting.apiError.description2": "しばらくしてからもう一度試してみてください", + "voting.apiError.title": "Catalyst APIは使用できません", "voting.catalyst.descriptionRow1": "Cardanoの革新的なアイデアの中で、どのアイデアに資金を提供するか決定します。", "voting.catalyst.descriptionRow2": "{reward}米ドル相当のADA報酬が、有権者登録を行ったADA保有者に分配されます。", "voting.catalyst.heading": "Project Catalyst", From daa2343ef779b48686a21741ef2a7ccde5a5908a Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Tue, 8 Feb 2022 11:41:39 -0300 Subject: [PATCH 07/23] [DDW-675] Update color --- source/renderer/app/components/voting/voting-info/ApiError.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/renderer/app/components/voting/voting-info/ApiError.scss b/source/renderer/app/components/voting/voting-info/ApiError.scss index 8ea822c144..e2dc3ec95d 100644 --- a/source/renderer/app/components/voting/voting-info/ApiError.scss +++ b/source/renderer/app/components/voting/voting-info/ApiError.scss @@ -5,13 +5,13 @@ align-items: start; background-color: var(--theme-button-flat-background-color); border-radius: 5px; + color: var(--theme-button-flat-text-color); display: flex; flex-direction: column; padding: 20px; width: 100%; .title { - color: var(--theme-button-flat-text-color); font-family: var(--font-bold); font-size: 18px; line-height: 1.33; From 2ddb236c58a7bdf71f65ad11a1ee69dc44e4bd9b Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Tue, 8 Feb 2022 11:42:03 -0300 Subject: [PATCH 08/23] [DDW-675] Test voting flag --- source/main/environment.ts | 2 ++ source/renderer/app/stores/SidebarStore.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/main/environment.ts b/source/main/environment.ts index 0d4dd34e75..4f1bbc140b 100644 --- a/source/main/environment.ts +++ b/source/main/environment.ts @@ -56,6 +56,7 @@ const MOBX_DEV_TOOLS = process.env.MOBX_DEV_TOOLS || false; const isMacOS = checkIsMacOS(PLATFORM); const isWindows = checkIsWindows(PLATFORM); const isLinux = checkIsLinux(PLATFORM); +const isVotingEnabled = includes(process.argv.slice(1), '--voting'); /* ================================================================== = Compose environment = @@ -96,6 +97,7 @@ export const environment: Environment = Object.assign( isLinux, isBlankScreenFixActive, keepLocalClusterRunning, + isVotingEnabled, }, process.env ); diff --git a/source/renderer/app/stores/SidebarStore.ts b/source/renderer/app/stores/SidebarStore.ts index 702f8288fd..dae98bbddd 100644 --- a/source/renderer/app/stores/SidebarStore.ts +++ b/source/renderer/app/stores/SidebarStore.ts @@ -108,7 +108,7 @@ export default class SidebarStore extends Store { // @ts-ignore ts-migrate(2339) FIXME: Property 'isFlight' does not exist on type 'typeof... Remove this comment to see the full error message isFlight, // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'typ... Remove this comment to see the full error message - environment: { isDev, isMainnet }, + environment: { isDev, isMainnet, isVotingEnabled }, } = global; const { CATEGORIES_BY_NAME: categories, @@ -123,7 +123,7 @@ export default class SidebarStore extends Store { [categories.STAKING_DELEGATION_COUNTDOWN.name]: false, [categories.STAKING.name]: true, [categories.SETTINGS.name]: true, - [categories.VOTING.name]: isMainnet || isDev, + [categories.VOTING.name]: isMainnet || isDev || isVotingEnabled, [categories.NETWORK_INFO.name]: isFlight, }; const categoriesFilteredList: Array = list.filter( From ed89cfb7379be566b0c38c26126a82df98cd463d Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Tue, 8 Feb 2022 15:57:43 -0300 Subject: [PATCH 09/23] [DDW-675] Review: Change fund object structure --- source/renderer/app/api/api.ts | 32 +++++----- .../api/voting/requests/getCatalystFund.ts | 1 - source/renderer/app/api/voting/types.ts | 20 ++++--- .../voting/voting-info/RegisterToVote.tsx | 19 +++--- .../voting/voting-info/ResultsPhase.tsx | 4 +- .../voting/voting-info/SnapshotPhase.tsx | 19 +++--- .../voting/voting-info/TallyingPhase.tsx | 6 +- .../voting/voting-info/VotingInfo.tsx | 18 +++--- .../voting/voting-info/VotingPhase.tsx | 6 +- .../renderer/app/stores/VotingStore.spec.ts | 49 ++++++++------- source/renderer/app/stores/VotingStore.ts | 59 ++++++++++--------- storybook/stories/voting/Voting.stories.tsx | 30 ++++++---- 12 files changed, 142 insertions(+), 121 deletions(-) diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index cf269e4147..9b69eed6a5 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -2945,20 +2945,24 @@ export default class AdaApi { catalystFund, }); return { - fundNumber: catalystFund.id + 1, - nextFundNumber: catalystFund.id + 2, - fundEndTime: new Date(catalystFund.fund_end_time), - fundStartTime: new Date(catalystFund.fund_start_time), - fundResults: new Date( - catalystFund.chain_vote_plans?.[0]?.chain_committee_end_time - ), - nextFundStartTime: new Date(catalystFund.next_fund_start_time), - nextRegistrationSnapshotTime: new Date( - catalystFund.next_registration_snapshot_time - ), - registrationSnapshotTime: new Date( - catalystFund.registration_snapshot_time - ), + current: { + number: catalystFund.id + 1, + startTime: new Date(catalystFund.fund_start_time), + endTime: new Date(catalystFund.fund_end_time), + results: new Date( + catalystFund.chain_vote_plans?.[0]?.chain_committee_end_time + ), + registrationSnapshotTime: new Date( + catalystFund.registration_snapshot_time + ), + }, + next: { + number: catalystFund.id + 2, + startTime: new Date(catalystFund.next_fund_start_time), + registrationSnapshotTime: new Date( + catalystFund.next_registration_snapshot_time + ), + }, }; } catch (error) { logger.error('AdaApi::getCatalystFund error', { diff --git a/source/renderer/app/api/voting/requests/getCatalystFund.ts b/source/renderer/app/api/voting/requests/getCatalystFund.ts index dd7e4bf2b1..91031e7f94 100644 --- a/source/renderer/app/api/voting/requests/getCatalystFund.ts +++ b/source/renderer/app/api/voting/requests/getCatalystFund.ts @@ -1,6 +1,5 @@ import { externalRequest } from '../../utils/externalRequest'; import { MAINNET_SERVICING_STATION_URL } from '../../../config/urlsConfig'; -// import { GetCatalystFundResponse } from '../types'; export const getCatalystFund = (): Promise => externalRequest( diff --git a/source/renderer/app/api/voting/types.ts b/source/renderer/app/api/voting/types.ts index 53ff202449..ea3aaf73eb 100644 --- a/source/renderer/app/api/voting/types.ts +++ b/source/renderer/app/api/voting/types.ts @@ -40,12 +40,16 @@ export type GetCatalystFundResponse = { }>; }; export type CatalystFund = { - fundNumber: number; - nextFundNumber: number; - fundEndTime: Date; - fundStartTime: Date; - fundResults: Date; - nextFundStartTime: Date; - nextRegistrationSnapshotTime: Date; - registrationSnapshotTime: Date; + current: { + number: number; + startTime: Date; + endTime: Date; + results: Date; + registrationSnapshotTime: Date; + }; + next: { + number: number; + startTime: Date; + registrationSnapshotTime: Date; + }; }; diff --git a/source/renderer/app/components/voting/voting-info/RegisterToVote.tsx b/source/renderer/app/components/voting/voting-info/RegisterToVote.tsx index 4f648bf5f0..ad307cd05e 100644 --- a/source/renderer/app/components/voting/voting-info/RegisterToVote.tsx +++ b/source/renderer/app/components/voting/voting-info/RegisterToVote.tsx @@ -36,19 +36,22 @@ function RegisterToVote({ const [step1, setStep1] = useState(false); const [step2, setStep2] = useState(false); const canRegister = step1 && step2; - const castEndDate = formattedDateTime(fundInfo.nextRegistrationSnapshotTime, { - currentLocale, - ...mapToLongDateTimeFormat({ + const castEndDate = formattedDateTime( + fundInfo.next.registrationSnapshotTime, + { currentLocale, - currentDateFormat, - currentTimeFormat, - }), - }); + ...mapToLongDateTimeFormat({ + currentLocale, + currentDateFormat, + currentTimeFormat, + }), + } + ); return (
{intl.formatMessage(votingMessages.fundName, { - votingFundNumber: fundInfo.nextFundNumber, + votingFundNumber: fundInfo.next.number, })} diff --git a/source/renderer/app/components/voting/voting-info/ResultsPhase.tsx b/source/renderer/app/components/voting/voting-info/ResultsPhase.tsx index 43e991a31c..4836de2902 100644 --- a/source/renderer/app/components/voting/voting-info/ResultsPhase.tsx +++ b/source/renderer/app/components/voting/voting-info/ResultsPhase.tsx @@ -36,7 +36,7 @@ function ResultsPhase({ currentDateFormat, currentTimeFormat, }); - const endDate = formattedDateTime(fundInfo.fundEndTime, { + const endDate = formattedDateTime(fundInfo.current.endTime, { currentLocale, currentDateFormat: mappedFormats.currentDateFormat, currentTimeFormat: mappedFormats.currentTimeFormat, @@ -45,7 +45,7 @@ function ResultsPhase({

{intl.formatMessage(votingMessages.fundName, { - votingFundNumber: fundInfo.fundNumber, + votingFundNumber: fundInfo.current.number, })}

diff --git a/source/renderer/app/components/voting/voting-info/SnapshotPhase.tsx b/source/renderer/app/components/voting/voting-info/SnapshotPhase.tsx index 607f98ebfe..465e6f21e4 100644 --- a/source/renderer/app/components/voting/voting-info/SnapshotPhase.tsx +++ b/source/renderer/app/components/voting/voting-info/SnapshotPhase.tsx @@ -33,16 +33,19 @@ function SnapshotPhase({ currentDateFormat, currentTimeFormat, }); - const snapshotDate = formattedDateTime(fundInfo.registrationSnapshotTime, { - currentLocale, - currentDateFormat: mappedFormats.currentDateFormat, - currentTimeFormat: mappedFormats.currentTimeFormat, - }); - const startDate = formattedDateTime(fundInfo.fundStartTime, { + const snapshotDate = formattedDateTime( + fundInfo.current.registrationSnapshotTime, + { + currentLocale, + currentDateFormat: mappedFormats.currentDateFormat, + currentTimeFormat: mappedFormats.currentTimeFormat, + } + ); + const startDate = formattedDateTime(fundInfo.current.startTime, { currentLocale, currentDateFormat: mappedFormats.currentDateFormat, }); - const endDate = formattedDateTime(fundInfo.fundEndTime, { + const endDate = formattedDateTime(fundInfo.current.endTime, { currentLocale, currentDateFormat: mappedFormats.currentDateFormat, }); @@ -50,7 +53,7 @@ function SnapshotPhase({

{intl.formatMessage(votingMessages.fundName, { - votingFundNumber: fundInfo.fundNumber, + votingFundNumber: fundInfo.current.number, })}

diff --git a/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx b/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx index 302823ede9..0733d5c341 100644 --- a/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx +++ b/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx @@ -33,11 +33,11 @@ function TallyingPhase({ currentDateFormat, currentTimeFormat, }); - const endDated = formattedDateTime(fundInfo.fundEndTime, { + const endDated = formattedDateTime(fundInfo.current.endTime, { currentLocale, currentDateFormat: mappedFormats.currentDateFormat, }); - const resultsDate = formattedDateTime(fundInfo.fundResults, { + const resultsDate = formattedDateTime(fundInfo.current.results, { currentLocale, currentDateFormat: mappedFormats.currentDateFormat, }); @@ -45,7 +45,7 @@ function TallyingPhase({

{intl.formatMessage(votingMessages.fundName, { - votingFundNumber: fundInfo.fundNumber, + votingFundNumber: fundInfo.current.number, })}

diff --git a/source/renderer/app/components/voting/voting-info/VotingInfo.tsx b/source/renderer/app/components/voting/voting-info/VotingInfo.tsx index 7c087aae0c..7152299813 100644 --- a/source/renderer/app/components/voting/voting-info/VotingInfo.tsx +++ b/source/renderer/app/components/voting/voting-info/VotingInfo.tsx @@ -12,8 +12,7 @@ import Headline from './Headline'; import AppStore from './AppStore'; import RegisterToVote from './RegisterToVote'; import ApiError from './ApiError'; -import { FundPhases } from '../../../stores/VotingStore'; -import type { FundPhase } from '../../../stores/VotingStore'; +import { FundPhase } from '../../../stores/VotingStore'; import type { CatalystFund } from '../../../api/voting/types'; type Props = { @@ -26,10 +25,10 @@ type Props = { onExternalLinkClick: (...args: Array) => any; }; const phaseToComponentMap = { - [FundPhases.SNAPSHOT]: SnapshotPhase, - [FundPhases.VOTING]: VotingPhase, - [FundPhases.TALLYING]: TallyingPhase, - [FundPhases.RESULTS]: ResultsPhase, + [FundPhase.SNAPSHOT]: SnapshotPhase, + [FundPhase.VOTING]: VotingPhase, + [FundPhase.TALLYING]: TallyingPhase, + [FundPhase.RESULTS]: ResultsPhase, }; const VotingInfo = ({ @@ -41,16 +40,15 @@ const VotingInfo = ({ onRegisterToVoteClick, onExternalLinkClick, }: Props) => { - const PhaseComponent = phaseToComponentMap[fundPhase || FundPhases.SNAPSHOT]; + const PhaseComponent = phaseToComponentMap[fundPhase || FundPhase.SNAPSHOT]; return (

- {!fundPhase ? ( - - ) : ( + {fundPhase === null && } + {fundPhase && ( <>

{intl.formatMessage(votingMessages.fundName, { - votingFundNumber: fundInfo.fundNumber, + votingFundNumber: fundInfo.current.number, })}

diff --git a/source/renderer/app/stores/VotingStore.spec.ts b/source/renderer/app/stores/VotingStore.spec.ts index 55c1a4161c..3fa40315fa 100644 --- a/source/renderer/app/stores/VotingStore.spec.ts +++ b/source/renderer/app/stores/VotingStore.spec.ts @@ -1,17 +1,15 @@ import type { Api } from '../api/index'; import type { ActionsMap } from '../actions/index'; -import VotingStore, { FundPhases } from './VotingStore'; +import VotingStore, { FundPhase } from './VotingStore'; import type { CatalystFund } from '../api/voting/types'; -const mockFundInfo: CatalystFund = { - fundNumber: 7, - nextFundNumber: 8, - fundEndTime: new Date('Feb 3, 2022, 11:00 UTC'), - fundStartTime: new Date('Jan 20, 2022, 11:00 UTC'), - fundResults: new Date('Feb 10, 2022'), - nextRegistrationSnapshotTime: new Date('Apr 7, 2022, 11:00 UTC'), - registrationSnapshotTime: new Date('Jan 6, 2022, 11:00 UTC'), - nextFundStartTime: new Date('Jan 6, 2022, 11:00 UTC'), +const mockFundInfo = { + current: { + startTime: new Date('Jan 20, 2022, 11:00 UTC'), + endTime: new Date('Feb 3, 2022, 11:00 UTC'), + results: new Date('Feb 10, 2022'), + registrationSnapshotTime: new Date('Jan 6, 2022, 11:00 UTC'), + }, }; describe('VotingStore', () => { @@ -20,30 +18,37 @@ describe('VotingStore', () => { } as any; const actions: ActionsMap = jest.fn() as any; const cases = [ + [undefined, null], [ - new Date(mockFundInfo.registrationSnapshotTime.getTime() - 60000), - FundPhases.SNAPSHOT, + new Date(mockFundInfo.current.registrationSnapshotTime.getTime() - 60000), + FundPhase.SNAPSHOT, ], - [mockFundInfo.registrationSnapshotTime, FundPhases.SNAPSHOT], + [mockFundInfo.current.registrationSnapshotTime, FundPhase.SNAPSHOT], [ - new Date(mockFundInfo.fundStartTime.getTime() - 60000), - FundPhases.SNAPSHOT, + new Date(mockFundInfo.current.startTime.getTime() - 60000), + FundPhase.SNAPSHOT, ], - [mockFundInfo.fundStartTime, FundPhases.VOTING], - [new Date(mockFundInfo.fundEndTime.getTime() - 60000), FundPhases.VOTING], - [mockFundInfo.fundEndTime, FundPhases.TALLYING], - [new Date(mockFundInfo.fundResults.getTime() - 60000), FundPhases.TALLYING], - [mockFundInfo.fundResults, FundPhases.RESULTS], + [mockFundInfo.current.startTime, FundPhase.VOTING], + [ + new Date(mockFundInfo.current.endTime.getTime() - 60000), + FundPhase.VOTING, + ], + [mockFundInfo.current.endTime, FundPhase.TALLYING], + [ + new Date(mockFundInfo.current.results.getTime() - 60000), + FundPhase.TALLYING, + ], + [mockFundInfo.current.results, FundPhase.RESULTS], ]; const votingStore = new VotingStore(api, actions); beforeAll(() => { - votingStore.catalystFund = mockFundInfo; + votingStore.catalystFund = mockFundInfo as CatalystFund; }); test.each(cases)( `should have correct fund phase for date %s - %s phase`, - (date, expected) => { + (date: Date, expected: FundPhase) => { votingStore._checkFundPhase(date); expect(votingStore.fundPhase).toEqual(expected); } diff --git a/source/renderer/app/stores/VotingStore.ts b/source/renderer/app/stores/VotingStore.ts index 9f0c91b50b..2b459e8668 100644 --- a/source/renderer/app/stores/VotingStore.ts +++ b/source/renderer/app/stores/VotingStore.ts @@ -37,14 +37,13 @@ export type VotingDataType = { metadata: VotingMetadataType; absoluteSlotNumber: number; }; -export type FundPhase = 'snapshot' | 'voting' | 'tallying' | 'results'; -// @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'EnumMap'. -export const FundPhases: EnumMap = { - SNAPSHOT: 'snapshot', - VOTING: 'voting', - TALLYING: 'tallying', - RESULTS: 'results', -}; + +export enum FundPhase { + SNAPSHOT = 'snapshot', + VOTING = 'voting', + TALLYING = 'tallying', + RESULTS = 'results', +} export default class VotingStore extends Store { @observable registrationStep = 1; @@ -73,7 +72,7 @@ export default class VotingStore extends Store { // @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'IntervalID'. fundPhaseInterval: IntervalID | null | undefined = null; - async setup() { + setup() { const { voting: votingActions } = this.actions; votingActions.selectWallet.listen(this._setSelectedWalletId); votingActions.sendTransaction.listen(this._sendTransaction); @@ -87,17 +86,19 @@ export default class VotingStore extends Store { votingActions.showConfirmationDialog.listen(this._showConfirmationDialog); votingActions.closeConfirmationDialog.listen(this._closeConfirmationDialog); - this._initializeFundPhaseInterval(); + this._setupFund(); + } - // @ts-ignore ts-migrate(1320) FIXME: Type of 'await' operand must either be a valid pro... Remove this comment to see the full error message - await this.getCatalystFundRequest.execute(); - const catalystFund = this.getCatalystFundRequest.result; + @action + _setupFund = async () => { + await this.getCatalystFundRequest.execute().promise; + this._initializeFundPhaseInterval(); runInAction('Initialize fund', () => { - this.catalystFund = catalystFund; + this.catalystFund = this.getCatalystFundRequest.result; this._checkFundPhase(new Date()); }); - } + }; // REQUESTS @observable @@ -419,7 +420,7 @@ export default class VotingStore extends Store { currentDateFormat, currentTimeFormat, } = this.stores.profile; - const nextVotingFundNumber = this.catalystFund?.nextFundNumber; + const nextVotingFundNumber = this.catalystFund?.next?.number; const { network, isMainnet } = this.environment; const intl = i18nContext(currentLocale); @@ -476,20 +477,20 @@ export default class VotingStore extends Store { @action _checkFundPhase = (now: Date) => { const phaseValidation = { - [FundPhases.SNAPSHOT]: (date: Date) => - date < this.catalystFund?.fundStartTime, - [FundPhases.VOTING]: (date: Date) => - date >= this.catalystFund?.fundStartTime && - date < this.catalystFund?.fundEndTime, - [FundPhases.TALLYING]: (date: Date) => - date >= this.catalystFund?.fundEndTime && - date < this.catalystFund?.fundResults, - [FundPhases.RESULTS]: (date: Date) => - date >= this.catalystFund?.fundResults, + [FundPhase.SNAPSHOT]: (date: Date) => + date < this.catalystFund?.current?.startTime, + [FundPhase.VOTING]: (date: Date) => + date >= this.catalystFund?.current?.startTime && + date < this.catalystFund?.current?.endTime, + [FundPhase.TALLYING]: (date: Date) => + date >= this.catalystFund?.current?.endTime && + date < this.catalystFund?.current?.results, + [FundPhase.RESULTS]: (date: Date) => + date >= this.catalystFund?.current?.results, }; - this.fundPhase = Object.values(FundPhases).find((phase) => - phaseValidation[phase](now) - ); + this.fundPhase = + Object.values(FundPhase).find((phase) => phaseValidation[phase](now)) || + null; }; _generateVotingRegistrationKey = async () => { const { Ed25519ExtendedPrivate: extendedPrivateKey } = await walletUtils; diff --git a/storybook/stories/voting/Voting.stories.tsx b/storybook/stories/voting/Voting.stories.tsx index cb22658402..742c9f8e52 100644 --- a/storybook/stories/voting/Voting.stories.tsx +++ b/storybook/stories/voting/Voting.stories.tsx @@ -11,7 +11,7 @@ import VotingRegistrationStepsConfirm from '../../../source/renderer/app/compone import VotingRegistrationStepsEnterPinCode from '../../../source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode'; import VotingRegistrationStepsQrCode from '../../../source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode'; import VotingInfo from '../../../source/renderer/app/components/voting/voting-info/VotingInfo'; -import { FundPhases } from '../../../source/renderer/app/stores/VotingStore'; +import { FundPhase } from '../../../source/renderer/app/stores/VotingStore'; import { CatalystFund } from '../../../source/renderer/app/api/voting/types'; import { VotingFooterLinks } from '../../../source/renderer/app/components/voting/VotingFooterLinks'; import { @@ -32,14 +32,18 @@ import { HwDeviceStatuses } from '../../../source/renderer/app/domains/Wallet'; import VerticalFlexContainer from '../../../source/renderer/app/components/layout/VerticalFlexContainer'; const mockFundInfo: CatalystFund = { - fundNumber: 7, - nextFundNumber: 8, - fundEndTime: new Date('Feb 3, 2022, 11:00 UTC'), - fundStartTime: new Date('Jan 20, 2022, 11:00 UTC'), - fundResults: new Date('Feb 10, 2022'), - nextRegistrationSnapshotTime: new Date('Apr 7, 2022, 11:00 UTC'), - registrationSnapshotTime: new Date('Jan 6, 2022, 11:00 UTC'), - nextFundStartTime: new Date('Jan 6, 2022, 11:00 UTC'), + current: { + number: 7, + startTime: new Date('Jan 20, 2022, 11:00 UTC'), + endTime: new Date('Feb 3, 2022, 11:00 UTC'), + results: new Date('Feb 10, 2022'), + registrationSnapshotTime: new Date('Jan 6, 2022, 11:00 UTC'), + }, + next: { + number: 8, + startTime: new Date('Jan 6, 2022, 11:00 UTC'), + registrationSnapshotTime: new Date('Apr 7, 2022, 11:00 UTC'), + }, }; const assets = { @@ -181,10 +185,10 @@ storiesOf('Voting|Voting Info', module) fundInfo={mockFundInfo} // @ts-ignore ts-migrate(2554) FIXME: Expected 3-4 arguments, but got 2. fundPhase={select('Fund phase', [ - FundPhases.SNAPSHOT, - FundPhases.VOTING, - FundPhases.TALLYING, - FundPhases.RESULTS, + FundPhase.SNAPSHOT, + FundPhase.VOTING, + FundPhase.TALLYING, + FundPhase.RESULTS, ])} // @ts-ignore ts-migrate(2322) FIXME: Type 'string' is not assignable to type 'Locale'. currentLocale={LANGUAGE_OPTIONS[0].value} From 59057dc98d1a565c05dd5a5a72ed3d63da6618fe Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Tue, 8 Feb 2022 17:15:07 -0300 Subject: [PATCH 10/23] [DDW-675] Remove throw in catch block --- source/renderer/app/api/api.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index 9b69eed6a5..14e8c52936 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -2968,7 +2968,6 @@ export default class AdaApi { logger.error('AdaApi::getCatalystFund error', { error, }); - throw new Error('Unable to fetch catalyst fund'); } }; } // ========== TRANSFORM SERVER DATA INTO FRONTEND MODELS ========= From db1cdda728b884581668d4b5d04f54a6d9562bc9 Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Wed, 9 Feb 2022 15:12:00 -0300 Subject: [PATCH 11/23] [DDW-675] Remove voting flag --- source/main/environment.ts | 2 -- source/renderer/app/stores/SidebarStore.ts | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/source/main/environment.ts b/source/main/environment.ts index d3d21d5354..9085431ff1 100644 --- a/source/main/environment.ts +++ b/source/main/environment.ts @@ -63,7 +63,6 @@ const MOBX_DEV_TOOLS = process.env.MOBX_DEV_TOOLS || false; const isMacOS = checkIsMacOS(PLATFORM); const isWindows = checkIsWindows(PLATFORM); const isLinux = checkIsLinux(PLATFORM); -const isVotingEnabled = includes(process.argv.slice(1), '--voting'); /* ================================================================== = Compose environment = @@ -105,7 +104,6 @@ export const environment: Environment = Object.assign( isBlankScreenFixActive, keepLocalClusterRunning, hasMetHardwareRequirements, - isVotingEnabled, }, process.env ); diff --git a/source/renderer/app/stores/SidebarStore.ts b/source/renderer/app/stores/SidebarStore.ts index dae98bbddd..702f8288fd 100644 --- a/source/renderer/app/stores/SidebarStore.ts +++ b/source/renderer/app/stores/SidebarStore.ts @@ -108,7 +108,7 @@ export default class SidebarStore extends Store { // @ts-ignore ts-migrate(2339) FIXME: Property 'isFlight' does not exist on type 'typeof... Remove this comment to see the full error message isFlight, // @ts-ignore ts-migrate(2339) FIXME: Property 'environment' does not exist on type 'typ... Remove this comment to see the full error message - environment: { isDev, isMainnet, isVotingEnabled }, + environment: { isDev, isMainnet }, } = global; const { CATEGORIES_BY_NAME: categories, @@ -123,7 +123,7 @@ export default class SidebarStore extends Store { [categories.STAKING_DELEGATION_COUNTDOWN.name]: false, [categories.STAKING.name]: true, [categories.SETTINGS.name]: true, - [categories.VOTING.name]: isMainnet || isDev || isVotingEnabled, + [categories.VOTING.name]: isMainnet || isDev, [categories.NETWORK_INFO.name]: isFlight, }; const categoriesFilteredList: Array = list.filter( From 9acb8f38fd694a8825c86e2b47332addf3a879bd Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Wed, 9 Feb 2022 16:10:30 -0300 Subject: [PATCH 12/23] [DDW-675] Fix property path --- .../renderer/app/containers/voting/VotingRegistrationPage.tsx | 2 +- .../voting/dialogs/VotingRegistrationDialogContainer.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/renderer/app/containers/voting/VotingRegistrationPage.tsx b/source/renderer/app/containers/voting/VotingRegistrationPage.tsx index 08811b3cfb..cdd9997235 100644 --- a/source/renderer/app/containers/voting/VotingRegistrationPage.tsx +++ b/source/renderer/app/containers/voting/VotingRegistrationPage.tsx @@ -44,7 +44,7 @@ class VotingRegistrationPage extends Component { if (!wallets.allWallets.length) { return ( diff --git a/source/renderer/app/containers/voting/dialogs/VotingRegistrationDialogContainer.tsx b/source/renderer/app/containers/voting/dialogs/VotingRegistrationDialogContainer.tsx index 40ce42c661..bd60df2779 100644 --- a/source/renderer/app/containers/voting/dialogs/VotingRegistrationDialogContainer.tsx +++ b/source/renderer/app/containers/voting/dialogs/VotingRegistrationDialogContainer.tsx @@ -228,11 +228,11 @@ class VotingRegistrationDialogContainer extends Component { onExternalLinkClick={openExternalLink} isTrezor={isTrezor} isHardwareWallet={isHardwareWallet} - nextFundNumber={catalystFund?.nextFundNumber} + nextFundNumber={catalystFund?.next?.number} /> {isConfirmationDialogOpen && ( { this.props.actions.dialogs.closeActiveDialog.trigger(); From 8d2e6032b00cf96f661f65a84e313f6a96b8bb4e Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Wed, 9 Feb 2022 16:10:47 -0300 Subject: [PATCH 13/23] [DDW-675] Improve variable name --- .../app/components/voting/voting-info/RegisterToVote.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/renderer/app/components/voting/voting-info/RegisterToVote.tsx b/source/renderer/app/components/voting/voting-info/RegisterToVote.tsx index ad307cd05e..d0369abee8 100644 --- a/source/renderer/app/components/voting/voting-info/RegisterToVote.tsx +++ b/source/renderer/app/components/voting/voting-info/RegisterToVote.tsx @@ -36,7 +36,7 @@ function RegisterToVote({ const [step1, setStep1] = useState(false); const [step2, setStep2] = useState(false); const canRegister = step1 && step2; - const castEndDate = formattedDateTime( + const snapshotDate = formattedDateTime( fundInfo.next.registrationSnapshotTime, { currentLocale, @@ -57,7 +57,7 @@ function RegisterToVote({ {intl.formatMessage(messages.dateLabel)} - {castEndDate} + {snapshotDate}
{intl.formatMessage(messages.stepsTitle)} From 2b1a0472dc377b3fa945e90be6080b8a46a23424 Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Wed, 9 Feb 2022 16:16:12 -0300 Subject: [PATCH 14/23] [DDW-675] Fix CHANGELOG --- CHANGELOG.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae09a93208..af6facfcda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,6 @@ ### Features - Implemented catalyst dynamic content ([PR 2856](https://github.com/input-output-hk/daedalus/pull/2856)) - -## 4.8.0 - -### Features - - Added table view for delegated stake pools list ([PR 2837](https://github.com/input-output-hk/daedalus/pull/2837)) - Removed Discreet mode notification ([PR 2852](https://github.com/input-output-hk/daedalus/pull/2852)) - Unified CPU info in diagnostics dialog ([PR 2818](https://github.com/input-output-hk/daedalus/pull/2818)) From e9557688cbbab0023b55e79f2011f91f7be12751 Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Thu, 10 Feb 2022 10:16:44 -0300 Subject: [PATCH 15/23] [DDW-675] Review: Change font style add storybook --- .../voting/voting-info/ApiError.messages.ts | 4 +- .../voting/voting-info/ApiError.scss | 4 +- .../voting/voting-info/ApiError.tsx | 5 +- .../voting/voting-info/CurrentPhase.scss | 2 +- .../voting/voting-info/RegisterToVote.scss | 2 +- .../app/i18n/locales/defaultMessages.json | 4 +- source/renderer/app/i18n/locales/en-US.json | 4 +- source/renderer/app/i18n/locales/ja-JP.json | 4 +- storybook/stories/voting/Voting.stories.tsx | 54 +++++++++++-------- 9 files changed, 47 insertions(+), 36 deletions(-) diff --git a/source/renderer/app/components/voting/voting-info/ApiError.messages.ts b/source/renderer/app/components/voting/voting-info/ApiError.messages.ts index 4670fd5a4f..ed16d80eda 100644 --- a/source/renderer/app/components/voting/voting-info/ApiError.messages.ts +++ b/source/renderer/app/components/voting/voting-info/ApiError.messages.ts @@ -9,12 +9,12 @@ export const messages = defineMessages({ description1: { id: 'voting.apiError.description1', defaultMessage: - '!!!Unable to communicate with the API that retrieves the Catalyst date information', + '!!!Unable to communicate with the API that retrieves the Catalyst date information.', description: 'Description 1', }, description2: { id: 'voting.apiError.description2', - defaultMessage: '!!!Please, try again later', + defaultMessage: '!!!Please, try again later.', description: 'Description 2', }, }); diff --git a/source/renderer/app/components/voting/voting-info/ApiError.scss b/source/renderer/app/components/voting/voting-info/ApiError.scss index e2dc3ec95d..5d1a99280b 100644 --- a/source/renderer/app/components/voting/voting-info/ApiError.scss +++ b/source/renderer/app/components/voting/voting-info/ApiError.scss @@ -12,13 +12,13 @@ width: 100%; .title { - font-family: var(--font-bold); + font-family: var(--font-semibold); font-size: 18px; line-height: 1.33; margin-bottom: 11px; } - .description1 { + .description2 { font-family: var(--font-medium); } } diff --git a/source/renderer/app/components/voting/voting-info/ApiError.tsx b/source/renderer/app/components/voting/voting-info/ApiError.tsx index 15e4597b24..afd4bfa0d4 100644 --- a/source/renderer/app/components/voting/voting-info/ApiError.tsx +++ b/source/renderer/app/components/voting/voting-info/ApiError.tsx @@ -1,7 +1,6 @@ import React from 'react'; import { injectIntl } from 'react-intl'; import type { Intl } from '../../../types/i18nTypes'; -// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './CurrentPhase.scss' or its co... Remove this comment to see the full error message import styles from './ApiError.scss'; import { messages } from './ApiError.messages'; @@ -16,7 +15,9 @@ function ApiError({ intl }: Props) { {intl.formatMessage(messages.description1)} - {intl.formatMessage(messages.description2)} + + {intl.formatMessage(messages.description2)} +
); } diff --git a/source/renderer/app/components/voting/voting-info/CurrentPhase.scss b/source/renderer/app/components/voting/voting-info/CurrentPhase.scss index 1d90208480..ba427e1344 100644 --- a/source/renderer/app/components/voting/voting-info/CurrentPhase.scss +++ b/source/renderer/app/components/voting/voting-info/CurrentPhase.scss @@ -12,7 +12,7 @@ .fundName { color: var(--theme-button-flat-text-color); - font-family: var(--font-bold); + font-family: var(--font-semibold); font-size: 18px; line-height: 1.33; margin-bottom: 11px; diff --git a/source/renderer/app/components/voting/voting-info/RegisterToVote.scss b/source/renderer/app/components/voting/voting-info/RegisterToVote.scss index dbdd57b02f..6b2f5dba14 100644 --- a/source/renderer/app/components/voting/voting-info/RegisterToVote.scss +++ b/source/renderer/app/components/voting/voting-info/RegisterToVote.scss @@ -7,7 +7,7 @@ padding: 20px; .title { - font-family: var(--font-bold); + font-family: var(--font-semibold); font-size: 18px; line-height: 1.33; } diff --git a/source/renderer/app/i18n/locales/defaultMessages.json b/source/renderer/app/i18n/locales/defaultMessages.json index 946cee273f..54c5c6bd70 100644 --- a/source/renderer/app/i18n/locales/defaultMessages.json +++ b/source/renderer/app/i18n/locales/defaultMessages.json @@ -8391,7 +8391,7 @@ } }, { - "defaultMessage": "!!!Unable to communicate with the API that retrieves the Catalyst date information", + "defaultMessage": "!!!Unable to communicate with the API that retrieves the Catalyst date information.", "description": "Description 1", "end": { "column": 3, @@ -8405,7 +8405,7 @@ } }, { - "defaultMessage": "!!!Please, try again later", + "defaultMessage": "!!!Please, try again later.", "description": "Description 2", "end": { "column": 3, diff --git a/source/renderer/app/i18n/locales/en-US.json b/source/renderer/app/i18n/locales/en-US.json index 596b6f84b9..61cd7f2324 100755 --- a/source/renderer/app/i18n/locales/en-US.json +++ b/source/renderer/app/i18n/locales/en-US.json @@ -659,8 +659,8 @@ "test.environment.shelleyQaLabel": "Shelley QA", "test.environment.stagingLabel": "Staging", "test.environment.testnetLabel": "Testnet", - "voting.apiError.description1": "Unable to communicate with the API that retrieves the Catalyst date information", - "voting.apiError.description2": "Please, try again later", + "voting.apiError.description1": "Unable to communicate with the API that retrieves the Catalyst date information.", + "voting.apiError.description2": "Please, try again later.", "voting.apiError.title": "Catalyst API unavailable", "voting.catalyst.descriptionRow1": "Decide which innovative ideas for Cardano will receive funding.", "voting.catalyst.descriptionRow2": "${reward} worth of ada rewards will be distributed between ada holders who register their vote.", diff --git a/source/renderer/app/i18n/locales/ja-JP.json b/source/renderer/app/i18n/locales/ja-JP.json index cd8979c994..e2c6a81dbd 100755 --- a/source/renderer/app/i18n/locales/ja-JP.json +++ b/source/renderer/app/i18n/locales/ja-JP.json @@ -659,8 +659,8 @@ "test.environment.shelleyQaLabel": "Shelley QA", "test.environment.stagingLabel": "ステージング", "test.environment.testnetLabel": "テストネット", - "voting.apiError.description1": "Catalystの日付情報を取得するAPIと通信できません", - "voting.apiError.description2": "しばらくしてからもう一度試してみてください", + "voting.apiError.description1": "Catalystの日付情報を取得するAPIと通信できません。", + "voting.apiError.description2": "しばらくしてからもう一度試してみてください。", "voting.apiError.title": "Catalyst APIは使用できません", "voting.catalyst.descriptionRow1": "Cardanoの革新的なアイデアの中で、どのアイデアに資金を提供するか決定します。", "voting.catalyst.descriptionRow2": "{reward}米ドル相当のADA報酬が、有権者登録を行ったADA保有者に分配されます。", diff --git a/storybook/stories/voting/Voting.stories.tsx b/storybook/stories/voting/Voting.stories.tsx index 742c9f8e52..3b500602f6 100644 --- a/storybook/stories/voting/Voting.stories.tsx +++ b/storybook/stories/voting/Voting.stories.tsx @@ -30,6 +30,7 @@ import { } from '../_support/utils'; import { HwDeviceStatuses } from '../../../source/renderer/app/domains/Wallet'; import VerticalFlexContainer from '../../../source/renderer/app/components/layout/VerticalFlexContainer'; +import { Locale } from '../../../source/common/types/locales.types'; const mockFundInfo: CatalystFund = { current: { @@ -93,6 +94,16 @@ const WALLETS = [ ), ]; const stepsList = ['Wallet', 'Sign', 'Confirm', 'PIN code', 'QR code']; + +const votingInfo = { + fundInfo: mockFundInfo, + currentLocale: LANGUAGE_OPTIONS[0].value as Locale, + currentDateFormat: DATE_ENGLISH_OPTIONS[0].value, + currentTimeFormat: TIME_OPTIONS[0].value, + onRegisterToVoteClick: action('onRegisterToVoteClick'), + onExternalLinkClick: action('onExternalLinkClick'), +}; + storiesOf('Voting|Voting Registration Wizard', module) .addDecorator((story) => ( @@ -177,26 +188,25 @@ storiesOf('Voting|Voting Registration Wizard', module) /> )); storiesOf('Voting|Voting Info', module) - .addDecorator((story) => {story()}) + .addDecorator((story) => ( + + + {story()} + + + + )) .addDecorator(withKnobs) // ====== Stories ====== - .add('Voting Info', () => ( - - - - - )); + .add('Snapshot phase', () => ( + + )) + .add('Voting phase', () => ( + + )) + .add('Tallying phase', () => ( + + )) + .add('Results phase', () => ( + + )) + .add('API error', () => ); From e82718e69dff38c030f036f4dc7e7d33855e50e0 Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Thu, 10 Feb 2022 11:05:26 -0300 Subject: [PATCH 16/23] [DDW-675] Review: Change font style --- .../renderer/app/components/voting/voting-info/Headline.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/renderer/app/components/voting/voting-info/Headline.scss b/source/renderer/app/components/voting/voting-info/Headline.scss index 7e80851187..b7e1c742d1 100644 --- a/source/renderer/app/components/voting/voting-info/Headline.scss +++ b/source/renderer/app/components/voting/voting-info/Headline.scss @@ -4,7 +4,8 @@ .heading { @extend %accentText; font-family: var(--font-semibold); - font-size: 19px; + font-size: 18px; + letter-spacing: 2px; margin-bottom: 14px; text-align: center; text-transform: uppercase; From d1c9c5c804c4224f34153022b8fb41c121dc801a Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Fri, 11 Feb 2022 09:33:23 -0300 Subject: [PATCH 17/23] [DDW-675] Review: Change property name --- source/renderer/app/api/api.ts | 2 +- source/renderer/app/api/voting/types.ts | 2 +- .../app/components/voting/voting-info/TallyingPhase.tsx | 2 +- source/renderer/app/stores/VotingStore.spec.ts | 6 +++--- source/renderer/app/stores/VotingStore.ts | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index 14e8c52936..4ee6c2fdcf 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -2949,7 +2949,7 @@ export default class AdaApi { number: catalystFund.id + 1, startTime: new Date(catalystFund.fund_start_time), endTime: new Date(catalystFund.fund_end_time), - results: new Date( + resultsTime: new Date( catalystFund.chain_vote_plans?.[0]?.chain_committee_end_time ), registrationSnapshotTime: new Date( diff --git a/source/renderer/app/api/voting/types.ts b/source/renderer/app/api/voting/types.ts index ea3aaf73eb..ab15db9d65 100644 --- a/source/renderer/app/api/voting/types.ts +++ b/source/renderer/app/api/voting/types.ts @@ -44,7 +44,7 @@ export type CatalystFund = { number: number; startTime: Date; endTime: Date; - results: Date; + resultsTime: Date; registrationSnapshotTime: Date; }; next: { diff --git a/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx b/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx index 0733d5c341..d0f18d910e 100644 --- a/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx +++ b/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx @@ -37,7 +37,7 @@ function TallyingPhase({ currentLocale, currentDateFormat: mappedFormats.currentDateFormat, }); - const resultsDate = formattedDateTime(fundInfo.current.results, { + const resultsDate = formattedDateTime(fundInfo.current.resultsTime, { currentLocale, currentDateFormat: mappedFormats.currentDateFormat, }); diff --git a/source/renderer/app/stores/VotingStore.spec.ts b/source/renderer/app/stores/VotingStore.spec.ts index 3fa40315fa..89d0fb292b 100644 --- a/source/renderer/app/stores/VotingStore.spec.ts +++ b/source/renderer/app/stores/VotingStore.spec.ts @@ -7,7 +7,7 @@ const mockFundInfo = { current: { startTime: new Date('Jan 20, 2022, 11:00 UTC'), endTime: new Date('Feb 3, 2022, 11:00 UTC'), - results: new Date('Feb 10, 2022'), + resultsTime: new Date('Feb 10, 2022'), registrationSnapshotTime: new Date('Jan 6, 2022, 11:00 UTC'), }, }; @@ -35,10 +35,10 @@ describe('VotingStore', () => { ], [mockFundInfo.current.endTime, FundPhase.TALLYING], [ - new Date(mockFundInfo.current.results.getTime() - 60000), + new Date(mockFundInfo.current.resultsTime.getTime() - 60000), FundPhase.TALLYING, ], - [mockFundInfo.current.results, FundPhase.RESULTS], + [mockFundInfo.current.resultsTime, FundPhase.RESULTS], ]; const votingStore = new VotingStore(api, actions); diff --git a/source/renderer/app/stores/VotingStore.ts b/source/renderer/app/stores/VotingStore.ts index 2b459e8668..f9e9ce5c3c 100644 --- a/source/renderer/app/stores/VotingStore.ts +++ b/source/renderer/app/stores/VotingStore.ts @@ -484,9 +484,9 @@ export default class VotingStore extends Store { date < this.catalystFund?.current?.endTime, [FundPhase.TALLYING]: (date: Date) => date >= this.catalystFund?.current?.endTime && - date < this.catalystFund?.current?.results, + date < this.catalystFund?.current?.resultsTime, [FundPhase.RESULTS]: (date: Date) => - date >= this.catalystFund?.current?.results, + date >= this.catalystFund?.current?.resultsTime, }; this.fundPhase = Object.values(FundPhase).find((phase) => phaseValidation[phase](now)) || From a813fa60f5b3a79829026446333412134978c125 Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Fri, 11 Feb 2022 09:38:35 -0300 Subject: [PATCH 18/23] [DDW-675] Review: Update use of externalRequest --- source/renderer/app/api/api.ts | 4 ++-- .../app/api/voting/requests/getCatalystFund.ts | 18 ++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index 4ee6c2fdcf..51e3d3a561 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -2938,12 +2938,12 @@ export default class AdaApi { logger.debug('AdaApi::getCatalystFund called', {}); try { - const catalystFundRaw = await getCatalystFund(); - const catalystFund: GetCatalystFundResponse = JSON.parse(catalystFundRaw); + const catalystFund = await getCatalystFund(); logger.debug('AdaApi::getCatalystFund success', { catalystFund, }); + return { current: { number: catalystFund.id + 1, diff --git a/source/renderer/app/api/voting/requests/getCatalystFund.ts b/source/renderer/app/api/voting/requests/getCatalystFund.ts index 91031e7f94..dd0efc55cd 100644 --- a/source/renderer/app/api/voting/requests/getCatalystFund.ts +++ b/source/renderer/app/api/voting/requests/getCatalystFund.ts @@ -1,13 +1,11 @@ import { externalRequest } from '../../utils/externalRequest'; import { MAINNET_SERVICING_STATION_URL } from '../../../config/urlsConfig'; +import { GetCatalystFundResponse } from '../types'; -export const getCatalystFund = (): Promise => - externalRequest( - { - hostname: MAINNET_SERVICING_STATION_URL, - path: '/api/v0/fund', - method: 'GET', - protocol: 'https', - }, - true - ); +export const getCatalystFund = (): Promise => + externalRequest({ + hostname: MAINNET_SERVICING_STATION_URL, + path: '/api/v0/fund', + method: 'GET', + protocol: 'https', + }); From 965c03bdee9f47a1c7d21248ce90d28bb8c9a3ff Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Fri, 11 Feb 2022 10:41:28 -0300 Subject: [PATCH 19/23] [DDW-675] Review: Remove default phase and update types --- .../voting/voting-info/ResultsPhase.tsx | 14 +------------ .../voting/voting-info/SnapshotPhase.tsx | 13 +----------- .../voting/voting-info/TallyingPhase.tsx | 13 +----------- .../voting/voting-info/VotingInfo.tsx | 17 +++------------ .../voting/voting-info/VotingPhase.tsx | 14 +------------ .../components/voting/voting-info/types.ts | 21 +++++++++++++++++++ 6 files changed, 28 insertions(+), 64 deletions(-) create mode 100644 source/renderer/app/components/voting/voting-info/types.ts diff --git a/source/renderer/app/components/voting/voting-info/ResultsPhase.tsx b/source/renderer/app/components/voting/voting-info/ResultsPhase.tsx index 4836de2902..c25bc4339f 100644 --- a/source/renderer/app/components/voting/voting-info/ResultsPhase.tsx +++ b/source/renderer/app/components/voting/voting-info/ResultsPhase.tsx @@ -5,23 +5,11 @@ import { formattedDateTime, mapToLongDateTimeFormat, } from '../../../utils/formatters'; -import type { Locale } from '../../../../../common/types/locales.types'; import { ExternalLinkButton } from '../../widgets/ExternalLinkButton'; -import type { Intl } from '../../../types/i18nTypes'; import { messages } from './ResultsPhase.messages'; import { messages as votingMessages } from './VotingInfo.messages'; -// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './CurrentPhase.scss' or its co... Remove this comment to see the full error message import styles from './CurrentPhase.scss'; -import type { CatalystFund } from '../../../api/voting/types'; - -type Props = { - currentLocale: Locale; - currentDateFormat: string; - currentTimeFormat: string; - onExternalLinkClick: (...args: Array) => any; - fundInfo: CatalystFund; - intl: Intl; -}; +import type { PhaseIntlProps as Props } from './types'; function ResultsPhase({ currentLocale, diff --git a/source/renderer/app/components/voting/voting-info/SnapshotPhase.tsx b/source/renderer/app/components/voting/voting-info/SnapshotPhase.tsx index 465e6f21e4..3d73d1b86c 100644 --- a/source/renderer/app/components/voting/voting-info/SnapshotPhase.tsx +++ b/source/renderer/app/components/voting/voting-info/SnapshotPhase.tsx @@ -5,21 +5,10 @@ import { formattedDateTime, mapToLongDateTimeFormat, } from '../../../utils/formatters'; -import type { Locale } from '../../../../../common/types/locales.types'; -import type { Intl } from '../../../types/i18nTypes'; -// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './CurrentPhase.scss' or its co... Remove this comment to see the full error message import styles from './CurrentPhase.scss'; import { messages } from './SnapshotPhase.messages'; import { messages as votingMessages } from './VotingInfo.messages'; -import type { CatalystFund } from '../../../api/voting/types'; - -type Props = { - currentLocale: Locale; - currentDateFormat: string; - currentTimeFormat: string; - fundInfo: CatalystFund; - intl: Intl; -}; +import type { PhaseIntlProps as Props } from './types'; function SnapshotPhase({ currentLocale, diff --git a/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx b/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx index d0f18d910e..532b11ebcf 100644 --- a/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx +++ b/source/renderer/app/components/voting/voting-info/TallyingPhase.tsx @@ -5,21 +5,10 @@ import { formattedDateTime, mapToLongDateTimeFormat, } from '../../../utils/formatters'; -import type { Locale } from '../../../../../common/types/locales.types'; -import type { Intl } from '../../../types/i18nTypes'; -// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './CurrentPhase.scss' or its co... Remove this comment to see the full error message import styles from './CurrentPhase.scss'; import { messages } from './TallyingPhase.messages'; import { messages as votingMessages } from './VotingInfo.messages'; -import type { CatalystFund } from '../../../api/voting/types'; - -type Props = { - currentLocale: Locale; - currentDateFormat: string; - currentTimeFormat: string; - fundInfo: CatalystFund; - intl: Intl; -}; +import type { PhaseIntlProps as Props } from './types'; function TallyingPhase({ currentLocale, diff --git a/source/renderer/app/components/voting/voting-info/VotingInfo.tsx b/source/renderer/app/components/voting/voting-info/VotingInfo.tsx index 7152299813..525099eae2 100644 --- a/source/renderer/app/components/voting/voting-info/VotingInfo.tsx +++ b/source/renderer/app/components/voting/voting-info/VotingInfo.tsx @@ -1,8 +1,6 @@ import React from 'react'; import { observer } from 'mobx-react'; import BorderedBox from '../../widgets/BorderedBox'; -import type { Locale } from '../../../../../common/types/locales.types'; -// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './VotingInfo.scss' or its corr... Remove this comment to see the full error message import styles from './VotingInfo.scss'; import ResultsPhase from './ResultsPhase'; import SnapshotPhase from './SnapshotPhase'; @@ -13,18 +11,9 @@ import AppStore from './AppStore'; import RegisterToVote from './RegisterToVote'; import ApiError from './ApiError'; import { FundPhase } from '../../../stores/VotingStore'; -import type { CatalystFund } from '../../../api/voting/types'; +import { VotingProps as Props, PhaseProps } from './types'; -type Props = { - currentLocale: Locale; - currentDateFormat: string; - currentTimeFormat: string; - fundPhase: FundPhase; - fundInfo: CatalystFund; - onRegisterToVoteClick: (...args: Array) => any; - onExternalLinkClick: (...args: Array) => any; -}; -const phaseToComponentMap = { +const phaseToComponentMap: { [key in FundPhase]: React.FC } = { [FundPhase.SNAPSHOT]: SnapshotPhase, [FundPhase.VOTING]: VotingPhase, [FundPhase.TALLYING]: TallyingPhase, @@ -40,7 +29,7 @@ const VotingInfo = ({ onRegisterToVoteClick, onExternalLinkClick, }: Props) => { - const PhaseComponent = phaseToComponentMap[fundPhase || FundPhase.SNAPSHOT]; + const PhaseComponent = phaseToComponentMap[fundPhase]; return (
diff --git a/source/renderer/app/components/voting/voting-info/VotingPhase.tsx b/source/renderer/app/components/voting/voting-info/VotingPhase.tsx index a8af04cb38..5135cb65ef 100644 --- a/source/renderer/app/components/voting/voting-info/VotingPhase.tsx +++ b/source/renderer/app/components/voting/voting-info/VotingPhase.tsx @@ -5,23 +5,11 @@ import { formattedDateTime, mapToLongDateTimeFormat, } from '../../../utils/formatters'; -import type { Locale } from '../../../../../common/types/locales.types'; -import type { Intl } from '../../../types/i18nTypes'; import { messages } from './VotingPhase.messages'; import { messages as votingMessages } from './VotingInfo.messages'; -// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './CurrentPhase.scss' or its co... Remove this comment to see the full error message import styles from './CurrentPhase.scss'; -// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './VotingInfo.scss' or its corr... Remove this comment to see the full error message import votingStyles from './VotingInfo.scss'; -import type { CatalystFund } from '../../../api/voting/types'; - -type Props = { - currentLocale: Locale; - currentDateFormat: string; - currentTimeFormat: string; - fundInfo: CatalystFund; - intl: Intl; -}; +import type { PhaseIntlProps as Props } from './types'; function VotingPhase({ currentLocale, diff --git a/source/renderer/app/components/voting/voting-info/types.ts b/source/renderer/app/components/voting/voting-info/types.ts new file mode 100644 index 0000000000..3e5e8d6fd0 --- /dev/null +++ b/source/renderer/app/components/voting/voting-info/types.ts @@ -0,0 +1,21 @@ +import { FundPhase } from '../../../stores/VotingStore'; +import type { Intl } from '../../../types/i18nTypes'; +import type { CatalystFund } from '../../../api/voting/types'; +import type { Locale } from '../../../../../common/types/locales.types'; + +export type VotingProps = { + currentLocale: Locale; + currentDateFormat: string; + currentTimeFormat: string; + fundPhase: FundPhase; + fundInfo: CatalystFund; + onRegisterToVoteClick: (...args: Array) => any; + onExternalLinkClick: (...args: Array) => any; +}; + +export type PhaseProps = {} & Omit< + VotingProps, + 'fundPhase' | 'onRegisterToVoteClick' +>; + +export type PhaseIntlProps = { intl: Intl } & PhaseProps; From f2926df62f883e09d5436b8a0c47451fe6f75032 Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Fri, 11 Feb 2022 10:53:04 -0300 Subject: [PATCH 20/23] [DDW-675] Review: Make nextFundNumber required --- source/renderer/app/components/voting/VotingNoWallets.tsx | 2 +- .../app/components/voting/VotingRegistrationDialogWizard.tsx | 2 +- .../VotingRegistrationStepsChooseWallet.tsx | 2 +- .../VotingRegistrationStepsConfirm.tsx | 2 +- .../VotingRegistrationStepsEnterPinCode.tsx | 2 +- .../VotingRegistrationStepsQrCode.tsx | 2 +- .../VotingRegistrationStepsRegister.tsx | 2 +- .../widgets/ConfirmationDialog.tsx | 2 +- .../widgets/VotingRegistrationDialog.tsx | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/renderer/app/components/voting/VotingNoWallets.tsx b/source/renderer/app/components/voting/VotingNoWallets.tsx index 8dcad17955..8d8b15e3b9 100644 --- a/source/renderer/app/components/voting/VotingNoWallets.tsx +++ b/source/renderer/app/components/voting/VotingNoWallets.tsx @@ -32,7 +32,7 @@ const messages = defineMessages({ type Props = { onGoToCreateWalletClick: (...args: Array) => any; minVotingFunds: number; - nextFundNumber?: number; + nextFundNumber: number; }; export default class VotingNoWallets extends Component { static contextTypes = { diff --git a/source/renderer/app/components/voting/VotingRegistrationDialogWizard.tsx b/source/renderer/app/components/voting/VotingRegistrationDialogWizard.tsx index 49effc8815..04242acf42 100644 --- a/source/renderer/app/components/voting/VotingRegistrationDialogWizard.tsx +++ b/source/renderer/app/components/voting/VotingRegistrationDialogWizard.tsx @@ -42,7 +42,7 @@ type Props = { onRestart: (...args: Array) => any; onExternalLinkClick: (...args: Array) => any; hwDeviceStatus: HwDeviceStatus; - nextFundNumber?: number; + nextFundNumber: number; }; @observer diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx index 690aeb4d24..9843901575 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsChooseWallet.tsx @@ -75,7 +75,7 @@ type Props = { selectedWalletId: string | null | undefined; isWalletAcceptable: (...args: Array) => any; getStakePoolById: (...args: Array) => any; - nextFundNumber?: number; + nextFundNumber: number; }; type State = { selectedWalletId: string | null | undefined; diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsConfirm.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsConfirm.tsx index 0667e3eb9c..4c1bb5a5fc 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsConfirm.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsConfirm.tsx @@ -80,7 +80,7 @@ type Props = { | (LocalizableError | null | undefined); onConfirm: (...args: Array) => any; onRestart: (...args: Array) => any; - nextFundNumber?: number; + nextFundNumber: number; }; @observer diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx index f2e7ab0c84..d259dcdb7e 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsEnterPinCode.tsx @@ -62,7 +62,7 @@ type Props = { stepsList: Array; activeStep: number; onSetPinCode: (...args: Array) => any; - nextFundNumber?: number; + nextFundNumber: number; }; interface FormFields { diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx index 0df668d4c1..b312194e2f 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsQrCode.tsx @@ -67,7 +67,7 @@ type Props = { stepsList: Array; activeStep: number; qrCode: string | null | undefined; - nextFundNumber?: number; + nextFundNumber: number; }; type State = { isCheckbox1Accepted: boolean; diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx index 621070852b..d3056986e5 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/VotingRegistrationStepsRegister.tsx @@ -77,7 +77,7 @@ type Props = { transactionError?: LocalizableError | null | undefined; hwDeviceStatus: HwDeviceStatus; selectedWallet: Wallet | null | undefined; - nextFundNumber?: number; + nextFundNumber: number; isTrezor: boolean; isHardwareWallet: boolean; isSubmitting: boolean; diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx index d7be2ea37d..e625eadd1c 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/ConfirmationDialog.tsx @@ -36,7 +36,7 @@ const messages = defineMessages({ }, }); type Props = { - nextFundNumber?: number; + nextFundNumber: number; onConfirm: (...args: Array) => any; onCancel: (...args: Array) => any; }; diff --git a/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/VotingRegistrationDialog.tsx b/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/VotingRegistrationDialog.tsx index 6a6446d4c1..a193e99bfd 100644 --- a/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/VotingRegistrationDialog.tsx +++ b/source/renderer/app/components/voting/voting-registration-wizard-steps/widgets/VotingRegistrationDialog.tsx @@ -36,7 +36,7 @@ type Props = { contentClassName?: string | null | undefined; hideCloseButton?: boolean; hideSteps?: boolean; - nextFundNumber?: number; + nextFundNumber: number; }; @observer From d34bc9d4373b64563c276436c6ef0279b9fc05c9 Mon Sep 17 00:00:00 2001 From: Lucas Araujo Date: Fri, 11 Feb 2022 11:06:47 -0300 Subject: [PATCH 21/23] [DDW-675] Fix property name --- storybook/stories/voting/Voting.stories.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storybook/stories/voting/Voting.stories.tsx b/storybook/stories/voting/Voting.stories.tsx index 3b500602f6..7e3acbcd93 100644 --- a/storybook/stories/voting/Voting.stories.tsx +++ b/storybook/stories/voting/Voting.stories.tsx @@ -37,7 +37,7 @@ const mockFundInfo: CatalystFund = { number: 7, startTime: new Date('Jan 20, 2022, 11:00 UTC'), endTime: new Date('Feb 3, 2022, 11:00 UTC'), - results: new Date('Feb 10, 2022'), + resultsTime: new Date('Feb 10, 2022'), registrationSnapshotTime: new Date('Jan 6, 2022, 11:00 UTC'), }, next: { From 1f5be934c1b6205ec2085a60d4eaf55d247c8eb9 Mon Sep 17 00:00:00 2001 From: Daniel Main Date: Tue, 15 Feb 2022 19:02:43 +0100 Subject: [PATCH 22/23] [DDW-675] Moved it in the CHANGELOG.md to the vNext section --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b89de5c37..21ed889296 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,13 +3,14 @@ ## vNext ### Features + - Improved stake pool searchbar ([PR 2847](https://github.com/input-output-hk/daedalus/pull/2847)) +- Implemented catalyst dynamic content ([PR 2856](https://github.com/input-output-hk/daedalus/pull/2856)) ## 4.9.0-FC1 ### Features -- Implemented catalyst dynamic content ([PR 2856](https://github.com/input-output-hk/daedalus/pull/2856)) - Added table view for delegated stake pools list ([PR 2837](https://github.com/input-output-hk/daedalus/pull/2837)) - Removed Discreet mode notification ([PR 2852](https://github.com/input-output-hk/daedalus/pull/2852)) - Unified CPU info in diagnostics dialog ([PR 2818](https://github.com/input-output-hk/daedalus/pull/2818)) From a0c73677bad3ce87b59f900ea646640cbb2d4875 Mon Sep 17 00:00:00 2001 From: Daniel Main Date: Tue, 15 Feb 2022 19:10:24 +0100 Subject: [PATCH 23/23] [DDW-675] Run `yarn manage:translations` --- .../app/i18n/locales/defaultMessages.json | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/source/renderer/app/i18n/locales/defaultMessages.json b/source/renderer/app/i18n/locales/defaultMessages.json index 54c5c6bd70..05fa3a2278 100644 --- a/source/renderer/app/i18n/locales/defaultMessages.json +++ b/source/renderer/app/i18n/locales/defaultMessages.json @@ -6606,13 +6606,13 @@ "description": "\"Delegating List Title\" for the Stake Pools search.", "end": { "column": 3, - "line": 27 + "line": 8 }, - "file": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.tsx", + "file": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.messages.ts", "id": "staking.stakePools.search.searchInputPlaceholder", "start": { "column": 26, - "line": 23 + "line": 4 } }, { @@ -6620,13 +6620,13 @@ "description": "\"delegatingListTitle\" for the Stake Pools search.", "end": { "column": 3, - "line": 32 + "line": 13 }, - "file": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.tsx", + "file": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.messages.ts", "id": "staking.stakePools.search.delegatingListTitle", "start": { "column": 23, - "line": 28 + "line": 9 } }, { @@ -6634,13 +6634,13 @@ "description": "\"listTitle\" for the Stake Pools search.", "end": { "column": 3, - "line": 37 + "line": 18 }, - "file": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.tsx", + "file": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.messages.ts", "id": "staking.stakePools.search.listTitle", "start": { "column": 13, - "line": 33 + "line": 14 } }, { @@ -6648,13 +6648,13 @@ "description": "\"gridIconTooltip\" for the Stake Pools search.", "end": { "column": 3, - "line": 42 + "line": 23 }, - "file": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.tsx", + "file": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.messages.ts", "id": "staking.stakePools.search.gridIconTooltip", "start": { "column": 19, - "line": 38 + "line": 19 } }, { @@ -6662,13 +6662,13 @@ "description": "\"gridRewardsIconTooltip\" for the Stake Pools search.", "end": { "column": 3, - "line": 47 + "line": 28 }, - "file": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.tsx", + "file": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.messages.ts", "id": "staking.stakePools.search.gridRewardsIconTooltip", "start": { "column": 26, - "line": 43 + "line": 24 } }, { @@ -6676,13 +6676,13 @@ "description": "\"listIconTooltip\" for the Stake Pools search.", "end": { "column": 3, - "line": 52 + "line": 33 }, - "file": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.tsx", + "file": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.messages.ts", "id": "staking.stakePools.search.listIconTooltip", "start": { "column": 19, - "line": 48 + "line": 29 } }, { @@ -6690,17 +6690,17 @@ "description": "\"clearTooltip\" for the Stake Pools search.", "end": { "column": 3, - "line": 57 + "line": 38 }, - "file": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.tsx", + "file": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.messages.ts", "id": "staking.stakePools.search.clearTooltip", "start": { "column": 16, - "line": 53 + "line": 34 } } ], - "path": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.json" + "path": "source/renderer/app/components/staking/stake-pools/StakePoolsSearch.messages.json" }, { "descriptors": [