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

View File

@@ -31,7 +31,8 @@ pub fn render_timeline_route(
| TimelineKind::Hashtag(_)
| TimelineKind::Generic(_) => {
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)
}

View File

@@ -146,20 +146,28 @@ fn render_note_contents(
match block.blocktype() {
BlockType::MentionBech32 => match block.as_mention().unwrap() {
Mention::Profile(profile) => {
let act =
ui::Mention::new(note_context.ndb, note_context.img_cache, txn, profile.pubkey())
.show(ui)
.inner;
let act = ui::Mention::new(
note_context.ndb,
note_context.img_cache,
txn,
profile.pubkey(),
)
.show(ui)
.inner;
if act.is_some() {
note_action = act;
}
}
Mention::Pubkey(npub) => {
let act =
ui::Mention::new(note_context.ndb, note_context.img_cache, txn, npub.pubkey())
.show(ui)
.inner;
let act = ui::Mention::new(
note_context.ndb,
note_context.img_cache,
txn,
npub.pubkey(),
)
.show(ui)
.inner;
if act.is_some() {
note_action = act;
}

View File

@@ -385,7 +385,9 @@ impl<'a, 'd> NoteView<'a, 'd> {
if note_reply.reply().is_some() {
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;
if action.is_some() {

View File

@@ -223,7 +223,8 @@ impl<'a, 'd> PostView<'a, 'd> {
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(
self.note_context.img_cache,
self.note_context.ndb,
@@ -238,8 +239,10 @@ impl<'a, 'd> PostView<'a, 'd> {
) => {
if let Some(hint_index) = selection {
if let Some(pk) = res.get(hint_index) {
let record =
self.note_context.ndb.get_profile_by_pubkey(txn, pk);
let record = self
.note_context
.ndb
.get_profile_by_pubkey(txn, pk);
self.draft.buffer.select_mention_and_replace_name(
mention.index,

View File

@@ -61,11 +61,16 @@ pub fn reply_desc(
if note_reply.is_reply_to_root() {
// 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())
.size(size)
.selectable(selectable)
.show(ui)
.inner;
let action = ui::Mention::new(
note_context.ndb,
note_context.img_cache,
txn,
reply_note.pubkey(),
)
.size(size)
.selectable(selectable)
.show(ui)
.inner;
if action.is_some() {
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 root_note.pubkey() == reply_note.pubkey() {
// simply "replying to bob's note" when replying to bob in his thread
let action =
ui::Mention::new(note_context.ndb, note_context.img_cache, txn, reply_note.pubkey())
.size(size)
.selectable(selectable)
.show(ui)
.inner;
let action = ui::Mention::new(
note_context.ndb,
note_context.img_cache,
txn,
reply_note.pubkey(),
)
.size(size)
.selectable(selectable)
.show(ui)
.inner;
if action.is_some() {
note_action = action;
@@ -99,12 +108,16 @@ pub fn reply_desc(
} else {
// replying to bob in alice's thread
let action =
ui::Mention::new(note_context.ndb, note_context.img_cache, txn, reply_note.pubkey())
.size(size)
.selectable(selectable)
.show(ui)
.inner;
let action = ui::Mention::new(
note_context.ndb,
note_context.img_cache,
txn,
reply_note.pubkey(),
)
.size(size)
.selectable(selectable)
.show(ui)
.inner;
if action.is_some() {
note_action = action;
@@ -120,12 +133,16 @@ pub fn reply_desc(
Label::new(RichText::new("in").size(size).color(color)).selectable(selectable),
);
let action =
ui::Mention::new(note_context.ndb, note_context.img_cache, txn, root_note.pubkey())
.size(size)
.selectable(selectable)
.show(ui)
.inner;
let action = ui::Mention::new(
note_context.ndb,
note_context.img_cache,
txn,
root_note.pubkey(),
)
.size(size)
.selectable(selectable)
.show(ui)
.inner;
if action.is_some() {
note_action = action;
@@ -138,11 +155,16 @@ pub fn reply_desc(
note_link(ui, note_context, "thread", &root_note);
}
} else {
let action = ui::Mention::new(note_context.ndb, note_context.img_cache, txn, reply_note.pubkey())
.size(size)
.selectable(selectable)
.show(ui)
.inner;
let action = ui::Mention::new(
note_context.ndb,
note_context.img_cache,
txn,
reply_note.pubkey(),
)
.size(size)
.selectable(selectable)
.show(ui)
.inner;
if action.is_some() {
note_action = action;

View File

@@ -140,9 +140,12 @@ impl<'a, 'd> ProfileView<'a, 'd> {
ui.horizontal(|ui| {
ui.put(
pfp_rect,
ProfilePic::new(self.note_context.img_cache, get_profile_url(Some(&profile)))
.size(size)
.border(ProfilePic::border_stroke(ui)),
ProfilePic::new(
self.note_context.img_cache,
get_profile_url(Some(&profile)),
)
.size(size)
.border(ProfilePic::border_stroke(ui)),
);
if ui.add(copy_key_widget(&pfp_rect)).clicked() {

View File

@@ -138,7 +138,14 @@ fn timeline_ui(
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;
@@ -338,12 +345,13 @@ impl<'a, 'd> TimelineTabView<'a, 'd> {
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) {
note
} else {
warn!("failed to query note {:?}", note_key);
return 0;
};
let note =
if let Ok(note) = self.note_context.ndb.get_note_by_key(self.txn, note_key) {
note
} else {
warn!("failed to query note {:?}", note_key);
return 0;
};
// should we mute the thread? we might not have it!
let muted = if let Ok(root_id) = root_note_id_from_selected_id(