Styling for Apply/Discard buttons (#21017)

Change the "Apply" and "Discard" buttons to match @danilo-leal's design!
Here are some different states:

### Cursor in the first hunk

Now that the cursor is in a particular hunk, we show the "Apply" and
"Discard" names, and the keyboard shortcut. If I press the keyboard
shortcut, it will only apply to this hunk.

<img width="759" alt="Screenshot 2024-11-23 at 10 54 45 PM"
src="https://github.com/user-attachments/assets/68e0f109-9493-4ca2-a99c-dfcbb4d1ce0c">

### Cursor in the second hunk

Moving the cursor to a different hunk changes which buttons get the
keyboard shortcut treatment. Now the keyboard shortcut is shown next to
the hunk that will actually be affected if you press that shortcut.

<img width="749" alt="Screenshot 2024-11-23 at 10 56 27 PM"
src="https://github.com/user-attachments/assets/59c2ace3-6972-4a60-b806-f45e8c25eaae">


Release Notes:

- Restyled Apply/Discard buttons

---------

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
This commit is contained in:
Richard Feldman 2024-11-26 11:09:43 -05:00 committed by GitHub
parent 8f1ec3d11b
commit 884748038e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 411 additions and 293 deletions

View file

@ -17,8 +17,8 @@ use breadcrumbs::Breadcrumbs;
use client::{zed_urls, ZED_URL_SCHEME};
use collections::VecDeque;
use command_palette_hooks::CommandPaletteFilter;
use editor::ProposedChangesEditorToolbar;
use editor::{scroll::Autoscroll, Editor, MultiBuffer};
use editor::{ProposedChangesToolbar, ProposedChangesToolbarControls};
use feature_flags::FeatureFlagAppExt;
use futures::{channel::mpsc, select_biased, StreamExt};
use gpui::{
@ -644,8 +644,10 @@ fn initialize_pane(workspace: &Workspace, pane: &View<Pane>, cx: &mut ViewContex
let buffer_search_bar = cx.new_view(search::BufferSearchBar::new);
toolbar.add_item(buffer_search_bar.clone(), cx);
let proposed_change_bar = cx.new_view(|_| ProposedChangesEditorToolbar::new());
toolbar.add_item(proposed_change_bar, cx);
let proposed_changes_bar = cx.new_view(|_| ProposedChangesToolbar::new());
toolbar.add_item(proposed_changes_bar, cx);
let proposed_changes_controls = cx.new_view(|_| ProposedChangesToolbarControls::new());
toolbar.add_item(proposed_changes_controls, cx);
let quick_action_bar =
cx.new_view(|cx| QuickActionBar::new(buffer_search_bar, workspace, cx));
toolbar.add_item(quick_action_bar, cx);