Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Create and implement a Stepper component. #2246

Merged
merged 13 commits into from
Jan 21, 2022
Merged

Conversation

fairlighteth
Copy link
Contributor

Summary

  • Adds a Stepper component and uses this in our Claim flow
Screen.Recording.2022-01-21.at.12.38.08.mov
Screen.Recording.2022-01-21.at.12.37.40.mov

Note

  • Stepper not optimized for mobile/responsive

@fairlighteth fairlighteth requested review from a team January 21, 2022 11:41
@fairlighteth
Copy link
Contributor Author

Update:

  • Changed some styles, where only the active step has a bold step text title:

Screen Shot 2022-01-21 at 12 47 48

- Cleaned up unused styled components, in relation to our previous 'stepper'.

@github-actions
Copy link
Contributor

  • 🔭 GP Swap: CoW Protocol v2 Swap UI

Copy link

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

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

@biocom , great changes!
A small question: will we change name 'Approve tokens' button to the 'Next' (or so) here or in a separate PR?
image

@fairlighteth
Copy link
Contributor Author

@elena-zh Ah yes I recall the discussion. Changed it to 'Continue'. WDYT?
Screen Shot 2022-01-21 at 13 48 31

@elena-zh
Copy link

@biocom , sounds great!
Thanks!

@fairlighteth
Copy link
Contributor Author

@biocom , sounds great! Thanks!

This has been committed to this PR. Thank you.

Copy link
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

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

Looks great, its a big difference in UX ! 🔥

Approved with minor comments.

One suggestion for another PR is to change this to:
image

With some text like:

You have chosen to exercise some investment opportunities. Investing will give you the chance to get vCOW token at at fixed price. 

This process will consist in two steps. The first one will be to define the investment amounts and set the required allowances. This means, that you will need to approve the investment for the investing tokens. 

The last step is to execute all the claiming opportunities on-chain. This step will send the vCOW tokens for both Airdrop and the selected investment opportunities. Additionally, this step will take the invested tokens.

For more details on this, please read [BLOG POST]

src/custom/components/Stepper/index.tsx Outdated Show resolved Hide resolved
src/custom/pages/Claim/InvestmentFlow/index.tsx Outdated Show resolved Hide resolved
@fairlighteth
Copy link
Contributor Author

@anxolin Thank for the suggestions. As for the text I updated it to this:
Screen Shot 2022-01-21 at 15 29 11

What do you think?

As for the Stepper component I've refactored things :)

const completedStep = activeStep > id
const isActiveStep = activeStep === id
return (
<Step key={id} totalSteps={steps.length} isActiveStep={isActiveStep} completedStep={completedStep}>
Copy link
Contributor

Choose a reason for hiding this comment

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

bit overkill as there are only 3 steps but cool anyhow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just keeping in mind, this was setup as a re-usable component (outside Claim purposes).

title: 'Start',
},
{
id: 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you need an id if the index/order is deterministic? it's an array

Copy link
Contributor Author

@fairlighteth fairlighteth Jan 21, 2022

Choose a reason for hiding this comment

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

@W3stside My thinking was that this would be a more fool proof approach. Order of an Array in the context of this small Array of objects const indeed is deterministic.

In context of a general purpose Stepper component, my understanding is that in scenarios where you might have missing (object) values in the Array or externally imported data, one could argue setting explicit step numbers might be a defensive way of setting it up, given the order/index number might be affected in those scenarios. But correct me if I'm wrong.

Happy to do it another way, but just to highlight.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Feel free to review post merge. For now I reverted logic back to use index for key.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then make id optional as a prop and use the index as a fallback

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure Michel, makes sense if you plan to feed this with dynamic data which doesn't have order guarantees.
My thinking was, it's just using a static deterministic array, and in practical terms it will always be the case. I don't see the stepper consuming a dynamic list from an untrusted REST API :P

Anyways, it's all good, i consider the comment a ubernit :)
Fine to leave it, fine to remove it, fine to make it optional

Copy link
Contributor Author

@fairlighteth fairlighteth Jan 21, 2022

Choose a reason for hiding this comment

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

I see, could also be an option. A bit messy potentially in the end where index and id are thrown together and mixed up? I think I leave it as per your first suggestion and use only index for now. Feel free to modify post merge otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@anxolin Yeah, probably I'm over thinking it at this moment :)

&::before {
left: 0;
right: 50%;
margin-right: ${({ circleSize }) => (circleSize ? `${circleSize}px` : '42px')};
Copy link
Contributor

Choose a reason for hiding this comment

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

could be useful to cache 42px here as you're clearly setting it in several places. would make tweaking this a breeze later and prevent 1 change from skewing the others

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Will set up CSS vars in the parent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@W3stside Updated to reflect this now.

The first step allows you to define the investment amounts and set the required allowances for the tokens you
will use to invest with. <br />
<br />
The last step executes all claiming opportunities on-chain. In addition it sends the tokens you will use to
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The last step executes all claiming opportunities on-chain. In addition it sends the tokens you will use to
The last step executes all claiming opportunities on-chain. Additionally, it sends the tokens you will use to

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Preference (both are correct). Will update otherwise.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nah not really, "In addition" is awkward like that

Copy link
Contributor

@W3stside W3stside left a comment

Choose a reason for hiding this comment

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

check comments and address first please

Copy link
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

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

Nice changes, i really like this new component

@fairlighteth
Copy link
Contributor Author

Updated text with a wording suggestion by @W3stside but also the latest text provided by @avsavsavs

@elena-zh
Copy link

elena-zh commented Jan 21, 2022

@biocom , could you please remove this exceeding period?
image

Or move it to the end of the previous sentence..

Base automatically changed from claim-styleImprove-27 to develop January 21, 2022 16:41
Copy link
Contributor

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

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

Excellent, looks amazing!

One tiny suggestion regarding a period and this:

Screen Shot 2022-01-21 at 08 50 09

I find it funny that there are clearly 3 steps on top but we say there are two steps 😆

I know it was there before, and you could say it's 0 indexed hehe, but still sounds weird.

src/custom/pages/Claim/InvestmentFlow/index.tsx Outdated Show resolved Hide resolved
fairlighteth and others added 2 commits January 21, 2022 18:22
Co-authored-by: Leandro Boscariol <alfetopito@users.noreply.github.com>
@fairlighteth
Copy link
Contributor Author

@alfetopito

I find it funny that there are clearly 3 steps on top but we say there are two steps 😆
I know it was there before, and you could say it's 0 indexed hehe, but still sounds weird.

Yeah... I see your point. At the end, it is still accurate in a way (1 step done, 2 more to go? 😆 ). Open to address it, maybe in a next PR to keep this one going.

@fairlighteth fairlighteth merged commit 56fbeb1 into develop Jan 21, 2022
@alfetopito alfetopito deleted the claim-styleImprove-28 branch February 1, 2022 17:38
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.

6 participants