change string style

This commit is contained in:
Simon Laux
2020-03-22 21:08:21 +01:00
committed by Simon
parent 9f24d57835
commit c99131f551

View File

@@ -126,22 +126,22 @@ fn message_to_html(author_cache: &HashMap<u32, ContactInfo>, message: Message) -
let avatar: String = { let avatar: String = {
if let Some(profile_img) = &author.profile_img { if let Some(profile_img) = &author.profile_img {
format!( format!(
r#"<div class="author-avatar"> "<div class=\"author-avatar\">\
<img <img\
alt="{author_name}" alt=\"{author_name}\"\
src="blobs/{author_avatar_src}" src=\"blobs/{author_avatar_src}\"\
/> />\
</div>"#, </div>",
author_name = author.name, author_name = author.name,
author_avatar_src = profile_img author_avatar_src = profile_img
) )
} else { } else {
format!( format!(
r#"<div class="author-avatar default" alt="{name}"> "<div class=\"author-avatar default\" alt=\"{name}\">\
<div class="label" style="background-color: {color}"> <div class=\"label\" style=\"background-color: {color}\">\
{initial} {initial}\
</div> </div>\
</div>"#, </div>",
name = author.name, name = author.name,
initial = author.initial, initial = author.initial,
color = author.color color = author.color
@@ -154,22 +154,24 @@ fn message_to_html(author_cache: &HashMap<u32, ContactInfo>, message: Message) -
//todo support images / voice message / attachments //todo support images / voice message / attachments
format!( format!(
r#"<li><div class='message {direction}'> "<li>\
{avatar} <div class=\"message {direction}\">\
<div class="msg-container"> {avatar}\
<span class="author" style="color: {author_color};">{author_name}</span> <div class=\"msg-container\">\
<div class="msg-body"> <span class=\"author\" style=\"color: {author_color};\">{author_name}</span>\
<div dir="auto" class="text"> <div class=\"msg-body\">\
{content} <div dir=\"auto\" class=\"text\">\
</div> {content}\
<div class="metadata"> </div>\
{encryption} <div class=\"metadata\">\
<span class="date date--{direction}" title="{full_time}">{relative_time}</span> {encryption}\
<span class="spacer"></span> <span class=\"date date--{direction}\" title=\"{full_time}\">{relative_time}</span>\
</div> <span class=\"spacer\"></span>\
</div> </div>\
</div> </div>\
<div></li>"#, </div>\
<div>\
</li>",
direction = match message.from_id == DC_CONTACT_ID_SELF { direction = match message.from_id == DC_CONTACT_ID_SELF {
true => "outgoing", true => "outgoing",
false => "incomming", false => "incomming",