don't show zap button if no wallet
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -27,7 +27,7 @@ use crate::{
|
||||
|
||||
use egui_nav::{Nav, NavAction, NavResponse, NavUiType};
|
||||
use nostrdb::Transaction;
|
||||
use notedeck::{AccountsAction, AppContext, NoteAction, NoteContext};
|
||||
use notedeck::{get_current_wallet, AccountsAction, AppContext, NoteAction, NoteContext};
|
||||
use notedeck_ui::View;
|
||||
use tracing::error;
|
||||
|
||||
@@ -277,6 +277,7 @@ fn render_nav_body(
|
||||
zaps: ctx.zaps,
|
||||
pool: ctx.pool,
|
||||
job_pool: ctx.job_pool,
|
||||
current_account_has_wallet: get_current_wallet(ctx.accounts, ctx.global_wallet).is_some(),
|
||||
};
|
||||
match top {
|
||||
Route::Timeline(kind) => render_timeline_route(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
¬e,
|
||||
self.note_options,
|
||||
self.jobs,
|
||||
|
||||
Reference in New Issue
Block a user