mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-19 01:24:21 +01:00
@@ -352,7 +352,8 @@ fn render_nav_body(
|
|||||||
|
|
||||||
let txn = Transaction::new(ctx.ndb).expect("txn");
|
let txn = Transaction::new(ctx.ndb).expect("txn");
|
||||||
let post_response =
|
let post_response =
|
||||||
ui::PostView::new(&mut note_context, draft, PostType::New, kp, inner_rect).ui(&txn, ui);
|
ui::PostView::new(&mut note_context, draft, PostType::New, kp, inner_rect)
|
||||||
|
.ui(&txn, ui);
|
||||||
|
|
||||||
post_response.action.map(Into::into)
|
post_response.action.map(Into::into)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ pub fn render_timeline_route(
|
|||||||
| TimelineKind::Hashtag(_)
|
| TimelineKind::Hashtag(_)
|
||||||
| TimelineKind::Generic(_) => {
|
| TimelineKind::Generic(_) => {
|
||||||
let note_action =
|
let note_action =
|
||||||
ui::TimelineView::new(kind, timeline_cache, &accounts.mutefun(), note_context).ui(ui);
|
ui::TimelineView::new(kind, timeline_cache, &accounts.mutefun(), note_context)
|
||||||
|
.ui(ui);
|
||||||
|
|
||||||
note_action.map(RenderNavAction::NoteAction)
|
note_action.map(RenderNavAction::NoteAction)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,20 +146,28 @@ fn render_note_contents(
|
|||||||
match block.blocktype() {
|
match block.blocktype() {
|
||||||
BlockType::MentionBech32 => match block.as_mention().unwrap() {
|
BlockType::MentionBech32 => match block.as_mention().unwrap() {
|
||||||
Mention::Profile(profile) => {
|
Mention::Profile(profile) => {
|
||||||
let act =
|
let act = ui::Mention::new(
|
||||||
ui::Mention::new(note_context.ndb, note_context.img_cache, txn, profile.pubkey())
|
note_context.ndb,
|
||||||
.show(ui)
|
note_context.img_cache,
|
||||||
.inner;
|
txn,
|
||||||
|
profile.pubkey(),
|
||||||
|
)
|
||||||
|
.show(ui)
|
||||||
|
.inner;
|
||||||
if act.is_some() {
|
if act.is_some() {
|
||||||
note_action = act;
|
note_action = act;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Mention::Pubkey(npub) => {
|
Mention::Pubkey(npub) => {
|
||||||
let act =
|
let act = ui::Mention::new(
|
||||||
ui::Mention::new(note_context.ndb, note_context.img_cache, txn, npub.pubkey())
|
note_context.ndb,
|
||||||
.show(ui)
|
note_context.img_cache,
|
||||||
.inner;
|
txn,
|
||||||
|
npub.pubkey(),
|
||||||
|
)
|
||||||
|
.show(ui)
|
||||||
|
.inner;
|
||||||
if act.is_some() {
|
if act.is_some() {
|
||||||
note_action = act;
|
note_action = act;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -385,7 +385,9 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
|||||||
|
|
||||||
if note_reply.reply().is_some() {
|
if note_reply.reply().is_some() {
|
||||||
let action = ui
|
let action = ui
|
||||||
.horizontal(|ui| reply_desc(ui, txn, ¬e_reply, self.note_context))
|
.horizontal(|ui| {
|
||||||
|
reply_desc(ui, txn, ¬e_reply, self.note_context)
|
||||||
|
})
|
||||||
.inner;
|
.inner;
|
||||||
|
|
||||||
if action.is_some() {
|
if action.is_some() {
|
||||||
|
|||||||
@@ -223,7 +223,8 @@ impl<'a, 'd> PostView<'a, 'd> {
|
|||||||
hint_rect
|
hint_rect
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Ok(res) = self.note_context.ndb.search_profile(txn, mention_str, 10) {
|
if let Ok(res) = self.note_context.ndb.search_profile(txn, mention_str, 10)
|
||||||
|
{
|
||||||
let resp = SearchResultsView::new(
|
let resp = SearchResultsView::new(
|
||||||
self.note_context.img_cache,
|
self.note_context.img_cache,
|
||||||
self.note_context.ndb,
|
self.note_context.ndb,
|
||||||
@@ -238,8 +239,10 @@ impl<'a, 'd> PostView<'a, 'd> {
|
|||||||
) => {
|
) => {
|
||||||
if let Some(hint_index) = selection {
|
if let Some(hint_index) = selection {
|
||||||
if let Some(pk) = res.get(hint_index) {
|
if let Some(pk) = res.get(hint_index) {
|
||||||
let record =
|
let record = self
|
||||||
self.note_context.ndb.get_profile_by_pubkey(txn, pk);
|
.note_context
|
||||||
|
.ndb
|
||||||
|
.get_profile_by_pubkey(txn, pk);
|
||||||
|
|
||||||
self.draft.buffer.select_mention_and_replace_name(
|
self.draft.buffer.select_mention_and_replace_name(
|
||||||
mention.index,
|
mention.index,
|
||||||
|
|||||||
@@ -61,11 +61,16 @@ pub fn reply_desc(
|
|||||||
|
|
||||||
if note_reply.is_reply_to_root() {
|
if note_reply.is_reply_to_root() {
|
||||||
// We're replying to the root, let's show this
|
// We're replying to the root, let's show this
|
||||||
let action = ui::Mention::new(note_context.ndb, note_context.img_cache, txn, reply_note.pubkey())
|
let action = ui::Mention::new(
|
||||||
.size(size)
|
note_context.ndb,
|
||||||
.selectable(selectable)
|
note_context.img_cache,
|
||||||
.show(ui)
|
txn,
|
||||||
.inner;
|
reply_note.pubkey(),
|
||||||
|
)
|
||||||
|
.size(size)
|
||||||
|
.selectable(selectable)
|
||||||
|
.show(ui)
|
||||||
|
.inner;
|
||||||
|
|
||||||
if action.is_some() {
|
if action.is_some() {
|
||||||
note_action = action;
|
note_action = action;
|
||||||
@@ -80,12 +85,16 @@ pub fn reply_desc(
|
|||||||
if let Ok(root_note) = note_context.ndb.get_note_by_id(txn, root.id) {
|
if let Ok(root_note) = note_context.ndb.get_note_by_id(txn, root.id) {
|
||||||
if root_note.pubkey() == reply_note.pubkey() {
|
if root_note.pubkey() == reply_note.pubkey() {
|
||||||
// simply "replying to bob's note" when replying to bob in his thread
|
// simply "replying to bob's note" when replying to bob in his thread
|
||||||
let action =
|
let action = ui::Mention::new(
|
||||||
ui::Mention::new(note_context.ndb, note_context.img_cache, txn, reply_note.pubkey())
|
note_context.ndb,
|
||||||
.size(size)
|
note_context.img_cache,
|
||||||
.selectable(selectable)
|
txn,
|
||||||
.show(ui)
|
reply_note.pubkey(),
|
||||||
.inner;
|
)
|
||||||
|
.size(size)
|
||||||
|
.selectable(selectable)
|
||||||
|
.show(ui)
|
||||||
|
.inner;
|
||||||
|
|
||||||
if action.is_some() {
|
if action.is_some() {
|
||||||
note_action = action;
|
note_action = action;
|
||||||
@@ -99,12 +108,16 @@ pub fn reply_desc(
|
|||||||
} else {
|
} else {
|
||||||
// replying to bob in alice's thread
|
// replying to bob in alice's thread
|
||||||
|
|
||||||
let action =
|
let action = ui::Mention::new(
|
||||||
ui::Mention::new(note_context.ndb, note_context.img_cache, txn, reply_note.pubkey())
|
note_context.ndb,
|
||||||
.size(size)
|
note_context.img_cache,
|
||||||
.selectable(selectable)
|
txn,
|
||||||
.show(ui)
|
reply_note.pubkey(),
|
||||||
.inner;
|
)
|
||||||
|
.size(size)
|
||||||
|
.selectable(selectable)
|
||||||
|
.show(ui)
|
||||||
|
.inner;
|
||||||
|
|
||||||
if action.is_some() {
|
if action.is_some() {
|
||||||
note_action = action;
|
note_action = action;
|
||||||
@@ -120,12 +133,16 @@ pub fn reply_desc(
|
|||||||
Label::new(RichText::new("in").size(size).color(color)).selectable(selectable),
|
Label::new(RichText::new("in").size(size).color(color)).selectable(selectable),
|
||||||
);
|
);
|
||||||
|
|
||||||
let action =
|
let action = ui::Mention::new(
|
||||||
ui::Mention::new(note_context.ndb, note_context.img_cache, txn, root_note.pubkey())
|
note_context.ndb,
|
||||||
.size(size)
|
note_context.img_cache,
|
||||||
.selectable(selectable)
|
txn,
|
||||||
.show(ui)
|
root_note.pubkey(),
|
||||||
.inner;
|
)
|
||||||
|
.size(size)
|
||||||
|
.selectable(selectable)
|
||||||
|
.show(ui)
|
||||||
|
.inner;
|
||||||
|
|
||||||
if action.is_some() {
|
if action.is_some() {
|
||||||
note_action = action;
|
note_action = action;
|
||||||
@@ -138,11 +155,16 @@ pub fn reply_desc(
|
|||||||
note_link(ui, note_context, "thread", &root_note);
|
note_link(ui, note_context, "thread", &root_note);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let action = ui::Mention::new(note_context.ndb, note_context.img_cache, txn, reply_note.pubkey())
|
let action = ui::Mention::new(
|
||||||
.size(size)
|
note_context.ndb,
|
||||||
.selectable(selectable)
|
note_context.img_cache,
|
||||||
.show(ui)
|
txn,
|
||||||
.inner;
|
reply_note.pubkey(),
|
||||||
|
)
|
||||||
|
.size(size)
|
||||||
|
.selectable(selectable)
|
||||||
|
.show(ui)
|
||||||
|
.inner;
|
||||||
|
|
||||||
if action.is_some() {
|
if action.is_some() {
|
||||||
note_action = action;
|
note_action = action;
|
||||||
|
|||||||
@@ -140,9 +140,12 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
|||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
ui.put(
|
ui.put(
|
||||||
pfp_rect,
|
pfp_rect,
|
||||||
ProfilePic::new(self.note_context.img_cache, get_profile_url(Some(&profile)))
|
ProfilePic::new(
|
||||||
.size(size)
|
self.note_context.img_cache,
|
||||||
.border(ProfilePic::border_stroke(ui)),
|
get_profile_url(Some(&profile)),
|
||||||
|
)
|
||||||
|
.size(size)
|
||||||
|
.border(ProfilePic::border_stroke(ui)),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ui.add(copy_key_widget(&pfp_rect)).clicked() {
|
if ui.add(copy_key_widget(&pfp_rect)).clicked() {
|
||||||
|
|||||||
@@ -138,7 +138,14 @@ fn timeline_ui(
|
|||||||
|
|
||||||
let txn = Transaction::new(note_context.ndb).expect("failed to create txn");
|
let txn = Transaction::new(note_context.ndb).expect("failed to create txn");
|
||||||
|
|
||||||
TimelineTabView::new(timeline.current_view(), reversed, &txn, is_muted, note_context).show(ui)
|
TimelineTabView::new(
|
||||||
|
timeline.current_view(),
|
||||||
|
reversed,
|
||||||
|
&txn,
|
||||||
|
is_muted,
|
||||||
|
note_context,
|
||||||
|
)
|
||||||
|
.show(ui)
|
||||||
});
|
});
|
||||||
|
|
||||||
let at_top_after_scroll = scroll_output.state.offset.y == 0.0;
|
let at_top_after_scroll = scroll_output.state.offset.y == 0.0;
|
||||||
@@ -338,12 +345,13 @@ impl<'a, 'd> TimelineTabView<'a, 'd> {
|
|||||||
|
|
||||||
let note_key = self.tab.notes[ind].key;
|
let note_key = self.tab.notes[ind].key;
|
||||||
|
|
||||||
let note = if let Ok(note) = self.note_context.ndb.get_note_by_key(self.txn, note_key) {
|
let note =
|
||||||
note
|
if let Ok(note) = self.note_context.ndb.get_note_by_key(self.txn, note_key) {
|
||||||
} else {
|
note
|
||||||
warn!("failed to query note {:?}", note_key);
|
} else {
|
||||||
return 0;
|
warn!("failed to query note {:?}", note_key);
|
||||||
};
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
// should we mute the thread? we might not have it!
|
// should we mute the thread? we might not have it!
|
||||||
let muted = if let Ok(root_id) = root_note_id_from_selected_id(
|
let muted = if let Ok(root_id) = root_note_id_from_selected_id(
|
||||||
|
|||||||
Reference in New Issue
Block a user