mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: keep reactions sorted after change
This commit is contained in:
1 file changed
+3
-3
@@ -10,9 +10,9 @@ import { request } from 'vj/utils';
|
|||||||
|
|
||||||
function renderReactions(reactions, self, rootEle) {
|
function renderReactions(reactions, self, rootEle) {
|
||||||
let html = '';
|
let html = '';
|
||||||
for (const key in reactions) {
|
for (const [k, v] of Object.entries(reactions).sort(([, v1], [, v2]) => +v2 - +v1)) {
|
||||||
if (!reactions[key]) continue;
|
if (!v) continue;
|
||||||
html += `<div class="reaction${self[key] ? ' active' : ''}""><span class="emoji">${key}</span> ${reactions[key]}</div>\n`;
|
html += `<div class="reaction${self[k] ? ' active' : ''}""><span class="emoji">${k}</span> ${v}</div>\n`;
|
||||||
}
|
}
|
||||||
rootEle.html(html);
|
rootEle.html(html);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user