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

feat: Control return to confirm action #10306

Closed
wants to merge 7 commits into from

Conversation

Jarsen136
Copy link
Contributor

Thank you for your contribution to the Koda - Generative Art Marketplace.

👇 __ Let's make a quick check before the contribution.

PR Type

  • Feature

Needs Design check

Needs QA check

  • @kodadot/qa-guild please review

Context

Did your issue had any of the "$" label on it?

Screenshot 📸

  • My fix has changed something on UI; a screenshot is best to understand changes for others.

@Jarsen136 Jarsen136 marked this pull request as ready for review May 15, 2024 13:44
@Jarsen136 Jarsen136 requested a review from a team as a code owner May 15, 2024 13:44
@Jarsen136 Jarsen136 requested review from daiagi and hassnian and removed request for a team May 15, 2024 13:44
Copy link

netlify bot commented May 15, 2024

Deploy Preview for koda-canary ready!

Name Link
🔨 Latest commit 806c624
🔍 Latest deploy log https://app.netlify.com/sites/koda-canary/deploys/664e087472e29a00078cc88b
😎 Deploy Preview https://deploy-preview-10306--koda-canary.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.

Copy link
Contributor

@hassnian hassnian left a comment

Choose a reason for hiding this comment

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

bug or a feature :)

probably we should only allow that shortcut if the transaction has not started

CleanShot.2024-05-16.at.17.18.47.mp4

can useMagicKeys combinations give you a cleaner solution?

@prury
Copy link
Member

prury commented May 16, 2024

bug or a feature :)

probably we should only allow that shortcut if the transaction has not started
CleanShot.2024-05-16.at.17.18.47.mp4

can useMagicKeys combinations give you a cleaner solution?

thank you very much for checking it @hassnian

@prury prury added the S-changes-requested-🤞 PR is almost good to go, just some fine tunning label May 16, 2024
@Jarsen136
Copy link
Contributor Author

bug or a feature :)

probably we should only allow that shortcut if the transaction has not started

can useMagicKeys combinations give you a cleaner solution?

Thank you! I have updated it.

@Jarsen136 Jarsen136 requested a review from hassnian May 16, 2024 21:04
@prury
Copy link
Member

prury commented May 17, 2024

What should be the correct behavior? working only for confirmation buttons on modals or also for trying again when a transaction is cancelled/fails?

Transfer: doesn't work on confirmation button prob because it uses a different modal
Teleport bridge: works on try again
Drop: works on modal and on try again
Create NFT/Collection: won't proceed to signing if you hit it once, i think it's a focus issue, doesn't work on try again
Buy Now: works for signing but doesn't for try again
Listing: works for signing but doesn't for try again

@Jarsen136
Copy link
Contributor Author

What should be the correct behavior? working only for confirmation buttons on modals or also for trying again when a transaction is cancelled/fails?

I prefer it only works for confirmation buttons on modal.

Transfer: doesn't work on confirmation button prob because it uses a different modal

Yup, it's a separate modal. However, I have also made the transfer confirm modal work with the shortcut. Now it should work as the others.

Teleport bridge: works on try again
Drop: works on modal and on try again
Create NFT/Collection: won't proceed to signing if you hit it once, i think it's a focus issue, doesn't work on try again
Buy Now: works for signing but doesn't for try again
Listing: works for signing but doesn't for try again

Only applying to the confirm button should be enough.
I can't manage to go to the page with "try again" button after I cancel the transaction request. It keeps loading all the time.
I would leave it to another follow-up issue if anyone else could reproduce it and fix it.

Kapture 2024-05-20 at 01 03 48

@hassnian
Copy link
Contributor

modal animation is gone

this pr

CleanShot.2024-05-20.at.17.03.43.mp4

canary

CleanShot.2024-05-20.at.17.04.16.mp4

@@ -1,5 +1,5 @@
<template>
<teleport to="body" :disabled="!appendToBody">
<teleport v-if="isModalActive" to="body" :disabled="!appendToBody">
Copy link
Contributor

Choose a reason for hiding this comment

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

can we do a local solution for each modal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why apply it for each modal? It's kind of a bug from OModal that the DOM of modal will not be removed after closing the modal.

Copy link
Contributor

Choose a reason for hiding this comment

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

pls check

@daiagi what do you think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh sorry, I miss the comment.

The missing animation was zoom-out
image

It's a trade-off. Whether we keep the animation as currently we have, or solve the memory leak of modal.
I would fix the memory leak issue.

Here is the screenshot that, I closed the modal while the DOM of modal was still there.
image

Comment on lines +306 to +308
useKeyboardKeys({
onPressControlEnter: handleSubmit,
})
Copy link
Contributor

@hassnian hassnian May 20, 2024

Choose a reason for hiding this comment

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

enabled if action button is visible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not needed, because the keyboard event would be listened to only when the action button component is mounted.

Copy link
Contributor

@hassnian hassnian May 20, 2024

Choose a reason for hiding this comment

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

I was suggesting this if we removed the teleport v-if
CleanShot 2024-05-20 at 17 45 27@2x

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. The trickier thing is that the action button is always visible and not be unmounted, due to the memory leak of the modal.... #10306 (comment)

@@ -0,0 +1,11 @@
import { useMagicKeys } from '@vueuse/core'

export function useKeyboardKeys({ onPressControlEnter }) {
Copy link
Contributor

@hassnian hassnian May 20, 2024

Choose a reason for hiding this comment

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

Suggested change
export function useKeyboardKeys({ onPressControlEnter }) {
export function useKeyboardKeys({ onPressControlEnter , enabled }) {

Comment on lines +156 to +158
useKeyboardKeys({
onPressControlEnter: confirmTransfer,
})
Copy link
Contributor

Choose a reason for hiding this comment

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

enabled if isModalActive

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the same reason as the above comment

Copy link

codeclimate bot commented May 22, 2024

Code Climate has analyzed commit 806c624 and detected 0 issues on this pull request.

View more on Code Climate.

Copy link

sonarcloud bot commented May 22, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@prury
Copy link
Member

prury commented May 22, 2024

rechecking PR:

on transfer, modal is being shown behind the other modal:

modal.being.shown.behind.webm
  • still working for try again on teleport
  • create nft/collection: modal opens behind

buy now and listing are good

@Jarsen136
Copy link
Contributor Author

Jarsen136 commented May 22, 2024

@hassnian @prury Thanks for all the comments above. I will close this PR and leave it to the other one who has a better solution.

@Jarsen136 Jarsen136 closed this May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-changes-requested-🤞 PR is almost good to go, just some fine tunning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Control return to confirm action
3 participants