diff --git a/Cargo.lock b/Cargo.lock index 47a1743..873b1c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -202,11 +202,11 @@ checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" [[package]] name = "ar_archive_writer" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4087686b4b0a3427190bae57a1d9a478dbb2d40c5dc1bd6e2b6d797913bdd348" +checksum = "73cd58deff2140a0a8eae87e417bd01db68a33e148aa93d1e8cd837e55e312b6" dependencies = [ - "object", + "object 0.39.1", ] [[package]] @@ -635,7 +635,7 @@ dependencies = [ "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.37.3", "rustc-demangle", "windows-link 0.2.1", ] @@ -1232,7 +1232,7 @@ dependencies = [ [[package]] name = "collections" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "gpui_util", "indexmap", @@ -1716,7 +1716,7 @@ dependencies = [ [[package]] name = "derive_refineable" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "proc-macro2", "quote", @@ -2612,7 +2612,7 @@ dependencies = [ [[package]] name = "gpui" version = "0.2.2" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "accesskit", "anyhow", @@ -2694,7 +2694,7 @@ dependencies = [ [[package]] name = "gpui_linux" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "accesskit", "accesskit_unix", @@ -2746,7 +2746,7 @@ dependencies = [ [[package]] name = "gpui_macos" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "accesskit", "accesskit_macos", @@ -2795,7 +2795,7 @@ dependencies = [ [[package]] name = "gpui_macros" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -2806,7 +2806,7 @@ dependencies = [ [[package]] name = "gpui_platform" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "console_error_panic_hook", "gpui", @@ -2819,7 +2819,7 @@ dependencies = [ [[package]] name = "gpui_shared_string" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "schemars", "serde", @@ -2829,7 +2829,7 @@ dependencies = [ [[package]] name = "gpui_tokio" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "anyhow", "gpui", @@ -2840,7 +2840,7 @@ dependencies = [ [[package]] name = "gpui_util" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "anyhow", "log", @@ -2850,7 +2850,7 @@ dependencies = [ [[package]] name = "gpui_web" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "anyhow", "console_error_panic_hook", @@ -2873,7 +2873,7 @@ dependencies = [ [[package]] name = "gpui_wgpu" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "anyhow", "bytemuck", @@ -2903,7 +2903,7 @@ dependencies = [ [[package]] name = "gpui_windows" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "accesskit", "accesskit_windows", @@ -3193,7 +3193,7 @@ dependencies = [ [[package]] name = "http_client" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "anyhow", "async-compression", @@ -3213,7 +3213,7 @@ dependencies = [ [[package]] name = "http_client_tls" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "rustls", "rustls-platform-verifier", @@ -4020,7 +4020,7 @@ dependencies = [ [[package]] name = "media" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "anyhow", "bindgen", @@ -4213,8 +4213,8 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" [[package]] name = "nostr" -version = "0.45.0-alpha.7" -source = "git+https://github.com/rust-nostr/nostr#affbc9e8f918ead0f1857a6c7d4afdc16f812a6c" +version = "0.45.0-alpha.8" +source = "git+https://github.com/rust-nostr/nostr#83cb556fa59259eb30f3df63f153f42aab77519b" dependencies = [ "aes", "base64", @@ -4238,8 +4238,8 @@ dependencies = [ [[package]] name = "nostr-blossom" -version = "0.45.0-alpha.7" -source = "git+https://github.com/rust-nostr/nostr#affbc9e8f918ead0f1857a6c7d4afdc16f812a6c" +version = "0.45.0-alpha.8" +source = "git+https://github.com/rust-nostr/nostr#83cb556fa59259eb30f3df63f153f42aab77519b" dependencies = [ "base64", "bitcoin_hashes", @@ -4251,8 +4251,8 @@ dependencies = [ [[package]] name = "nostr-connect" -version = "0.45.0-alpha.7" -source = "git+https://github.com/rust-nostr/nostr#affbc9e8f918ead0f1857a6c7d4afdc16f812a6c" +version = "0.45.0-alpha.8" +source = "git+https://github.com/rust-nostr/nostr#83cb556fa59259eb30f3df63f153f42aab77519b" dependencies = [ "async-utility", "futures-core", @@ -4265,8 +4265,8 @@ dependencies = [ [[package]] name = "nostr-database" -version = "0.45.0-alpha.7" -source = "git+https://github.com/rust-nostr/nostr#affbc9e8f918ead0f1857a6c7d4afdc16f812a6c" +version = "0.45.0-alpha.8" +source = "git+https://github.com/rust-nostr/nostr#83cb556fa59259eb30f3df63f153f42aab77519b" dependencies = [ "btreecap", "flatbuffers", @@ -4276,8 +4276,8 @@ dependencies = [ [[package]] name = "nostr-gossip" -version = "0.45.0-alpha.7" -source = "git+https://github.com/rust-nostr/nostr#affbc9e8f918ead0f1857a6c7d4afdc16f812a6c" +version = "0.45.0-alpha.8" +source = "git+https://github.com/rust-nostr/nostr#83cb556fa59259eb30f3df63f153f42aab77519b" dependencies = [ "nostr", "opaquerr", @@ -4285,8 +4285,8 @@ dependencies = [ [[package]] name = "nostr-gossip-memory" -version = "0.45.0-alpha.7" -source = "git+https://github.com/rust-nostr/nostr#affbc9e8f918ead0f1857a6c7d4afdc16f812a6c" +version = "0.45.0-alpha.8" +source = "git+https://github.com/rust-nostr/nostr#83cb556fa59259eb30f3df63f153f42aab77519b" dependencies = [ "indexmap", "lru", @@ -4297,8 +4297,8 @@ dependencies = [ [[package]] name = "nostr-lmdb" -version = "0.45.0-alpha.7" -source = "git+https://github.com/rust-nostr/nostr#affbc9e8f918ead0f1857a6c7d4afdc16f812a6c" +version = "0.45.0-alpha.8" +source = "git+https://github.com/rust-nostr/nostr#83cb556fa59259eb30f3df63f153f42aab77519b" dependencies = [ "async-utility", "flume 0.12.0", @@ -4311,8 +4311,8 @@ dependencies = [ [[package]] name = "nostr-memory" -version = "0.45.0-alpha.7" -source = "git+https://github.com/rust-nostr/nostr#affbc9e8f918ead0f1857a6c7d4afdc16f812a6c" +version = "0.45.0-alpha.8" +source = "git+https://github.com/rust-nostr/nostr#83cb556fa59259eb30f3df63f153f42aab77519b" dependencies = [ "btreecap", "nostr", @@ -4322,8 +4322,8 @@ dependencies = [ [[package]] name = "nostr-sdk" -version = "0.45.0-alpha.7" -source = "git+https://github.com/rust-nostr/nostr#affbc9e8f918ead0f1857a6c7d4afdc16f812a6c" +version = "0.45.0-alpha.8" +source = "git+https://github.com/rust-nostr/nostr#83cb556fa59259eb30f3df63f153f42aab77519b" dependencies = [ "async-utility", "async-wsocket", @@ -4732,6 +4732,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "object" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.4" @@ -4925,7 +4934,7 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "perf" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "collections", "serde", @@ -4945,7 +4954,6 @@ dependencies = [ "nostr-sdk", "smallvec", "state", - "urlencoding", ] [[package]] @@ -5737,7 +5745,7 @@ dependencies = [ [[package]] name = "refineable" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "derive_refineable", ] @@ -5819,7 +5827,7 @@ dependencies = [ [[package]] name = "reqwest_client" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "anyhow", "bytes", @@ -6134,7 +6142,7 @@ dependencies = [ [[package]] name = "scheduler" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "async-task", "backtrace", @@ -6760,7 +6768,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sum_tree" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "heapless 0.9.3", "log", @@ -7713,12 +7721,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "urlencoding" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" - [[package]] name = "usvg" version = "0.46.0" @@ -7761,7 +7763,7 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "util_macros" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "perf", "quote", @@ -9091,9 +9093,9 @@ dependencies = [ [[package]] name = "xcursor" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec9e4a500ca8864c5b47b8b482a73d62e4237670e5b5f1d6b9e3cae50f28f2b" +checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" [[package]] name = "xim-ctext" @@ -9494,7 +9496,7 @@ dependencies = [ [[package]] name = "zlog" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "anyhow", "chrono", @@ -9511,7 +9513,7 @@ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" [[package]] name = "ztracing" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" dependencies = [ "tracing", "tracing-subscriber", @@ -9522,7 +9524,7 @@ dependencies = [ [[package]] name = "ztracing_macro" version = "0.1.0" -source = "git+https://github.com/zed-industries/zed#ae394f3d474f4996d2cdef6ee97551fdb6748acd" +source = "git+https://github.com/zed-industries/zed#5e1fd392f67e27fa1da91bad43eef7db1a5dec23" [[package]] name = "zune-core" diff --git a/README.md b/README.md index 5320197..329b7db 100644 --- a/README.md +++ b/README.md @@ -1,125 +1,5 @@ -![Coop](/docs/coop.png) - -

- - Actions - - GitHub repo size - GitHub issues - GitHub pull requests -

- Coop is a simple, fast, and reliable nostr client for secure messaging across all platforms. -### Screenshots - -

- - - - - - - - - - - - - - -

- -### Installation - -To install Coop, follow these steps: - -1. **Download the Latest Release**: - - - Visit the [Coop Releases page on GitHub](https://github.com/reyakov/coop/releases). - - Download the package that matches your operating system (Windows, macOS, or Linux). - -2. **Install**: - - - **Windows**: Run the downloaded `.exe` installer and follow the on-screen instructions. - - **macOS**: Open the downloaded `.dmg` file and drag Coop to your Applications folder. - - **Linux**: Run the downloaded `.flatpak` or `.snap` installer and follow the on-screen instructions. - -3. **Run Coop**: - - Launch Coop from your Applications folder (macOS) or by double-clicking the executable (Windows/Linux). - -For more detailed instructions, refer to the [Release Notes](#) on GitHub. - -### Developing Coop - -Coop is built using Rust and GPUI. All Nostr related stuffs handled by [Rust Nostr SDK](https://github.com/rust-nostr/nostr) - -#### Prerequisites - -- **Rust Toolchain**: Ensure you have Rust installed. If not, you can install it using [rustup](https://rustup.rs/). -- **Cargo**: Rust's package manager, which comes bundled with the Rust installation. -- **Git**: To clone the repository and manage version control. - -#### Setting Up the Development Environment - -1. Clone the repository: - - ```bash - git clone https://github.com/reyakov/coop.git - cd coop - ``` - -2.1 Install Linux dependencies: - - ```bash - ./script/linux - ``` - -2.2 Install FreeBSD dependencies: - - ```bash - ./script/freebsd - ``` - -3. Install Rust dependencies: - - ```bash - cargo build - ``` - -4. Run the app: - ```bash - cargo run - ``` - -#### Building for Production - -To build Coop for production, use the following command: - -```bash -cargo build --release -``` - -This will generate an optimized binary in the `target/release` directory. - -#### Contributing Code - -If you'd like to contribute to Coop, please follow these steps: - -1. Fork the repository. -2. Create a new branch for your feature or bugfix. -3. Make your changes and ensure all tests pass. -4. Submit a pull request with a detailed description of your changes. - -For more information, see the [Contributing](#contributing) section. - -#### Additional Resources - -- [Rust Nostr](https://github.com/rust-nostr/nostr/) -- [GPUI](https://www.gpui.rs/) -- [GPUI Components](https://github.com/longbridge/gpui-component/) -- [Coop Issue Tracker](https://github.com/reyakov/coop/issues/) - ### License Copyright (C) 2025 Ren Amamiya & other Coop contributors diff --git a/crates/person/Cargo.toml b/crates/person/Cargo.toml index ea15a5b..c138558 100644 --- a/crates/person/Cargo.toml +++ b/crates/person/Cargo.toml @@ -15,4 +15,3 @@ anyhow.workspace = true smallvec.workspace = true flume.workspace = true log.workspace = true -urlencoding = "2.1.3" diff --git a/crates/person/src/lib.rs b/crates/person/src/lib.rs index a0a46e2..28e41e4 100644 --- a/crates/person/src/lib.rs +++ b/crates/person/src/lib.rs @@ -1,10 +1,10 @@ use std::collections::{HashMap, HashSet}; use std::sync::RwLock; -use instant::Duration; use anyhow::{Error, anyhow}; use common::EventExt; use gpui::{App, AppContext, Context, Entity, Global, Task, Window}; +use instant::Duration; use nostr_sdk::prelude::*; use smallvec::{SmallVec, smallvec}; use state::{Announcement, BOOTSTRAP_RELAYS, NostrRegistry, TIMEOUT}; diff --git a/crates/person/src/person.rs b/crates/person/src/person.rs index 01e89db..f597a19 100644 --- a/crates/person/src/person.rs +++ b/crates/person/src/person.rs @@ -5,8 +5,6 @@ use gpui::SharedString; use nostr_sdk::prelude::*; use state::Announcement; -const IMAGE_RESIZER: &str = "https://wsrv.nl"; - /// Person #[derive(Debug, Clone)] pub struct Person { @@ -111,13 +109,7 @@ impl Person { .picture .as_ref() .filter(|picture| !picture.is_empty()) - .map(|picture| { - let encoded_picture = urlencoding::encode(picture); - let url = format!( - "{IMAGE_RESIZER}/?url={encoded_picture}&w=100&h=100&fit=cover&mask=circle&n=-1" - ); - url.into() - }) + .map(|picture| picture.into()) .unwrap_or_else(|| "brand/avatar.png".into()) } diff --git a/crates/ui/src/avatar.rs b/crates/ui/src/avatar.rs index 7ceaaa8..1586548 100644 --- a/crates/ui/src/avatar.rs +++ b/crates/ui/src/avatar.rs @@ -1,8 +1,8 @@ use gpui::prelude::FluentBuilder; use gpui::{ AbsoluteLength, App, Div, Hsla, ImageSource, Img, InteractiveElement, Interactivity, - IntoElement, ParentElement, RenderOnce, StyleRefinement, Styled, StyledImage, Window, div, img, - px, + IntoElement, ObjectFit, ParentElement, RenderOnce, StyleRefinement, Styled, StyledImage, + Window, div, img, px, }; use theme::ActiveTheme; @@ -26,9 +26,7 @@ pub(super) fn avatar_size(size: Size) -> AbsoluteLength { /// ``` /// use ui::{Avatar}; /// -/// Avatar::new("path/to/image.png") -/// .grayscale(true) -/// .border_color(gpui::red()); +/// Avatar::new("path/to/image.png").grayscale(true).border_color(gpui::red()); /// ``` #[derive(IntoElement)] pub struct Avatar { @@ -130,7 +128,7 @@ impl RenderOnce for Avatar { self.image .size(image_size) .rounded_full() - .object_fit(gpui::ObjectFit::Fill) + .object_fit(ObjectFit::Cover) .bg(cx.theme().ghost_element_background) .with_fallback(move || { img("brand/avatar.png") diff --git a/crates/ui/src/dock/tab_panel.rs b/crates/ui/src/dock/tab_panel.rs index 4b96597..43dc89a 100644 --- a/crates/ui/src/dock/tab_panel.rs +++ b/crates/ui/src/dock/tab_panel.rs @@ -51,7 +51,7 @@ impl Render for DragPanel { .overflow_hidden() .whitespace_nowrap() .rounded(cx.theme().radius) - .text_xs() + .text_sm() .text_color(cx.theme().text) .text_ellipsis() .when(cx.theme().shadow, |this| this.shadow_xs()) @@ -312,6 +312,7 @@ impl TabPanel { cx.emit(PanelEvent::ZoomOut); cx.emit(PanelEvent::LayoutChanged); + cx.notify(); } fn detach_panel( @@ -321,10 +322,22 @@ impl TabPanel { cx: &mut Context, ) { let panel_view = panel.view(); + let removed_ix = self.panels.iter().position(|p| p.view() == panel_view); self.panels.retain(|p| p.view() != panel_view); if self.active_ix >= self.panels.len() { self.set_active_ix(self.panels.len().saturating_sub(1), window, cx) + } else if let Some(removed_ix) = removed_ix { + if removed_ix < self.active_ix { + self.active_ix = self.active_ix.saturating_sub(1); + } else if removed_ix == self.active_ix { + // The active panel was removed and another panel shifted into + // its position. Activate the new panel at the same index. + if let Some(new_active) = self.panels.get(self.active_ix) { + new_active.set_active(true, cx); + } + self.focus_active_panel(window, cx); + } } } @@ -613,7 +626,7 @@ impl TabPanel { div() .w_full() .text_ellipsis() - .text_xs() + .text_sm() .child(panel.title(cx)), ) .when(state.draggable, |this| { @@ -687,8 +700,8 @@ impl TabPanel { .on_click(cx.listener({ let panel = panel.clone(); move |view, _ev, window, cx| { + cx.stop_propagation(); view.remove_panel(&panel, window, cx); - view.set_active_ix(ix, window, cx); } })), ) diff --git a/crates/ui/src/modal.rs b/crates/ui/src/modal.rs index b93bfc0..a16d4b1 100644 --- a/crates/ui/src/modal.rs +++ b/crates/ui/src/modal.rs @@ -1,5 +1,4 @@ use std::rc::Rc; -use instant::Duration; use gpui::prelude::FluentBuilder; use gpui::{ @@ -7,6 +6,7 @@ use gpui::{ InteractiveElement, IntoElement, KeyBinding, MouseButton, ParentElement, Pixels, Point, RenderOnce, SharedString, StyleRefinement, Styled, Window, anchored, div, hsla, point, px, }; +use instant::Duration; use theme::ActiveTheme; use crate::actions::{Cancel, Confirm}; @@ -359,8 +359,8 @@ impl RenderOnce for Modal { let y = self.margin_top.unwrap_or(view_size.height / 10.) + offset_top; let x = bounds.center().x - self.width / 2.; - let mut padding_right = px(8.); - let mut padding_left = px(8.); + let mut padding_right = px(16.); + let mut padding_left = px(16.); if let Some(pl) = self.style.padding.left { padding_left = pl.to_pixels(self.width.into(), window.rem_size()); @@ -452,8 +452,8 @@ impl RenderOnce for Modal { .when_some(self.max_width, |this, w| this.max_w(w)) .child( div() - .px_2() - .h_4() + .px_4() + .h_8() .w_full() .flex() .items_center() diff --git a/crates/ui/src/tab/mod.rs b/crates/ui/src/tab/mod.rs index 0bf2665..812927d 100644 --- a/crates/ui/src/tab/mod.rs +++ b/crates/ui/src/tab/mod.rs @@ -183,12 +183,10 @@ impl RenderOnce for Tab { .items_center() .flex_shrink_0() .h(TABBAR_HEIGHT) + .relative() .overflow_hidden() .text_color(fg) .text_sm() - .when(!self.selected && !self.disabled, |this| { - this.hover(|this| this.text_color(cx.theme().secondary_foreground)) - }) .when_some(self.prefix, |this, prefix| this.child(prefix)) .child( h_flex() @@ -222,5 +220,21 @@ impl RenderOnce for Tab { this.on_click(move |event, window, cx| on_click(event, window, cx)) }) }) + .child( + div() + .absolute() + .bottom_0() + .left_0() + .right_0() + .h_0p5() + .when(self.selected && !self.disabled, |this| { + this.bg(cx.theme().element_active) + }) + .when(!self.selected && !self.disabled, |this| { + this.invisible().group_hover("", |this| { + this.visible().bg(cx.theme().secondary_background) + }) + }), + ) } } diff --git a/crates/workspace/src/dialogs/screening.rs b/crates/workspace/src/dialogs/screening.rs index d0f0b1e..d71ab38 100644 --- a/crates/workspace/src/dialogs/screening.rs +++ b/crates/workspace/src/dialogs/screening.rs @@ -16,7 +16,7 @@ use theme::ActiveTheme; use ui::avatar::Avatar; use ui::button::{Button, ButtonVariants}; use ui::indicator::Indicator; -use ui::{Icon, IconName, Sizable, StyledExt, WindowExtension, h_flex, v_flex}; +use ui::{Disableable, Icon, IconName, Sizable, StyledExt, WindowExtension, h_flex, v_flex}; pub fn init(public_key: PublicKey, window: &mut Window, cx: &mut App) -> Entity { cx.new(|cx| Screening::new(public_key, window, cx)) @@ -263,7 +263,7 @@ impl Screening { let contacts = contacts.clone(); let total = contacts.len(); - this.title(SharedString::from("Mutual contacts")).child( + this.title("Mutual contacts").child( v_flex().gap_1().pb_2().child( uniform_list("contacts", total, move |range, _window, cx| { let persons = PersonRegistry::global(cx); @@ -342,7 +342,7 @@ impl Render for Screening { .h_7() .justify_center() .rounded_full() - .bg(cx.theme().surface_background) + .bg(cx.theme().elevated_surface_background) .text_sm() .truncate() .text_ellipsis() @@ -355,7 +355,8 @@ impl Render for Screening { .gap_1() .child( Button::new("njump") - .label("View on njump.me") + .icon(IconName::Link) + .label("njump.me") .secondary() .small() .rounded() @@ -386,21 +387,18 @@ impl Render for Screening { .text_sm() .child(status_badge(Some(self.followed), cx)) .child( - v_flex() - .text_sm() - .child(SharedString::from("Contact")) - .child( - div() - .line_clamp(1) - .text_color(cx.theme().text_muted) - .child({ - if self.followed { - SharedString::from(CONTACT) - } else { - SharedString::from(NOT_CONTACT) - } - }), - ), + v_flex().text_sm().child("Contact").child( + div() + .line_clamp(1) + .text_color(cx.theme().text_muted) + .child({ + if self.followed { + SharedString::from(CONTACT) + } else { + SharedString::from(NOT_CONTACT) + } + }), + ), ), ) .child( @@ -415,7 +413,7 @@ impl Render for Screening { .child( h_flex() .gap_0p5() - .child(SharedString::from("Activity on Public Relays")) + .child("Activity on Public Relays") .child( Button::new("active") .icon(IconName::Info) @@ -484,25 +482,8 @@ impl Render for Screening { .gap_2() .child(status_badge(Some(mutuals > 0), cx)) .child( - v_flex() + h_flex() .text_sm() - .child( - h_flex() - .gap_0p5() - .child(SharedString::from("Mutual contacts")) - .child( - Button::new("mutuals") - .icon(IconName::Info) - .xsmall() - .ghost() - .rounded() - .on_click(cx.listener( - move |this, _, window, cx| { - this.mutual_contacts(window, cx); - }, - )), - ), - ) .child( div() .line_clamp(1) @@ -514,6 +495,17 @@ impl Render for Screening { SharedString::from(NO_MUTUAL) } }), + ) + .child( + Button::new("mutuals") + .icon(IconName::Info) + .xsmall() + .ghost() + .rounded() + .disabled(mutuals == 0) + .on_click(cx.listener(move |this, _, window, cx| { + this.mutual_contacts(window, cx); + })), ), ), ), diff --git a/crates/workspace/src/sidebar/entry.rs b/crates/workspace/src/sidebar/entry.rs index a64af30..2c3a89d 100644 --- a/crates/workspace/src/sidebar/entry.rs +++ b/crates/workspace/src/sidebar/entry.rs @@ -164,9 +164,7 @@ impl RenderOnce for RoomEntry { ) .on_cancel(move |_event, window, cx| { window.dispatch_action(Box::new(ClosePanel), cx); - // Prevent closing the modal on click - // modal will be automatically closed after closing panel - false + true }) }); } diff --git a/crates/workspace/src/sidebar/mod.rs b/crates/workspace/src/sidebar/mod.rs index 587c8f7..cbb6125 100644 --- a/crates/workspace/src/sidebar/mod.rs +++ b/crates/workspace/src/sidebar/mod.rs @@ -354,6 +354,14 @@ impl Sidebar { cx.notify(); }); self.new_requests = false; + + // Reset search state when switching to inbox/requests + self.reset(window, cx); + + // Clear the find input value + self.find_input.update(cx, |this, cx| { + this.set_value("", window, cx); + }); } fn render_list_items( diff --git a/docs/coop.png b/docs/coop.png deleted file mode 100644 index a015392..0000000 Binary files a/docs/coop.png and /dev/null differ diff --git a/docs/linux_01.png b/docs/linux_01.png deleted file mode 100644 index c910ac0..0000000 Binary files a/docs/linux_01.png and /dev/null differ diff --git a/docs/linux_02.png b/docs/linux_02.png deleted file mode 100644 index 06db0dc..0000000 Binary files a/docs/linux_02.png and /dev/null differ diff --git a/docs/linux_03.png b/docs/linux_03.png deleted file mode 100644 index 6951702..0000000 Binary files a/docs/linux_03.png and /dev/null differ diff --git a/docs/linux_04.png b/docs/linux_04.png deleted file mode 100644 index 6a88126..0000000 Binary files a/docs/linux_04.png and /dev/null differ diff --git a/docs/linux_05.png b/docs/linux_05.png deleted file mode 100644 index 1060b4f..0000000 Binary files a/docs/linux_05.png and /dev/null differ diff --git a/docs/mac_01.png b/docs/mac_01.png deleted file mode 100644 index 38b00c6..0000000 Binary files a/docs/mac_01.png and /dev/null differ diff --git a/docs/mac_02.png b/docs/mac_02.png deleted file mode 100644 index a30a33d..0000000 Binary files a/docs/mac_02.png and /dev/null differ diff --git a/docs/mac_03.png b/docs/mac_03.png deleted file mode 100644 index fd0ab8c..0000000 Binary files a/docs/mac_03.png and /dev/null differ diff --git a/docs/mac_04.png b/docs/mac_04.png deleted file mode 100644 index 390245d..0000000 Binary files a/docs/mac_04.png and /dev/null differ diff --git a/docs/mac_05.png b/docs/mac_05.png deleted file mode 100644 index a91d6b0..0000000 Binary files a/docs/mac_05.png and /dev/null differ diff --git a/docs/mac_06.png b/docs/mac_06.png deleted file mode 100644 index 2d3f97b..0000000 Binary files a/docs/mac_06.png and /dev/null differ diff --git a/docs/mac_07.png b/docs/mac_07.png deleted file mode 100644 index 6cd0801..0000000 Binary files a/docs/mac_07.png and /dev/null differ diff --git a/docs/mac_08.png b/docs/mac_08.png deleted file mode 100644 index 1eab9d1..0000000 Binary files a/docs/mac_08.png and /dev/null differ diff --git a/docs/mac_09.png b/docs/mac_09.png deleted file mode 100644 index 6b79292..0000000 Binary files a/docs/mac_09.png and /dev/null differ