don't show zap button if no wallet

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-05-07 14:36:56 -04:00
parent 86d2a9e2e7
commit 54c0fdb563
10 changed files with 84 additions and 58 deletions

View File

@@ -11,7 +11,7 @@ use egui::{
widgets::text_edit::TextEdit,
Frame, Layout, Margin, Pos2, ScrollArea, Sense, TextBuffer,
};
use enostr::{FilledKeypair, FullKeypair, NoteId, Pubkey, RelayPool};
use enostr::{FilledKeypair, FullKeypair, KeypairUnowned, NoteId, Pubkey, RelayPool};
use nostrdb::{Ndb, Transaction};
use notedeck_ui::blur::PixelDimensions;
use notedeck_ui::images::{get_render_state, RenderState};
@@ -341,10 +341,16 @@ impl<'a, 'd> PostView<'a, 'd> {
.show(ui, |ui| {
ui.vertical(|ui| {
ui.set_max_width(avail_size.x * 0.8);
let zapping_acc = self
.note_context
.current_account_has_wallet
.then(|| KeypairUnowned::from(&self.poster));
render_note_preview(
ui,
self.note_context,
&Some(self.poster.into()),
zapping_acc.as_ref(),
txn,
id.bytes(),
nostrdb::NoteKey::new(0),
@@ -778,6 +784,7 @@ mod preview {
zaps: app.zaps,
pool: app.pool,
job_pool: app.job_pool,
current_account_has_wallet: false,
};
PostView::new(

View File

@@ -4,7 +4,7 @@ use crate::ui::{
note::{PostAction, PostResponse, PostType},
};
use enostr::{FilledKeypair, NoteId};
use enostr::{FilledKeypair, KeypairUnowned, NoteId};
use notedeck::NoteContext;
use notedeck_ui::jobs::JobsCache;
use notedeck_ui::{NoteOptions, NoteView, ProfilePic};
@@ -67,12 +67,17 @@ impl<'a, 'd> PostReplyView<'a, 'd> {
let note_offset: i8 =
pfp_offset - ProfilePic::medium_size() / 2 - NoteView::expand_size() / 2;
let zapping_acc = self
.note_context
.current_account_has_wallet
.then(|| KeypairUnowned::from(&self.poster));
let quoted_note = egui::Frame::NONE
.outer_margin(egui::Margin::same(note_offset))
.show(ui, |ui| {
NoteView::new(
self.note_context,
&Some(self.poster.into()),
zapping_acc.as_ref(),
self.note,
self.note_options,
self.jobs,

View File

@@ -399,10 +399,15 @@ impl<'a, 'd> TimelineTabView<'a, 'd> {
};
if !muted {
let zapping_acc = self
.cur_acc
.as_ref()
.filter(|_| self.note_context.current_account_has_wallet);
notedeck_ui::padding(8.0, ui, |ui| {
let resp = NoteView::new(
self.note_context,
self.cur_acc,
zapping_acc,
&note,
self.note_options,
self.jobs,