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

Update deposit flow #401

Merged
merged 16 commits into from
May 14, 2024
Merged

Update deposit flow #401

merged 16 commits into from
May 14, 2024

Conversation

kkosiorowska
Copy link
Contributor

@kkosiorowska kkosiorowska commented May 8, 2024

Ref #394

This PR updates the deposit flow. It removes some of the unneeded components and updates the styles for the new modals. This is only part of the fixes that need to be done. What has been done:

  • Removal of some unnecessary components
  • Updates for TransactionModal and ActionFormModal. - There is no need to save the type of flow in the context. The user is no longer able to switch the flow from ActionFormModal.
  • Redesign for DepositBTCModal and Sidebar
  • Global style updates for modals
  • Add conversion to fiat for the TokenBalanceInput component

@kkosiorowska kkosiorowska self-assigned this May 8, 2024
Copy link

netlify bot commented May 8, 2024

Deploy Preview for acre-dapp-testnet ready!

Name Link
🔨 Latest commit fa1ba0a
🔍 Latest deploy log https://app.netlify.com/sites/acre-dapp-testnet/deploys/6643719d781376000810a4d5
😎 Deploy Preview https://deploy-preview-401--acre-dapp-testnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kkosiorowska kkosiorowska force-pushed the clean-deposit-flow branch from c531a41 to d4ea05b Compare May 8, 2024 09:59
@kkosiorowska kkosiorowska marked this pull request as ready for review May 9, 2024 07:18
Copy link
Contributor

@kpyszkowski kpyszkowski left a comment

Choose a reason for hiding this comment

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

Reviewed

ActionFlowType,
{
header: string
FormComponent: (
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep the key in camel case. It's confusing.
To use it in JSX you can always rename it while destructuring.

const { foo: Foo } = bar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm this was a special trick to make it clear that it should be used as a component. However, if there is any doubt I can simplify it.

0a420d1

> = {
stake: {
header: "Deposit",
FormComponent: StakeFormModal,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

},
unstake: {
header: "Withdraw",
FormComponent: UnstakeFormModal,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -20,16 +11,36 @@ import { logPromiseFailure } from "#/utils"
import StakeFormModal from "./ActiveStakingStep/StakeFormModal"
import UnstakeFormModal from "./ActiveUnstakingStep/UnstakeFormModal"

const TABS = Object.values(ACTION_FLOW_TYPES)
const FORM_DATA: Record<
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rename "header" to "heading". By header we usually mean the very top component on a page. It's a little confusing
Also we don't need such strict type safety for formComponent. It's declared only once for private use of the component only. Just React.ReactNode is enough.,

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'd rename "header" to "heading". By header we usually mean the very top component on a page. It's a little confusing

Sure, let's change it. 0a420d1

Also we don't need such strict type safety for formComponent. It's declared only once for private use of the component only. Just React.ReactNode is enough.,

We call the content in the component and need to pass the necessary props. Therefore, we need to declare it in such a way as to pass the right props to the component. So even though this is called once I think we need to declare the type here. As a result, when calling renderComponent, we get a suggestion of what props should be given.

Screenshot 2024-05-14 at 08 30 45

Screenshot 2024-05-14 at 08 31 26

However, I have simplified the definition of form component type. - a14030f

useEffect(() => {
setStatus(PROCESS_STATUSES.PENDING)
}, [setStatus])

const onSignMessageSuccess = useCallback(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

To keep it consistent:

Suggested change
const onSignMessageSuccess = useCallback(() => {
const onSignMessageSuccess = React.useCallback(() => {

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 will stay with useCallback. From what I can see, most of our modal components just use this convention. However, I think this is a matter of preference and I would leave a freedom of choice.

@@ -118,6 +125,8 @@ export default function TokenBalanceInput({
valueRef.current = value ? userAmountToBigInt(value, decimals) : undefined
}

const showConversionBalance = amount !== undefined && !!fiatCurrency
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
const showConversionBalance = amount !== undefined && !!fiatCurrency
const shouldShowConversionBalance = amount !== undefined && !!fiatCurrency

@r-czajkowski
Copy link
Contributor

Leaving the final approval to @kpyszkowski.

@kpyszkowski kpyszkowski enabled auto-merge May 14, 2024 14:14
@kpyszkowski kpyszkowski merged commit 82d5bac into main May 14, 2024
25 checks passed
@kpyszkowski kpyszkowski deleted the clean-deposit-flow branch May 14, 2024 14:17
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.

3 participants