fix formatting

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-03-07 12:36:26 -08:00
parent 65bd6a65f9
commit cec49c83bd
8 changed files with 100 additions and 52 deletions

View File

@@ -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)
} }

View File

@@ -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)
} }

View File

@@ -146,8 +146,12 @@ 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,
note_context.img_cache,
txn,
profile.pubkey(),
)
.show(ui) .show(ui)
.inner; .inner;
if act.is_some() { if act.is_some() {
@@ -156,8 +160,12 @@ fn render_note_contents(
} }
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,
note_context.img_cache,
txn,
npub.pubkey(),
)
.show(ui) .show(ui)
.inner; .inner;
if act.is_some() { if act.is_some() {

View File

@@ -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, &note_reply, self.note_context)) .horizontal(|ui| {
reply_desc(ui, txn, &note_reply, self.note_context)
})
.inner; .inner;
if action.is_some() { if action.is_some() {

View File

@@ -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,

View File

@@ -61,7 +61,12 @@ 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(
note_context.ndb,
note_context.img_cache,
txn,
reply_note.pubkey(),
)
.size(size) .size(size)
.selectable(selectable) .selectable(selectable)
.show(ui) .show(ui)
@@ -80,8 +85,12 @@ 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,
note_context.img_cache,
txn,
reply_note.pubkey(),
)
.size(size) .size(size)
.selectable(selectable) .selectable(selectable)
.show(ui) .show(ui)
@@ -99,8 +108,12 @@ 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,
note_context.img_cache,
txn,
reply_note.pubkey(),
)
.size(size) .size(size)
.selectable(selectable) .selectable(selectable)
.show(ui) .show(ui)
@@ -120,8 +133,12 @@ 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,
note_context.img_cache,
txn,
root_note.pubkey(),
)
.size(size) .size(size)
.selectable(selectable) .selectable(selectable)
.show(ui) .show(ui)
@@ -138,7 +155,12 @@ 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(
note_context.ndb,
note_context.img_cache,
txn,
reply_note.pubkey(),
)
.size(size) .size(size)
.selectable(selectable) .selectable(selectable)
.show(ui) .show(ui)

View File

@@ -140,7 +140,10 @@ 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(
self.note_context.img_cache,
get_profile_url(Some(&profile)),
)
.size(size) .size(size)
.border(ProfilePic::border_stroke(ui)), .border(ProfilePic::border_stroke(ui)),
); );

View File

@@ -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,7 +345,8 @@ 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 =
if let Ok(note) = self.note_context.ndb.get_note_by_key(self.txn, note_key) {
note note
} else { } else {
warn!("failed to query note {:?}", note_key); warn!("failed to query note {:?}", note_key);