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

Initial implementation of stake form #93

Merged
merged 28 commits into from
Jan 10, 2024
Merged

Initial implementation of stake form #93

merged 28 commits into from
Jan 10, 2024

Conversation

kkosiorowska
Copy link
Contributor

@kkosiorowska kkosiorowska commented Dec 27, 2023

Closes #95

This PR adds a stake form. The data after approving the form will be saved in the context to use the given amount in a later step. The form for ustake and stake are very similar, so let's create a form base component. It will allow us to use it for unstake flow later. Changes:

  • Added styles for the Tabs component
  • Created the form base component
  • Handling of the stake form
  • Basic validation for form input
  • Added necessary methods that convert numbers from floating point number to bigint
Screen.Recording.2023-12-29.at.09.07.37.mov

@kkosiorowska kkosiorowska self-assigned this Dec 27, 2023
Base automatically changed from custom-input to main December 28, 2023 14:48
@kkosiorowska kkosiorowska marked this pull request as ready for review December 29, 2023 09:00
Copy link
Contributor Author

@kkosiorowska kkosiorowska Dec 29, 2023

Choose a reason for hiding this comment

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

A minor comment: would be helpful to organize the formatting/converting logic to make the functions consistent and readable with each other. Let's do this in a separate PR - #101

dapp/src/components/Modals/ActionForm/index.tsx Outdated Show resolved Hide resolved
dapp/src/components/Modals/ActionForm/index.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about the name of this component because at first sight, it may indicate we can render any form but actually we are rendering stake/unstake form.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's true this name isn't perfect. But I don't have a better idea. You are right, but on the other hand, we are just displaying the form there. The type of action restricts us on the types of form. If you just have any better idea let me know.

dapp/src/components/Modals/Staking/StakeForm.tsx Outdated Show resolved Hide resolved
dapp/src/components/Modals/Staking/StakeForm.tsx Outdated Show resolved Hide resolved
dapp/src/components/Modals/Staking/StakeForm.tsx Outdated Show resolved Hide resolved

function StakingSteps() {
const { activeStep, goNext } = useModalFlowContext()

switch (activeStep) {
case 1:
return <Overview goNext={goNext} />
return <ActionForm defaultForm="stake" goNext={goNext} />
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to figure out how to display the correct steps based on the form type. In this case, if a user changes tab to unstake, fills a form, and goes to the next step this component will display the next step for staking not unstaking. Just flagging, we probably should address it in a separate PR during the unstaking flow work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great catch! Let's do it as you say in a separate PR. We will have to think about it so I will also create a task to not lose it. #127

dapp/src/utils/forms.ts Outdated Show resolved Hide resolved
dapp/src/utils/forms.ts Show resolved Hide resolved
@r-czajkowski r-czajkowski self-requested a review January 10, 2024 13:38
Copy link
Contributor

@r-czajkowski r-czajkowski left a comment

Choose a reason for hiding this comment

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

:shipit:

@r-czajkowski r-czajkowski merged commit 5916950 into main Jan 10, 2024
11 checks passed
@r-czajkowski r-czajkowski deleted the stake-form branch January 10, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stake form
2 participants