mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-29 16:31:18 +00:00
Allow theme to distinguish comment mentions
This commit is contained in:
parent
47c70369d7
commit
5a202195cd
@ -16,6 +16,7 @@ use nostr_types::{Event, EventDelegation, EventKind, IdHex, PublicKeyHex, Tag};
|
||||
|
||||
mod content;
|
||||
|
||||
#[derive(PartialEq)]
|
||||
enum RepostType {
|
||||
/// Damus style, kind 6 repost where the reposted note's JSON
|
||||
/// is included in the content
|
||||
@ -166,6 +167,8 @@ pub struct NoteRenderData {
|
||||
pub is_main_event: bool,
|
||||
/// This message is a repost of another message
|
||||
pub has_repost: bool,
|
||||
/// Is this post being mentioned within a comment
|
||||
pub is_comment_mention: bool,
|
||||
/// This message is part of a thread
|
||||
pub is_thread: bool,
|
||||
/// Is this the first post in the display?
|
||||
@ -225,6 +228,7 @@ pub(super) fn render_note(
|
||||
let render_data = NoteRenderData {
|
||||
height: *height,
|
||||
has_repost: note_data.repost.is_some(),
|
||||
is_comment_mention: false,
|
||||
is_new,
|
||||
is_thread: threaded,
|
||||
is_first,
|
||||
@ -775,6 +779,7 @@ pub(super) fn render_repost(app: &mut GossipUi, ui: &mut Ui, ctx: &Context, pare
|
||||
let render_data = NoteRenderData {
|
||||
height: 0.0,
|
||||
has_repost: repost_data.repost.is_some(),
|
||||
is_comment_mention: parent_data.repost == Some(RepostType::CommentMention),
|
||||
is_new: false,
|
||||
is_main_event: false,
|
||||
is_thread: false,
|
||||
|
@ -510,6 +510,10 @@ impl ThemeDef for DefaultTheme {
|
||||
Shadow::NONE
|
||||
}
|
||||
fn repost_fill(dark_mode: bool, post: &NoteRenderData) -> Color32 {
|
||||
if !post.is_comment_mention {
|
||||
return Color32::TRANSPARENT
|
||||
}
|
||||
|
||||
let mut hsva: ecolor::HsvaGamma = Self::feed_frame_fill(dark_mode, post).into();
|
||||
if dark_mode {
|
||||
hsva.v = (hsva.v + 0.05).min(1.0); // lighten
|
||||
|
@ -495,6 +495,10 @@ impl ThemeDef for RoundyTheme {
|
||||
Shadow::NONE
|
||||
}
|
||||
fn repost_fill(dark_mode: bool, post: &NoteRenderData) -> Color32 {
|
||||
if !post.is_comment_mention {
|
||||
return Color32::TRANSPARENT
|
||||
}
|
||||
|
||||
let mut hsva: ecolor::HsvaGamma = Self::feed_frame_fill(dark_mode, post).into();
|
||||
if dark_mode {
|
||||
hsva.v = (hsva.v + 0.05).min(1.0); // lighten
|
||||
|
Loading…
Reference in New Issue
Block a user