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

Add UI for configuring the demos directory #35

Merged
merged 16 commits into from May 5, 2023

Conversation

yep-tf2
Copy link
Contributor

@yep-tf2 yep-tf2 commented Dec 31, 2022

Remove hardcoded directory name in favor of using the latest value on app startup
Update styles for the settings page to make it look a bit nicer
Change "Back" text link to a button

Screenshot
Screenshot from 2022-12-30 23-48-51
Set to a valid directory

Screenshot from 2022-12-30 23-49-30
Set to an invalid directory

Comment on lines +16 to +24
"path": {
"all": true
},
"fs": {
"all": true,
"scope": [
"**"
]
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Required so the tauri fs API has access to read files

Copy link
Collaborator

Choose a reason for hiding this comment

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

Really? I thought "all": true enables everything.

I intend to reduce the allowed scopes before release, but I believe that with the current settings everything is allowed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tauri was raising permissions errors on file reads without adding this. Maybe "all" only applies to top-level permissions within the scope?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's odd, but I suppose you're right.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it sufficient to specify the scope?

src/views/home/index.tsx Outdated Show resolved Hide resolved
@Narcha
Copy link
Collaborator

Narcha commented Dec 31, 2022

Looks nice, I like it. I think the back button is redundant and can be removed, the settings page was nothing more than a placeholder until now.

Copy link
Collaborator

@Narcha Narcha left a comment

Choose a reason for hiding this comment

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

I like what you've done here.
I use Prettier to format all of my code, and I suggest that you do the same so that every line of code follows the same style.
If you use VS code, you can use the recommended plugins to do that for you. If you use vim, there's the vim-prettier plugin you can use.

Comment on lines +16 to +24
"path": {
"all": true
},
"fs": {
"all": true,
"scope": [
"**"
]
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Really? I thought "all": true enables everything.

I intend to reduce the allowed scopes before release, but I believe that with the current settings everything is allowed.

src/views/home/index.tsx Outdated Show resolved Hide resolved
src/views/settings/index.tsx Outdated Show resolved Hide resolved
src/views/settings/index.tsx Outdated Show resolved Hide resolved
src/views/settings/index.tsx Outdated Show resolved Hide resolved
@yep-tf2 yep-tf2 marked this pull request as ready for review January 2, 2023 18:40
@Narcha
Copy link
Collaborator

Narcha commented Jan 5, 2023

We could use this crate to auto-detect where TF2 is installed. What do you think?

@Narcha
Copy link
Collaborator

Narcha commented Jan 5, 2023

Also, instead of asking for the user to paste the path into the text input, we could use the platform's open dialog to let the user choose a path directly. Sounds good?

@Narcha
Copy link
Collaborator

Narcha commented Jan 6, 2023

This looks very nice.

@yep-tf2 yep-tf2 requested a review from Narcha January 7, 2023 01:46
src/views/home/index.tsx Outdated Show resolved Hide resolved
src/views/home/index.tsx Outdated Show resolved Hide resolved
src/views/settings/index.tsx Outdated Show resolved Hide resolved
src/views/settings/storage.ts Outdated Show resolved Hide resolved
src/views/home/index.tsx Show resolved Hide resolved
src/views/home/index.tsx Outdated Show resolved Hide resolved
src/views/settings/index.tsx Outdated Show resolved Hide resolved
src/views/settings/index.tsx Outdated Show resolved Hide resolved
<Link to="/">Back</Link>
</div>

<ScrollArea.Autosize maxHeight={400}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should let the scroll area fill the entire height of the window instead of having a hard-coded 400px max height. See mantinedev/mantine#724 for possible solutions.

@Narcha Narcha added this to the Release 2.0.0 milestone Mar 20, 2023
@Narcha Narcha added the enhancement New feature or request label Mar 27, 2023
@yep-tf2 yep-tf2 requested a review from Narcha April 16, 2023 17:13
@Narcha
Copy link
Collaborator

Narcha commented Apr 16, 2023

Run cargo fmt to fix the finding.

yep-tf2 added 14 commits May 5, 2023 09:38
Remove hardcoded directory name in favor of using the latest value on app startup
Update styles for the settings page to make it look a bit nicer
Change "Back" text link to a button
If TF2 couldn't be found, default to looking in the user's home directory
This isn't any more likely to work than any other fallback, but it's preferred over having nothing at all
Display the current folder in a disabled text input
Lets the UI always correspond to the configured state
Root div needs to resize with its parent (the window), otherwise it doesn't shrink in the Y axis and the scroll overflow wouldn't kick in
@Narcha Narcha force-pushed the tauri_configurable-demos-dir branch from a0444ef to f88f80c Compare May 5, 2023 08:03
@Narcha
Copy link
Collaborator

Narcha commented May 5, 2023

Rebased on latest tauri to fix merge conflicts

@Narcha Narcha merged commit 923bbe3 into DemomanApp:tauri May 5, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants