mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 06:59:22 +01:00
Add announcement banner for Delta (#64963)
## Summary This PR introduces an announcement banner for Delta that will be shown in the next Zed release. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - N/A
This commit is contained in:
Generated
+2
-2
@@ -1429,7 +1429,6 @@ dependencies = [
|
||||
name = "auto_update_ui"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"agent_skills",
|
||||
"anyhow",
|
||||
"auto_update",
|
||||
"client",
|
||||
@@ -1437,11 +1436,12 @@ dependencies = [
|
||||
"editor",
|
||||
"gpui",
|
||||
"markdown_preview",
|
||||
"prompt_store",
|
||||
"project",
|
||||
"release_channel",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"settings",
|
||||
"smol",
|
||||
"telemetry",
|
||||
"ui",
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<svg width="400" height="155" viewBox="0 0 400 155" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<marker id="arrow" markerWidth="5" markerHeight="6" refX="4" refY="3" orient="auto" markerUnits="userSpaceOnUse">
|
||||
<path d="M0.5 0.5L3.5 3L0.5 5.5" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</marker>
|
||||
</defs>
|
||||
<g stroke="black" stroke-linecap="round" stroke-linejoin="round" opacity="0.12">
|
||||
<path d="M74 87Q78 87 78 91V112Q78 116 82 116H104" marker-end="url(#arrow)"/>
|
||||
<path d="M136 116H184" marker-end="url(#arrow)"/>
|
||||
<path d="M216 116H240Q244 116 244 112V91Q244 87 248 87"/>
|
||||
<path d="M54 40H82"/>
|
||||
<path d="M136 40H184" marker-end="url(#arrow)"/>
|
||||
<path d="M216 40H240Q244 40 244 44V77"/>
|
||||
<g fill="black" fill-opacity="0.08">
|
||||
<path d="M120 108L129 124H111Z"/>
|
||||
<path d="M200 108L209 124H191Z"/>
|
||||
<path d="M38 31L47 47H29Z"/>
|
||||
<path d="M200 31L209 47H191Z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g stroke="black" stroke-linecap="round" stroke-linejoin="round" opacity="0.85">
|
||||
<path d="M54 87H74Q78 87 78 83V44Q78 40 82 40H104" marker-end="url(#arrow)"/>
|
||||
<path d="M120 57V69Q120 73 124 73H184" marker-end="url(#arrow)"/>
|
||||
<path d="M216 73H240Q244 73 244 77V83Q244 87 248 87H272" marker-end="url(#arrow)"/>
|
||||
<g fill="black" fill-opacity="0.08">
|
||||
<path d="M38 78L47 94H29Z"/>
|
||||
<path d="M120 31L129 47H111Z"/>
|
||||
<path d="M200 62L209 78H191Z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g stroke="black" stroke-width="1.1" opacity="0.25">
|
||||
<path d="M286 55H280V133H358V127"/>
|
||||
<path d="M292 49V43H370V121H364"/>
|
||||
</g>
|
||||
<rect x="286" y="49" width="78" height="78" fill="black" fill-opacity="0.04" stroke="black" stroke-opacity="0.8" stroke-width="1.1"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1,8 @@
|
||||
<svg width="400" height="155" viewBox="0 0 400 155" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g stroke="black" opacity="0.5">
|
||||
<rect x="14.5" y="12.5" width="371" height="130"/>
|
||||
<path d="M0 12.5H11M18 12.5H382M389 12.5H400M0 142.5H11M18 142.5H382M389 142.5H400M14.5 0V9M14.5 16V139M14.5 146V155M385.5 0V9M385.5 16V139M385.5 146V155"/>
|
||||
<path d="M14.5 9.5L17.5 12.5L14.5 15.5L11.5 12.5ZM385.5 9.5L388.5 12.5L385.5 15.5L382.5 12.5ZM14.5 139.5L17.5 142.5L14.5 145.5L11.5 142.5ZM385.5 139.5L388.5 142.5L385.5 145.5L382.5 142.5Z"/>
|
||||
</g>
|
||||
<path d="M38.5 13V142M120.5 13V142M200.5 13V142M280.5 13V142" stroke="black" stroke-dasharray="4 5" opacity="0.25"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 679 B |
@@ -0,0 +1,5 @@
|
||||
<svg width="400" height="155" viewBox="0 0 400 155" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="translate(298 65) scale(0.3483870968)">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M73.4951 3.70233C74.8179 1.41138 77.2625 0 79.9081 0C82.5536 0 84.9983 1.41138 86.3211 3.70233L153.403 119.892C154.726 122.183 154.726 125.006 153.403 127.297C152.081 129.589 149.636 131 146.99 131H41.2399C38.5943 131 36.1497 129.589 34.8269 127.297C33.5041 125.006 33.5041 122.183 34.8269 119.892L79.9081 41.8097L117.195 106.393H71.0355L77.376 95.4102H98.1731L79.9081 63.7743L47.4358 120.018H140.795L79.9081 14.5594L12.681 131H0L73.4951 3.70233Z" fill="white"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 678 B |
@@ -14,7 +14,6 @@ test = false
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
agent_skills.workspace = true
|
||||
anyhow.workspace = true
|
||||
auto_update.workspace = true
|
||||
client.workspace = true
|
||||
@@ -22,11 +21,12 @@ db.workspace = true
|
||||
editor.workspace = true
|
||||
gpui.workspace = true
|
||||
markdown_preview.workspace = true
|
||||
prompt_store.workspace = true
|
||||
project.workspace = true
|
||||
release_channel.workspace = true
|
||||
semver.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
settings.workspace = true
|
||||
smol.workspace = true
|
||||
telemetry.workspace = true
|
||||
ui.workspace = true
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use agent_skills::GLOBAL_SKILLS_DIR_DISPLAY;
|
||||
use auto_update::{AutoUpdater, release_notes_url};
|
||||
use client::zed_urls;
|
||||
use db::kvp::Dismissable;
|
||||
use editor::{Editor, MultiBuffer};
|
||||
use gpui::{
|
||||
@@ -10,12 +6,13 @@ use gpui::{
|
||||
prelude::*,
|
||||
};
|
||||
use markdown_preview::markdown_preview_view::{MarkdownPreviewMode, MarkdownPreviewView};
|
||||
use prompt_store::rules_to_skills_migration;
|
||||
use project::DisableAiSettings;
|
||||
use release_channel::{AppVersion, ReleaseChannel};
|
||||
use semver::Version;
|
||||
use serde::Deserialize;
|
||||
use settings::Settings as _;
|
||||
use smol::io::AsyncReadExt;
|
||||
use ui::{AnnouncementToast, ListBulletItem, SkillsIllustration, prelude::*};
|
||||
use ui::{AnnouncementToast, DeltaIllustration, ListBulletItem, prelude::*};
|
||||
use util::{ResultExt as _, maybe};
|
||||
use workspace::{
|
||||
Workspace,
|
||||
@@ -194,60 +191,40 @@ struct AnnouncementContent {
|
||||
bullet_items: Vec<SharedString>,
|
||||
primary_action_label: SharedString,
|
||||
secondary_action_label: SharedString,
|
||||
primary_action_url: Option<SharedString>,
|
||||
primary_action_callback: Option<Arc<dyn Fn(&mut Window, &mut App) + Send + Sync>>,
|
||||
secondary_action_url: Option<SharedString>,
|
||||
on_dismiss: Option<Arc<dyn Fn(&mut App) + Send + Sync>>,
|
||||
primary_action_url: SharedString,
|
||||
secondary_action_url: SharedString,
|
||||
}
|
||||
|
||||
struct SkillsAnnouncement;
|
||||
struct DeltaAnnouncement;
|
||||
|
||||
impl Dismissable for SkillsAnnouncement {
|
||||
const KEY: &'static str = "skills_announcement_dismissed";
|
||||
impl Dismissable for DeltaAnnouncement {
|
||||
const KEY: &'static str = "delta_announcement_dismissed";
|
||||
}
|
||||
|
||||
fn announcement_for_version(version: &Version, cx: &App) -> Option<AnnouncementContent> {
|
||||
let version_with_skills = match ReleaseChannel::global(cx) {
|
||||
ReleaseChannel::Stable => Version::new(1, 4, 0),
|
||||
ReleaseChannel::Dev | ReleaseChannel::Nightly | ReleaseChannel::Preview => {
|
||||
Version::new(1, 4, 0)
|
||||
}
|
||||
};
|
||||
|
||||
if *version >= version_with_skills && !SkillsAnnouncement::dismissed(cx) {
|
||||
// Only mention the Rules → Skills migration if the user actually
|
||||
// had Rules that got migrated. New users (and existing users who
|
||||
// never created a Rule) would otherwise be confused by a bullet
|
||||
// referring to "your rules" that don't exist.
|
||||
let migrated_anything =
|
||||
rules_to_skills_migration::migration_result().is_some_and(|result| !result.is_empty());
|
||||
|
||||
let mut bullet_items: Vec<SharedString> = Vec::with_capacity(3);
|
||||
bullet_items
|
||||
.push(format!("Skills live in {GLOBAL_SKILLS_DIR_DISPLAY}/<name>/SKILL.md").into());
|
||||
bullet_items.push("Type / to manually invoke a skill".into());
|
||||
if migrated_anything {
|
||||
bullet_items.push(
|
||||
"The Rules Library is making way for skills: your default rules are now in a global AGENTS.md, and your other rules have been converted to skills".into(),
|
||||
);
|
||||
}
|
||||
|
||||
Some(AnnouncementContent {
|
||||
heading: "Introducing Skills Support".into(),
|
||||
description: "Extend the agent with focused instructions and domain knowledge.".into(),
|
||||
bullet_items,
|
||||
primary_action_label: "Try Now".into(),
|
||||
secondary_action_label: "Read Documentation".into(),
|
||||
primary_action_url: None,
|
||||
primary_action_callback: Some(Arc::new(move |window, cx| {
|
||||
window.dispatch_action(Box::new(zed_actions::assistant::FocusAgent), cx);
|
||||
})),
|
||||
on_dismiss: Some(Arc::new(|cx| SkillsAnnouncement::set_dismissed(true, cx))),
|
||||
secondary_action_url: Some(zed_urls::skills_docs(cx).into()),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
let version_with_delta = Version::new(1, 22, 0);
|
||||
if *version < version_with_delta
|
||||
|| DisableAiSettings::get_global(cx).disable_ai
|
||||
|| DeltaAnnouncement::dismissed(cx)
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(AnnouncementContent {
|
||||
heading: "Introducing Delta".into(),
|
||||
description:
|
||||
"Built on DeltaDB, so your threads and code stay in sync across machines and teammates."
|
||||
.into(),
|
||||
bullet_items: vec![
|
||||
"Made by the Zed team, with the same quality and performance".into(),
|
||||
"Work with teammates and agents in the same thread, live or later".into(),
|
||||
"Pick up your thread on the web or your phone, without committing or pushing".into(),
|
||||
],
|
||||
primary_action_label: "Try Delta".into(),
|
||||
secondary_action_label: "Learn More".into(),
|
||||
primary_action_url: "https://delta.dev/".into(),
|
||||
secondary_action_url: "https://delta.dev/docs/getting-started".into(),
|
||||
})
|
||||
}
|
||||
|
||||
struct AnnouncementToastNotification {
|
||||
@@ -265,9 +242,7 @@ impl AnnouncementToastNotification {
|
||||
|
||||
fn dismiss(&mut self, cx: &mut Context<Self>) {
|
||||
cx.emit(DismissEvent);
|
||||
if let Some(on_dismiss) = &self.content.on_dismiss {
|
||||
on_dismiss(cx);
|
||||
}
|
||||
DeltaAnnouncement::set_dismissed(true, cx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,9 +257,9 @@ impl EventEmitter<SuppressEvent> for AnnouncementToastNotification {}
|
||||
impl Notification for AnnouncementToastNotification {}
|
||||
|
||||
impl Render for AnnouncementToastNotification {
|
||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
AnnouncementToast::new()
|
||||
.illustration(SkillsIllustration::new())
|
||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
let toast = AnnouncementToast::new()
|
||||
.illustration(DeltaIllustration::new())
|
||||
.heading(self.content.heading.clone())
|
||||
.description(self.content.description.clone())
|
||||
.bullet_items(
|
||||
@@ -297,31 +272,30 @@ impl Render for AnnouncementToastNotification {
|
||||
.secondary_action_label(self.content.secondary_action_label.clone())
|
||||
.primary_on_click(cx.listener({
|
||||
let url = self.content.primary_action_url.clone();
|
||||
let callback = self.content.primary_action_callback.clone();
|
||||
move |this, _, window, cx| {
|
||||
telemetry::event!("Skills Announcement Main Click");
|
||||
if let Some(callback) = &callback {
|
||||
callback(window, cx);
|
||||
}
|
||||
if let Some(url) = &url {
|
||||
cx.open_url(url);
|
||||
}
|
||||
move |this, _, _window, cx| {
|
||||
telemetry::event!("Delta Announcement Main Click");
|
||||
cx.open_url(&url);
|
||||
this.dismiss(cx);
|
||||
}
|
||||
}))
|
||||
.secondary_on_click(cx.listener({
|
||||
let url = self.content.secondary_action_url.clone();
|
||||
move |_, _, _window, cx| {
|
||||
telemetry::event!("Skills Announcement Secondary Click");
|
||||
if let Some(url) = &url {
|
||||
cx.open_url(url);
|
||||
}
|
||||
telemetry::event!("Delta Announcement Secondary Click");
|
||||
cx.open_url(&url);
|
||||
}
|
||||
}))
|
||||
.dismiss_on_click(cx.listener(|this, _, _window, cx| {
|
||||
telemetry::event!("Skills Announcement Dismiss");
|
||||
telemetry::event!("Delta Announcement Dismiss");
|
||||
this.dismiss(cx);
|
||||
}))
|
||||
}));
|
||||
|
||||
div()
|
||||
.self_end()
|
||||
.flex_none()
|
||||
.w(rems_from_px(400_f32))
|
||||
.max_w((window.viewport_size().width - window.rem_size() * 1.5).max(px(0.)))
|
||||
.child(toast)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
mod agent_setup_button;
|
||||
mod ai_setting_item;
|
||||
mod configured_api_card;
|
||||
mod skills_illustration;
|
||||
mod delta_illustration;
|
||||
mod thread_item;
|
||||
|
||||
pub use agent_setup_button::*;
|
||||
pub use ai_setting_item::*;
|
||||
pub use configured_api_card::*;
|
||||
pub use skills_illustration::*;
|
||||
pub use delta_illustration::*;
|
||||
pub use thread_item::*;
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
use crate::prelude::*;
|
||||
use gpui::{linear_color_stop, linear_gradient, svg};
|
||||
|
||||
#[derive(IntoElement)]
|
||||
pub struct DeltaIllustration;
|
||||
|
||||
impl DeltaIllustration {
|
||||
pub fn new() -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderOnce for DeltaIllustration {
|
||||
fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
|
||||
let (background_color, bottom_opacity, top_opacity) = if cx.theme().appearance.is_light() {
|
||||
(cx.theme().colors().icon_muted, 0.05, 0.025)
|
||||
} else {
|
||||
(gpui::black(), 0.2, 0.1)
|
||||
};
|
||||
|
||||
v_flex()
|
||||
.relative()
|
||||
.h(rems_from_px(155_f32))
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.rounded_t_md()
|
||||
.overflow_hidden()
|
||||
.bg(linear_gradient(
|
||||
0.,
|
||||
linear_color_stop(background_color.opacity(bottom_opacity), 0.),
|
||||
linear_color_stop(background_color.opacity(top_opacity), 1.),
|
||||
))
|
||||
.child(
|
||||
svg()
|
||||
.absolute()
|
||||
.inset_0()
|
||||
.size_full()
|
||||
.path("images/delta_announcement_grid.svg")
|
||||
.text_color(cx.theme().colors().border),
|
||||
)
|
||||
.child(
|
||||
svg()
|
||||
.absolute()
|
||||
.inset_0()
|
||||
.size_full()
|
||||
.path("images/delta_announcement_diagram.svg")
|
||||
.text_color(cx.theme().colors().text),
|
||||
)
|
||||
.child(
|
||||
svg()
|
||||
.absolute()
|
||||
.inset_0()
|
||||
.size_full()
|
||||
.path("images/delta_mark.svg")
|
||||
.text_color(gpui::rgb(0xd5442c)),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
use crate::prelude::*;
|
||||
use gpui::{linear_color_stop, linear_gradient};
|
||||
|
||||
#[derive(IntoElement)]
|
||||
pub struct SkillsIllustration;
|
||||
|
||||
impl SkillsIllustration {
|
||||
pub fn new() -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderOnce for SkillsIllustration {
|
||||
fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
|
||||
let skill_crease = |label: SharedString, source: SharedString| {
|
||||
h_flex()
|
||||
.py_1()
|
||||
.px_1p5()
|
||||
.gap_1p5()
|
||||
.border_1()
|
||||
.border_color(cx.theme().colors().border)
|
||||
.bg(cx.theme().colors().element_active.opacity(0.5))
|
||||
.justify_center()
|
||||
.rounded_md()
|
||||
.shadow_sm()
|
||||
.child(
|
||||
Icon::new(IconName::Sparkle)
|
||||
.color(Color::Muted)
|
||||
.size(IconSize::XSmall),
|
||||
)
|
||||
.child(Label::new(label).size(LabelSize::XSmall).buffer_font(cx))
|
||||
.child(
|
||||
Label::new(format!("({source})"))
|
||||
.size(LabelSize::XSmall)
|
||||
.color(Color::Muted)
|
||||
.buffer_font(cx),
|
||||
)
|
||||
};
|
||||
|
||||
let skill_list = v_flex()
|
||||
.absolute()
|
||||
.top_8()
|
||||
.gap_2p5()
|
||||
.items_center()
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2p5()
|
||||
.child(skill_crease("img-gen".into(), "studio".into()))
|
||||
.child(skill_crease("frontend-design".into(), "global".into())),
|
||||
)
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2p5()
|
||||
.child(skill_crease("brainstorming".into(), "global".into()))
|
||||
.child(skill_crease("borrow-checker-expert".into(), "zed".into())),
|
||||
)
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2p5()
|
||||
.child(skill_crease("grill-with-docs".into(), "global".into()))
|
||||
.child(skill_crease("video-edit".into(), "studio".into())),
|
||||
);
|
||||
|
||||
let gradient_bg = cx.theme().colors().editor_background;
|
||||
let gradient_fade = div()
|
||||
.absolute()
|
||||
.rounded_t_md()
|
||||
.inset_0()
|
||||
.bg(linear_gradient(
|
||||
0.,
|
||||
linear_color_stop(gradient_bg.opacity(0.8), 0.),
|
||||
linear_color_stop(gradient_bg.opacity(0.0), 1.),
|
||||
));
|
||||
|
||||
v_flex()
|
||||
.relative()
|
||||
.h(rems_from_px(150_f32))
|
||||
.justify_end()
|
||||
.items_center()
|
||||
.rounded_t_md()
|
||||
.overflow_hidden()
|
||||
.bg(gpui::black().opacity(0.2))
|
||||
.child(skill_list)
|
||||
.child(gradient_fade)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user