joshwcomeau / guppy

🐠A friendly application manager and task runner for React.js
ISC License
3.27k stars 154 forks source link

App settings #295

Closed AWolf81 closed 5 years ago

AWolf81 commented 5 years ago

Related Issue:

288

Summary:

Things to discuss

Todos:

Screenshots/GIFs: Preferences modal grafik

Tooltip for project directory grafik

melanieseltzer commented 5 years ago

Great πŸ‘ Kept my review light so far, since it's early WIP.

Should we auto-close on save button click. I think it's better to keep it open and display a short text, so it's visible that the settings are saved.

I think yes to keeping it open, as well. If a user hits save but realizes they forgot something, kinda annoying to have to bring it back up again. Sidenote - if we keep it open should we make the Project Settings modal behave the same way? Currently it closes the modal on save.

Do we need an automatic saving e.g. trigger with throttling after every change or save on modal close?

I think auto saving is traditionally used for stuff like saving drafts. I wonder if it's a bit overkill for a preferences modal where you aren't typing anything, just selecting buttons. I think I prefer a save button here, and that would keep consistent with Project Settings modal as well (I think consistency is important).

[Edit] Hm the more I think about it, the more I am open to auto save. Could be good with a flashing 'Saved!' on screen somewhere. Though I wonder if the modal should be that large if there would be no save button.

I think let's hear from others about this!

AWolf81 commented 5 years ago

@melanieseltzer Thanks for your review of my WIP.

For auto-saving: I can't exactly say which is the right way but I think for native apps there is always a button to confirm or cancel a dialog. That's why we should stick to the save button. But auto-saving would be a nice option - maybe we could add this later as option to the app settings. So it could be enabled. Anyway I think we need a saved! flash so it's clear that everything is OK and yes we should be consistent with the Project configuration modal. (The auto closing is also there because it's sort of a confirmation that saving happend.) I'd like to add the Saved flash in a PR after app settings landed as it's an improvement.

Things I think we could do after this PR are:

AWolf81 commented 5 years ago

@melanieseltzer Could you please review again? I've addressed everything.

Except the point from Mathieu. I think it would be good to have type checking for the mentioned function but I think it's not that critical as I think the rendering will be automated later.

For saved flash we should open an issue after this PR. So the user get's a feedback that it's saved. Also we'll modify the ProjectConfigurationModal saving to the same behviour for consistency. I'll create the issue and mention that we have to wait for this PR to be merged.

AWolf81 commented 5 years ago

@melanieseltzer Thanks for your review.

I've addressed everything and also improved the UI (see updated screenshot in PR comment above). Sorry, for the left over commented lines that I missed to remove. They're removed.

Also the input can be modified by typing now. What do you think should we add a check if the folder exists on save of the new path? Or can we improve the creation so nested new folders are supported and only check that the path is valid? At the moment, the user can enter an invalid path and other scripts (e.g. CreateNewProject) will fail.

But I think we can improve this after this PR. If the user enters a new path that's one level below an existing that's working because it will be created but if it's nested it will fail with the following error in create-project.service line 62: grafik

melanieseltzer commented 5 years ago

Also the input can be modified by typing now. What do you think should we add a check if the folder exists on save of the new path?

Good catch. This is something I never considered with my initial suggestion πŸ€”

I think if it's possible to break it right now, we shouldn't have it editable until we do those checks (let's open a fresh issue and refactor later).

This PR is getting long and I'm sure you're sick of these changes πŸ˜†, so I think let's make it inputEditable={false} for now to get this merged, and I don't mind going back to do the style changes myself since I'm being picky.

AWolf81 commented 5 years ago

@melanieseltzer Oh, I've seen your approving comment too late. :-) So I did some extra work by adding your mentioned styling (see screenshot above) and I also added a path check. The path check can be improved later because it's allowed to enter a path where the last folder doesn't exists. For now we're checking the full path.

I think now it's good to go.

melanieseltzer commented 5 years ago

I think it looks good!

There's something funky going on with the check, though. If you enter a bad path and click save, it throws the dialog as expected. But then if you correct it, it still throws... forever. Will not let you save until you refresh the app.

kapture 2018-11-01 at 14 36 37

Is it something we should create a separate issue for?

AWolf81 commented 5 years ago

@melanieseltzer yes, please create an issue for it. I couldn't re-create it on Windows. Maybe it has to do something with the replacing of the first slash. Is it saving after initial render?

melanieseltzer commented 5 years ago

320 created. It's not saving for me on the initial render. But if I choose from the actual directory picker it works. It's just when typing the path that it's doing this.

If I have some time tomorrow/the weekend to look into it I will, but at least issue is created in case someone else wants to.