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: prompt to save generator on exit #293

Merged
merged 4 commits into from
Oct 30, 2024

Conversation

cristianoventura
Copy link
Collaborator

Description

This PR triggers the dialog to save the generator (if unsaved changes are present) when closing the main window.

How to Test

  • Open the generator
  • Make modifications to it
  • Close the main window
  • Check that the save dialog is triggered

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (npm run lint) and all checks pass.
  • I have run tests locally (npm test) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Screenshots (if appropriate):

Screen.Recording.2024-10-30.at.10.18.57.AM.mov

Related PR(s)/Issue(s)

Resolves #239

@cristianoventura cristianoventura self-assigned this Oct 30, 2024
Comment on lines +20 to +22
useEffect(() => {
window.studio.app.changeRoute(location.pathname)
}, [location])
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm keeping track of the routes on the electron side so we know which route the close event in the main window came from.

@cristianoventura cristianoventura marked this pull request as ready for review October 30, 2024 14:25
@cristianoventura cristianoventura requested a review from a team as a code owner October 30, 2024 14:25
@cristianoventura cristianoventura requested review from going-confetti, e-fisher and Llandy3d and removed request for a team October 30, 2024 14:25
Llandy3d
Llandy3d previously approved these changes Oct 30, 2024
Copy link
Member

@Llandy3d Llandy3d left a comment

Choose a reason for hiding this comment

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

Reviewing from the functionality standpoint, works great 🙌

going-confetti
going-confetti previously approved these changes Oct 30, 2024
Copy link
Collaborator

@going-confetti going-confetti left a comment

Choose a reason for hiding this comment

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

LGTM. Thought the copy could be improved for this specific case. Maybe something like this will work in both cases:

You have unsaved changes in the generator which will be lost if you proceed

Although I see that it's not ideal either

@Llandy3d
Copy link
Member

what about the same text plus upon leaving 👀

It should work both for leaving the page and leaving the application!

@cristianoventura
Copy link
Collaborator Author

@Llandy3d I liked your suggestion. Just pushed a change with it!

Copy link
Member

@Llandy3d Llandy3d left a comment

Choose a reason for hiding this comment

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

🙌

@cristianoventura cristianoventura merged commit a711010 into main Oct 30, 2024
2 checks passed
@cristianoventura cristianoventura deleted the feat/prompt-to-save-generator-on-exit branch October 30, 2024 22:23
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.

Prompt to save the Generator file on exit
3 participants