Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
zeta: Add adjustments to the review modal UI (#21920)
Danilo Lealc204b0d01a1e
diff --git a/assets/icons/zed_predict.svg b/assets/icons/zed_predict.svgnew file mode 100644index 00000000000..6b152af0d9c--- /dev/null+++ b/assets/icons/zed_predict.svg@@ -0,0 +1,4 @@+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M8 8.9V11C5.93097 11 5.06903 11 3 11V10.4L8 5.6V5H3V7.1" stroke="black" stroke-width="1.5"/>+<path d="M11 5L13 8L11 11" stroke="black" stroke-width="1.5"/>+</svg>diff --git a/crates/inline_completion_button/src/inline_completion_button.rs b/crates/inline_completion_button/src/inline_completion_button.rsindex f5a129de1b0..ab32d127f0a 100644--- a/crates/inline_completion_button/src/inline_completion_button.rs+++ b/crates/inline_completion_button/src/inline_completion_button.rs@@ -4,8 +4,8 @@ use editor::{scroll::Autoscroll, Editor};use feature_flags::{FeatureFlagAppExt, ZetaFeatureFlag};use fs::Fs;use gpui::{- div, Action, AnchorCorner, AppContext, AsyncWindowContext, Entity, IntoElement, ParentElement,- Render, Subscription, View, ViewContext, WeakView, WindowContext,+ actions, div, Action, AnchorCorner, AppContext, AsyncWindowContext, Entity, IntoElement,+ ParentElement, Render, Subscription, View, ViewContext, WeakView, WindowContext,};use language::{language_settings::{@@ -16,7 +16,6 @@ use language::{use settings::{update_settings_file, Settings, SettingsStore};use std::{path::Path, sync::Arc};use supermaven::{AccountStatus, Supermaven};-use ui::{Button, LabelSize};use workspace::{create_and_open_local_file,item::ItemHandle,@@ -29,6 +28,8 @@ use workspace::{use zed_actions::OpenBrowser;use zeta::RateCompletionModal;+actions!(zeta, [RateCompletions]);+const COPILOT_SETTINGS_URL: &str = "https://github.com/settings/copilot";struct CopilotErrorToast;@@ -204,16 +205,22 @@ impl Render for InlineCompletionButton {}div().child(- Button::new("zeta", "ζ")- .label_size(LabelSize::Small)+ IconButton::new("zeta", IconName::ZedPredict)+ .tooltip(|cx| {+ Tooltip::with_meta(+ "Zed Predict",+ Some(&RateCompletions),+ "Click to rate completions",+ cx,+ )+ }).on_click(cx.listener(|this, _, cx| {if let Some(workspace) = this.workspace.upgrade() {workspace.update(cx, |workspace, cx| {RateCompletionModal::toggle(workspace, cx)});}- }))- .tooltip(|cx| Tooltip::text("Rate Completions", cx)),+ })),)}}diff --git a/crates/ui/src/components/icon.rs b/crates/ui/src/components/icon.rsindex e663e007082..414a7c94c06 100644--- a/crates/ui/src/components/icon.rs+++ b/crates/ui/src/components/icon.rs@@ -303,6 +303,7 @@ pub enum IconName {XCircle,ZedAssistant,ZedAssistantFilled,+ ZedPredict,ZedXCopilot,}diff --git a/crates/zeta/src/rate_completion_modal.rs b/crates/zeta/src/rate_completion_modal.rsindex d08f6bc005b..f5b95d23530 100644--- a/crates/zeta/src/rate_completion_modal.rs+++ b/crates/zeta/src/rate_completion_modal.rs@@ -8,7 +8,7 @@ use language::{language_settings, OffsetRangeExt};use settings::Settings;use std::time::Duration;use theme::ThemeSettings;-use ui::{prelude::*, KeyBinding, List, ListItem, ListItemSpacing, TintColor, Tooltip};+use ui::{prelude::*, KeyBinding, List, ListItem, ListItemSpacing, Tooltip};use workspace::{ModalView, Workspace};actions!(@@ -369,34 +369,39 @@ impl RateCompletionModal {.overflow_scroll().child(StyledText::new(diff).with_highlights(&text_style, diff_highlights)),)- .child(- h_flex()- .p_2()- .gap_2()- .border_y_1()- .border_color(border_color)- .child(- Icon::new(IconName::Info)- .size(IconSize::XSmall)- .color(Color::Muted)- )- .child(- Label::new("Ensure you explain why this completion is negative or positive. In case it's negative, report what you expected instead.")- .size(LabelSize::Small)- .color(Color::Muted)- )- )- .child(- div()- .h_40()- .pt_1()- .bg(bg_color)- .child(active_completion.feedback_editor.clone()),- )+ .when_some((!rated).then(|| ()), |this, _| {+ this.child(+ h_flex()+ .p_2()+ .gap_2()+ .border_y_1()+ .border_color(border_color)+ .child(+ Icon::new(IconName::Info)+ .size(IconSize::XSmall)+ .color(Color::Muted)+ )+ .child(+ Label::new("Ensure you explain why this completion is negative or positive. In case it's negative, report what you expected instead.")+ .size(LabelSize::Small)+ .color(Color::Muted)+ )+ )+ })+ .when_some((!rated).then(|| ()), |this, _| {+ this.child(+ div()+ .h_40()+ .pt_1()+ .bg(bg_color)+ .child(active_completion.feedback_editor.clone())+ )+ }).child(h_flex().p_1().h_8()+ .max_h_8().border_t_1().border_color(border_color).max_w_full()@@ -409,7 +414,7 @@ impl RateCompletionModal {.size(IconSize::Small).color(Color::Success),)- .child(Label::new("Rated completion").color(Color::Muted)),+ .child(Label::new("Rated completion.").color(Color::Muted)),)} else if active_completion.completion.edits.is_empty() {Some(@@ -419,7 +424,7 @@ impl RateCompletionModal {.size(IconSize::Small).color(Color::Warning),)- .child(Label::new("No edits produced").color(Color::Muted)),+ .child(Label::new("No edits produced.").color(Color::Muted)),)} else {Some(label_container())@@ -434,11 +439,10 @@ impl RateCompletionModal {&self.focus_handle(cx),cx,))- .style(ButtonStyle::Tinted(TintColor::Negative))+ .style(ButtonStyle::Filled).icon(IconName::ThumbsDown).icon_size(IconSize::Small).icon_position(IconPosition::Start)- .icon_color(Color::Error).disabled(rated || feedback_empty).when(feedback_empty, |this| {this.tooltip(|cx| {@@ -459,11 +463,10 @@ impl RateCompletionModal {&self.focus_handle(cx),cx,))- .style(ButtonStyle::Tinted(TintColor::Positive))+ .style(ButtonStyle::Filled).icon(IconName::ThumbsUp).icon_size(IconSize::Small).icon_position(IconPosition::Start)- .icon_color(Color::Success).disabled(rated).on_click(cx.listener(move |this, _, cx| {this.thumbs_up_active(&ThumbsUpActiveCompletion, cx);@@ -537,7 +540,7 @@ impl Render for RateCompletionModal {.focused(index == self.selected_index).selected(selected).start_slot(if rated {- Icon::new(IconName::Check).color(Color::Success)+ Icon::new(IconName::Check).color(Color::Success).size(IconSize::Small)} else if completion.edits.is_empty() {Icon::new(IconName::File).color(Color::Muted).size(IconSize::Small)} else {@@ -546,13 +549,9 @@ impl Render for RateCompletionModal {.child(v_flex().child(Label::new(completion.path.to_string_lossy().to_string()).size(LabelSize::Small))- .child(div()- .overflow_hidden()- .text_ellipsis()- .child(Label::new(format!("{} ago, {:.2?}", format_time_ago(completion.response_received_at.elapsed()), completion.latency()))- .color(Color::Muted)- .size(LabelSize::XSmall)- )+ .child(Label::new(format!("{} ago, {:.2?}", format_time_ago(completion.response_received_at.elapsed()), completion.latency()))+ .color(Color::Muted)+ .size(LabelSize::XSmall))).on_click(cx.listener(move |this, _, cx| {