mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-19 19:46:50 +00:00
Reorganize posting area, show list of tags to be applied to a post
This commit is contained in:
parent
02e3eb8ebf
commit
0654b7e70d
@ -67,6 +67,10 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
|
|||||||
});
|
});
|
||||||
ui.separator();
|
ui.separator();
|
||||||
|
|
||||||
|
posting_area(app, ctx, frame, ui);
|
||||||
|
|
||||||
|
ui.separator();
|
||||||
|
|
||||||
// Top Buttons
|
// Top Buttons
|
||||||
Globals::trim_desired_events_sync();
|
Globals::trim_desired_events_sync();
|
||||||
let desired_count: isize = match GLOBALS.desired_events.try_read() {
|
let desired_count: isize = match GLOBALS.desired_events.try_read() {
|
||||||
@ -110,6 +114,38 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
|
|||||||
.on_hover_text("Requests In Flight (http, not wss)");
|
.on_hover_text("Requests In Flight (http, not wss)");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ui.separator();
|
||||||
|
|
||||||
|
match feed_kind {
|
||||||
|
FeedKind::General => {
|
||||||
|
let feed = GLOBALS.feed.get_general();
|
||||||
|
render_a_feed(app, ctx, frame, ui, feed, false);
|
||||||
|
}
|
||||||
|
FeedKind::Replies => {
|
||||||
|
if GLOBALS.signer.blocking_read().public_key().is_none() {
|
||||||
|
ui.horizontal(|ui| {
|
||||||
|
ui.label("You need to ");
|
||||||
|
if ui.link("setup an identity").clicked() {
|
||||||
|
app.page = Page::Relays;
|
||||||
|
}
|
||||||
|
ui.label(" to see any replies to that identity.");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
let feed = GLOBALS.feed.get_replies();
|
||||||
|
render_a_feed(app, ctx, frame, ui, feed, true);
|
||||||
|
}
|
||||||
|
FeedKind::Thread(id) => {
|
||||||
|
let parent = GLOBALS.feed.get_thread_parent(id);
|
||||||
|
render_a_feed(app, ctx, frame, ui, vec![parent], true);
|
||||||
|
}
|
||||||
|
FeedKind::Person(pubkeyhex) => {
|
||||||
|
let feed = GLOBALS.feed.get_person_feed(pubkeyhex);
|
||||||
|
render_a_feed(app, ctx, frame, ui, feed, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn posting_area(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Frame, ui: &mut Ui) {
|
||||||
// Posting Area
|
// Posting Area
|
||||||
ui.vertical(|ui| {
|
ui.vertical(|ui| {
|
||||||
if !GLOBALS.signer.blocking_read().is_ready() {
|
if !GLOBALS.signer.blocking_read().is_ready() {
|
||||||
@ -129,6 +165,13 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
|
|||||||
ui.label(" to post.");
|
ui.label(" to post.");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
real_posting_area(app, ctx, frame, ui);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn real_posting_area(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Frame, ui: &mut Ui) {
|
||||||
|
// Maybe render post we are replying to
|
||||||
if let Some(id) = app.replying_to {
|
if let Some(id) = app.replying_to {
|
||||||
render_post_actual(
|
render_post_actual(
|
||||||
app,
|
app,
|
||||||
@ -145,6 +188,7 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui.with_layout(Layout::right_to_left(Align::TOP), |ui| {
|
ui.with_layout(Layout::right_to_left(Align::TOP), |ui| {
|
||||||
|
// Buttons
|
||||||
ui.with_layout(Layout::top_down(Align::RIGHT), |ui| {
|
ui.with_layout(Layout::top_down(Align::RIGHT), |ui| {
|
||||||
if ui.button("Send").clicked() && !app.draft.is_empty() {
|
if ui.button("Send").clicked() && !app.draft.is_empty() {
|
||||||
match app.replying_to {
|
match app.replying_to {
|
||||||
@ -201,6 +245,8 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Text area
|
||||||
ui.add(
|
ui.add(
|
||||||
TextEdit::multiline(&mut app.draft)
|
TextEdit::multiline(&mut app.draft)
|
||||||
.hint_text("Type your message here")
|
.hint_text("Type your message here")
|
||||||
@ -208,37 +254,10 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
|
|||||||
.lock_focus(true),
|
.lock_focus(true),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ui.separator();
|
// List of tags to be applied
|
||||||
|
for (i, tag) in app.draft_tags.iter().enumerate() {
|
||||||
match feed_kind {
|
ui.label(format!("{}: {}", i, serde_json::to_string(tag).unwrap()));
|
||||||
FeedKind::General => {
|
|
||||||
let feed = GLOBALS.feed.get_general();
|
|
||||||
render_a_feed(app, ctx, frame, ui, feed, false);
|
|
||||||
}
|
|
||||||
FeedKind::Replies => {
|
|
||||||
if GLOBALS.signer.blocking_read().public_key().is_none() {
|
|
||||||
ui.horizontal(|ui| {
|
|
||||||
ui.label("You need to ");
|
|
||||||
if ui.link("setup an identity").clicked() {
|
|
||||||
app.page = Page::Relays;
|
|
||||||
}
|
|
||||||
ui.label(" to see any replies to that identity.");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
let feed = GLOBALS.feed.get_replies();
|
|
||||||
render_a_feed(app, ctx, frame, ui, feed, true);
|
|
||||||
}
|
|
||||||
FeedKind::Thread(id) => {
|
|
||||||
let parent = GLOBALS.feed.get_thread_parent(id);
|
|
||||||
render_a_feed(app, ctx, frame, ui, vec![parent], true);
|
|
||||||
}
|
|
||||||
FeedKind::Person(pubkeyhex) => {
|
|
||||||
let feed = GLOBALS.feed.get_person_feed(pubkeyhex);
|
|
||||||
render_a_feed(app, ctx, frame, ui, feed, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user