Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Setup dApp skeleton #7

Closed
wants to merge 23 commits into from
Closed

Setup dApp skeleton #7

wants to merge 23 commits into from

Conversation

liamzebedee
Copy link
Contributor

@liamzebedee liamzebedee commented Jul 23, 2019

Setup the dapp 'skeleton'

  • next.js app, using React and Redux
  • pages
  • routes to pages
  • styling/layout
  • interaction handlers: actions and sagas, using Redux
  • CircleCI config for automatic build pass/fail

Closes: #5

Implements #2, but no test for the payment just yet (blocked by bitcoin testnet)

@liamzebedee liamzebedee changed the title Setup Setup skeleton Jul 23, 2019
@pdyraga pdyraga requested a review from taggartbg July 24, 2019 14:48
@pdyraga
Copy link
Member

pdyraga commented Jul 24, 2019

@liamzebedee Some summary in the PR description about what are we doing here would be helpful.

@liamzebedee liamzebedee marked this pull request as ready for review July 25, 2019 13:55
@liamzebedee
Copy link
Contributor Author

liamzebedee commented Jul 25, 2019

Latest screenshots. The styling is very functional for now. I want to note that in sagas.js there's a lot of status updates on transactions and the like we can hook into the UI pretty easily.
Screen Shot 2019-07-25 at 4 59 51 pm
Screen Shot 2019-07-25 at 4 59 48 pm
Screen Shot 2019-07-25 at 4 59 44 pm
Screen Shot 2019-07-25 at 4 59 40 pm
Screen Shot 2019-07-25 at 4 59 34 pm
Screen Shot 2019-07-25 at 4 59 31 pm

@liamzebedee liamzebedee changed the title Setup skeleton Setup dApp skeleton Jul 25, 2019
@liamzebedee liamzebedee mentioned this pull request Jul 26, 2019
@liamzebedee
Copy link
Contributor Author

Yeah so added some styling! Minor details missing ofc, dependent on how far we get with UX this week. But looking better

Screen Shot 2019-07-30 at 2 04 01 am

Screen Shot 2019-07-30 at 2 04 06 am

Screen Shot 2019-07-30 at 2 05 16 am

Screen Shot 2019-07-30 at 2 05 19 am

Screen Shot 2019-07-30 at 2 05 22 am

Screen Shot 2019-07-30 at 2 05 25 am

Copy link
Member

@nkuba nkuba left a comment

Choose a reason for hiding this comment

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

I tried to run the app. It works, transitions work, styles has improved.

I did not review the frontend specific code.

We should remove app/test/index.js empty file.

@@ -0,0 +1,3227 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this file? Aren't we using npm?

@@ -0,0 +1,3 @@
node_modules
Copy link
Member

Choose a reason for hiding this comment

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

Thoughts on moving this .gitignore to a project root directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

^^ let's do it

@@ -0,0 +1,38 @@
order:
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should remove the plan from this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops

@@ -0,0 +1,24 @@
{
Copy link
Member

Choose a reason for hiding this comment

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

We should commit package-lock.json.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True

steps:
- checkout
- run: npm i
- run: npm run build
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if this will work. Maybe we should drop the circleci configuration from this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha could you be less specific? Why won't it work?

Copy link
Contributor

Choose a reason for hiding this comment

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

Both of you could use some details heh. Based on the commit that introduced this, I have no idea what you're trying to achieve. What's the purpose of adding this? That will probably help Kuba understand what is expected to work here.

It certainly doesn't test solidity, which is what your build currently implies 😉

Copy link
Member

Choose a reason for hiding this comment

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

Haha could you be less specific? Why won't it work?

Yes, sorry. This will be executed in the root directory, which doesn't contain these commands definition. We should set working_directory for these steps.
We should also add workflows specification at the end of the file.

If we want to configure it all in this PR I can give you a hand with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Closed but responding anyways - good catch guys, this was actually because I moved everything into app/ to play well with #8's file layout. ATT of that commit @Shadowfiend, it was correct and simply did a build.

@liamzebedee liamzebedee mentioned this pull request Jul 30, 2019
3 tasks
@Shadowfiend Shadowfiend mentioned this pull request Jul 30, 2019
return {
type: SUBMIT_DEPOSIT_PROOF
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

How do you feel about using object literals w/ strings throughout the app?

I've always followed the pattern you have here, but I'm wondering if its really worth it. Action Creators are great for managing side-effects, but we now have sagas for that, so I'm questioning our assumptions a bit.

With action name constants, I still see value in those: easier to debug if you typo, but I am not convinced thats a mistake made often enough to justify the additional boilerplate.

What you have here is much cleaner/safer than what I'm suggesting, and is what I'm used to - I'm just wondering where your head is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've never worked under a frontend senior, so I can't speak for the standard. But I wouldn't say the issue is typos - rather, it's refactors. In which case, using your type system is the right thing to do.

It's also something the official Redux docs recommend:

Encapsulating and centralizing commonly used pieces of code is a key concept in programming. While it is certainly possible to manually create action objects everywhere, and write each type value by hand, defining reusable constants makes maintaining code easier. If you put constants in a separate file, you can check your import statements against typos so you can't accidentally use the wrong string.

import { AwaitDepositConfirmation } from '../components/AwaitDepositConfirmation'
import { waitConfirmation } from '../actions'

class AwaitDepositConfirmationContainer extends React.Component {
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the container pattern, but questions whether we need it in an app this size. Each of these top-level components probably won't be re-used with different actions/state connected to it, so for readability maybe its worth colocating the connections.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm interested if you could elaborate - what do you see as good frontend readability? :)

(I know we're not reviewing this PR anymore - but this is more about getting on the same page and learning from each other)

if (!window[__NEXT_REDUX_STORE__]) {
window[__NEXT_REDUX_STORE__] = configureStore(initialState)
}
return window[__NEXT_REDUX_STORE__]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this redux store persisted in localstorage (or similar)? That'd be really really nice to have.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for the demo, it doesn't seem relevant. Although totally on board with this and was looking at https://github.com/rt2zz/redux-persist ;)

Router.push('/tbtc-minted')
}

export default function* () {
Copy link
Contributor

Choose a reason for hiding this comment

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

I really love having the takeEvery as simply part of the saga exports, rather than having a separate file of watchers. 👍

@pdyraga
Copy link
Member

pdyraga commented Jul 31, 2019

Closing in favour of #18.

See the discussion in #5.

@pdyraga pdyraga closed this Jul 31, 2019
liamzebedee added a commit that referenced this pull request Apr 20, 2020
Iron Confederacy: Improve tbtc.js for usage by the tBTC reference dApp
@mhluongo mhluongo deleted the setup branch July 15, 2020 12:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DApp Skeleton
5 participants