From 374b05a379e1aeb67c0f8d741ab69fc77aab1e81 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 23 Sep 2021 15:36:32 +0200 Subject: [PATCH] Display warning in titlebar when Zed is out-of-date --- zed/assets/themes/_base.toml | 1 + zed/src/theme.rs | 3 ++- zed/src/workspace.rs | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/zed/assets/themes/_base.toml b/zed/assets/themes/_base.toml index 5938032c2c8c099f2840460f3f5a640dd64196d6..3e326ab62c6168673be6888778b3cd11317829e5 100644 --- a/zed/assets/themes/_base.toml +++ b/zed/assets/themes/_base.toml @@ -11,6 +11,7 @@ title = "$text.0" avatar_width = 20 icon_color = "$text.2.color" avatar = { corner_radius = 10, border = { width = 1, color = "#00000088" } } +outdated_warning = { extends = "$text.2", size = 13 } [workspace.titlebar.offline_icon] padding = { right = 4 } diff --git a/zed/src/theme.rs b/zed/src/theme.rs index 8b43b09f13d28fdd1cafdf0871a12123efa12f96..a5378fe033c2f70c7767b75a7fe9cc6ec434b47d 100644 --- a/zed/src/theme.rs +++ b/zed/src/theme.rs @@ -54,6 +54,7 @@ pub struct Titlebar { pub offline_icon: OfflineIcon, pub icon_color: Color, pub avatar: ImageStyle, + pub outdated_warning: ContainedText, } #[derive(Clone, Deserialize)] @@ -169,7 +170,7 @@ pub struct Selector { pub active_item: ContainedLabel, } -#[derive(Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize)] pub struct ContainedText { #[serde(flatten)] pub container: ContainerStyle, diff --git a/zed/src/workspace.rs b/zed/src/workspace.rs index df4afb020e3246d09f462fb7ad85cd7fe72d13a2..c148b729164b0c7c1f940a97885ef4ae568700cd 100644 --- a/zed/src/workspace.rs +++ b/zed/src/workspace.rs @@ -1041,6 +1041,16 @@ impl Workspace { .with_style(theme.workspace.titlebar.offline_icon.container) .boxed(), ), + rpc::Status::UpgradeRequired => Some( + Label::new( + "Please update Zed to collaborate".to_string(), + theme.workspace.titlebar.outdated_warning.text.clone(), + ) + .contained() + .with_style(theme.workspace.titlebar.outdated_warning.container) + .aligned() + .boxed(), + ), _ => None, } }