Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Implement user menu
Conrad Irwin3094cb749ed1
diff --git a/Cargo.lock b/Cargo.lockindex ba868ebbae5..a6cc38ef6a8 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -1957,6 +1957,7 @@ dependencies = ["db2","editor2","feature_flags2",+ "feedback2","futures 0.3.28","fuzzy2","gpui2",@@ -1978,6 +1979,7 @@ dependencies = ["settings2","smallvec","theme2",+ "theme_selector2","time","tree-sitter-markdown","ui2",diff --git a/crates/collab_ui2/Cargo.toml b/crates/collab_ui2/Cargo.tomlindex 65aced8e7ed..88c27bc1657 100644--- a/crates/collab_ui2/Cargo.toml+++ b/crates/collab_ui2/Cargo.toml@@ -32,7 +32,7 @@ collections = { path = "../collections" }# context_menu = { path = "../context_menu" }# drag_and_drop = { path = "../drag_and_drop" }editor = { package="editor2", path = "../editor2" }-#feedback = { path = "../feedback" }+feedback = { package = "feedback2", path = "../feedback2" }fuzzy = { package = "fuzzy2", path = "../fuzzy2" }gpui = { package = "gpui2", path = "../gpui2" }language = { package = "language2", path = "../language2" }@@ -46,7 +46,7 @@ rpc = { package ="rpc2", path = "../rpc2" }settings = { package = "settings2", path = "../settings2" }feature_flags = { package = "feature_flags2", path = "../feature_flags2"}theme = { package = "theme2", path = "../theme2" }-# theme_selector = { path = "../theme_selector" }+theme_selector = { package = "theme_selector2", path = "../theme_selector2" }# vcs_menu = { path = "../vcs_menu" }ui = { package = "ui2", path = "../ui2" }util = { path = "../util" }diff --git a/crates/collab_ui2/src/collab_titlebar_item.rs b/crates/collab_ui2/src/collab_titlebar_item.rsindex 3d8fedd06bb..d6de5a1565d 100644--- a/crates/collab_ui2/src/collab_titlebar_item.rs+++ b/crates/collab_ui2/src/collab_titlebar_item.rs@@ -1,8 +1,8 @@use crate::face_pile::FacePile;use call::{ActiveCall, ParticipantLocation, Room};-use client::{proto::PeerId, Client, ParticipantIndex, User, UserStore};+use client::{proto::PeerId, Client, ParticipantIndex, SignOut, User, UserStore};use gpui::{- actions, canvas, div, overlay, point, px, rems, AppContext, DismissEvent, Div, Element,+ actions, canvas, div, overlay, point, px, rems, Action, AppContext, DismissEvent, Div, Element,FocusableView, Hsla, InteractiveElement, IntoElement, Model, ParentElement, Path, Render,Stateful, StatefulInteractiveElement, Styled, Subscription, ViewContext, VisualContext,WeakView, WindowBounds,@@ -16,7 +16,7 @@ use ui::{IconButton, IconElement, KeyBinding, Tooltip,};use util::ResultExt;-use workspace::{notifications::NotifyResultExt, Workspace, WORKSPACE_DB};+use workspace::{notifications::NotifyResultExt, Feedback, Workspace, WORKSPACE_DB};const MAX_PROJECT_NAME_LENGTH: usize = 40;const MAX_BRANCH_NAME_LENGTH: usize = 40;@@ -239,7 +239,19 @@ impl Render for CollabTitlebarItem {this.child(popover_menu("user-menu").menu(|cx| {- ContextMenu::build(cx, |menu, _| menu.header("ADADA"))+ ContextMenu::build(cx, |menu, _| {+ menu.action(+ "Settings",+ zed_actions::OpenSettings.boxed_clone(),+ )+ .action("Theme", theme_selector::Toggle.boxed_clone())+ .separator()+ .action(+ "Share Feedback",+ feedback::GiveFeedback.boxed_clone(),+ )+ .action("Sign Out", client::SignOut.boxed_clone())+ })}).trigger(ButtonLike::new("user-menu")@@ -259,16 +271,6 @@ impl Render for CollabTitlebarItem {).anchor(gpui::AnchorCorner::TopRight),)- // this.child(- // ButtonLike::new("user-menu")- // .child(- // h_stack().gap_0p5().child(Avatar::data(avatar)).child(- // IconElement::new(Icon::ChevronDown).color(Color::Muted),- // ),- // )- // .style(ButtonStyle::Subtle)- // .tooltip(move |cx| Tooltip::text("Toggle User Menu", cx)),- // )} else {this.child(Button::new("sign_in", "Sign in").on_click(move |_, cx| {let client = client.clone();@@ -280,6 +282,36 @@ impl Render for CollabTitlebarItem {}).detach();}))+ .child(+ popover_menu("user-menu")+ .menu(|cx| {+ ContextMenu::build(cx, |menu, _| {+ menu.action(+ "Settings",+ zed_actions::OpenSettings.boxed_clone(),+ )+ .action("Theme", theme_selector::Toggle.boxed_clone())+ .separator()+ .action(+ "Share Feedback",+ feedback::GiveFeedback.boxed_clone(),+ )+ })+ })+ .trigger(+ ButtonLike::new("user-menu")+ .child(+ h_stack().gap_0p5().child(+ IconElement::new(Icon::ChevronDown)+ .color(Color::Muted),+ ),+ )+ .style(ButtonStyle::Subtle)+ .tooltip(move |cx| {+ Tooltip::text("Toggle User Menu", cx)+ }),+ ),+ )}})),)diff --git a/crates/zed2/src/zed2.rs b/crates/zed2/src/zed2.rsindex 611cf645528..45ef08fdcc1 100644--- a/crates/zed2/src/zed2.rs+++ b/crates/zed2/src/zed2.rs@@ -41,7 +41,7 @@ use workspace::{notifications::simple_message_notification::MessageNotification, open_new, AppState, NewFile,NewWindow, Workspace, WorkspaceSettings,};-use zed_actions::{OpenBrowser, OpenZedURL, Quit};+use zed_actions::{OpenBrowser, OpenSettings, OpenZedURL, Quit};actions!(zed,@@ -59,7 +59,6 @@ actions!(OpenLicenses,OpenLocalSettings,OpenLog,- OpenSettings,OpenTelemetryLog,ResetBufferFontSize,ResetDatabase,diff --git a/crates/zed_actions2/src/lib.rs b/crates/zed_actions2/src/lib.rsindex fa1a4a5ea96..badf76a6e7b 100644--- a/crates/zed_actions2/src/lib.rs+++ b/crates/zed_actions2/src/lib.rs@@ -22,4 +22,4 @@ pub struct OpenZedURL {impl_actions!(zed, [OpenBrowser, OpenZedURL]);-actions!(zed, [Quit]);+actions!(zed, [OpenSettings, Quit]);