diff --git a/Cargo.lock b/Cargo.lock index 8161f50..9603c10 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -718,9 +718,9 @@ checksum = "5c0e531d93d39c34eef561e929e8a7f86d77a5af08aac4f6d6e39976c51858e9" [[package]] name = "bumpalo" -version = "3.20.3" +version = "3.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" +checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db" [[package]] name = "bytemuck" @@ -801,9 +801,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ff2a8126fff0f8c839080d619675a585e61720bb12d2baceae45769fd66f155" +checksum = "33ef9e3e8154a45c7a95cff4c1299702106ad94062d7bb85fdc5d3a5afd91d45" dependencies = [ "find-msvc-tools", "jobserver", @@ -1221,9 +1221,9 @@ dependencies = [ [[package]] name = "ctor" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914a755b7c2d4af2bdcff7ce1739e2db9a1b81a9b07123d8015786ae03c0980d" +checksum = "ea691ed9f36489d087419b8b2ba3ef27d89621380b4178c73e2445a379e4e0f4" dependencies = [ "link-section", "linktime-proc-macro", @@ -1574,12 +1574,12 @@ checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" [[package]] name = "errno" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -2397,7 +2397,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7518b930f6aeb75e871d32ce873c2ae46e35cef19b5a0b039d4337f651d897cd" dependencies = [ "bstr", - "hashbrown 0.16.1", + "hashbrown 0.17.1", ] [[package]] @@ -3059,7 +3059,7 @@ dependencies = [ [[package]] name = "gpui-native-core" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=d1a79fb9af4c6532166c5d28e9f493efa6d97b18#d1a79fb9af4c6532166c5d28e9f493efa6d97b18" +source = "git+https://git.reya.info/reya/gpui-native-kit#a7abeea8c6c377ab36e6675371743a31d0816c2a" dependencies = [ "cpal", "flume 0.12.0", @@ -3075,7 +3075,7 @@ dependencies = [ [[package]] name = "gpui-native-data" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=d1a79fb9af4c6532166c5d28e9f493efa6d97b18#d1a79fb9af4c6532166c5d28e9f493efa6d97b18" +source = "git+https://git.reya.info/reya/gpui-native-kit#a7abeea8c6c377ab36e6675371743a31d0816c2a" dependencies = [ "gpui", "gpui-native-core", @@ -3087,7 +3087,7 @@ dependencies = [ [[package]] name = "gpui-native-editor" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=d1a79fb9af4c6532166c5d28e9f493efa6d97b18#d1a79fb9af4c6532166c5d28e9f493efa6d97b18" +source = "git+https://git.reya.info/reya/gpui-native-kit#a7abeea8c6c377ab36e6675371743a31d0816c2a" dependencies = [ "gpui", "gpui-native-core", @@ -3106,7 +3106,7 @@ dependencies = [ [[package]] name = "gpui-native-icons" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=d1a79fb9af4c6532166c5d28e9f493efa6d97b18#d1a79fb9af4c6532166c5d28e9f493efa6d97b18" +source = "git+https://git.reya.info/reya/gpui-native-kit#a7abeea8c6c377ab36e6675371743a31d0816c2a" dependencies = [ "anyhow", "gpui", @@ -3115,7 +3115,7 @@ dependencies = [ [[package]] name = "gpui-native-kit" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=d1a79fb9af4c6532166c5d28e9f493efa6d97b18#d1a79fb9af4c6532166c5d28e9f493efa6d97b18" +source = "git+https://git.reya.info/reya/gpui-native-kit#a7abeea8c6c377ab36e6675371743a31d0816c2a" dependencies = [ "gpui", "gpui-native-core", @@ -3129,7 +3129,7 @@ dependencies = [ [[package]] name = "gpui-native-layout" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=d1a79fb9af4c6532166c5d28e9f493efa6d97b18#d1a79fb9af4c6532166c5d28e9f493efa6d97b18" +source = "git+https://git.reya.info/reya/gpui-native-kit#a7abeea8c6c377ab36e6675371743a31d0816c2a" dependencies = [ "gpui", "gpui-native-core", @@ -3141,7 +3141,7 @@ dependencies = [ [[package]] name = "gpui-native-theme" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=d1a79fb9af4c6532166c5d28e9f493efa6d97b18#d1a79fb9af4c6532166c5d28e9f493efa6d97b18" +source = "git+https://git.reya.info/reya/gpui-native-kit#a7abeea8c6c377ab36e6675371743a31d0816c2a" dependencies = [ "anyhow", "async-channel", @@ -3162,7 +3162,7 @@ dependencies = [ [[package]] name = "gpui-native-utils" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=d1a79fb9af4c6532166c5d28e9f493efa6d97b18#d1a79fb9af4c6532166c5d28e9f493efa6d97b18" +source = "git+https://git.reya.info/reya/gpui-native-kit#a7abeea8c6c377ab36e6675371743a31d0816c2a" dependencies = [ "gpui", "gpui-native-theme", @@ -4105,9 +4105,9 @@ checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" [[package]] name = "jiff" -version = "0.2.42" +version = "0.2.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fefca06093eeaed707a905795e68206da0edca4edef23d2a3997a3ddbee462aa" +checksum = "175dc66334db3b9ab9985bf8b61cfed50dc16d20964bb47f9e479adcae984a7f" dependencies = [ "jiff-core", "jiff-static", @@ -4121,18 +4121,18 @@ dependencies = [ [[package]] name = "jiff-core" -version = "0.1.4" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a24020db0ee88d1c681d677681bd31f9f4ea189a455425223d52ce4f1508aa" +checksum = "e599b80292e597019b8b3e392de3f4bea2959ddfb8c7dff60e035e9e311a2c1b" dependencies = [ "log", ] [[package]] name = "jiff-static" -version = "0.2.42" +version = "0.2.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d3213549742662eea1a18e6c5af9be5dfbabeb7611ab71356a54928ec398f0" +checksum = "c7b1af7547d47354bc438d797e3854601bde8f8d185780c5ba4ab27afa54f1ba" dependencies = [ "jiff-core", "proc-macro2", @@ -4142,9 +4142,9 @@ dependencies = [ [[package]] name = "jiff-tzdb" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa8377070c6bae868759445e5a77f66d84f0b72f3a054bfb00e6d038b8282da7" +checksum = "0980fca2cc272465bd60e82397607ba9f33add9e48defd77923301bbd03808f2" [[package]] name = "jiff-tzdb-platform" @@ -4344,9 +4344,9 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "link-section" -version = "0.19.3" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c29a617ce3df32c08497bdc1ab6e2376e0b17948ac166a2fbe5977c5954cd9" +checksum = "4d9aae57673c1a235149777a74d152f3210ebd3e3b13346d2cdb6809e566bd3c" [[package]] name = "linktime-proc-macro" @@ -4606,9 +4606,9 @@ dependencies = [ [[package]] name = "mio" -version = "1.2.4" +version = "1.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +checksum = "20521a903f02b0a573cd6840e9d0a5a0cc043d361fe924092cd70f8556cc9c4a" dependencies = [ "libc", "log", @@ -4776,7 +4776,7 @@ dependencies = [ "chacha20poly1305", "faster-hex", "opaquerr", - "rand 0.10.3", + "rand 0.10.4", "scrypt", "secp256k1", "serde", @@ -4860,7 +4860,7 @@ dependencies = [ "nostr-database", "nostr-gossip", "opaquerr", - "rand 0.10.3", + "rand 0.10.4", "tokio", "tokio-stream", "tracing", @@ -4897,14 +4897,14 @@ dependencies = [ "mac-notification-sys", "serde", "tauri-winrt-notification", - "zbus 6.2.1", + "zbus 6.3.0", ] [[package]] name = "notify-types" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c491a384baf9fec20df565cdb8138a12809d4c7439763b566eb8114c5d59979" +checksum = "cbd044e85df3d939d8e32a1c35a3b737c7d0a4eeb7acd737bd207644e00f4e5f" dependencies = [ "bitflags 2.13.2", ] @@ -5915,7 +5915,7 @@ dependencies = [ "bytes", "getrandom 0.4.3", "lru-slab", - "rand 0.10.3", + "rand 0.10.4", "rand_pcg", "ring", "rustc-hash 2.1.3", @@ -5939,7 +5939,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -5986,9 +5986,9 @@ dependencies = [ [[package]] name = "rand" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" +checksum = "8f6fa277c67e6ea590466f04c3fe82cb509f0864fe470643e5570de9514a9b11" dependencies = [ "chacha20 0.10.2", "getrandom 0.4.3", @@ -6437,7 +6437,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -6505,7 +6505,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -6516,9 +6516,9 @@ checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f" [[package]] name = "rustls-webpki" -version = "0.103.16" +version = "0.103.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" +checksum = "e3a0760a887c14823fca5a1c970b01d47c328c696c0c64829d1df50e8f853fd5" dependencies = [ "aws-lc-rs", "ring", @@ -7381,7 +7381,7 @@ dependencies = [ "getrandom 0.4.3", "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -8574,7 +8574,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -9201,9 +9201,9 @@ dependencies = [ [[package]] name = "zbus" -version = "6.2.1" +version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ddb2961d9587ef9f24ad14cde1c3bc4c5edc9f1525932a8cffdd5bd98886eb9" +checksum = "6b4aae740b23927ceabed962431abab2cdefb9f7f885e5bbab062da09bf580e4" dependencies = [ "async-trait", "bitflags 2.13.2", @@ -9220,7 +9220,7 @@ dependencies = [ "uuid", "windows-sys 0.61.2", "winnow 1.0.5", - "zbus_macros 6.2.1", + "zbus_macros 6.3.0", "zbus_utils", "zcheapstr", "zruntime", @@ -9243,9 +9243,9 @@ dependencies = [ [[package]] name = "zbus_macros" -version = "6.2.1" +version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "083b38add47c340fc12ec560124fb1d9c23acb584f7021099f85ec6587a03c54" +checksum = "37c9dd4beaf145c16fcb2902862f50da86e54aed13dd368ddf64a1d17e6b8529" dependencies = [ "proc-macro2", "quote", @@ -9488,9 +9488,9 @@ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" [[package]] name = "zruntime" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23ef5ed7d628cdf0af82f93dfe03330a8e37383bf7422a1d3d6eb72326680be5" +checksum = "ce6a55d4f521760475a30f7b96779508fe8c40dc834478709454dd1d5f0ebc72" dependencies = [ "futures-core", "futures-io", diff --git a/Cargo.toml b/Cargo.toml index fbdbc63..f681989 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ gpui = { git = "https://github.com/zed-industries/zed", rev = "f8cfc7ed9e57503de gpui_platform = { git = "https://github.com/zed-industries/zed", rev = "f8cfc7ed9e57503def9479138894f3139f5400cc", features = ["font-kit"] } reqwest_client = { git = "https://github.com/zed-industries/zed", rev = "f8cfc7ed9e57503def9479138894f3139f5400cc" } -gpui-native-kit = { git = "https://git.reya.info/reya/gpui-native-kit", rev = "d1a79fb9af4c6532166c5d28e9f493efa6d97b18", features = ["layout", "editor"] } +gpui-native-kit = { git = "https://git.reya.info/reya/gpui-native-kit", features = ["layout", "editor"] } settings = { path = "crates/settings" } signed_app = { path = "crates/signed_app" } diff --git a/crates/signed_app/src/issues/mod.rs b/crates/signed_app/src/issues/mod.rs index 748e789..0f6b8bd 100644 --- a/crates/signed_app/src/issues/mod.rs +++ b/crates/signed_app/src/issues/mod.rs @@ -14,6 +14,7 @@ use gpui_native_kit::layout::panel::Panel; use gpui_native_kit::scrollbar::Scrollbar; use gpui_native_kit::segmented::{Segmented, SegmentedOption}; use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; +use helpers::{IssueFilter, StatusCounts, filter_by_status}; use metadata::ProfileDirectory; use nostr::prelude::PublicKey; use signed_core::GitEvent; @@ -21,8 +22,6 @@ use signed_state::RepoStore; use utils::relative_time; use self::detail::IssueDetailView; -use helpers::{IssueFilter, StatusCounts, filter_by_status}; - use crate::shared::panels; use crate::shared::widgets::status_badge; use crate::workspace::Workspace; @@ -74,6 +73,11 @@ impl IssuesView { } } + /// Total number of issues across all statuses, for the sidebar label. + pub fn total_count(&self) -> usize { + self.counts.total + } + fn rebuild(&mut self, cx: &mut Context) { let filter = self.filter; diff --git a/crates/signed_app/src/pull_requests/mod.rs b/crates/signed_app/src/pull_requests/mod.rs index 28bcb5d..c063d44 100644 --- a/crates/signed_app/src/pull_requests/mod.rs +++ b/crates/signed_app/src/pull_requests/mod.rs @@ -82,6 +82,11 @@ impl PullRequestsView { } } + /// Total number of pull requests across all statuses, for the sidebar label. + pub fn total_count(&self) -> usize { + self.counts.total + } + fn rebuild(&mut self, cx: &mut Context) { let store = self.store.read(cx); let filter = self.filter; diff --git a/crates/signed_app/src/repo/header.rs b/crates/signed_app/src/repo/header.rs index 091da80..bb155a1 100644 --- a/crates/signed_app/src/repo/header.rs +++ b/crates/signed_app/src/repo/header.rs @@ -9,7 +9,7 @@ use gpui::{ use gpui_native_kit::avatar::Avatar; use gpui_native_kit::button::{Button, ButtonVariant}; use gpui_native_kit::clipboard::ClipboardButton; -use gpui_native_kit::common::{Sizable as _, h_flex, v_flex}; +use gpui_native_kit::common::{h_flex, v_flex}; use gpui_native_kit::dropdown_menu::DropdownMenu; use gpui_native_kit::icons::{Icon, IconRole}; use gpui_native_kit::menu::MenuItem; @@ -18,12 +18,10 @@ use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use gpui_native_kit::tooltip::Tooltip; use signed_state::{Backend, Nip34Kind}; -use super::RepoDetailView; -use super::actions; -use super::dialogs; use super::helpers::{ ShareTargets, bound_repo_label, clone_group, fork_row, nostr_clone_url, repo_display_name, }; +use super::{RepoDetailView, actions, dialogs}; use crate::pull_requests::NewPullRequestView; impl RepoDetailView { @@ -125,20 +123,19 @@ impl RepoDetailView { .flex_none() .p_4() .w_full() - .gap_6() .border_b_1() .border_color(cx.theme().colors.border) .child( h_flex() .w_full() - .gap_4() + .gap_6() .items_start() .justify_between() .child( v_flex() .flex_1() .min_w_0() - .gap_1() + .gap_2() .child( h_flex() .gap_2() @@ -151,23 +148,11 @@ impl RepoDetailView { .min_w_0() .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) - .line_clamp(2) + .line_clamp(3) .child(description), ) .when_some(fork_row(&announcement, cx), |this, row| this.child(row)) - .child( - h_flex() - .mt_2() - .w_full() - .gap_1() - .child( - div() - .typeset(TextRole::Caption2, cx) - .text_color(cx.theme().colors.muted_foreground) - .child("Maintainers:"), - ) - .child(self.render_maintainers(cx)), - ), + .child(h_flex().mt_4().gap_2().child(self.render_maintainers(cx))), ) .child( h_flex() @@ -210,9 +195,7 @@ impl RepoDetailView { } }) .items(move |_, cx| { - let owner = Backend::global(cx) - .read(cx) - .current_user() + let owner = Backend::global(cx).read(cx).current_user() == Some(announcement_for_menu.owner); let mut items = vec![MenuItem::new("About").handler({ @@ -235,41 +218,51 @@ impl RepoDetailView { items.push(MenuItem::new("Republish").handler({ let weak = weak_menu_items.clone(); move |window, cx| { - if let Err(error) = weak.update(cx, |this, cx| { - this.push_repository(window, cx); - }) { + if let Err(error) = + weak.update(cx, |this, cx| { + this.push_repository(window, cx); + }) + { log::warn!("failed to republish: {error}"); } } })); - items.push(MenuItem::new("Reset remote to local").handler({ - let weak = weak_menu_items.clone(); - move |window, cx| { - if let Err(error) = weak.update(cx, |this, cx| { - this.reset_remote(window, cx); - }) { - log::warn!("failed to reset remote: {error}"); + items.push( + MenuItem::new("Reset remote to local").handler({ + let weak = weak_menu_items.clone(); + move |window, cx| { + if let Err(error) = + weak.update(cx, |this, cx| { + this.reset_remote(window, cx); + }) + { + log::warn!( + "failed to reset remote: {error}" + ); + } } - } - })); + }), + ); items.push(MenuItem::separator()); items.push( - MenuItem::new("Delete") - .destructive(true) - .handler({ + MenuItem::new("Delete").destructive(true).handler( + { let weak = weak_menu_items.clone(); move |window, cx| { if let Err(error) = weak.update(cx, |this, cx| { - this.delete_repository(window, cx); + this.delete_repository( + window, cx, + ); }) { log::warn!( - "failed to delete repository: {error}" + "failed to delete: {error}" ); } } - }), + }, + ), ); } @@ -330,16 +323,18 @@ impl RepoDetailView { .child("No git clone urls."), ) }) - .children(git_for_popover.iter().enumerate().map( - |(ix, command)| { - ClipboardButton::new( - SharedString::from(format!( - "copy-git-{ix}" - )), - command.clone(), - ) - }, - )), + .children( + git_for_popover.iter().enumerate().map( + |(ix, command)| { + ClipboardButton::new( + SharedString::from(format!( + "copy-git-{ix}" + )), + command.clone(), + ) + }, + ), + ), ) .child( h_flex().justify_end().child( @@ -351,7 +346,9 @@ impl RepoDetailView { move |_, window, cx| { if let Err(error) = weak.update(cx, |this, cx| { - this.clone_to_folder(window, cx); + this.clone_to_folder( + window, cx, + ); }) { log::warn!( @@ -442,6 +439,7 @@ impl RepoDetailView { }; let mut seen = HashSet::new(); + let rest: Vec<_> = announcement .maintainers .iter() @@ -464,8 +462,7 @@ impl RepoDetailView { .child( Avatar::new(announcement.owner) .name(owner_name.clone()) - .picture(owner.picture()) - .small(), + .picture(owner.picture()), ) .child( div() diff --git a/crates/signed_app/src/repo/mod.rs b/crates/signed_app/src/repo/mod.rs index 079bd1d..a469af4 100644 --- a/crates/signed_app/src/repo/mod.rs +++ b/crates/signed_app/src/repo/mod.rs @@ -7,7 +7,7 @@ use gpui::prelude::FluentBuilder as _; use gpui::{ AnyElement, App, AppContext as _, Context, Entity, InteractiveElement as _, IntoElement, ParentElement as _, PathPromptOptions, Render, SharedString, Styled as _, Subscription, Task, - WeakEntity, Window, div, px, + WeakEntity, Window, div, }; use gpui_native_kit::alert::{Alert, AlertSeverity}; use gpui_native_kit::badge::Badge; @@ -48,9 +48,6 @@ use crate::pull_requests::PullRequestsView; use crate::shared::tree::{build_tree_items, sorted_worktree_paths}; use crate::workspace::Workspace; -const REPO_SIDEBAR_WIDTH: f32 = 240.; -const REPO_SIDEBAR_ROW_HEIGHT: f32 = 30.; - #[derive(Clone, Copy, PartialEq, Eq)] pub(super) enum RepoSection { Files, @@ -1211,14 +1208,11 @@ impl RepoDetailView { } fn render_sidebar(&self, cx: &mut Context) -> AnyElement { - let tree = self.files.read(cx).render_tree(self.files.downgrade()); - let commits = self - .history - .read(cx) - .commit_count() - .map(|count| SharedString::from(format!("Commits ({count})"))) - .unwrap_or_else(|| SharedString::from("Commits")); + let files = self.files.clone(); + let commit_count = self.history.read(cx).commit_count(); let include_issues = self.store.read(cx).addr().is_some(); + let issue_count = include_issues.then(|| self.issues.read(cx).total_count()); + let pull_count = include_issues.then(|| self.pulls.read(cx).total_count()); let selected = match self.active_section { RepoSection::Commits => Some(0), RepoSection::Issues if include_issues => Some(1), @@ -1226,11 +1220,10 @@ impl RepoDetailView { _ => None, }; let weak = cx.entity().downgrade(); - let rows = if include_issues { 3.0 } else { 1.0 }; - let nav_height = px(REPO_SIDEBAR_ROW_HEIGHT * rows + 8.); - let nav = Sidebar::new("repo-sidebar-nav") + Sidebar::new("repo-sidebar") .selected(selected) + .border_right(true) .on_change(move |index, _, cx| { let section = match (index, include_issues) { (Some(0), _) => RepoSection::Commits, @@ -1245,43 +1238,34 @@ impl RepoDetailView { }) .entries(move |_, cx| { let color = cx.theme().colors.muted_foreground; + let mut entries = vec![ - SidebarEntry::row("repo-nav-commits", commits.clone()) - .prefix(Icon::named(CustomIconName::GitCommit).small().color(color)), + SidebarEntry::row("repo-nav-commits", "Commits") + .prefix(Icon::named(CustomIconName::GitCommit).color(color)) + .when_some(commit_count, |entry, count| entry.detail(count.to_string())), ]; + if include_issues { entries.push( - SidebarEntry::row("repo-nav-issues", "Issues").prefix( - Icon::named(CustomIconName::GitIssueDone) - .small() - .color(color), - ), + SidebarEntry::row("repo-nav-issues", "Issues") + .prefix(Icon::named(CustomIconName::GitIssueDone).color(color)) + .when_some(issue_count, |entry, count| entry.detail(count.to_string())), ); entries.push( - SidebarEntry::row("repo-nav-pulls", "Pull requests").prefix( - Icon::named(CustomIconName::GitPullRequest) - .small() - .color(color), - ), + SidebarEntry::row("repo-nav-pulls", "Pull requests") + .prefix(Icon::named(CustomIconName::GitPullRequest).color(color)) + .when_some(pull_count, |entry, count| entry.detail(count.to_string())), ); } - entries - }); - div() - .w(px(REPO_SIDEBAR_WIDTH)) - .h_full() - .flex_none() - .border_r_1() - .border_color(cx.theme().colors.border) - .child( - Sidebar::new("repo-sidebar").content( - v_flex() - .size_full() - .child(div().h(nav_height).flex_none().child(nav)) - .child(div().flex_1().min_h_0().px_2().pb_2().child(tree)), - ), - ) + entries.push(SidebarEntry::header("Files")); + + entries.push(SidebarEntry::custom( + files.read(cx).render_tree(files.downgrade()), + )); + + entries + }) .into_any_element() } @@ -1299,6 +1283,8 @@ impl Panel for RepoDetailView {} impl Render for RepoDetailView { fn render(&mut self, _window: &mut Window, cx: &mut Context) -> impl IntoElement { + let weak = cx.entity().downgrade(); + let banner = self .render_ready_banner(cx) .or_else(|| self.render_push_banner(cx)) @@ -1312,8 +1298,6 @@ impl Render for RepoDetailView { .map(SharedString::from) }); - let weak = cx.entity().downgrade(); - v_flex() .id("repo") .size_full()