Introducing Damus Notedeck: a nostr browser
This splits notedeck into: - notedeck - notedeck_chrome - notedeck_columns The `notedeck` crate is the library that `notedeck_chrome` and `notedeck_columns`, use. It contains common functionality related to notedeck apps such as the NoteCache, ImageCache, etc. The `notedeck_chrome` crate is the binary and ui chrome. It is responsible for managing themes, user accounts, signing, data paths, nostrdb, image caches etc. It will eventually have its own ui which has yet to be determined. For now it just manages the browser data, which is passed to apps via a new struct called `AppContext`. `notedeck_columns` is our columns app, with less responsibility now that more things are handled by `notedeck_chrome` There is still much work left to do before this is a proper browser: - process isolation - sandboxing - etc This is the beginning of a new era! We're just getting started. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -8,12 +8,10 @@ use nostrdb::{Ndb, Transaction};
|
||||
pub use picture::ProfilePic;
|
||||
pub use preview::ProfilePreview;
|
||||
|
||||
use crate::{
|
||||
actionbar::NoteAction, imgcache::ImageCache, muted::MuteFun, notecache::NoteCache,
|
||||
notes_holder::NotesHolderStorage, profile::Profile,
|
||||
};
|
||||
use crate::{actionbar::NoteAction, notes_holder::NotesHolderStorage, profile::Profile};
|
||||
|
||||
use super::timeline::{tabs_ui, TimelineTabView};
|
||||
use notedeck::{ImageCache, MuteFun, NoteCache};
|
||||
|
||||
pub struct ProfileView<'a> {
|
||||
pubkey: &'a Pubkey,
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
use crate::images::ImageType;
|
||||
use crate::imgcache::ImageCache;
|
||||
use crate::ui::{Preview, PreviewConfig, View};
|
||||
use egui::{vec2, Sense, TextureHandle};
|
||||
use nostrdb::{Ndb, Transaction};
|
||||
|
||||
use notedeck::ImageCache;
|
||||
|
||||
pub struct ProfilePic<'cache, 'url> {
|
||||
cache: &'cache mut ImageCache,
|
||||
url: &'url str,
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
use crate::app_style::{get_font_size, NotedeckTextStyle};
|
||||
use crate::imgcache::ImageCache;
|
||||
use crate::storage::{DataPath, DataPathType};
|
||||
use crate::ui::ProfilePic;
|
||||
use crate::user_account::UserAccount;
|
||||
use crate::{colors, images, DisplayName};
|
||||
use egui::load::TexturePoll;
|
||||
use egui::{Frame, Label, RichText, Sense, Widget};
|
||||
@@ -10,6 +6,8 @@ use egui_extras::Size;
|
||||
use enostr::{NoteId, Pubkey};
|
||||
use nostrdb::{Ndb, ProfileRecord, Transaction};
|
||||
|
||||
use notedeck::{DataPath, DataPathType, ImageCache, NotedeckTextStyle, UserAccount};
|
||||
|
||||
pub struct ProfilePreview<'a, 'cache> {
|
||||
profile: &'a ProfileRecord<'a>,
|
||||
cache: &'cache mut ImageCache,
|
||||
@@ -121,7 +119,10 @@ impl egui::Widget for SimpleProfilePreview<'_, '_> {
|
||||
ui.add(
|
||||
Label::new(
|
||||
RichText::new("Read only")
|
||||
.size(get_font_size(ui.ctx(), &NotedeckTextStyle::Tiny))
|
||||
.size(notedeck::fonts::get_font_size(
|
||||
ui.ctx(),
|
||||
&NotedeckTextStyle::Tiny,
|
||||
))
|
||||
.color(ui.visuals().warn_fg_color),
|
||||
)
|
||||
.selectable(false),
|
||||
@@ -256,17 +257,16 @@ fn display_name_widget(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn one_line_display_name_widget(
|
||||
display_name: DisplayName<'_>,
|
||||
pub fn one_line_display_name_widget<'a>(
|
||||
visuals: &egui::Visuals,
|
||||
display_name: DisplayName<'a>,
|
||||
style: NotedeckTextStyle,
|
||||
) -> impl egui::Widget + '_ {
|
||||
) -> impl egui::Widget + 'a {
|
||||
let text_style = style.text_style();
|
||||
let color = visuals.noninteractive().fg_stroke.color;
|
||||
|
||||
move |ui: &mut egui::Ui| match display_name {
|
||||
DisplayName::One(n) => ui.label(
|
||||
RichText::new(n)
|
||||
.text_style(text_style)
|
||||
.color(colors::GRAY_SECONDARY),
|
||||
),
|
||||
DisplayName::One(n) => ui.label(RichText::new(n).text_style(text_style).color(color)),
|
||||
|
||||
DisplayName::Both {
|
||||
display_name,
|
||||
@@ -274,7 +274,7 @@ pub fn one_line_display_name_widget(
|
||||
} => ui.label(
|
||||
RichText::new(display_name)
|
||||
.text_style(text_style)
|
||||
.color(colors::GRAY_SECONDARY),
|
||||
.color(color),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user