From 4f69c2f16aaf50ba891d9c1a43f1a9cb2a7bf0f9 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Thu, 18 Aug 2022 12:59:23 +0200 Subject: [PATCH 1/8] Add paper wallet validation --- .../app/components/wallet/WalletRestoreDialog.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/WalletRestoreDialog.js b/packages/yoroi-extension/app/components/wallet/WalletRestoreDialog.js index 1734be5ec1..8949a8268d 100644 --- a/packages/yoroi-extension/app/components/wallet/WalletRestoreDialog.js +++ b/packages/yoroi-extension/app/components/wallet/WalletRestoreDialog.js @@ -172,10 +172,7 @@ export default class WalletRestoreDialog extends Component { ]; }, ({ field }) => ([ - // TODO: Should we allow 0-length paper wallet passwords? - // Disable for now to avoid user accidentally forgetting - // to enter his password and pressing restore - field.value.length > 0, + field.value.length > 10, this.context.intl.formatMessage(globalMessages.invalidPaperPassword) ]), ], From 79b5cc79af88722ffa151a6e3f3c2873453469c7 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Thu, 18 Aug 2022 13:07:13 +0200 Subject: [PATCH 2/8] Fix min-ada error message --- packages/yoroi-extension/app/api/common/errors.js | 2 +- packages/yoroi-extension/app/i18n/locales/en-US.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/app/api/common/errors.js b/packages/yoroi-extension/app/api/common/errors.js index da31e0dc5a..85517bd389 100644 --- a/packages/yoroi-extension/app/api/common/errors.js +++ b/packages/yoroi-extension/app/api/common/errors.js @@ -46,7 +46,7 @@ const messages = defineMessages({ }, cannotSendBelowMinimumValueError: { id: 'api.errors.CannotSendBelowMinimumValueError', - defaultMessage: '!!!Minimum required is 1 ADA', + defaultMessage: '!!!A minimum of 1 ADA is required', }, assetOverflowError: { id: 'api.errors.assetOverflowError', diff --git a/packages/yoroi-extension/app/i18n/locales/en-US.json b/packages/yoroi-extension/app/i18n/locales/en-US.json index 1302ea9b76..aa79ccaef9 100644 --- a/packages/yoroi-extension/app/i18n/locales/en-US.json +++ b/packages/yoroi-extension/app/i18n/locales/en-US.json @@ -1,6 +1,6 @@ { "api.errors.ApiMethodNotYetImplementedError": "This API method is not yet implemented.", - "api.errors.CannotSendBelowMinimumValueError": "Minimum required is 1 ADA", + "api.errors.CannotSendBelowMinimumValueError": "A minimum of 1 ADA is required", "api.errors.GenericApiError": "An error occurred. Please retry.", "api.errors.IncorrectPasswordError": "Incorrect spending password. Please retype.", "api.errors.NotEnoughMoneyToSendError": "Insufficient funds to complete this transaction.", From 78cf5f0b5fba56e2c6c8b40123d560c2113a8250 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Thu, 18 Aug 2022 13:36:08 +0200 Subject: [PATCH 3/8] Update wallet already exits error --- .../app/components/wallet/WalletAlreadyExistDialog.js | 2 +- .../app/components/wallet/WalletAlreadyExistDialog.scss | 5 +++++ packages/yoroi-extension/app/i18n/locales/en-US.json | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/WalletAlreadyExistDialog.js b/packages/yoroi-extension/app/components/wallet/WalletAlreadyExistDialog.js index 656a9bf35a..a3dec32caf 100644 --- a/packages/yoroi-extension/app/components/wallet/WalletAlreadyExistDialog.js +++ b/packages/yoroi-extension/app/components/wallet/WalletAlreadyExistDialog.js @@ -21,7 +21,7 @@ const messages = defineMessages({ }, explanation: { id: 'wallet.restore.dialog.walletExist.explanation', - defaultMessage: '!!!You are trying to restore existing wallet.', + defaultMessage: '!!!The wallet you are trying to restore already exists.', } }); diff --git a/packages/yoroi-extension/app/components/wallet/WalletAlreadyExistDialog.scss b/packages/yoroi-extension/app/components/wallet/WalletAlreadyExistDialog.scss index 0e85651b24..7c9b9caabf 100644 --- a/packages/yoroi-extension/app/components/wallet/WalletAlreadyExistDialog.scss +++ b/packages/yoroi-extension/app/components/wallet/WalletAlreadyExistDialog.scss @@ -1,8 +1,13 @@ .component { + + & > div { + overflow: hidden; + } .wrapper { display: grid; grid-template-columns: 1fr 4fr; grid-gap: 8px; + overflow: hidden; } .explanation { diff --git a/packages/yoroi-extension/app/i18n/locales/en-US.json b/packages/yoroi-extension/app/i18n/locales/en-US.json index aa79ccaef9..eac7c728f6 100644 --- a/packages/yoroi-extension/app/i18n/locales/en-US.json +++ b/packages/yoroi-extension/app/i18n/locales/en-US.json @@ -723,7 +723,7 @@ "wallet.restore.dialog.verify.wallet.button.label": "Verify wallet", "wallet.restore.dialog.wallet.name.input.hint": "e.g: Shopping Wallet", "wallet.restore.dialog.wallet.name.input.label": "Wallet name", - "wallet.restore.dialog.walletExist.explanation": "You are trying to restore existing wallet.", + "wallet.restore.dialog.walletExist.explanation": "The wallet you are trying to restore already exists.", "wallet.restore.dialog.walletExist.openWallet": "Open Wallet", "wallet.restore.dialog.walletExist.title": "Wallet Already Exist", "wallet.send.confirmationDialog.addressToLabel": "To", From 3b7bae95e32cba52eb6be097792274dbace653d3 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Thu, 18 Aug 2022 13:47:15 +0200 Subject: [PATCH 4/8] Fix transfer status error --- packages/yoroi-extension/app/components/transfer/ErrorPage.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/yoroi-extension/app/components/transfer/ErrorPage.scss b/packages/yoroi-extension/app/components/transfer/ErrorPage.scss index ae5dd451a5..c0ac735a62 100644 --- a/packages/yoroi-extension/app/components/transfer/ErrorPage.scss +++ b/packages/yoroi-extension/app/components/transfer/ErrorPage.scss @@ -18,7 +18,6 @@ font-weight: 500; line-height: 23px; margin-bottom: 6px; - word-break: break-all; text-align: center; } From c937e5e77474edc0b376f6fdb868ab56d5a26efa Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Fri, 19 Aug 2022 14:57:54 +0200 Subject: [PATCH 5/8] Update crash screen --- packages/yoroi-extension/app/App.js | 2 +- .../app/components/loading/Crashed.js | 32 ++++++++----------- .../app/containers/CrashPage.js | 22 +------------ .../app/i18n/global-messages.js | 6 +++- .../app/i18n/locales/en-US.json | 3 +- 5 files changed, 22 insertions(+), 43 deletions(-) diff --git a/packages/yoroi-extension/app/App.js b/packages/yoroi-extension/app/App.js index 1e9e2581a5..8138604921 100644 --- a/packages/yoroi-extension/app/App.js +++ b/packages/yoroi-extension/app/App.js @@ -144,7 +144,7 @@ class App extends Component { getContent: void => ?Node = () => { const { stores, actions, history } = this.props; if (this.state.crashed === true) { - return ; + return ; } if (stores.serverConnectionStore.isMaintenance) { return ; diff --git a/packages/yoroi-extension/app/components/loading/Crashed.js b/packages/yoroi-extension/app/components/loading/Crashed.js index 027e458281..de58daa1ad 100644 --- a/packages/yoroi-extension/app/components/loading/Crashed.js +++ b/packages/yoroi-extension/app/components/loading/Crashed.js @@ -7,6 +7,7 @@ import globalMessages from '../../i18n/global-messages'; import type { $npm$ReactIntl$IntlFormat } from 'react-intl'; import UnavailableDialog from '../widgets/UnavailableDialog'; import { defineMessages, intlShape, FormattedMessage } from 'react-intl'; +import { Link, Typography } from '@mui/material'; const messages = defineMessages({ title: { @@ -50,38 +51,31 @@ export default class Crashed extends Component { _getErrorMessageComponent: (void => Node) = () => { const { intl } = this.context; const { - onExternalLinkClick, onDownloadLogs } = this.props; const downloadLogsLink = ( // eslint-disable-next-line jsx-a11y/anchor-is-valid - onDownloadLogs()} - > + onDownloadLogs()}> {intl.formatMessage(globalMessages.downloadLogsLink)} - + ); const supportRequestLink = ( - onExternalLinkClick(event)} - target='_blank' - rel="noreferrer" - > - {intl.formatMessage(globalMessages.contactSupport)} - + + {intl.formatMessage(globalMessages.here)} + ); return (

- -

- + + + + + + +

); }; diff --git a/packages/yoroi-extension/app/containers/CrashPage.js b/packages/yoroi-extension/app/containers/CrashPage.js index f8ae59ad03..5aa6ee5e55 100644 --- a/packages/yoroi-extension/app/containers/CrashPage.js +++ b/packages/yoroi-extension/app/containers/CrashPage.js @@ -2,37 +2,17 @@ import type { Node } from 'react'; import { Component } from 'react'; import { observer } from 'mobx-react'; -import { computed } from 'mobx'; import Crashed from '../components/loading/Crashed'; -import type { JointInjectedOrGenerated } from '../types/injectedPropsType'; -import { handleExternalLinkClick } from '../utils/routing'; import { downloadLogs } from '../utils/logging'; -type GeneratedData = typeof CrashPage.prototype.generated; - @observer -export default class CrashPage extends Component< - JointInjectedOrGenerated -> { +export default class CrashPage extends Component<{||}> { render(): Node { return ( ); } - - @computed get generated(): {|handleExternalLinkClick: (event: MouseEvent) => void|} { - if (this.props.generated !== undefined) { - return this.props.generated; - } - if (this.props.stores == null || this.props.actions == null) { - throw new Error(`${nameof(CrashPage)} no way to generated props`); - } - return Object.freeze({ - handleExternalLinkClick, - }); - } } diff --git a/packages/yoroi-extension/app/i18n/global-messages.js b/packages/yoroi-extension/app/i18n/global-messages.js index c8f8515c9c..8b51e48839 100644 --- a/packages/yoroi-extension/app/i18n/global-messages.js +++ b/packages/yoroi-extension/app/i18n/global-messages.js @@ -8,6 +8,10 @@ import { defineMessages } from 'react-intl'; */ const globalMessages: * = defineMessages({ + here: { + id: 'global.util.here', + defaultMessage: '!!!here', + }, token: { id: 'global.labels.token', defaultMessage: '!!!Token', @@ -427,7 +431,7 @@ const globalMessages: * = defineMessages({ }, forMoreHelp: { id: 'loading.screen.error', - defaultMessage: '!!!For more help, you can {supportRequestLink}', + defaultMessage: '!!!Unexpected error occurred. We apologize for the inconvenience. If this error persists, please reach out to our support team {supportRequestLink}', }, logsContent: { id: 'settings.support.logs.content', diff --git a/packages/yoroi-extension/app/i18n/locales/en-US.json b/packages/yoroi-extension/app/i18n/locales/en-US.json index eac7c728f6..4ced475a62 100644 --- a/packages/yoroi-extension/app/i18n/locales/en-US.json +++ b/packages/yoroi-extension/app/i18n/locales/en-US.json @@ -158,6 +158,7 @@ "global.labels.optionalMemo": "Memo (optional)", "global.labels.nft": "NFTs", "global.labels.token": "token", + "global.util.here": "here", "wallet.send.form.memoWarning": "Memos are stored localy only", "wallet.send.form.max": "MAX", "wallet.send.form.dialog.add": "add", @@ -216,7 +217,7 @@ "inline.editing.input.cancel.label": "cancel", "inline.editing.input.change.label": "change", "inline.editing.input.changesSaved": "Your changes have been saved", - "loading.screen.error": "For more help, you can {supportRequestLink}", + "loading.screen.error": "Unexpected error occurred. We apologize for the inconvenience. If this error persists, please reach out to our support team {supportRequestLink}", "loading.screen.loading": "Loading components", "maintenance.screen.explanation": "Yoroi is in maintenance mode. You can still access your funds through any other wallet software.", "maintenance.screen.title": "Temporary Maintenance", From 85fe9eb23546429d00b472906049afa0e347e979 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Fri, 19 Aug 2022 15:12:29 +0200 Subject: [PATCH 6/8] Update Catalyst page --- .../wallet/voting/ConfirmPinDialog.js | 2 +- .../app/components/widgets/forms/PinInput.js | 5 +++-- .../app/containers/wallet/voting/VotingPage.js | 18 ++++++++++++++---- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/packages/yoroi-extension/app/components/wallet/voting/ConfirmPinDialog.js b/packages/yoroi-extension/app/components/wallet/voting/ConfirmPinDialog.js index 4806c6c1e2..ccd9b85640 100644 --- a/packages/yoroi-extension/app/components/wallet/voting/ConfirmPinDialog.js +++ b/packages/yoroi-extension/app/components/wallet/voting/ConfirmPinDialog.js @@ -89,7 +89,7 @@ export default class ConfirmPinDialog extends Component {
-
+
this.setPinForm(form)} disabled={false} diff --git a/packages/yoroi-extension/app/components/widgets/forms/PinInput.js b/packages/yoroi-extension/app/components/widgets/forms/PinInput.js index b70c1ac48d..18877f2706 100644 --- a/packages/yoroi-extension/app/components/widgets/forms/PinInput.js +++ b/packages/yoroi-extension/app/components/widgets/forms/PinInput.js @@ -9,6 +9,7 @@ import globalMessages from '../../../i18n/global-messages'; import config from '../../../config'; import TextField from '../../common/TextField'; import type { $npm$ReactIntl$IntlFormat } from 'react-intl'; +import { Box } from '@mui/material'; type Props = {| +setForm: ReactToolboxMobxForm => void, @@ -90,7 +91,7 @@ export default class PinInput extends Component { const pinField = form.$(this.props.fieldName); return ( -
+ {this.props.disclaimer} { error={pinField.error} done={this.props.done} /> -
+ ); } } diff --git a/packages/yoroi-extension/app/containers/wallet/voting/VotingPage.js b/packages/yoroi-extension/app/containers/wallet/voting/VotingPage.js index c1128236b1..845ff26264 100644 --- a/packages/yoroi-extension/app/containers/wallet/voting/VotingPage.js +++ b/packages/yoroi-extension/app/containers/wallet/voting/VotingPage.js @@ -160,11 +160,21 @@ export default class VotingPage extends Component { registrationStart: nextFund?.registrationStart }) + const fund = { + 'id': 8, + 'name': 'Fund9', + 'registrationStart': '2021-01-27T11:00:00Z', + 'registrationEnd': '2023-08-04T11:00:00Z', + 'votingStart': '2021-08-11T11:00:00Z', + 'votingEnd': '2023-08-25T11:00:00Z', + 'votingPowerThreshold': '450' + }; if (currentFund) { - const isLate = new Date() >= new Date(Date.parse(currentFund.registrationEnd)) - const isEarly = new Date() <= new Date(Date.parse(currentFund.registrationStart)) - const isBeforeVoting = new Date() <= new Date(Date.parse(currentFund.votingStart)) - const isAfterVoting = new Date() >= new Date(Date.parse(currentFund.votingEnd)) + console.log(JSON.parse(JSON.stringify(currentFund))) + const isLate = new Date() >= new Date(Date.parse(fund.registrationEnd)) + const isEarly = new Date() <= new Date(Date.parse(fund.registrationStart)) + const isBeforeVoting = new Date() <= new Date(Date.parse(fund.votingStart)) + const isAfterVoting = new Date() >= new Date(Date.parse(fund.votingEnd)) const isBetweenVoting = !isBeforeVoting && !isAfterVoting; if (isEarly) { From d05680df9c49c6101cd725b903311e0fa7273e81 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Mon, 22 Aug 2022 14:19:25 +0200 Subject: [PATCH 7/8] Check for password length --- .../app/components/wallet/WalletRestoreDialog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/components/wallet/WalletRestoreDialog.js b/packages/yoroi-extension/app/components/wallet/WalletRestoreDialog.js index 8949a8268d..1f4e9e3f1e 100644 --- a/packages/yoroi-extension/app/components/wallet/WalletRestoreDialog.js +++ b/packages/yoroi-extension/app/components/wallet/WalletRestoreDialog.js @@ -172,7 +172,7 @@ export default class WalletRestoreDialog extends Component { ]; }, ({ field }) => ([ - field.value.length > 10, + field.value.length > 9, this.context.intl.formatMessage(globalMessages.invalidPaperPassword) ]), ], From 2121ed5c79aeaa662a4bce30506346e094a61395 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Fri, 26 Aug 2022 11:57:50 +0200 Subject: [PATCH 8/8] Flow --- .../yoroi-extension/app/components/loading/Crashed.js | 1 - .../yoroi-extension/app/containers/CrashPage.stories.js | 8 +------- packages/yoroi-extension/app/ergo-connector/App.js | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/yoroi-extension/app/components/loading/Crashed.js b/packages/yoroi-extension/app/components/loading/Crashed.js index de58daa1ad..a92b1e7145 100644 --- a/packages/yoroi-extension/app/components/loading/Crashed.js +++ b/packages/yoroi-extension/app/components/loading/Crashed.js @@ -17,7 +17,6 @@ const messages = defineMessages({ }); type Props = {| - +onExternalLinkClick: MouseEvent => void, +onDownloadLogs: void => void, |}; diff --git a/packages/yoroi-extension/app/containers/CrashPage.stories.js b/packages/yoroi-extension/app/containers/CrashPage.stories.js index 5393b1d931..62586e584a 100644 --- a/packages/yoroi-extension/app/containers/CrashPage.stories.js +++ b/packages/yoroi-extension/app/containers/CrashPage.stories.js @@ -1,8 +1,6 @@ // @flow import type { Node } from 'react'; - -import { action } from '@storybook/addon-actions'; import CrashPage from './CrashPage'; import { withScreenshot } from 'storycap'; @@ -13,9 +11,5 @@ export default { }; export const Generic = (): Node => ( - + ); diff --git a/packages/yoroi-extension/app/ergo-connector/App.js b/packages/yoroi-extension/app/ergo-connector/App.js index 80420cb7d4..d1ef07a8ee 100644 --- a/packages/yoroi-extension/app/ergo-connector/App.js +++ b/packages/yoroi-extension/app/ergo-connector/App.js @@ -122,7 +122,7 @@ class App extends Component { getContent: void => ?Node = () => { const { stores, actions, history } = this.props; if (this.state.crashed === true) { - return ; + return ; } return {Routes(stores, actions)}; };