zeta: Add adjustments to the review modal UI (#21920)

Most notably, adding a current iteration of a possible logo to feel it
out! :) Also, I'm hiding the input and instructions container after the
review has been sent. In the future, if we allow changing an already
sent review, we can change this behavior.

<img width="800" alt="Screenshot 2024-12-12 at 10 42 44"
src="https://github.com/user-attachments/assets/37e63d0d-d847-445e-bdf8-bf5c97d0fe4c"
/>

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2024-12-12 11:17:08 -03:00 committed by GitHub
parent 8e0ae441f3
commit c204b0d01a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 57 additions and 46 deletions

View file

@ -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>

After

Width:  |  Height:  |  Size: 268 B

View file

@ -4,8 +4,8 @@ use editor::{scroll::Autoscroll, Editor};
use feature_flags::{FeatureFlagAppExt, ZetaFeatureFlag}; use feature_flags::{FeatureFlagAppExt, ZetaFeatureFlag};
use fs::Fs; use fs::Fs;
use gpui::{ use gpui::{
div, Action, AnchorCorner, AppContext, AsyncWindowContext, Entity, IntoElement, ParentElement, actions, div, Action, AnchorCorner, AppContext, AsyncWindowContext, Entity, IntoElement,
Render, Subscription, View, ViewContext, WeakView, WindowContext, ParentElement, Render, Subscription, View, ViewContext, WeakView, WindowContext,
}; };
use language::{ use language::{
language_settings::{ language_settings::{
@ -16,7 +16,6 @@ use language::{
use settings::{update_settings_file, Settings, SettingsStore}; use settings::{update_settings_file, Settings, SettingsStore};
use std::{path::Path, sync::Arc}; use std::{path::Path, sync::Arc};
use supermaven::{AccountStatus, Supermaven}; use supermaven::{AccountStatus, Supermaven};
use ui::{Button, LabelSize};
use workspace::{ use workspace::{
create_and_open_local_file, create_and_open_local_file,
item::ItemHandle, item::ItemHandle,
@ -29,6 +28,8 @@ use workspace::{
use zed_actions::OpenBrowser; use zed_actions::OpenBrowser;
use zeta::RateCompletionModal; use zeta::RateCompletionModal;
actions!(zeta, [RateCompletions]);
const COPILOT_SETTINGS_URL: &str = "https://github.com/settings/copilot"; const COPILOT_SETTINGS_URL: &str = "https://github.com/settings/copilot";
struct CopilotErrorToast; struct CopilotErrorToast;
@ -204,16 +205,22 @@ impl Render for InlineCompletionButton {
} }
div().child( div().child(
Button::new("zeta", "ζ") IconButton::new("zeta", IconName::ZedPredict)
.label_size(LabelSize::Small) .tooltip(|cx| {
Tooltip::with_meta(
"Zed Predict",
Some(&RateCompletions),
"Click to rate completions",
cx,
)
})
.on_click(cx.listener(|this, _, cx| { .on_click(cx.listener(|this, _, cx| {
if let Some(workspace) = this.workspace.upgrade() { if let Some(workspace) = this.workspace.upgrade() {
workspace.update(cx, |workspace, cx| { workspace.update(cx, |workspace, cx| {
RateCompletionModal::toggle(workspace, cx) RateCompletionModal::toggle(workspace, cx)
}); });
} }
})) })),
.tooltip(|cx| Tooltip::text("Rate Completions", cx)),
) )
} }
} }

View file

@ -303,6 +303,7 @@ pub enum IconName {
XCircle, XCircle,
ZedAssistant, ZedAssistant,
ZedAssistantFilled, ZedAssistantFilled,
ZedPredict,
ZedXCopilot, ZedXCopilot,
} }

View file

@ -8,7 +8,7 @@ use language::{language_settings, OffsetRangeExt};
use settings::Settings; use settings::Settings;
use std::time::Duration; use std::time::Duration;
use theme::ThemeSettings; use theme::ThemeSettings;
use ui::{prelude::*, KeyBinding, List, ListItem, ListItemSpacing, TintColor, Tooltip}; use ui::{prelude::*, KeyBinding, List, ListItem, ListItemSpacing, Tooltip};
use workspace::{ModalView, Workspace}; use workspace::{ModalView, Workspace};
actions!( actions!(
@ -369,34 +369,39 @@ impl RateCompletionModal {
.overflow_scroll() .overflow_scroll()
.child(StyledText::new(diff).with_highlights(&text_style, diff_highlights)), .child(StyledText::new(diff).with_highlights(&text_style, diff_highlights)),
) )
.child( .when_some((!rated).then(|| ()), |this, _| {
h_flex() this.child(
.p_2() h_flex()
.gap_2() .p_2()
.border_y_1() .gap_2()
.border_color(border_color) .border_y_1()
.child( .border_color(border_color)
Icon::new(IconName::Info) .child(
.size(IconSize::XSmall) Icon::new(IconName::Info)
.color(Color::Muted) .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.") .child(
.size(LabelSize::Small) Label::new("Ensure you explain why this completion is negative or positive. In case it's negative, report what you expected instead.")
.color(Color::Muted) .size(LabelSize::Small)
) .color(Color::Muted)
) )
.child( )
div() })
.h_40() .when_some((!rated).then(|| ()), |this, _| {
.pt_1() this.child(
.bg(bg_color) div()
.child(active_completion.feedback_editor.clone()), .h_40()
) .pt_1()
.bg(bg_color)
.child(active_completion.feedback_editor.clone())
)
})
.child( .child(
h_flex() h_flex()
.p_1() .p_1()
.h_8() .h_8()
.max_h_8()
.border_t_1() .border_t_1()
.border_color(border_color) .border_color(border_color)
.max_w_full() .max_w_full()
@ -409,7 +414,7 @@ impl RateCompletionModal {
.size(IconSize::Small) .size(IconSize::Small)
.color(Color::Success), .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() { } else if active_completion.completion.edits.is_empty() {
Some( Some(
@ -419,7 +424,7 @@ impl RateCompletionModal {
.size(IconSize::Small) .size(IconSize::Small)
.color(Color::Warning), .color(Color::Warning),
) )
.child(Label::new("No edits produced").color(Color::Muted)), .child(Label::new("No edits produced.").color(Color::Muted)),
) )
} else { } else {
Some(label_container()) Some(label_container())
@ -434,11 +439,10 @@ impl RateCompletionModal {
&self.focus_handle(cx), &self.focus_handle(cx),
cx, cx,
)) ))
.style(ButtonStyle::Tinted(TintColor::Negative)) .style(ButtonStyle::Filled)
.icon(IconName::ThumbsDown) .icon(IconName::ThumbsDown)
.icon_size(IconSize::Small) .icon_size(IconSize::Small)
.icon_position(IconPosition::Start) .icon_position(IconPosition::Start)
.icon_color(Color::Error)
.disabled(rated || feedback_empty) .disabled(rated || feedback_empty)
.when(feedback_empty, |this| { .when(feedback_empty, |this| {
this.tooltip(|cx| { this.tooltip(|cx| {
@ -459,11 +463,10 @@ impl RateCompletionModal {
&self.focus_handle(cx), &self.focus_handle(cx),
cx, cx,
)) ))
.style(ButtonStyle::Tinted(TintColor::Positive)) .style(ButtonStyle::Filled)
.icon(IconName::ThumbsUp) .icon(IconName::ThumbsUp)
.icon_size(IconSize::Small) .icon_size(IconSize::Small)
.icon_position(IconPosition::Start) .icon_position(IconPosition::Start)
.icon_color(Color::Success)
.disabled(rated) .disabled(rated)
.on_click(cx.listener(move |this, _, cx| { .on_click(cx.listener(move |this, _, cx| {
this.thumbs_up_active(&ThumbsUpActiveCompletion, cx); this.thumbs_up_active(&ThumbsUpActiveCompletion, cx);
@ -537,7 +540,7 @@ impl Render for RateCompletionModal {
.focused(index == self.selected_index) .focused(index == self.selected_index)
.selected(selected) .selected(selected)
.start_slot(if rated { .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() { } else if completion.edits.is_empty() {
Icon::new(IconName::File).color(Color::Muted).size(IconSize::Small) Icon::new(IconName::File).color(Color::Muted).size(IconSize::Small)
} else { } else {
@ -546,13 +549,9 @@ impl Render for RateCompletionModal {
.child( .child(
v_flex() v_flex()
.child(Label::new(completion.path.to_string_lossy().to_string()).size(LabelSize::Small)) .child(Label::new(completion.path.to_string_lossy().to_string()).size(LabelSize::Small))
.child(div() .child(Label::new(format!("{} ago, {:.2?}", format_time_ago(completion.response_received_at.elapsed()), completion.latency()))
.overflow_hidden() .color(Color::Muted)
.text_ellipsis() .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| { .on_click(cx.listener(move |this, _, cx| {