Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/zedra/assets/icons/copy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
767 changes: 767 additions & 0 deletions crates/zedra/src/account_view.rs

Large diffs are not rendered by default.

32 changes: 31 additions & 1 deletion crates/zedra/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::time::Duration;
use gpui::*;
use zedra_telemetry::*;

use crate::account_view::{AccountEvent, AccountView};
use crate::app_action::SystemBack;
use crate::deeplink::{self, DeeplinkAction};
use crate::fonts;
Expand All @@ -25,6 +26,7 @@ enum AppScreen {
OpenProject,
Settings,
WebTunnel,
Account,
Workspace,
}

Expand All @@ -33,7 +35,9 @@ fn app_view_descriptor(screen: AppScreen) -> Option<ViewDescriptor> {
// Open project is a Home subscreen; report it as Home.
AppScreen::Home | AppScreen::OpenProject => Some(view_telemetry::HOME),
// Web tunnel is a Settings subscreen; report it as Settings.
AppScreen::Settings | AppScreen::WebTunnel => Some(view_telemetry::SETTINGS),
AppScreen::Settings | AppScreen::WebTunnel | AppScreen::Account => {
Some(view_telemetry::SETTINGS)
}
AppScreen::Workspace => None,
}
}
Expand All @@ -49,6 +53,7 @@ pub struct ZedraApp {
home_view: Entity<HomeView>,
settings_view: Entity<SettingsView>,
web_tunnel_manager: Entity<WebTunnelManager>,
account_view: Entity<AccountView>,
open_project_view: Entity<OpenProjectView>,
workspaces: Entity<Workspaces>,
quick_action_drawer: Entity<DrawerHost>,
Expand Down Expand Up @@ -196,6 +201,9 @@ impl ZedraApp {
subscriptions.push(sub);

let web_tunnel_manager = cx.new(|cx| WebTunnelManager::new(workspaces.clone(), cx));
let account_view = cx.new(|cx| AccountView::new(delta_state.clone(), cx));
let sub = cx.subscribe(&account_view, Self::on_account_event);
subscriptions.push(sub);

let open_project_view = cx.new(|cx| OpenProjectView::new(workspaces.clone(), cx));
let sub = cx.subscribe(&open_project_view, Self::on_open_project_event);
Expand Down Expand Up @@ -247,6 +255,7 @@ impl ZedraApp {
home_view,
settings_view,
web_tunnel_manager,
account_view,
open_project_view,
workspaces,
quick_action_drawer,
Expand Down Expand Up @@ -363,6 +372,13 @@ impl ZedraApp {
SettingsEvent::NavigateHome => {
self.set_screen(AppScreen::Home, cx);
}
SettingsEvent::OpenAccount => {
// The view is built once at startup, so the node list refreshes
// on open rather than on construction.
self.account_view
.update(cx, |view, cx| view.refresh_nodes_if_stale(cx));
self.set_screen(AppScreen::Account, cx);
}
SettingsEvent::OpenWebTunnel => {
self.set_screen(AppScreen::WebTunnel, cx);
}
Expand All @@ -375,6 +391,15 @@ impl ZedraApp {
}
}

fn on_account_event(
&mut self,
_: Entity<AccountView>,
_: &AccountEvent,
cx: &mut Context<Self>,
) {
self.set_screen(AppScreen::Settings, cx);
}

fn on_theme_changed(
&mut self,
_: Entity<ThemeState>,
Expand Down Expand Up @@ -602,6 +627,10 @@ impl ZedraApp {
self.set_screen(AppScreen::Settings, cx);
true
}
AppScreen::Account => {
self.set_screen(AppScreen::Settings, cx);
true
}
AppScreen::OpenProject => {
if self
.open_project_view
Expand Down Expand Up @@ -640,6 +669,7 @@ impl ZedraApp {
AppScreen::Home => self.home_view.clone().into(),
AppScreen::Settings => self.settings_view.clone().into(),
AppScreen::WebTunnel => self.web_tunnel_manager.clone().into(),
AppScreen::Account => self.account_view.clone().into(),
AppScreen::OpenProject => self.open_project_view.clone().into(),
AppScreen::Workspace => self
.workspaces
Expand Down
Loading
Loading