Skip to content

More Git Dialog UI cleanup - #95

Merged
jonasehrlich merged 21 commits into
mainfrom
je/ui-cleanup
Aug 5, 2025
Merged

More Git Dialog UI cleanup#95
jonasehrlich merged 21 commits into
mainfrom
je/ui-cleanup

Conversation

@jonasehrlich

Copy link
Copy Markdown
Owner

This PR cleans-up more of the UI.

Summary of the changes:

  • Set default button size to sm
  • Reduce padding and text size in Git Panels
  • Add GitHub style tabs including the commit and change count
  • Add the diff to the commit details view
image

* Make each diff file rounded-md
* Rename stats chart
* Don't display diff for a pure rename
Previously a tree component would display the full base
path. Now the text to display is passed as a separate
property.
* Show icon on the file whether it was added, changed or renamed
* Show open / close folder icons
The API now only provides the following data:

```
struct Diff {
    /// Patch between old and new
    patch: String,
    /// Stats of the diff
    stats: DiffStats,
    /// Map of old source paths to the old content
    old_sources: hash_map::HashMap<Path, FileContent>,
}
```

This is easier to handle on the client side.
* Set text-sm on CardContent
* Use font-mono for revision in status card
* Add restore icon
* Add gap if both panels are displayed
@jonasehrlich
jonasehrlich requested a review from TobTheRock August 4, 2025 15:08
@jonasehrlich jonasehrlich self-assigned this Aug 4, 2025
@jonasehrlich

jonasehrlich commented Aug 4, 2025

Copy link
Copy Markdown
Owner Author

⚠️ Requires #94 to be merged first

Comment thread backend/app/src/web/api/v1/git.rs
Comment thread backend/app/src/actors/git.rs
Comment thread backend/git2-ox/src/diff.rs
diff_type,
)
};
pub fn try_from_repo_and_diff(repo: &git2::Repository, diff: &git2::Diff) -> Result<Self> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This function got really long and hard to read. Can we split it down?
Possible subroutines:

  • file path from diff
  • file content from diff
  • patch content from diffs

Comment thread backend/git2-ox/src/diff.rs
find_opts.renames(true);
// Transform a diff marking file renames, copies, etc.
diff.find_similar(Some(&mut find_opts))
.map_err(|e| Error::from_ctx_and_error("Failed to find similar files in diff", e))?;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: same as in #92, i don't think we need to propagate the error to the user and can just ignore it

Comment thread frontend/src/components/diff-viewer/file.tsx
@TobTheRock TobTheRock mentioned this pull request Aug 5, 2025
@jonasehrlich
jonasehrlich merged commit baff048 into main Aug 5, 2025
10 checks passed
@jonasehrlich
jonasehrlich deleted the je/ui-cleanup branch August 5, 2025 18:43
This was referenced Aug 5, 2025
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.

2 participants