-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3219 from Emurgo/ruslan/catalyst-ui-revert
Revert Catalyst UI changes
- Loading branch information
Showing
24 changed files
with
1,200 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
packages/yoroi-extension/app/components/wallet/voting/ConfirmPinDialog.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
// @flow | ||
import type { Node } from 'react'; | ||
import { Component } from 'react'; | ||
import { observer } from 'mobx-react'; | ||
import classnames from 'classnames'; | ||
import { observable, action } from 'mobx'; | ||
import { defineMessages, intlShape, FormattedHTMLMessage } from 'react-intl'; | ||
import type { $npm$ReactIntl$IntlFormat } from 'react-intl'; | ||
import ReactToolboxMobxForm from '../../../utils/ReactToolboxMobxForm'; | ||
import globalMessages from '../../../i18n/global-messages'; | ||
|
||
import Dialog from '../../widgets/Dialog'; | ||
import DialogCloseButton from '../../widgets/DialogCloseButton'; | ||
import DialogBackButton from '../../widgets/DialogBackButton'; | ||
import ProgressStepBlock from './ProgressStepBlock'; | ||
import { ProgressInfo } from '../../../stores/ada/VotingStore'; | ||
import PinInput from '../../widgets/forms/PinInput'; | ||
|
||
import styles from './ConfirmPinDialog.scss'; | ||
import type { StepsList } from './types'; | ||
|
||
const messages = defineMessages({ | ||
line1: { | ||
id: 'wallet.voting.dialog.step.confirm.line1', | ||
defaultMessage: '!!!Please enter the PIN as you will need it <strong>every time</strong> you want to access the Catalyst Voting app.', | ||
}, | ||
}); | ||
|
||
type Props = {| | ||
+stepsList: StepsList, | ||
+progressInfo: ProgressInfo, | ||
+goBack: void => void, | ||
+submit: void => PossiblyAsync<void>, | ||
+error: void => PossiblyAsync<void>, | ||
+cancel: void => void, | ||
+classicTheme: boolean, | ||
+pinValidation: string => boolean, | ||
+isProcessing: boolean, | ||
|}; | ||
|
||
@observer | ||
export default class ConfirmPinDialog extends Component<Props> { | ||
|
||
static contextTypes: {|intl: $npm$ReactIntl$IntlFormat|} = { | ||
intl: intlShape.isRequired | ||
}; | ||
@observable pinForm: void | ReactToolboxMobxForm; | ||
|
||
@action | ||
setPinForm(form: ReactToolboxMobxForm) { | ||
this.pinForm = form; | ||
} | ||
|
||
render(): Node { | ||
const { intl } = this.context; | ||
const { | ||
stepsList, | ||
progressInfo, | ||
goBack, | ||
cancel, | ||
classicTheme, | ||
pinValidation, | ||
isProcessing, | ||
} = this.props; | ||
|
||
const dailogActions = [{ | ||
label: intl.formatMessage(globalMessages.stepConfirm), | ||
primary: true, | ||
onClick: this._submitForm, | ||
isSubmitting: isProcessing, | ||
disabled: isProcessing, | ||
}]; | ||
|
||
return ( | ||
<Dialog | ||
className={classnames([styles.dialog])} | ||
title={intl.formatMessage(globalMessages.votingRegistrationTitle)} | ||
actions={dailogActions} | ||
closeOnOverlayClick={false} | ||
closeButton={<DialogCloseButton />} | ||
backButton={<DialogBackButton onBack={goBack} />} | ||
onClose={cancel} | ||
> | ||
<ProgressStepBlock | ||
stepsList={stepsList} | ||
progressInfo={progressInfo} | ||
classicTheme={classicTheme} | ||
/> | ||
<div className={classnames([styles.lineText, styles.firstItem])}> | ||
<FormattedHTMLMessage {...messages.line1} /> | ||
</div> | ||
<div className={styles.pinInputContainer}> | ||
<PinInput | ||
setForm={form => this.setPinForm(form)} | ||
disabled={false} | ||
classicTheme={classicTheme} | ||
pinMatches={pinValidation} | ||
fieldName="pin" | ||
validCheck={_pin => true} | ||
placeholder={this.context.intl.formatMessage(globalMessages.confirmPin)} | ||
allowEmptyInput={false} | ||
/> | ||
</div> | ||
</Dialog>); | ||
} | ||
|
||
_submitForm: void => Promise<void> = async () => { | ||
if (this.pinForm !== undefined) { | ||
this.pinForm.submit({ | ||
onSuccess: async () => { | ||
await this.props.submit(); | ||
}, | ||
onError: async () => { | ||
await this.props.error(); | ||
}, | ||
}); | ||
} | ||
}; | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/yoroi-extension/app/components/wallet/voting/ConfirmPinDialog.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@import './common.scss'; | ||
|
||
.pinInputContainer{ | ||
display: flex; | ||
justify-content: center; | ||
margin-top: 32px; | ||
} |
62 changes: 0 additions & 62 deletions
62
packages/yoroi-extension/app/components/wallet/voting/DoneDialog.js
This file was deleted.
Oops, something went wrong.
93 changes: 93 additions & 0 deletions
93
packages/yoroi-extension/app/components/wallet/voting/GeneratePinDialog.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// @flow | ||
import type { Node } from 'react'; | ||
import { Component } from 'react'; | ||
import { observer } from 'mobx-react'; | ||
import classnames from 'classnames'; | ||
import { defineMessages, intlShape, FormattedHTMLMessage } from 'react-intl'; | ||
|
||
import globalMessages from '../../../i18n/global-messages'; | ||
|
||
import Dialog from '../../widgets/Dialog'; | ||
import DialogCloseButton from '../../widgets/DialogCloseButton'; | ||
import DialogBackButton from '../../widgets/DialogBackButton'; | ||
|
||
import ProgressStepBlock from './ProgressStepBlock'; | ||
|
||
import type { $npm$ReactIntl$IntlFormat } from 'react-intl'; | ||
import { ProgressInfo } from '../../../stores/ada/VotingStore'; | ||
|
||
import styles from './GeneratePinDialog.scss'; | ||
import type { StepsList } from './types'; | ||
|
||
const messages = defineMessages({ | ||
line1: { | ||
id: 'wallet.voting.dialog.step.pin.line1', | ||
defaultMessage: '!!!Please write down this PIN as you will need it <strong>every time</strong> you want to access the Catalyst Voting app.', | ||
}, | ||
actionButton: { | ||
id: 'wallet.voting.dialog.step.pin.actionButton', | ||
defaultMessage: '!!!Confirm that I wrote down the PIN', | ||
}, | ||
}); | ||
|
||
type Props = {| | ||
+stepsList: StepsList, | ||
+progressInfo: ProgressInfo, | ||
+next: void => void, | ||
+cancel: void => void, | ||
+onBack: void => void, | ||
+classicTheme: boolean, | ||
+pin: Array<number>, | ||
|}; | ||
|
||
@observer | ||
export default class GeneratePinDialog extends Component<Props> { | ||
static contextTypes: {| intl: $npm$ReactIntl$IntlFormat |} = { | ||
intl: intlShape.isRequired, | ||
}; | ||
|
||
render(): Node { | ||
const { intl } = this.context; | ||
const { stepsList, progressInfo, next, cancel, classicTheme, pin } = this.props; | ||
|
||
const dialogActions = [ | ||
{ | ||
label: intl.formatMessage(messages.actionButton), | ||
primary: true, | ||
onClick: next, | ||
}, | ||
]; | ||
|
||
const pinCards = ( | ||
<div className={classnames([styles.pinContainer, styles.lastItem])}> | ||
{pin.map((value, index) => { | ||
// eslint-disable-next-line react/no-array-index-key | ||
return <div key={index} className={styles.pin}><span>{value}</span></div>; | ||
})} | ||
</div> | ||
); | ||
|
||
return ( | ||
<Dialog | ||
className={classnames([styles.dialog])} | ||
title={intl.formatMessage(globalMessages.votingRegistrationTitle)} | ||
actions={dialogActions} | ||
closeOnOverlayClick={false} | ||
closeButton={<DialogCloseButton />} | ||
backButton={<DialogBackButton onBack={this.props.onBack} />} | ||
onClose={cancel} | ||
> | ||
<ProgressStepBlock | ||
stepsList={stepsList} | ||
progressInfo={progressInfo} | ||
classicTheme={classicTheme} | ||
/> | ||
|
||
<div className={classnames([styles.lineText, styles.firstItem, styles.importantText])}> | ||
<FormattedHTMLMessage {...messages.line1} /> | ||
</div> | ||
{pinCards} | ||
</Dialog> | ||
); | ||
} | ||
} |
Oops, something went wrong.