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 Slide to Confirm #689

Merged

Conversation

ericjohnson97
Copy link
Contributor

@ericjohnson97 ericjohnson97 commented Jan 18, 2024

2024-01-17_20-38-16.mp4

Closes #578

src/App.vue Outdated Show resolved Hide resolved
src/App.vue Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
src/stores/mainVehicle.ts Outdated Show resolved Hide resolved
Comment on lines -129 to +137
function arm(): void {
mainVehicle.value?.arm()
function arm(): Promise<void> {
return slideToConfirm(() => {
if (!mainVehicle.value) {
throw new Error('action rejected or failed')
}
mainVehicle.value.arm()
})
Copy link
Member

Choose a reason for hiding this comment

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

Although this logic is fine and we can proceed with it, I have a suggestion of a slight different one that seems to be less intrusive in the code:

async function arm(): Promise<void> {
  if (!mainVehicle.value) throw new Error('No vehicle available to be armed.')
  
  const slideConfirmed = await slideToConfirm('Slide to arm', 10000)
  if (slideConfirmed) {
    mainVehicle.value.arm()
    return
  }
  console.error('No confirmation for arming action received') 
}

This way we don't have to pass the whole success code (in this case it's only mainVehicle.value.arm(), but on more complex cases could be several lines of code) to the confirmation slider, but just to read its result. This way the code get's cleaner, more readable, with less indentations, and its more in line with what we currently use for SweetAlert2 confirmation dialogs, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this also makes sense. I will change. Thanks for all the great feedback!

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 forgot to do this. let me know if you would like me to make that change. If I do, do you think I should reset that commit make the change and recommit, or would it be better to make a separate commit to make that change?

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be cool, but at the same time it would be an improvement, so you can add it to a following commit, so you don't have to recommit everything, or we can settle with how it is right now and allow this part to be improved on a future PR, without hurries. I'm fine with both, so let me know what you prefer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After giving it another look, I think it would take me a little bit of time to refactor.

If you are ok with it I think I would like to leave it how it is for now. 🙂

Copy link
Member

Choose a reason for hiding this comment

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

No problem!
I will test it tomorrow morning so we can merge.

@rafaellehmkuhl
Copy link
Member

rafaellehmkuhl commented Jan 18, 2024

I really liked the new functionality Eric!

UI/UX speaking, I think additions like the transition for it to appear/disappear or the color change (suggested by @danielhonies) would be great, although they shouldn't stop us from merging this PR.

PS: I took the liberty to append your screen recording to this PR, as a visual aid.

@ericjohnson97
Copy link
Contributor Author

I really liked the new functionality Eric!

UI/UX speaking, I think additions like the transition for it to appear/disappear or the color change (suggested by @danielhonies) would be great, although they shouldn't stop us from merging this PR.

PS: I took the liberty to append your screen recording to this PR, as a visual aid.

Thanks for adding the video. They will be good for people viewing the PR to see.

showing the slider green for a second would be a easy addition because the slider is this component and it has that by default, but right now the slider stops showing too fast to see it.
https://github.com/joseph2/vue-slide-unlock

related to this, I see that the pipeline is failing because of typing related to adding that component and I don't know how to fix it. Do you have any thoughts?

@rafaellehmkuhl
Copy link
Member

I really liked the new functionality Eric!
UI/UX speaking, I think additions like the transition for it to appear/disappear or the color change (suggested by @danielhonies) would be great, although they shouldn't stop us from merging this PR.
PS: I took the liberty to append your screen recording to this PR, as a visual aid.

Thanks for adding the video. They will be good for people viewing the PR to see.

showing the slider green for a second would be a easy addition because the slider is this component and it has that by default, but right now the slider stops showing too fast to see it. https://github.com/joseph2/vue-slide-unlock

related to this, I see that the pipeline is failing because of typing related to adding that component and I don't know how to fix it. Do you have any thoughts?

The linter is blaming that there's no type declarations for one of the libraries you added ('vue-drag-verify'), but I'm seeing here that you are importing it but not using. You can just remove its code from the main.ts file, bun remove vue-drag-verify, bun install and then push the branch again to see if it fixes the problem.

@ericjohnson97 ericjohnson97 force-pushed the feature/slide_to_confirm branch from 25456dd to 4f4e594 Compare January 26, 2024 00:45
@ericjohnson97
Copy link
Contributor Author

I really liked the new functionality Eric!
UI/UX speaking, I think additions like the transition for it to appear/disappear or the color change (suggested by @danielhonies) would be great, although they shouldn't stop us from merging this PR.
PS: I took the liberty to append your screen recording to this PR, as a visual aid.

Thanks for adding the video. They will be good for people viewing the PR to see.
showing the slider green for a second would be a easy addition because the slider is this component and it has that by default, but right now the slider stops showing too fast to see it. https://github.com/joseph2/vue-slide-unlock
related to this, I see that the pipeline is failing because of typing related to adding that component and I don't know how to fix it. Do you have any thoughts?

The linter is blaming that there's no type declarations for one of the libraries you added ('vue-drag-verify'), but I'm seeing here that you are importing it but not using. You can just remove its code from the main.ts file, bun remove vue-drag-verify, bun install and then push the branch again to see if it fixes the problem.

You are totally right. that was a package I was trying to use before I settled on vue-slide-unlock

@ericjohnson97 ericjohnson97 marked this pull request as ready for review January 26, 2024 00:54
@rafaellehmkuhl rafaellehmkuhl self-requested a review January 26, 2024 01:27
Copy link
Member

@rafaellehmkuhl rafaellehmkuhl left a comment

Choose a reason for hiding this comment

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

I've tested here and it works like a charm!

@ericjohnson97 could you just reword the 3rd commit, from "widgets" to "components" before we merge?

@ericjohnson97 ericjohnson97 force-pushed the feature/slide_to_confirm branch 2 times, most recently from 1d17e39 to 4f35a3b Compare January 26, 2024 15:21
@ericjohnson97 ericjohnson97 force-pushed the feature/slide_to_confirm branch from 4f35a3b to 9b0a25c Compare January 26, 2024 15:23
@ericjohnson97
Copy link
Contributor Author

I've tested here and it works like a charm!

@ericjohnson97 could you just reword the 3rd commit, from "widgets" to "components" before we merge?

It took me a couple tries, but I think I got it now. 🙂

@rafaellehmkuhl rafaellehmkuhl merged commit 510e60f into bluerobotics:master Jan 26, 2024
7 checks passed
@rafaellehmkuhl
Copy link
Member

rafaellehmkuhl commented Jan 26, 2024

I've tested here and it works like a charm!
@ericjohnson97 could you just reword the 3rd commit, from "widgets" to "components" before we merge?

It took me a couple tries, but I think I got it now. 🙂

Cool!

You can usually use git rebase HEAD~3 -i for that (change 3 with the proper number of commits). Then put a "reword" instead of "pick" on the line you want to change the commit message. I think that's the easiest way.

@ericjohnson97
Copy link
Contributor Author

I've tested here and it works like a charm!
@ericjohnson97 could you just reword the 3rd commit, from "widgets" to "components" before we merge?

It took me a couple tries, but I think I got it now. 🙂

Cool!

You can usually use git rebase HEAD~3 -i for that (change 3 with the proper number of commits). Then put a "reword" instead of "pick" on the line you want to change the commit message. I think that's the easiest way.

Yep! I figured it out. I just had never done that before.

Thanks for all your advice with the design and all your help with the review!

@rafaellehmkuhl
Copy link
Member

Yep! I figured it out. I just had never done that before.

Thanks for all your advice with the design and all your help with the review!

No problem. Thanks again for the contribution, Eric.
And feel free to ask for help whenever needed :)

@rafaellehmkuhl rafaellehmkuhl added the docs-needed Change needs to be documented label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-needed Change needs to be documented
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slide to Confirm Component
2 participants