Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New signature request v3 UI #6891

Merged
merged 9 commits into from
Nov 4, 2019
Merged

Conversation

tshfx
Copy link
Contributor

@tshfx tshfx commented Jul 21, 2019

Work in progress

In this PR I've extracted the old Signature request component into a new component to follow newer practices.

Todo's

  • Finish styling
  • Add information tool tip

Screen Shot 2019-07-21 at 6 12 38 PM

This work refers to #5388

@danjm danjm self-assigned this Jul 22, 2019
@danjm danjm added this to the UI Sprint 17 [July 22] milestone Jul 22, 2019
danjm
danjm previously requested changes Jul 23, 2019
Copy link
Contributor

@danjm danjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good overall. I've made a few suggestions here.

Once the styles are updated again according to the figma, I will do another review

@@ -273,8 +273,7 @@ SignatureRequest.prototype.renderBody = function () {
}),
}, [notice]),

h('div.request-signature__rows', type === 'eth_signTypedData' && version === 'V3' ?
this.renderTypedDataV3(data) :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should delete the this.renderTypedDataV3 method too? No longer needed here, correct?

<div className="signature-request-header">
<div className="signature-request-header--account">
{selectedAccount && accounts && <AccountDropdownMini
selectedAccount={selectedAccount}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this selectedAccount is the current account. I think you mentioned you weren't sure where to get that from state

@danjm
Copy link
Contributor

danjm commented Oct 24, 2019

I've made some updates. This now looks like:

Screenshot from 2019-10-24 02-24-20

@danjm danjm marked this pull request as ready for review October 28, 2019 14:54
if (typeof value === 'boolean') {
value = value.toString()
}
return h('div.request-signature__row', [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we put a key prop on each of these rows? Minimally we could be using the index?

export default class SignatureRequestHeader extends PureComponent {
static propTypes = {
selectedAccount: PropTypes.object.isRequired,
accounts: PropTypes.object,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this prop isn't required we should include a defaultProp for it


render () {
const { selectedAccount } = this.props
console.log('selectedAccount', selectedAccount)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: console.log

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c8120c6dac920b8a64d46fce781d099aa398c8b1

address: PropTypes.string,
balance: PropTypes.string,
})
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this prop isn't required, we should add a defaultProp for it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still pending

@@ -137,34 +138,46 @@ ConfirmTxScreen.prototype.getTxData = function () {
: unconfTxList[index]
}

ConfirmTxScreen.prototype.signatureSelect = function (type, version) {
// Temporarily direct only v3 and v4 requests to new code.
console.log('type, version', type, version)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: console.log

cancelTypedMessage: this.cancelTypedMessage.bind(this, txData),
})
: h(Loading)
console.log('msgParams', msgParams)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: console.log

@@ -118,7 +119,7 @@ export default class ConfirmTransaction extends Component {
// Show routes when state.confirmTransaction has been set and when either the ID in the params
// isn't specified or is specified and matches the ID in state.confirmTransaction in order to
// support URLs of /confirm-transaction or /confirm-transaction/<transactionId>

console.log('transactionId, paramsTransactionId', transactionId, paramsTransactionId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: console.log

@@ -97,7 +97,7 @@ export default class Home extends PureComponent {
showRestorePrompt,
threeBoxLastUpdated,
} = this.props

console.log(123456)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: console.log

ui/index.js Outdated
@@ -60,6 +60,7 @@ async function startApp (metamaskState, backgroundConnection, opts) {
const unapprovedTxsAll = txHelper(metamaskState.unapprovedTxs, metamaskState.unapprovedMsgs, metamaskState.unapprovedPersonalMsgs, metamaskState.unapprovedTypedMessages, metamaskState.network)
const numberOfUnapprivedTx = unapprovedTxsAll.length
if (numberOfUnapprivedTx > 0) {
console.log('unapprovedTxsAll', unapprovedTxsAll)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: console.log

@danjm danjm force-pushed the 5388-new-signing-ui branch from 6eac8d3 to d223915 Compare October 31, 2019 15:50
@danjm
Copy link
Contributor

danjm commented Oct 31, 2019

@whymarrh All comments (except the question about the whether the array label issue was resolved) were resolved in c8120c6dac920b8a64d46fce781d099aa398c8b1

I also fixed the styling of the component in full screen mode in d223915e1a02b9c8ce0905aa24e653f2a6db8705

Looking into that array label issue now

@danjm
Copy link
Contributor

danjm commented Oct 31, 2019

And I left a comment regarding the array label issue

renderNode (data) {
return (
<div className="signature-request-message--node">
{this.makeNode(data).map(([ label, value ], i) => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the looks of it, makeNode does nothing more than return the result of Object.entries, so this could be a call to that method directly.

Suggested change
{this.makeNode(data).map(([ label, value ], i) => (
{Object.entries(data).map(([ label, value ], i) => (

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we should be able to remove makeNode since it's just the once instance

address: PropTypes.string,
balance: PropTypes.string,
})
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still pending

const { clearConfirmTransaction, cancel } = this.props
const { metricsEvent } = this.context
if (getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_NOTIFICATION) {
window.onbeforeunload = event => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @Gudahtt has pointed out elsewhere (#7333 and #7335):

Generally it's better to use window.addEventListener('beforeunload', (event) => { ... }); instead of window.onbeforeunload because it avoids overwriting other onbeforeunload handlers

@whymarrh
Copy link
Contributor

@danjm want to rebase this on the latest develop when you have a minute

@danjm danjm force-pushed the 5388-new-signing-ui branch from fcde372 to 5ec78d9 Compare November 1, 2019 14:10
@whymarrh
Copy link
Contributor

whymarrh commented Nov 1, 2019

@danjm this build is still failing

@danjm danjm force-pushed the 5388-new-signing-ui branch from 5ec78d9 to 2fe6133 Compare November 1, 2019 19:55
Copy link
Contributor

@whymarrh whymarrh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@danjm danjm merged commit 57a2966 into MetaMask:develop Nov 4, 2019
@@ -45,6 +45,7 @@ export default class ConfirmTransaction extends Component {
isTokenMethodAction: PropTypes.bool,
fullScreenVsPopupTestGroup: PropTypes.string,
trackABTest: PropTypes.bool,
conversionRate: PropTypes.number,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the post-merge nitpick, but this prop appears to be unused (both here and in the container component)

@ZimZim9

This comment has been minimized.

tmashuang pushed a commit that referenced this pull request Nov 4, 2019
* Refactoring signature-request out to a new component. Wip

* Styling polish and a better message display.

* Update signature request header to no longer use account dropdown mini

* Clean up code and styles

* Code cleanup for signature request redesign branch

* Fix signature request design for full screen

* Replace makenode with object.entries in signature-request-message.component.js

* Remove unused accounts prop from signature-request.component.js

* Use beforeunload  instead of window.onbeforeunload in signature-request
Gudahtt added a commit that referenced this pull request Nov 18, 2019
The styles for the multi-notification component on the home screen were
accidentally removed while resolving a merge conflict in #6891.

Fixes #7460
Gudahtt added a commit that referenced this pull request Apr 14, 2020
The header component for the new Signature Request screen has an
undeclared variable called `name` in it. This was present in the
original implementation of this component in #6891. It's unclear what
this was supposed to be, and it doesn't seem to reference anything that
exists.
Gudahtt added a commit that referenced this pull request Apr 15, 2020
The header component for the new Signature Request screen has an
undeclared variable called `name` in it. This was present in the
original implementation of this component in #6891. It's unclear what
this was supposed to be, and it doesn't seem to reference anything that
exists.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants