feat: simple dock layout

This commit is contained in:
2025-12-13 09:20:36 +07:00
parent 703fe988bd
commit af740f462c
12 changed files with 238 additions and 37 deletions

69
Cargo.lock generated
View File

@@ -1050,9 +1050,9 @@ dependencies = [
[[package]] [[package]]
name = "cmake" name = "cmake"
version = "0.1.54" version = "0.1.55"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0" checksum = "d49d74c227b6cc9f3c51a2c7c667a05b6453f7f0f952a5f8e4493bb9e731d68e"
dependencies = [ dependencies = [
"cc", "cc",
] ]
@@ -1131,7 +1131,7 @@ dependencies = [
[[package]] [[package]]
name = "collections" name = "collections"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"rustc-hash 2.1.1", "rustc-hash 2.1.1",
@@ -1520,7 +1520,7 @@ dependencies = [
[[package]] [[package]]
name = "derive_refineable" name = "derive_refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1789,7 +1789,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.61.2", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@@ -2391,7 +2391,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui" name = "gpui"
version = "0.2.2" version = "0.2.2"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"as-raw-xcb-connection", "as-raw-xcb-connection",
@@ -2433,6 +2433,7 @@ dependencies = [
"libc", "libc",
"log", "log",
"lyon", "lyon",
"mach2",
"media", "media",
"metal", "metal",
"naga", "naga",
@@ -2490,7 +2491,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui-component" name = "gpui-component"
version = "0.5.0" version = "0.5.0"
source = "git+https://github.com/longbridge/gpui-component#67608353f227f4f40d8d150f33adc0c891be318b" source = "git+https://github.com/longbridge/gpui-component#aeaa6b61455607c41620955850b06c086ca40b08"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"anyhow", "anyhow",
@@ -2528,7 +2529,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui-component-macros" name = "gpui-component-macros"
version = "0.5.0" version = "0.5.0"
source = "git+https://github.com/longbridge/gpui-component#67608353f227f4f40d8d150f33adc0c891be318b" source = "git+https://github.com/longbridge/gpui-component#aeaa6b61455607c41620955850b06c086ca40b08"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2550,7 +2551,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_macros" name = "gpui_macros"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"heck 0.5.0", "heck 0.5.0",
"proc-macro2", "proc-macro2",
@@ -2561,7 +2562,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_tokio" name = "gpui_tokio"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"gpui", "gpui",
@@ -2788,7 +2789,7 @@ dependencies = [
[[package]] [[package]]
name = "http_client" name = "http_client"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-compression", "async-compression",
@@ -2813,7 +2814,7 @@ dependencies = [
[[package]] [[package]]
name = "http_client_tls" name = "http_client_tls"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"rustls", "rustls",
"rustls-platform-verifier", "rustls-platform-verifier",
@@ -3604,6 +3605,7 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5cab8f2cadc416a82d2e783a1946388b31654d391d1c7d92cc1f03e295b1deb" checksum = "a5cab8f2cadc416a82d2e783a1946388b31654d391d1c7d92cc1f03e295b1deb"
dependencies = [ dependencies = [
"serde",
"unicode-id", "unicode-id",
] ]
@@ -3656,7 +3658,7 @@ dependencies = [
[[package]] [[package]]
name = "media" name = "media"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bindgen", "bindgen",
@@ -3945,6 +3947,18 @@ dependencies = [
"nostr", "nostr",
] ]
[[package]]
name = "nostr-gossip-memory"
version = "0.44.0"
source = "git+https://github.com/rust-nostr/nostr#8ef9fb157cc4c895c80bfba8fc9c5f0879aba36c"
dependencies = [
"indexmap",
"lru",
"nostr",
"nostr-gossip",
"tokio",
]
[[package]] [[package]]
name = "nostr-lmdb" name = "nostr-lmdb"
version = "0.44.0" version = "0.44.0"
@@ -4033,7 +4047,7 @@ version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [ dependencies = [
"windows-sys 0.61.2", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@@ -4514,7 +4528,7 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]] [[package]]
name = "perf" name = "perf"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"collections", "collections",
"serde", "serde",
@@ -4899,7 +4913,7 @@ dependencies = [
"once_cell", "once_cell",
"socket2", "socket2",
"tracing", "tracing",
"windows-sys 0.60.2", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@@ -5132,7 +5146,7 @@ dependencies = [
[[package]] [[package]]
name = "refineable" name = "refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"derive_refineable", "derive_refineable",
] ]
@@ -5213,7 +5227,7 @@ dependencies = [
[[package]] [[package]]
name = "reqwest_client" name = "reqwest_client"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -5412,7 +5426,7 @@ dependencies = [
"errno", "errno",
"libc", "libc",
"linux-raw-sys 0.11.0", "linux-raw-sys 0.11.0",
"windows-sys 0.61.2", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@@ -6078,6 +6092,7 @@ dependencies = [
"common", "common",
"gpui", "gpui",
"log", "log",
"nostr-gossip-memory",
"nostr-lmdb", "nostr-lmdb",
"nostr-sdk", "nostr-sdk",
"rustls", "rustls",
@@ -6191,7 +6206,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]] [[package]]
name = "sum_tree" name = "sum_tree"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"log", "log",
@@ -6440,7 +6455,7 @@ dependencies = [
"getrandom 0.3.4", "getrandom 0.3.4",
"once_cell", "once_cell",
"rustix 1.1.2", "rustix 1.1.2",
"windows-sys 0.61.2", "windows-sys 0.59.0",
] ]
[[package]] [[package]]
@@ -7147,7 +7162,7 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]] [[package]]
name = "util" name = "util"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-fs", "async-fs",
@@ -7183,7 +7198,7 @@ dependencies = [
[[package]] [[package]]
name = "util_macros" name = "util_macros"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"perf", "perf",
"quote", "quote",
@@ -7605,7 +7620,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [ dependencies = [
"windows-sys 0.61.2", "windows-sys 0.48.0",
] ]
[[package]] [[package]]
@@ -8666,7 +8681,7 @@ dependencies = [
[[package]] [[package]]
name = "zlog" name = "zlog"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",
@@ -8677,7 +8692,7 @@ dependencies = [
[[package]] [[package]]
name = "ztracing" name = "ztracing"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
dependencies = [ dependencies = [
"tracing", "tracing",
"tracing-subscriber", "tracing-subscriber",
@@ -8688,7 +8703,7 @@ dependencies = [
[[package]] [[package]]
name = "ztracing_macro" name = "ztracing_macro"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#0a1e5f93a08512806e3812a05fb1f884d6673295" source = "git+https://github.com/zed-industries/zed#e860252185bbefc30b1a9a051167a42c549bd6b0"
[[package]] [[package]]
name = "zune-core" name = "zune-core"

View File

@@ -18,7 +18,8 @@ reqwest_client = { git = "https://github.com/zed-industries/zed" }
# Nostr # Nostr
nostr-lmdb = { git = "https://github.com/rust-nostr/nostr" } nostr-lmdb = { git = "https://github.com/rust-nostr/nostr" }
nostr-connect = { git = "https://github.com/rust-nostr/nostr" } nostr-connect = { git = "https://github.com/rust-nostr/nostr" }
nostr-sdk = { git = "https://github.com/rust-nostr/nostr", features = [ "nip96", "nip59", "nip49", "nip44" ] } nostr-gossip-memory = { git = "https://github.com/rust-nostr/nostr" }
nostr-sdk = { git = "https://github.com/rust-nostr/nostr", features = [ "all-nips", "pow-multi-thread" ] }
# Others # Others
anyhow = "1.0.44" anyhow = "1.0.44"

View File

@@ -1,6 +1,7 @@
use std::env; use std::env;
use gpui::{App, AppContext, Context, Entity, Global, Task}; use anyhow::Error;
use gpui::{App, AppContext, Context, Entity, Global, Subscription, Task};
use nostr_sdk::prelude::*; use nostr_sdk::prelude::*;
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};
use state::NostrRegistry; use state::NostrRegistry;
@@ -17,8 +18,11 @@ pub struct Account {
/// The public key of the account /// The public key of the account
public_key: Option<PublicKey>, public_key: Option<PublicKey>,
/// Event subscriptions
_subscriptions: SmallVec<[Subscription; 1]>,
/// Tasks for asynchronous operations /// Tasks for asynchronous operations
_tasks: SmallVec<[Task<()>; 1]>, _tasks: SmallVec<[Task<Result<(), Error>>; 1]>,
} }
impl Account { impl Account {
@@ -51,11 +55,12 @@ impl Account {
let args: Vec<String> = env::args().collect(); let args: Vec<String> = env::args().collect();
let account = args.get(1).and_then(|s| Keys::parse(s).ok()); let account = args.get(1).and_then(|s| Keys::parse(s).ok());
let mut subscriptions = smallvec![];
let mut tasks = smallvec![]; let mut tasks = smallvec![];
if let Some(keys) = account { if let Some(keys) = account {
tasks.push( tasks.push(
// Background // Set signer in background
cx.spawn(async move |this, cx| { cx.spawn(async move |this, cx| {
let public_key = keys.public_key(); let public_key = keys.public_key();
@@ -72,13 +77,22 @@ impl Account {
this.public_key = Some(public_key); this.public_key = Some(public_key);
cx.notify(); cx.notify();
}) })
.ok();
}), }),
); );
} }
subscriptions.push(
// Listen for public key set
cx.observe_self(move |this, cx| {
if let Some(public_key) = this.public_key {
this.init(public_key, cx);
}
}),
);
Self { Self {
public_key: None, public_key: None,
_subscriptions: subscriptions,
_tasks: tasks, _tasks: tasks,
} }
} }
@@ -93,4 +107,37 @@ impl Account {
// This method is only called when user is logged in, so unwrap safely // This method is only called when user is logged in, so unwrap safely
self.public_key.unwrap() self.public_key.unwrap()
} }
fn init(&mut self, public_key: PublicKey, cx: &mut Context<Self>) {
let nostr = NostrRegistry::global(cx);
let client = nostr.read(cx).client();
let task: Task<Result<(), Error>> = cx.background_spawn(async move {
let opts = SubscribeAutoCloseOptions::default().exit_policy(ReqExitPolicy::ExitOnEOSE);
// Construct a filter to get the user's metadata
let filter = Filter::new()
.kind(Kind::Metadata)
.author(public_key)
.limit(1);
// Subscribe to the user metadata
client.subscribe(filter, Some(opts)).await?;
// Construct a filter to get the user's contact list
let filter = Filter::new()
.kind(Kind::ContactList)
.author(public_key)
.limit(1);
// Subscribe to the user's contact list
client.subscribe(filter, Some(opts)).await?;
log::info!("Subscribed to user metadata and contact list");
Ok(())
});
self._tasks.push(task);
}
} }

View File

@@ -19,3 +19,6 @@ pub const SEARCH_RELAYS: [&str; 3] = [
/// Default relay for Nostr Connect /// Default relay for Nostr Connect
pub const NOSTR_CONNECT_RELAY: &str = "wss://relay.nsec.app"; pub const NOSTR_CONNECT_RELAY: &str = "wss://relay.nsec.app";
/// Default width of the sidebar.
pub const DEFAULT_SIDEBAR_WIDTH: f32 = 240.;

View File

@@ -14,6 +14,8 @@ use crate::workspace::Workspace;
mod actions; mod actions;
mod menus; mod menus;
mod panels;
mod sidebar;
mod themes; mod themes;
mod title_bar; mod title_bar;
mod workspace; mod workspace;

View File

@@ -0,0 +1 @@
pub mod startup;

View File

@@ -0,0 +1,41 @@
use gpui::{
div, App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable, IntoElement,
ParentElement, Render, Window,
};
use gpui_component::dock::{Panel, PanelEvent};
pub fn init(window: &mut Window, cx: &mut App) -> Entity<Startup> {
cx.new(|cx| Startup::new(window, cx))
}
pub struct Startup {
focus_handle: FocusHandle,
}
impl Startup {
fn new(_window: &mut Window, cx: &mut Context<Self>) -> Self {
Self {
focus_handle: cx.focus_handle(),
}
}
}
impl Panel for Startup {
fn panel_name(&self) -> &'static str {
"Startup"
}
}
impl EventEmitter<PanelEvent> for Startup {}
impl Focusable for Startup {
fn focus_handle(&self, _cx: &App) -> FocusHandle {
self.focus_handle.clone()
}
}
impl Render for Startup {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div().child("Startup")
}
}

View File

@@ -0,0 +1,41 @@
use gpui::{
div, App, AppContext, Context, Entity, EventEmitter, FocusHandle, Focusable, IntoElement,
ParentElement, Render, Window,
};
use gpui_component::dock::{Panel, PanelEvent};
pub fn init(window: &mut Window, cx: &mut App) -> Entity<Sidebar> {
cx.new(|cx| Sidebar::new(window, cx))
}
pub struct Sidebar {
focus_handle: FocusHandle,
}
impl Sidebar {
fn new(_window: &mut Window, cx: &mut Context<Self>) -> Self {
Self {
focus_handle: cx.focus_handle(),
}
}
}
impl Panel for Sidebar {
fn panel_name(&self) -> &'static str {
"Sidebar"
}
}
impl EventEmitter<PanelEvent> for Sidebar {}
impl Focusable for Sidebar {
fn focus_handle(&self, _cx: &App) -> FocusHandle {
self.focus_handle.clone()
}
}
impl Render for Sidebar {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div().child("Sidebar")
}
}

