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

Help wanted: Allow ballot-UI make use of participate.js #247

Open
David405 opened this issue Jul 15, 2021 · 6 comments
Open

Help wanted: Allow ballot-UI make use of participate.js #247

David405 opened this issue Jul 15, 2021 · 6 comments
Labels
dev environment Anything affecting dev interface ui UI / UX We need help!

Comments

@David405
Copy link
Collaborator

@dckc I would really appreciate your assistance here, I want to be able to use participate.js functions inside ballot-UI. I tried tweaking the webpack-config but that didn't work, I cannot figure out how the elements in participate.html were called inside participate.js. I can see where these were mounted, but I can't see whether the IDs mounted belong in participate.html.

Creating a separate js file for ballot-UI would be redundant IMO, as the functions to be used by ballot-UI share a lot with the functions and dependencies inside participate.js

@David405 David405 added We need help! ui UI / UX dev environment Anything affecting dev interface labels Jul 15, 2021
@dckc
Copy link
Contributor

dckc commented Jul 15, 2021

What exactly happens when you tried? Exactly what errors did you get? In what way did you tweak webpack-config?

Perhaps push your experiment to a branch and give a log of the exact errors?

@jimscarver
Copy link
Contributor

visual studio finds the reference to ../participate in the import but when it is run the import is not found.

@dckc
Copy link
Contributor

dckc commented Jul 15, 2021

reference from what? "when run" how?

@David405
Copy link
Collaborator Author

David405 commented Jul 15, 2021

WHAT I DID 1
So I created a file called ballot.js and I imported the function signIn from participate.js and getEthProvider from rchain-api, since I don't know how particpate.js calls elements from participate.html, I manually required the script file ballot.js inside ballot.html as a module ( I know this is bad practice for an SPA, but it is only a temporal solution ). Also, inside of the wepack-config file, I added ballot.html as a HTMLWebpackPlugin.

ERROR
So, manually requiring ballot.js even as a module makes the browser unable to find rchain-api or participate.js.

WHAT I DID 2
I tried directly importing the signIn function from participate.js inside index.js and then did a getElementById of #signIn button and added an event listener which calls the function.

ERROR
It doesn't look in ballot-ui for the id signIn, so the button does nothing.

NB - I created the signIn function inside participate.js as I didn't want to rewrite existing code, I simply reused the dependencies and methods already created inside participate.js

@dckc
Copy link
Contributor

dckc commented Jul 15, 2021

That all seems reasonable, @David405 . I might be able to reproduce your results, but it would take an hour or so, which I can't justify given other commitments.

If you push the exact code you're running (or attach it as a .zip or something) and share the exact diagnostics you see, I might be able to help in less time.

@David405
Copy link
Collaborator Author

@dckc kindly check the pull request #250

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev environment Anything affecting dev interface ui UI / UX We need help!
Projects
None yet
Development

No branches or pull requests

4 participants