Display warning in titlebar when Zed is out-of-date

Antonio Scandurra created

Change summary

zed/assets/themes/_base.toml |  1 +
zed/src/theme.rs             |  3 ++-
zed/src/workspace.rs         | 10 ++++++++++
3 files changed, 13 insertions(+), 1 deletion(-)

Detailed changes

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 }

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,

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,
         }
     }