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

Allow for send invoke calls from websites the user visits #27

Merged
merged 6 commits into from
Jan 3, 2018

Conversation

slipo
Copy link
Collaborator

@slipo slipo commented Dec 26, 2017

Takes care of this one: #14

@slipo
Copy link
Collaborator Author

slipo commented Dec 28, 2017

WIP, resolving merge conflicts ... I will likely stop reusing the form and just make a text only version for this case.

@slipo
Copy link
Collaborator Author

slipo commented Dec 29, 2017

Merging done

To see the popup, run this in console on any page (compatible with previous versions of NeoLink):

window.postMessage({ type: "FROM_PAGE", text: {      scriptHash: 'b3a14d99a3fb6646c78bf2f4e2f25a7964d2956a',
    operation: 'putvalue',
    arg1: 'test',
    arg2: '1',
    assetType: 'GAS',
    assetAmount: '.0000025' } }, "*");

Copy link

@austinhinderer austinhinderer left a comment

Choose a reason for hiding this comment

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

I haven't done any functional testing on this yet, but this is what I saw from reading through.

@@ -6,13 +6,17 @@ import style from './Header.css'

export default class Header extends Component {
render() {
const { noMenu } = this.props

Choose a reason for hiding this comment

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

This code might more clear if it was written in a more declarative way. Something like: const { hasMenu = false } = this.props. This way, we can be more truthy, and we don't need to add configuration to take away a thing we don't need, we only have to add add configuration for a thing we want.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call. I'll update it.

<div className={style.menuNavWrapper}>
<MainNav />
</div>
{ noMenu ||

Choose a reason for hiding this comment

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

Rather than running this check inline in the JSP, you could break it out and keep your template code a little cleaner.

const menu = if (hasMenu) <div and mainMenu />

Then in the JSP, something like { menu } instead if the check. Keeping logic out of template code is best for testing when we get that running.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I like it.

const { transaction } = this.props

return (
<div>

Choose a reason for hiding this comment

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

I pointed this out in my big issue the other day, but it's a nice way to break up your concerns if you keep your view JSX in a different component than the connected portion which deals with the redux store. This makes testing easier, separates the implementation from redux in case you want to use the component in a non-connected way, want to remove redux and use a different state management system, or want to keep your testing simple.

This would also allow the component to be written as a stateless functional component which is really lightweight and easy to test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Are you saying we should do something like neon-wallet does?
https://github.com/CityOfZion/neon-wallet/blob/dev/app/containers/DisplayWalletKeys/index.js
https://github.com/CityOfZion/neon-wallet/blob/dev/app/containers/DisplayWalletKeys/DisplayWalletKeys.jsx

That separates redux and I'm ok with that. Just haven't planned out how to organize everything quite yet. We could follow their pattern or do something a bit different.

Or you're saying we should completely separate all jsx from even the react state?

Choose a reason for hiding this comment

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

Yeah, the way neon-wallet does it is fine!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@austinhinderer and I have agreed we'll tackle this as part of refactoring when testing is in place.

@@ -134,7 +92,7 @@ export default class SendInvoke extends Component {
}

render() {
const { txid, loading, errorMsg } = this.state
const { loading, txid, errorMsg } = this.state

Choose a reason for hiding this comment

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

?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

probably just happened with moving code around

@slipo
Copy link
Collaborator Author

slipo commented Dec 29, 2017

OK, review comments are handled. I took the Header changes a step further and made it a state-less component.

@hal0x2328 hal0x2328 merged commit cd70c7a into CityOfZion:development Jan 3, 2018
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.

None yet

3 participants