ui: feed: button to copy post

This commit is contained in:
Mike Dilger 2022-12-28 16:06:31 +13:00
parent 897756bdb9
commit 8d07305875

View File

@ -1,9 +1,12 @@
use super::{GossipUi, Page};
use crate::comms::BusMessage;
use crate::globals::{Globals, GLOBALS};
use eframe::egui;
use egui::{Align, Color32, Context, Layout, RichText, ScrollArea, TextStyle, Ui, Vec2};
use crate::ui::widgets::CopyButton;
use eframe::{egui, epaint};
use egui::{Align, Color32, Context, Layout, Pos2, RichText, ScrollArea, Shape, TextStyle, Ui, Vec2};
use epaint::{PathShape, Stroke};
use nostr_types::{EventKind, Id};
use tracing::info;
pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Frame, ui: &mut Ui) {
let feed = Globals::blocking_get_feed(true);
@ -75,7 +78,7 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
fn render_post(
app: &mut GossipUi,
_ctx: &Context,
ctx: &Context,
_frame: &mut eframe::Frame,
ui: &mut Ui,
id: Id,
@ -197,6 +200,13 @@ fn render_post(
});
ui.label(&event.content);
// Under row
ui.horizontal(|ui| {
if ui.add(CopyButton { }).clicked() {
ui.output().copied_text = event.content.clone();
}
});
});
});
@ -204,7 +214,8 @@ fn render_post(
if app.settings.view_threaded {
for reply_id in replies {
render_post(app, _ctx, _frame, ui, reply_id, indent + 1);
render_post(app, ctx, _frame, ui, reply_id, indent + 1);
}
}
}