mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-01-15 06:14:20 +01:00
Merge 'Repost improvements #314'
This slightly improves the style of reposts. Icon color and size still
needs an update[2]
We also update nostrdb[1] to support instant kind6 ingestion, making
reposts render immediately
William Casarin (3):
repost: update style
nostrdb: update to support fast kind6 repost ingest
[1] cd9ba0ea7d
[2] https://github.com/user-attachments/assets/23feba47-9d63-443f-9968-eba93053fc24
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -2477,7 +2477,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "nostrdb"
|
||||
version = "0.3.4"
|
||||
source = "git+https://github.com/damus-io/nostrdb-rs?rev=6d22af6d5159be4c9e4579f8c9d3af836e0d470a#6d22af6d5159be4c9e4579f8c9d3af836e0d470a"
|
||||
source = "git+https://github.com/damus-io/nostrdb-rs?rev=9bbafd8a2e904b77a51e7cfca71eb5bb5650e829#9bbafd8a2e904b77a51e7cfca71eb5bb5650e829"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"cc",
|
||||
|
||||
@@ -28,7 +28,7 @@ serde_derive = "1"
|
||||
serde = { version = "1", features = ["derive"] } # You only need this if you want app persistence
|
||||
tracing = "0.1.40"
|
||||
#wasm-bindgen = "0.2.83"
|
||||
nostrdb = { git = "https://github.com/damus-io/nostrdb-rs", rev = "6d22af6d5159be4c9e4579f8c9d3af836e0d470a" }
|
||||
nostrdb = { git = "https://github.com/damus-io/nostrdb-rs", rev = "9bbafd8a2e904b77a51e7cfca71eb5bb5650e829" }
|
||||
#nostrdb = { path = "/Users/jb55/dev/github/damus-io/nostrdb-rs" }
|
||||
#nostrdb = "0.3.4"
|
||||
enostr = { path = "enostr" }
|
||||
|
||||
@@ -11,7 +11,7 @@ serde_derive = "1"
|
||||
serde = { version = "1", features = ["derive"] } # You only need this if you want app persistence
|
||||
serde_json = "1.0.89"
|
||||
nostr = { version = "0.30.0" }
|
||||
nostrdb = { git = "https://github.com/damus-io/nostrdb-rs", rev = "6d22af6d5159be4c9e4579f8c9d3af836e0d470a" }
|
||||
nostrdb = { git = "https://github.com/damus-io/nostrdb-rs", rev = "9bbafd8a2e904b77a51e7cfca71eb5bb5650e829" }
|
||||
hex = "0.4.3"
|
||||
tracing = "0.1.40"
|
||||
env_logger = "0.11.1"
|
||||
|
||||
@@ -1,7 +1 @@
|
||||
{
|
||||
"limit": 100,
|
||||
"kinds": [
|
||||
1, 6
|
||||
],
|
||||
"#p": ["32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245"]
|
||||
}
|
||||
{ "limit": 100, "kinds": [ 6 ] }
|
||||
|
||||
@@ -96,7 +96,7 @@ pub fn mobile_font_size(text_style: &NotedeckTextStyle) -> f32 {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(EnumIter)]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug, EnumIter)]
|
||||
pub enum NotedeckTextStyle {
|
||||
Heading,
|
||||
Heading2,
|
||||
|
||||
@@ -327,19 +327,21 @@ impl<'a> NoteView<'a> {
|
||||
action: None,
|
||||
}
|
||||
} else {
|
||||
let txn = self.note.txn().expect("todo: support non-db notes");
|
||||
let txn = self.note.txn().expect("txn");
|
||||
if let Some(note_to_repost) = get_reposted_note(self.ndb, txn, self.note) {
|
||||
let profile = self.ndb.get_profile_by_pubkey(txn, self.note.pubkey());
|
||||
|
||||
let style = NotedeckTextStyle::Small;
|
||||
ui.horizontal(|ui| {
|
||||
ui.vertical(|ui| {
|
||||
ui.add_space(2.0);
|
||||
ui.add_sized([20.0, 20.0], repost_icon());
|
||||
});
|
||||
ui.add_space(6.0);
|
||||
let resp = ui.add(one_line_display_name_widget(get_display_name(
|
||||
profile.as_ref().ok(),
|
||||
)));
|
||||
let resp = ui.add(one_line_display_name_widget(
|
||||
get_display_name(profile.as_ref().ok()),
|
||||
style,
|
||||
));
|
||||
if let Ok(rec) = &profile {
|
||||
resp.on_hover_ui_at_pointer(|ui| {
|
||||
ui.set_max_width(300.0);
|
||||
@@ -349,7 +351,8 @@ impl<'a> NoteView<'a> {
|
||||
ui.add_space(4.0);
|
||||
ui.label(
|
||||
RichText::new("Reposted")
|
||||
.text_style(NotedeckTextStyle::Heading3.text_style()),
|
||||
.color(colors::GRAY_SECONDARY)
|
||||
.text_style(style.text_style()),
|
||||
);
|
||||
});
|
||||
NoteView::new(self.ndb, self.note_cache, self.img_cache, ¬e_to_repost).show(ui)
|
||||
|
||||
@@ -198,17 +198,25 @@ fn display_name_widget(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn one_line_display_name_widget(display_name: DisplayName<'_>) -> impl egui::Widget + '_ {
|
||||
pub fn one_line_display_name_widget(
|
||||
display_name: DisplayName<'_>,
|
||||
style: NotedeckTextStyle,
|
||||
) -> impl egui::Widget + '_ {
|
||||
let text_style = style.text_style();
|
||||
move |ui: &mut egui::Ui| match display_name {
|
||||
DisplayName::One(n) => {
|
||||
ui.label(RichText::new(n).text_style(NotedeckTextStyle::Heading3.text_style()))
|
||||
}
|
||||
DisplayName::One(n) => ui.label(
|
||||
RichText::new(n)
|
||||
.text_style(text_style)
|
||||
.color(colors::GRAY_SECONDARY),
|
||||
),
|
||||
|
||||
DisplayName::Both {
|
||||
display_name,
|
||||
username: _,
|
||||
} => ui.label(
|
||||
RichText::new(display_name).text_style(NotedeckTextStyle::Heading3.text_style()),
|
||||
RichText::new(display_name)
|
||||
.text_style(text_style)
|
||||
.color(colors::GRAY_SECONDARY),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user