This commit is contained in:
2026-08-08 08:08:24 +07:00
parent 161c066ca8
commit de9673e8fb
9 changed files with 110 additions and 73 deletions
+21 -10
View File
@@ -1,9 +1,11 @@
use std::sync::Arc;
use assets::CustomIconName;
use gpui::prelude::*;
use gpui::{Context, Entity, Render, SharedString, Subscription, Window, div, px};
use gpui_component::button::{Button, ButtonVariants};
use gpui_component::dock::{DockArea, DockItem};
use gpui_component::{ActiveTheme, Root, StyledExt, TitleBar, h_flex, v_flex};
use gpui_component::{ActiveTheme, Root, Sizable, StyledExt, TitleBar, h_flex, v_flex};
use signed_state::{Backend, BackendEvent};
use crate::views::SidebarPanel;
@@ -50,11 +52,11 @@ impl Workspace {
let subscription = cx.subscribe(&backend, |this, _backend, event, cx| {
match event {
BackendEvent::Connected => this.status = "Connected".into(),
BackendEvent::SyncProgress { total, current } => {
this.status = format!("Syncing repositories... {current}/{total}").into()
}
BackendEvent::Synced => this.status = "Connected".into(),
BackendEvent::Connected => this.status = "Connected".into(),
BackendEvent::Error(error) => this.status = error.clone().into(),
_ => return,
}
@@ -105,14 +107,23 @@ impl Render for Workspace {
// Left
.child(div())
// Right
.child(
h_flex().px_2().child(
div()
.text_xs()
.text_color(cx.theme().muted_foreground)
.child(self.status.clone()),
),
),
.child(h_flex().px_2().map(|this| {
if self.status == "Connected" {
this.child(
Button::new("relay")
.icon(CustomIconName::GlobalOn)
.small()
.ghost(),
)
} else {
this.child(
div()
.text_xs()
.text_color(cx.theme().muted_foreground)
.child(self.status.clone()),
)
}
})),
)
// Dock Area
.child(self.dock.clone()),