diff --git a/Cargo.lock b/Cargo.lock index dcaa6f0..ab991d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1238,7 +1238,7 @@ dependencies = [ [[package]] name = "collections" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "gpui_util", "indexmap", @@ -1704,7 +1704,7 @@ dependencies = [ [[package]] name = "derive_refineable" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "proc-macro2", "quote", @@ -3484,7 +3484,7 @@ dependencies = [ [[package]] name = "gpui" version = "0.2.2" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "accesskit", "anyhow", @@ -3555,7 +3555,7 @@ dependencies = [ [[package]] name = "gpui-base" version = "0.5.2" -source = "git+https://github.com/longbridge/gpui-component#0e2fb7acdf1d40d4db3d458da3893fe9865e901e" +source = "git+https://github.com/longbridge/gpui-component#b4393e22d3a04a880bc187dfdabca9b1eeee270a" dependencies = [ "aho-corasick", "anyhow", @@ -3587,7 +3587,7 @@ dependencies = [ [[package]] name = "gpui-component" version = "0.5.2" -source = "git+https://github.com/longbridge/gpui-component#0e2fb7acdf1d40d4db3d458da3893fe9865e901e" +source = "git+https://github.com/longbridge/gpui-component#b4393e22d3a04a880bc187dfdabca9b1eeee270a" dependencies = [ "anyhow", "chrono", @@ -3667,7 +3667,7 @@ dependencies = [ [[package]] name = "gpui-component-assets" version = "0.5.1" -source = "git+https://github.com/longbridge/gpui-component#0e2fb7acdf1d40d4db3d458da3893fe9865e901e" +source = "git+https://github.com/longbridge/gpui-component#b4393e22d3a04a880bc187dfdabca9b1eeee270a" dependencies = [ "anyhow", "gpui", @@ -3681,7 +3681,7 @@ dependencies = [ [[package]] name = "gpui-component-macros" version = "0.5.1" -source = "git+https://github.com/longbridge/gpui-component#0e2fb7acdf1d40d4db3d458da3893fe9865e901e" +source = "git+https://github.com/longbridge/gpui-component#b4393e22d3a04a880bc187dfdabca9b1eeee270a" dependencies = [ "proc-macro2", "quote", @@ -3691,7 +3691,7 @@ dependencies = [ [[package]] name = "gpui_apple" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "anyhow", "block", @@ -3714,7 +3714,7 @@ dependencies = [ [[package]] name = "gpui_linux" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "accesskit", "accesskit_unix", @@ -3760,7 +3760,7 @@ dependencies = [ [[package]] name = "gpui_macos" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "accesskit", "accesskit_macos", @@ -3806,7 +3806,7 @@ dependencies = [ [[package]] name = "gpui_macros" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -3817,7 +3817,7 @@ dependencies = [ [[package]] name = "gpui_platform" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "console_error_panic_hook", "gpui", @@ -3830,7 +3830,7 @@ dependencies = [ [[package]] name = "gpui_shared_string" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "schemars", "serde", @@ -3840,7 +3840,7 @@ dependencies = [ [[package]] name = "gpui_util" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "anyhow", "log", @@ -3850,7 +3850,7 @@ dependencies = [ [[package]] name = "gpui_web" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "anyhow", "console_error_panic_hook", @@ -3874,7 +3874,7 @@ dependencies = [ [[package]] name = "gpui_wgpu" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "anyhow", "bytemuck", @@ -3900,7 +3900,7 @@ dependencies = [ [[package]] name = "gpui_windows" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "accesskit", "accesskit_windows", @@ -4204,7 +4204,7 @@ dependencies = [ [[package]] name = "http_client" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "anyhow", "async-compression", @@ -4224,7 +4224,7 @@ dependencies = [ [[package]] name = "http_client_tls" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "log", "rustls", @@ -5180,7 +5180,7 @@ dependencies = [ [[package]] name = "media" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "anyhow", "bindgen", @@ -6228,7 +6228,7 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "perf" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "collections", "serde", @@ -7016,7 +7016,7 @@ dependencies = [ [[package]] name = "refineable" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "derive_refineable", ] @@ -7099,7 +7099,7 @@ dependencies = [ [[package]] name = "reqwest_client" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "anyhow", "bytes", @@ -7477,7 +7477,7 @@ dependencies = [ [[package]] name = "scheduler" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "async-task", "backtrace", @@ -8170,7 +8170,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sum_tree" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "heapless 0.9.3", "log", @@ -9554,7 +9554,7 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "util_macros" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "perf", "quote", @@ -11319,7 +11319,7 @@ checksum = "34b31d188d9d685a4f9c7b46d6e36631b07058d2cfe190267adce54dc230bf12" [[package]] name = "zlog" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "anyhow", "chrono", @@ -11336,7 +11336,7 @@ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" [[package]] name = "ztracing" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" dependencies = [ "tracing", "tracing-subscriber", @@ -11347,7 +11347,7 @@ dependencies = [ [[package]] name = "ztracing_macro" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#e3adf43f37d7a2a9c165a78b255d293b0848d2d0" +source = "git+https://github.com/zed-industries/zed#399258feeaf90ad8a3a208c99221ee87b6452f38" [[package]] name = "zune-core" diff --git a/crates/workspace/src/views/repo_list.rs b/crates/workspace/src/views/repo_list.rs index 6ce8437..9e4d5f5 100644 --- a/crates/workspace/src/views/repo_list.rs +++ b/crates/workspace/src/views/repo_list.rs @@ -18,7 +18,8 @@ use utils::relative_time; use super::RepoDetailView; use crate::image_cache::{MAX_IMAGES, image_cache}; -const CARD_HEIGHT: f32 = 160.; +const COLUMNS: usize = 2; +const CARD_HEIGHT: f32 = 32. + 64. + 48. + 2. + 6.; /// Browse all announced repositories (works anonymously). pub struct RepoListView { @@ -39,10 +40,11 @@ impl RepoListView { let store = cx.new(|cx| RepoListStore::new(None, cx)); let subscription = cx.observe(&store, |this, store, cx| { - let count = store.read(cx).announcements.len(); + // Each virtual list row holds `COLUMNS` repo cards. + let rows = store.read(cx).announcements.len().div_ceil(COLUMNS); - if this.item_sizes.len() != count { - this.item_sizes = Rc::new(vec![size(px(0.), px(CARD_HEIGHT)); count]); + if this.item_sizes.len() != rows { + this.item_sizes = Rc::new(vec![size(px(0.), px(CARD_HEIGHT)); rows]); } }); @@ -106,14 +108,17 @@ impl RepoListView { v_flex() .id(ix) - .px_4() - .w_full() - .border_b(px(1.)) + .flex_1() + .h_full() + .min_w_0() + .px_3() + .rounded(cx.theme().radius) + .border_1() .border_color(cx.theme().border) .hover(|this| this.bg(cx.theme().list_hover)) .child( h_flex() - .h_12() + .h_8() .text_sm() .font_semibold() .whitespace_nowrap() @@ -123,9 +128,11 @@ impl RepoListView { .child( div() .h_16() + .min_w_0() .text_sm() .text_color(cx.theme().muted_foreground) .line_clamp(2) + .text_ellipsis() .child(description), ) .child( @@ -235,10 +242,29 @@ impl Render for RepoListView { v_virtual_list(view, "repos", sizes, move |this, range, _window, cx| { let mut items = vec![]; - for ix in range { - let announcement: &Announcement = &announcements[ix]; - let activity = last_activity.get(&announcement.addr()).copied(); - items.push(this.render_card(ix, announcement, activity, cx)); + for row in range { + let mut row_cards = vec![]; + + for col in 0..COLUMNS { + let ix = row * COLUMNS + col; + let Some(announcement) = announcements.get(ix) else { + break; + }; + let activity = last_activity.get(&announcement.addr()).copied(); + row_cards.push(this.render_card(ix, announcement, activity, cx)); + } + + items.push( + h_flex() + .id(row) + .w_full() + .h_full() + .gap_3() + .px_3() + .pb_3() + .children(row_cards) + .into_any_element(), + ); } items