View File

@@ -9,6 +9,7 @@ use gpui_component::TitleBar;
use crate::menus; use crate::menus;
#[allow(clippy::type_complexity)]
pub struct AppTitleBar { pub struct AppTitleBar {
/// The app menu bar /// The app menu bar
app_menu_bar: Entity<AppMenuBar>, app_menu_bar: Entity<AppMenuBar>,
@@ -35,6 +36,7 @@ impl AppTitleBar {
} }
} }
#[allow(dead_code)]
pub fn child<F, E>(mut self, f: F) -> Self pub fn child<F, E>(mut self, f: F) -> Self
where where
E: IntoElement, E: IntoElement,

View File

@@ -1,12 +1,17 @@
use common::CLIENT_NAME; use std::sync::Arc;
use account::Account;
use common::{CLIENT_NAME, DEFAULT_SIDEBAR_WIDTH};
use gpui::{ use gpui::{
div, AppContext, Context, Entity, InteractiveElement, IntoElement, ParentElement, Render, div, px, AppContext, Axis, Context, Entity, InteractiveElement, IntoElement, ParentElement,
Styled, Subscription, Window, Render, Styled, Subscription, Window,
}; };
use gpui_component::dock::DockArea; use gpui_component::dock::{DockArea, DockItem};
use gpui_component::{v_flex, Root, Theme}; use gpui_component::{v_flex, Root, Theme};
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};
use crate::panels::startup;
use crate::sidebar;
use crate::title_bar::AppTitleBar; use crate::title_bar::AppTitleBar;
#[derive(Debug)] #[derive(Debug)]
@@ -25,6 +30,8 @@ impl Workspace {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self { pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let dock = cx.new(|cx| DockArea::new("dock", None, window, cx)); let dock = cx.new(|cx| DockArea::new("dock", None, window, cx));
let title_bar = cx.new(|cx| AppTitleBar::new(CLIENT_NAME, window, cx)); let title_bar = cx.new(|cx| AppTitleBar::new(CLIENT_NAME, window, cx));
let account = Account::global(cx);
let mut subscriptions = smallvec![]; let mut subscriptions = smallvec![];
subscriptions.push( subscriptions.push(
@@ -34,12 +41,47 @@ impl Workspace {
}), }),
); );
subscriptions.push(
// Observe account entity changes
cx.observe_in(&account, window, move |this, state, window, cx| {
if state.read(cx).has_account() {
this.init_app_layout(window, cx);
}
}),
);
Self { Self {
dock, dock,
title_bar, title_bar,
_subscriptions: subscriptions, _subscriptions: subscriptions,
} }
} }
fn init_app_layout(&self, window: &mut Window, cx: &mut Context<Self>) {
let weak_dock = self.dock.downgrade();
let sidebar = Arc::new(sidebar::init(window, cx));
let startup = Arc::new(startup::init(window, cx));
// Construct left dock (sidebar)
let left = DockItem::panel(sidebar);
// Construct center dock
let center = DockItem::split_with_sizes(
Axis::Vertical,
vec![DockItem::tabs(vec![startup], &weak_dock, window, cx)],
vec![None],
&weak_dock,
window,
cx,
);
// Update dock layout
self.dock.update(cx, |this, cx| {
this.set_left_dock(left, Some(px(DEFAULT_SIDEBAR_WIDTH)), true, window, cx);
this.set_center(center, window, cx);
});
}
} }
impl Render for Workspace { impl Render for Workspace {

View File

@@ -9,6 +9,7 @@ common = { path = "../common" }
nostr-sdk.workspace = true nostr-sdk.workspace = true
nostr-lmdb.workspace = true nostr-lmdb.workspace = true
nostr-gossip-memory.workspace = true
gpui.workspace = true gpui.workspace = true
smol.workspace = true smol.workspace = true

View File

@@ -2,6 +2,7 @@ use std::time::Duration;
use common::{config_dir, BOOTSTRAP_RELAYS, SEARCH_RELAYS}; use common::{config_dir, BOOTSTRAP_RELAYS, SEARCH_RELAYS};
use gpui::{App, AppContext, Context, Entity, Global, Task}; use gpui::{App, AppContext, Context, Entity, Global, Task};
use nostr_gossip_memory::prelude::*;
use nostr_lmdb::NostrLmdb; use nostr_lmdb::NostrLmdb;
use nostr_sdk::prelude::*; use nostr_sdk::prelude::*;
use smallvec::{smallvec, SmallVec}; use smallvec::{smallvec, SmallVec};
@@ -61,7 +62,11 @@ impl NostrRegistry {
}); });
// Construct the nostr client // Construct the nostr client
let client = ClientBuilder::default().database(lmdb).opts(opts).build(); let client = ClientBuilder::default()
.database(lmdb)
.gossip(NostrGossipMemory::unbounded())
.opts(opts)
.build();
let mut tasks = smallvec![]; let mut tasks = smallvec![];