notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

relay_view_preview.rs (1182B)


      1 use enostr::RelayPool;
      2 use notedeck::{relay_pool_manager::RelayPoolManager, relay_view::RelayView};
      3 
      4 use crate::egui_preview_setup::{EguiPreviewCase, EguiPreviewSetup};
      5 
      6 pub struct RelayViewPreview {
      7     pool: RelayPool,
      8 }
      9 
     10 #[allow(unused_must_use)]
     11 impl EguiPreviewCase for RelayViewPreview {
     12     fn new(_supr: EguiPreviewSetup) -> Self {
     13         let mut pool = RelayPool::new();
     14         let wakeup = move || {};
     15 
     16         pool.add_url("wss://relay.damus.io".to_string(), wakeup);
     17         pool.add_url("wss://eden.nostr.land".to_string(), wakeup);
     18         pool.add_url("wss://nostr.wine".to_string(), wakeup);
     19         pool.add_url("wss://nos.lol".to_string(), wakeup);
     20         pool.add_url("wss://test_relay_url_long_00000000000000000000000000000000000000000000000000000000000000000000000000000000000".to_string(), wakeup);
     21 
     22         for _ in 0..20 {
     23             pool.add_url("tmp".to_string(), wakeup);
     24         }
     25 
     26         RelayViewPreview { pool }
     27     }
     28 }
     29 
     30 impl eframe::App for RelayViewPreview {
     31     fn update(&mut self, ctx: &egui::Context, _: &mut eframe::Frame) {
     32         self.pool.try_recv();
     33         RelayView::new(ctx, RelayPoolManager::new(&mut self.pool)).panel();
     34     }
     35 }