From 2cdb230b1eb9fec8c4591f713c3880d884785266 Mon Sep 17 00:00:00 2001 From: Alexey Golub Date: Sat, 14 Sep 2019 19:31:24 +0300 Subject: [PATCH] [HTML] Add indication for pinned messages Closes #193 --- DiscordChatExporter.Core.Models/Message.cs | 6 +++++- .../Resources/HtmlDark.css | 4 ++++ .../Resources/HtmlLight.css | 4 ++++ .../Resources/HtmlShared.css | 20 ++++++++++--------- .../Resources/HtmlShared.html | 19 ++++++++++-------- .../DataService.Parsers.cs | 5 ++++- 6 files changed, 39 insertions(+), 19 deletions(-) diff --git a/DiscordChatExporter.Core.Models/Message.cs b/DiscordChatExporter.Core.Models/Message.cs index 5b35b0d..cb64974 100644 --- a/DiscordChatExporter.Core.Models/Message.cs +++ b/DiscordChatExporter.Core.Models/Message.cs @@ -29,9 +29,12 @@ namespace DiscordChatExporter.Core.Models public IReadOnlyList MentionedUsers { get; } + public bool IsPinned { get; } + public Message(string id, string channelId, MessageType type, User author, DateTimeOffset timestamp, DateTimeOffset? editedTimestamp, string content, IReadOnlyList attachments, - IReadOnlyList embeds, IReadOnlyList reactions, IReadOnlyList mentionedUsers) + IReadOnlyList embeds, IReadOnlyList reactions, IReadOnlyList mentionedUsers, + bool isPinned) { Id = id; ChannelId = channelId; @@ -44,6 +47,7 @@ namespace DiscordChatExporter.Core.Models Embeds = embeds; Reactions = reactions; MentionedUsers = mentionedUsers; + IsPinned = isPinned; } public override string ToString() => Content; diff --git a/DiscordChatExporter.Core.Rendering/Resources/HtmlDark.css b/DiscordChatExporter.Core.Rendering/Resources/HtmlDark.css index 5a1f8e2..0e72ceb 100644 --- a/DiscordChatExporter.Core.Rendering/Resources/HtmlDark.css +++ b/DiscordChatExporter.Core.Rendering/Resources/HtmlDark.css @@ -54,6 +54,10 @@ a { color: rgba(255, 255, 255, 0.2); } +.chatlog__message--pinned { + background-color: rgba(249, 168, 37, 0.05); +} + .chatlog__edited-timestamp { color: rgba(255, 255, 255, 0.2); } diff --git a/DiscordChatExporter.Core.Rendering/Resources/HtmlLight.css b/DiscordChatExporter.Core.Rendering/Resources/HtmlLight.css index e72751c..ccbaa7a 100644 --- a/DiscordChatExporter.Core.Rendering/Resources/HtmlLight.css +++ b/DiscordChatExporter.Core.Rendering/Resources/HtmlLight.css @@ -55,6 +55,10 @@ a { color: #99aab5; } +.chatlog__message--pinned { + background-color: rgba(249, 168, 37, 0.05); +} + .chatlog__edited-timestamp { color: #99aab5; } diff --git a/DiscordChatExporter.Core.Rendering/Resources/HtmlShared.css b/DiscordChatExporter.Core.Rendering/Resources/HtmlShared.css index 19c74b0..441f0d5 100644 --- a/DiscordChatExporter.Core.Rendering/Resources/HtmlShared.css +++ b/DiscordChatExporter.Core.Rendering/Resources/HtmlShared.css @@ -65,7 +65,7 @@ img { margin-top: 4px; padding: 8px; border: 2px solid; - border-radius: 5px; + border-radius: 5px; } .pre--inline { @@ -100,7 +100,7 @@ img { .info { display: flex; max-width: 100%; - margin: 0 5px 10px 5px; + margin: 0 5px 10px 5px; } .info__guild-icon-container { @@ -179,8 +179,13 @@ img { font-size: .75em; } +.chatlog__message { + padding: 2px 5px; + margin-right: -5px; + margin-left: -5px; +} + .chatlog__content { - padding-top: 5px; font-size: .9375em; word-wrap: break-word; } @@ -190,20 +195,17 @@ img { font-size: .8em; } -.chatlog__attachment { - margin: 5px 0; -} - .chatlog__attachment-thumbnail { + margin-top: 5px; max-width: 50%; max-height: 500px; border-radius: 3px; } .chatlog__embed { + margin-top: 5px; display: flex; max-width: 520px; - margin-top: 5px; } .chatlog__embed-color-pill { @@ -301,7 +303,7 @@ img { margin-top: 10px; } -.chatlog__embed-image { +.chatlog__embed-image { max-width: 500px; max-height: 400px; border-radius: 3px; diff --git a/DiscordChatExporter.Core.Rendering/Resources/HtmlShared.html b/DiscordChatExporter.Core.Rendering/Resources/HtmlShared.html index 1e65d86..b639ad2 100644 --- a/DiscordChatExporter.Core.Rendering/Resources/HtmlShared.html +++ b/DiscordChatExporter.Core.Rendering/Resources/HtmlShared.html @@ -27,7 +27,7 @@ - + {{~ # Info ~}}
@@ -36,13 +36,13 @@