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

Improve the file list checkboxes behavior #4859

Merged
merged 7 commits into from
Sep 11, 2024
Merged

Conversation

estib-vega
Copy link
Contributor

@estib-vega estib-vega commented Sep 9, 2024

Issue

As seen in #4846

There are some funky behaviors to our file checkboxes, this PR updates the style and behavior so that:

  • Adding new files to a lane does not reset the check-state of files/hunks
  • Selecting all hunks manually or selecting a file's checkbox updates the checked state bidirectionally
  • Selecting some hunks is displayed as a indeterminate checkbox

Changes

1. Update the Ownership class

Rename the Ownership class to SelectedOwnership, as it is only used to determine the selected state of the files to add to a commit.

Renamed the methods as well to convey their actual purpose.

The SelectedOwnership class will be updated in a way that the selected is persisted across file/hunk ownership updates

2. Track whether a file is partially selected or not

If only some hunks are selected, display the indeterminate checkbox state for that file

3. Design update

Update the style of the indeterminate checkbox state

Make it so that the indeterminate state of the checkbox matches the selected style
Create a module for array utilities.
Add a function that determines what amount of items in an array satisfy a condition
If only some of the hunks have been selected, display the file checkbox as indeterminate
Deduplicate and move the chunk utility into the array utilities module
Refactor and clean-up the component, so that the newer, more readable Svelte 5 state APIs are used
Rename the `Ownership` class to `SelectedOwnership`, as it is only used to determine the selected state of the files to add to a commit.

Renamed the methods as well to convey their actual purpose.

The `SelectedOwnership` class will be updated in a way that the selected is persisted across file/hunk ownership updates
Copy link

vercel bot commented Sep 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gitbutler-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 11, 2024 8:52am

@estib-vega
Copy link
Contributor Author

Missing some style updates

@estib-vega estib-vega force-pushed the check-boxes-behavior branch 2 times, most recently from 650a20e to d203a3d Compare September 11, 2024 08:34
@estib-vega
Copy link
Contributor Author

@PavelLaptev
I think I'm done (...with CSS for ever) haha

Screenshot 2024-09-11 at 10 36 36

@estib-vega estib-vega merged commit c4686bb into master Sep 11, 2024
14 checks passed
@estib-vega estib-vega deleted the check-boxes-behavior branch September 11, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants