mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-29 16:31:18 +00:00
Content warning: the ability to post with a content-warning label
This commit is contained in:
parent
13725c8ef7
commit
87afc88b02
@ -90,6 +90,22 @@ fn real_posting_area(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
|
||||
});
|
||||
}
|
||||
|
||||
if app.include_content_warning {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("Content Warning: ");
|
||||
ui.add(
|
||||
TextEdit::singleline(&mut app.content_warning)
|
||||
.hint_text("Type content warning here")
|
||||
.text_color(if ui.visuals().dark_mode {
|
||||
Color32::WHITE
|
||||
} else {
|
||||
Color32::BLACK
|
||||
})
|
||||
.desired_width(f32::INFINITY),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
ui.add(
|
||||
TextEdit::multiline(&mut app.draft)
|
||||
.hint_text("Type your message here")
|
||||
@ -114,6 +130,9 @@ fn real_posting_area(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
|
||||
if app.include_subject {
|
||||
tags.push(Tag::Subject(app.subject.clone()));
|
||||
}
|
||||
if app.include_content_warning {
|
||||
tags.push(Tag::ContentWarning(app.content_warning.clone()));
|
||||
}
|
||||
let _ = GLOBALS.to_overlord.send(ToOverlordMessage::Post(
|
||||
app.draft.clone(),
|
||||
tags,
|
||||
@ -159,6 +178,15 @@ fn real_posting_area(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
|
||||
app.include_subject = true;
|
||||
}
|
||||
|
||||
if app.include_content_warning {
|
||||
if ui.button("Remove Content Warning").clicked() {
|
||||
app.include_content_warning = false;
|
||||
app.content_warning = "".to_owned();
|
||||
}
|
||||
} else if ui.button("Add Content Warning").clicked() {
|
||||
app.include_content_warning = true;
|
||||
}
|
||||
|
||||
// Emoji picker
|
||||
ui.menu_button(RichText::new("😀▼").size(14.0), |ui| {
|
||||
for emoji in "😀😁😆😅🤣😕😯👀❤💜👍🤙💯🎯🤌🙏🤝🫂⚡🍆".chars()
|
||||
|
@ -114,6 +114,8 @@ struct GossipUi {
|
||||
tag_someone: String,
|
||||
include_subject: bool,
|
||||
subject: String,
|
||||
include_content_warning: bool,
|
||||
content_warning: String,
|
||||
replying_to: Option<Id>,
|
||||
|
||||
// User entry: metadata
|
||||
@ -251,6 +253,8 @@ impl GossipUi {
|
||||
tag_someone: "".to_owned(),
|
||||
include_subject: false,
|
||||
subject: "".to_owned(),
|
||||
include_content_warning: false,
|
||||
content_warning: "".to_owned(),
|
||||
replying_to: None,
|
||||
editing_metadata: false,
|
||||
metadata: Metadata::new(),
|
||||
|
Loading…
Reference in New Issue
Block a user