update repo list

This commit is contained in:
2026-08-05 09:24:46 +07:00
parent f497279886
commit fdf74327bb
4 changed files with 102 additions and 56 deletions
+9 -2
View File
@@ -14,9 +14,12 @@ pub struct Workspace {
impl Workspace {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let backend = Backend::global(cx);
let repo_list = cx.new(|cx| RepoListView::new(window, cx));
let subscription = cx.subscribe(&Backend::global(cx), |this, _backend, event, cx| {
let connected = backend.read(cx).is_connected();
let subscription = cx.subscribe(&backend, |this, _backend, event, cx| {
match event {
BackendEvent::Connected => this.status = "Connected".into(),
BackendEvent::Error(error) => this.status = error.clone().into(),
@@ -27,7 +30,11 @@ impl Workspace {
Self {
active_screen: repo_list.into(),
status: SharedString::from("Connecting..."),
status: if connected {
"Connected".into()
} else {
"Connecting...".into()
},
_subscription: subscription,
}
}