Fix display for reactions plugin

This commit is contained in:
lowlighter
2021-03-10 02:33:41 +01:00
parent 7976c7dc11
commit 86a6fa9090
2 changed files with 11 additions and 9 deletions

View File

@@ -45,7 +45,7 @@
list[key] = {value, score:value/(display === "relative" ? max : reactions.length)} list[key] = {value, score:value/(display === "relative" ? max : reactions.length)}
//Results //Results
return {list, comments:comments.length, details, days} return {list, comments:comments.length, details, days, twemoji:q["config.twemoji"]}
} }
//Handle errors //Handle errors
catch (error) { catch (error) {

View File

@@ -13,12 +13,14 @@
</div> </div>
<% } else { %> <% } else { %>
<div class="row fill-width"> <div class="row fill-width">
<style> <% if (plugins.reactions.twemoji) { %>
.gauge.info .twemoji { <style>
transform: scale(0.5); .gauge.info .twemoji {
transform-origin: center; transform: scale(0.5);
} transform-origin: center;
</style> }
</style>
<% } %>
<section class="categories"> <section class="categories">
<% for (const [reaction, icon] of Object.entries({HEART:"❤️", THUMBS_UP:"👍", THUMBS_DOWN:"👎", LAUGH:"😄", CONFUSED:"😕", EYES:"👀", ROCKET:"🚀", HOORAY:"🎉"})) { const {score = 0, value:count = 0} = plugins.reactions.list[reaction] ?? {} %> <% for (const [reaction, icon] of Object.entries({HEART:"❤️", THUMBS_UP:"👍", THUMBS_DOWN:"👎", LAUGH:"😄", CONFUSED:"😕", EYES:"👀", ROCKET:"🚀", HOORAY:"🎉"})) { const {score = 0, value:count = 0} = plugins.reactions.list[reaction] ?? {} %>
<div class="categorie column"> <div class="categorie column">
@@ -26,13 +28,13 @@
<circle class="gauge-base" r="53" cx="60" cy="60"></circle> <circle class="gauge-base" r="53" cx="60" cy="60"></circle>
<% if (score > 0) { %> <% if (score > 0) { %>
<circle class="gauge-arc" transform="rotate(-90 60 60)" r="53" cx="60" cy="60" stroke-dasharray="<%= score * 329 %> 329"></circle> <circle class="gauge-arc" transform="rotate(-90 60 60)" r="53" cx="60" cy="60" stroke-dasharray="<%= score * 329 %> 329"></circle>
<% if (true) { %> <% if (plugins.reactions.twemoji) { %>
<%= icon %> <%= icon %>
<% } else { %> <% } else { %>
<text x="60" y="60" dominant-baseline="central"><%= icon %></text> <text x="60" y="60" dominant-baseline="central"><%= icon %></text>
<% } %> <% } %>
<% } else { %> <% } else { %>
<% if (true) { %> <% if (plugins.reactions.twemoji) { %>
<%= icon %> <%= icon %>
<% } else { %> <% } else { %>
<text x="60" y="60" dominant-baseline="central"><%= icon %></text> <text x="60" y="60" dominant-baseline="central"><%= icon %></text>