git_ui: New panel design (#25821)

This PR updates the ui of the git panel. It removes the header from the
panel and unifies the repository, branch and commit controls in the
bottom section.

It also adds a secondary menu to the primary button giving access to a
variety of actions for managing local and remote changes:

![CleanShot 2025-02-28 at 12 18
15@2x](https://github.com/user-attachments/assets/0260c122-405f-46fc-8cc8-d6beac782b9d)

Known issues (will be fixed in a later pr)
- Spinner showing git operation progress was removed, will be re-added
- Clicking expand with the panel editor focused will commit (due to
shared action name. Already tracked)

Before | After

![CleanShot 2025-02-28 at 12 22
18@2x](https://github.com/user-attachments/assets/4c1e4ac9-b975-487f-bf4e-8815a8da4f4f)

(Also adds `component`, `linkme` to cargo-machete ignore as they are
used in the `IntoComponent` proc-macro and will always be incorrectly
flagged as unused)

Release Notes:

- N/A

---------

Co-authored-by: Cole Miller <m@cole-miller.net>
Co-authored-by: Cole Miller <53574922+cole-miller@users.noreply.github.com>
Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
Nate Butler 2025-02-28 15:00:39 -05:00 committed by GitHub
parent 8a22a07d14
commit 9d8a163f5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 832 additions and 372 deletions

View file

@ -20,6 +20,7 @@ test-support = ["multi_buffer/test-support"]
anyhow.workspace = true
buffer_diff.workspace = true
collections.workspace = true
component.workspace = true
db.workspace = true
editor.workspace = true
feature_flags.workspace = true
@ -29,6 +30,7 @@ git.workspace = true
gpui.workspace = true
itertools.workspace = true
language.workspace = true
linkme.workspace = true
menu.workspace = true
multi_buffer.workspace = true
panel.workspace = true
@ -40,6 +42,7 @@ serde.workspace = true
serde_derive.workspace = true
serde_json.workspace = true
settings.workspace = true
smallvec.workspace = true
strum.workspace = true
theme.workspace = true
time.workspace = true

View file

@ -2,7 +2,7 @@
use crate::branch_picker::{self, BranchList};
use crate::git_panel::{commit_message_editor, GitPanel};
use git::Commit;
use git::{Commit, ExpandCommitEditor};
use panel::{panel_button, panel_editor_style, panel_filled_button};
use project::Project;
use ui::{prelude::*, KeybindingHint, PopoverButton, Tooltip, TriggerablePopover};
@ -110,14 +110,17 @@ struct RestoreDock {
impl CommitModal {
pub fn register(workspace: &mut Workspace, _: &mut Window, _cx: &mut Context<Workspace>) {
workspace.register_action(|workspace, _: &Commit, window, cx| {
workspace.register_action(|workspace, _: &ExpandCommitEditor, window, cx| {
let Some(git_panel) = workspace.panel::<GitPanel>(cx) else {
return;
};
let (can_commit, conflict) = git_panel.update(cx, |git_panel, _cx| {
let (can_commit, conflict) = git_panel.update(cx, |git_panel, cx| {
let can_commit = git_panel.can_commit();
let conflict = git_panel.has_unstaged_conflicts();
if can_commit {
git_panel.set_modal_open(true, cx);
}
(can_commit, conflict)
});
if !can_commit {
@ -131,6 +134,7 @@ impl CommitModal {
prompt.await.ok();
})
.detach();
return;
}
let dock = workspace.dock_at_position(git_panel.position(window, cx));

File diff suppressed because it is too large Load diff