Account · Profile and access: profiles, switchers, a user menu, sessions, keys

ProfileCard shows someone at a glance; ProfileEditor edits a profile
seeded by its owner and saves once it changed, has a name and an email
that reads, with a way to put it back. AccountSwitcher and
WorkspaceSwitcher show the one in use in a row that opens a menu of the
others and a way to add one; UserMenu opens from an avatar with who is
signed in, the owner's rows and Sign out, through the new
menus::menu_under. SessionList puts this device first, signs others
out one by one or all after a second press. ApiKeyManager lists keys by
their ends, makes one by name and shows its secret once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-09-27 13:29:35 -04:00
1 parent 5f26c8ee1e
commit 24e0366e0e
12 files changed
+1654 -8

No files matched your search

+14 -1
View File
@@ -17,7 +17,7 @@ use crate::{
primitives::IconName,
};
type Click = Rc<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
pub(crate) type Click = Rc<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
fn state(id: &ElementId, window: &mut Window, cx: &mut App) -> Entity<Open> {
window.use_keyed_state((id.clone(), "menu"), cx, |_, _| Open::default())
@@ -54,6 +54,19 @@ fn host(
.children(hang(&id, menu, state, field, window, cx))
}
/// A menu under a trigger of the caller's making, which runs `click` when pressed.
pub(crate) fn menu_under(
id: ElementId,
menu: &Menu,
trigger: impl FnOnce(Click) -> AnyElement,
window: &mut Window,
cx: &mut App,
) -> Stateful<Div> {
let state = state(&id, window, cx);
let click = toggle(&state, menu, cx);
host(id, trigger(click), menu, &state, None, window, cx)
}
/// A button that opens a menu under it.
#[derive(IntoElement)]
pub struct DropdownMenu {