This commit is contained in:
2026-08-20 15:04:36 +07:00
parent 55fd3324b3
commit 584a8385a1
10 changed files with 556 additions and 324 deletions
@@ -6,13 +6,13 @@
use std::path::PathBuf;
use std::rc::Rc;
use dock::{Panel, PanelEvent};
use gpui::prelude::*;
use gpui::{
AnyElement, App, Context, Entity, EventEmitter, FocusHandle, Focusable, Pixels, Render,
ScrollStrategy, SharedString, Size, WeakEntity, Window, div, px, size,
};
use gpui_component::clipboard::Clipboard;
use dock::{Panel, PanelEvent};
use gpui_component::list::ListItem;
use gpui_component::resizable::{resizable_panel, v_resizable};
use gpui_component::scroll::{ScrollableElement, Scrollbar};
@@ -486,8 +486,6 @@ impl CommitDiffView {
v_flex()
.px_4()
.pt_2()
.pb_4()
.w_full()
.gap_4()
.child(
@@ -609,8 +607,8 @@ impl Render for CommitDiffView {
v_resizable("commit-diff")
.child(
resizable_panel()
.size(px(170.))
.size_range(px(100.)..px(400.))
.size(px(180.))
.size_range(px(120.)..px(420.))
.flex_none()
.bg(cx.theme().background)
.child(self.render_header(cx)),
+13 -11
View File
@@ -941,8 +941,7 @@ impl RepoDetailView {
v_flex()
.px_4()
.pt_2()
.pb_2()
.pb_4()
.w_full()
.gap_8()
.border_b_1()
@@ -1213,16 +1212,19 @@ impl Render for RepoDetailView {
v_flex()
.id("repo")
.size_full()
.gap_4()
.child(self.render_header(cx))
.child(match self.active_tab {
0 => h_flex()
.flex_1()
.w_full()
.overflow_hidden()
.child(Self::render_tree_column(tree_state, view, cx))
.child(self.render_content_column(pane_title, cx))
.into_any_element(),
_ => self.render_commits_tab(cx),
.map(|this| match self.active_tab {
0 => this.child(
h_flex()
.flex_1()
.w_full()
.overflow_hidden()
.child(Self::render_tree_column(tree_state, view, cx))
.child(self.render_content_column(pane_title, cx))
.into_any_element(),
),
_ => this.child(self.render_commits_tab(cx)),
})
}
}
+39 -26
View File
@@ -1,7 +1,7 @@
use std::sync::Arc;
use assets::CustomIconName;
use dock::{DockArea, DockPlacement, Panel, PanelEvent, title_bar_drag_handlers};
use dock::{DockArea, DockPlacement, Panel, PanelEvent, TAB_BAR_HEIGHT, title_bar_drag_handlers};
use gpui::prelude::*;
use gpui::{
App, ClickEvent, Context, ElementId, EventEmitter, FocusHandle, Focusable, Render,
@@ -11,7 +11,7 @@ use gpui_component::avatar::Avatar;
use gpui_component::button::{Button, ButtonVariants};
use gpui_component::input::InputState;
use gpui_component::{ActiveTheme, Icon, IconName, Sizable, StyledExt, h_flex, v_flex};
use signed_state::{Backend, BackendEvent, ProfileStore};
use signed_state::{Backend, BackendEvent, Profile, ProfileStore};
use super::RepoListView;
@@ -100,6 +100,42 @@ impl SidebarPanel {
fn open_import(&mut self, window: &mut Window, cx: &mut Context<Self>) {
import_dialog::open(window, cx);
}
/// Render the user avatar and name in the sidebar, wrapped in the window titlebar drag area.
fn render_user(
&self,
profile: &Profile,
window: &mut Window,
cx: &mut Context<Self>,
) -> impl IntoElement {
let name = profile.name();
let picture = profile.picture();
title_bar_drag_handlers(
h_flex()
.id("user")
.h(TAB_BAR_HEIGHT)
.when(cfg!(target_os = "macos"), |this| this.pl(px(80.)))
.child(
div().child(
Button::new("user").text().dropdown_caret(true).child(
h_flex()
.gap_1()
.child(
Avatar::new()
.name(name.clone())
.when_some(picture, |this, url| this.src(url))
.small()
.border_0(),
)
.child(div().text_xs().font_semibold().child(name)),
),
),
),
window,
cx,
)
}
}
impl Panel for SidebarPanel {
@@ -180,30 +216,7 @@ impl Render for SidebarPanel {
div()
.flex_1()
.when_some(profile.as_ref(), |this, profile| {
let name = profile.name();
let picture = profile.picture();
this.child(title_bar_drag_handlers(
h_flex()
.id("sidebar-profile")
.h_12()
.px_3()
.gap_2()
// The macOS traffic lights overlay the
// top-left corner of the window; keep the
// profile content clear of them.
.when(cfg!(target_os = "macos"), |this| this.pl(px(80.)))
.child(
Avatar::new()
.name(name.clone())
.when_some(picture, |this, url| this.src(url))
.small()
.border_0(),
)
.child(div().text_sm().child(name)),
window,
cx,
))
this.child(self.render_user(profile, window, cx))
})
.child(
v_flex()