wip
Rust / build (macos-latest, stable) (push) Waiting to run
Rust / build (ubuntu-latest, stable) (push) Waiting to run
Rust / build (windows-latest, stable) (push) Waiting to run
Rust / build (macos-latest, stable) (pull_request) Waiting to run
Rust / build (ubuntu-latest, stable) (pull_request) Waiting to run
Rust / build (windows-latest, stable) (pull_request) Waiting to run

This commit is contained in:
2026-11-17 18:17:24 +07:00
parent d5bf8c3e0f
commit c63acc8867
184 changed files with 240 additions and 1743 deletions
+35 -53
View File
@@ -4,8 +4,7 @@ use std::sync::Arc;
use gpui::{
AnyElement, App, AppContext as _, Context, Entity, IntoElement, KeyBinding,
KeyBindingContextPredicate, ParentElement as _, SharedString, Styled as _, Subscription,
WeakEntity, Window, px,
KeyBindingContextPredicate, ParentElement as _, SharedString, Subscription, WeakEntity, Window,
};
use metadata::{Profile, ProfileDirectory};
use nostr::prelude::PublicKey;
@@ -16,11 +15,9 @@ use signed_state::{Backend, BackendEvent, LocalReposStore, RepoListStore, Resolv
use ui::avatar::Avatar;
use ui::button::{Button, ButtonVariant};
use ui::command_palette::{Command, CommandPalette, CommandPaletteState};
use ui::common::h_flex;
use ui::icons::{Icon, IconRole};
use ui::menu::{Menu, MenuItem};
use ui::tabs::{Tab, Tabs, TabsVariant};
use ui::theme::ActiveTheme as _;
use ui::tooltip::Tooltip;
use crate::repo::{RepoDetailView, actions, dialogs};
@@ -364,6 +361,7 @@ impl TitlebarView {
.unwrap_or(usize::MAX);
let workspace = self.workspace.clone();
let close_workspace = self.workspace.clone();
let open_for_change = open.to_vec();
Some(
@@ -380,7 +378,7 @@ impl TitlebarView {
.map(|entry| entry.label.clone())
.unwrap_or_else(|| id.clone());
let mut tab = Tab::new(id.clone(), label);
let mut tab = Tab::new(id.clone(), label).closeable(true);
if let Some(entry) = entry {
tab = tab.lead(entry.avatar(&lookup_directory, cx));
}
@@ -395,6 +393,11 @@ impl TitlebarView {
log_dropped(workspace.update(cx, |workspace, cx| {
workspace.activate_main(&id, cx);
}));
})
.on_close(move |index, _, cx| {
log_dropped(close_workspace.update(cx, |workspace, cx| {
workspace.close_main_at(index, cx);
}));
}),
)
}
@@ -502,40 +505,48 @@ impl TitlebarView {
Some(self.render_user(&profile, cx).into_any_element())
}
fn render_user(&self, profile: &Profile, cx: &App) -> impl IntoElement {
pub fn render_new_repository(&self) -> AnyElement {
let workspace = self.workspace.clone();
Button::new("add-repo")
.icon(IconRole::Plus)
.variant(ButtonVariant::Ghost)
.fully_rounded(true)
.tooltip(Tooltip::text("Create repository"))
.on_click(move |_, window, cx| {
dialogs::create::open(workspace.clone(), window, cx);
})
.into_any_element()
}
fn render_user(&self, profile: &Profile, _cx: &App) -> impl IntoElement {
let name = profile.name();
let picture = profile.picture();
let public_key = profile.public_key();
let weak = self.weak.clone();
let muted = cx.theme().colors.muted_foreground;
Menu::new("user-menu")
.open(self.user_menu_open)
.on_change({
let weak = weak.clone();
move |open, _, cx| {
log_dropped(weak.update(cx, |this, cx| {
this.user_menu_open = open;
cx.notify();
}));
}
.on_change(move |open, _, cx| {
log_dropped(weak.update(cx, |this, cx| {
this.user_menu_open = open;
cx.notify();
}));
})
.trigger({
let name = name.clone();
let picture = picture.clone();
move |_, _| {
h_flex()
.gap_1()
.items_center()
Button::new("user-menu-trigger")
.variant(ButtonVariant::Ghost)
.fully_rounded(true)
.padded(false)
.accessibility_label(name.clone())
.child(
Avatar::new(public_key)
.name(name.clone())
.picture(picture.clone()),
)
.child(
Icon::named(IconRole::ChevronDown)
.size(px(12.))
.color(muted),
.picture(picture.clone())
.fully_rounded(true),
)
.into_any_element()
}
@@ -550,35 +561,6 @@ impl TitlebarView {
]
})
}
pub fn render_actions(&self) -> AnyElement {
let workspace = self.workspace.clone();
h_flex()
.gap_1()
.child(
Button::new("open-command-palette")
.icon(IconRole::Search)
.variant(ButtonVariant::Ghost)
.tooltip(Tooltip::text("Command palette"))
.on_click({
let palette = self.palette.clone();
move |_, window, cx| {
palette.update(cx, |palette, cx| palette.toggle(window, cx));
}
}),
)
.child(
Button::new("add-repo")
.icon(IconRole::Plus)
.variant(ButtonVariant::Ghost)
.tooltip(Tooltip::text("Create repository"))
.on_click(move |_, window, cx| {
dialogs::create::open(workspace.clone(), window, cx);
}),
)
.into_any_element()
}
}
fn announcement_key(announcement: &Announcement) -> SharedString {