notecrumbs

a nostr opengraph server build on nostrdb and egui
git clone git://jb55.com/notecrumbs
Log | Files | Refs | README | LICENSE

commit 83e63394e8bfbec3e1cf290976a470f30a20f2b5
parent 1c1835d56b5b4668f24047a6dc89c4db4e0884a3
Author: William Casarin <jb55@jb55.com>
Date:   Mon,  1 Jan 2024 09:05:50 -0800

cleanup some warnings

Diffstat:
Msrc/main.rs | 9+++++----
Msrc/render.rs | 20+++++++++-----------
2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/src/main.rs b/src/main.rs @@ -271,13 +271,14 @@ fn get_env_timeout() -> Duration { } fn get_gradient() -> egui::ColorImage { - use egui::{pos2, Color32, ColorImage}; + use egui::{Color32, ColorImage}; + //use egui::pos2; use gradient::Gradient; //let gradient = Gradient::linear(Color32::LIGHT_GRAY, Color32::DARK_GRAY); - let size = pfp::PFP_SIZE as usize; - let radius = (pfp::PFP_SIZE as f32) / 2.0; - let center = pos2(radius, radius); + //let size = pfp::PFP_SIZE as usize; + //let radius = (pfp::PFP_SIZE as f32) / 2.0; + //let center = pos2(radius, radius); let scol = [0x1C, 0x55, 0xFF]; //let ecol = [0xFA, 0x0D, 0xD4]; diff --git a/src/render.rs b/src/render.rs @@ -1,5 +1,4 @@ use crate::{fonts, Error, Notecrumbs}; -use egui::emath::Rot2; use egui::epaint::Shadow; use egui::{ pos2, @@ -9,9 +8,13 @@ use egui::{ }; use log::{debug, info, warn}; use nostr_sdk::nips::nip19::Nip19; -use nostr_sdk::prelude::*; -use nostrdb::{BlockType, Blocks, Note, Transaction}; -use std::f32::consts::PI; +use nostr_sdk::prelude::{json, Event, EventId, Nip19Event, XOnlyPublicKey}; +use nostrdb::{Block, BlockType, Blocks, Mention, Ndb, Note, Transaction}; + +const PURPLE: Color32 = Color32::from_rgb(0xcc, 0x43, 0xc5); + +//use egui::emath::Rot2; +//use std::f32::consts::PI; impl ProfileRenderData { pub fn default(pfp: egui::ImageData) -> Self { @@ -351,8 +354,6 @@ fn wrapped_body_blocks(ui: &mut egui::Ui, note: &Note, blocks: &Blocks) { } fn wrapped_body_text(ui: &mut egui::Ui, text: &str) { - use egui::text::{LayoutJob, TextFormat}; - let format = TextFormat { font_id: FontId::proportional(52.0), color: Color32::WHITE, @@ -361,8 +362,7 @@ fn wrapped_body_text(ui: &mut egui::Ui, text: &str) { ..Default::default() }; - let mut job = LayoutJob::single_section(text.to_owned(), format); - + let job = LayoutJob::single_section(text.to_owned(), format); ui.label(job); } @@ -437,8 +437,6 @@ fn note_ui(app: &Notecrumbs, ctx: &egui::Context, note: &NoteRenderData) { ui.set_max_size(desired); ui.set_min_size(desired); - let mut rendered = false; - let ok = (|| -> Result<(), nostrdb::Error> { let txn = Transaction::new(&app.ndb)?; let note_id = note.note.id.ok_or(nostrdb::Error::NotFound)?; @@ -481,7 +479,7 @@ fn background_texture(ui: &mut egui::Ui, texture: &TextureHandle) { // Get the painter and draw the texture let painter = ui.ctx().layer_painter(layer_id); - let tint = Color32::WHITE; + //let tint = Color32::WHITE; let mut mesh = Mesh::with_texture(texture.into());