-
Notifications
You must be signed in to change notification settings - Fork 22
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
Initial Implementation of Slide to Confirm #689
Conversation
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() | ||
}) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. 🙂
There was a problem hiding this comment.
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.
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. 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 |
25456dd
to
4f4e594
Compare
You are totally right. that was a package I was trying to use before I settled on |
There was a problem hiding this 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?
1d17e39
to
4f35a3b
Compare
4f35a3b
to
9b0a25c
Compare
It took me a couple tries, but I think I got it now. 🙂 |
Cool! You can usually use |
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. |
2024-01-17_20-38-16.mp4
Closes #578