diff --git a/apps/ssb.json b/apps/ssb.json index d646c48b..d160eff7 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🐌", - "previous": "&CEeuaRddTxMQkVqXi1GTN9AyqzdyWTAjs3mqSHVTBWY=.sha256" + "previous": "&VsajulCFc9qmOy/hTlOD3q4ilEz3MP2a31u6DRnz4aA=.sha256" } diff --git a/apps/ssb/index.html b/apps/ssb/index.html index 2f6e0e74..7271b9f9 100644 --- a/apps/ssb/index.html +++ b/apps/ssb/index.html @@ -11,7 +11,8 @@ - + + diff --git a/apps/ssb/script.js b/apps/ssb/script.js index 71cb39c2..7054543e 100644 --- a/apps/ssb/script.js +++ b/apps/ssb/script.js @@ -7,6 +7,7 @@ import * as tf_user from './tf-user.js'; import * as tf_compose from './tf-compose.js'; import * as tf_news from './tf-news.js'; import * as tf_profile from './tf-profile.js'; +import * as tf_reactions_modal from './tf-reactions-modal.js'; import * as tf_tab_mentions from './tf-tab-mentions.js'; import * as tf_tab_news from './tf-tab-news.js'; import * as tf_tab_news_feed from './tf-tab-news-feed.js'; diff --git a/apps/ssb/tf-app.js b/apps/ssb/tf-app.js index 72ef8201..95694681 100644 --- a/apps/ssb/tf-app.js +++ b/apps/ssb/tf-app.js @@ -234,7 +234,9 @@ class TfElement extends LitElement { by_count.push({count: v.of, id: id}); } console.log(by_count.sort((x, y) => y.count - x.count).slice(0, 20)); + let start_time = new Date(); users = await this.fetch_about(Object.keys(following).sort(), users); + console.log('about took', (new Date() - start_time) / 1000.0, 'seconds for', Object.keys(users).length, 'users'); this.following = Object.keys(following); this.users = users; await tags; diff --git a/apps/ssb/tf-message.js b/apps/ssb/tf-message.js index 5f1642d6..49840dfe 100644 --- a/apps/ssb/tf-message.js +++ b/apps/ssb/tf-message.js @@ -1,4 +1,4 @@ -import {LitElement, html, unsafeHTML} from './lit-all.min.js'; +import {LitElement, html, render, unsafeHTML} from './lit-all.min.js'; import * as tfrpc from '/static/tfrpc.js'; import * as tfutils from './tf-utils.js'; import * as emojis from './emojis.js'; @@ -54,6 +54,12 @@ class TfMessageElement extends LitElement { ); } + show_reactions() { + let modal = document.getElementById('reactions_modal'); + modal.users = this.users; + modal.votes = this.message?.votes || []; + } + render_votes() { function normalize_expression(expression) { if (expression === 'Like' || !expression) { @@ -66,7 +72,10 @@ class TfMessageElement extends LitElement { return expression; } } - return html`
+ return html`
${(this.message.votes || []).map( (vote) => html` +
+
+

Reactions

+ × +
+
    + ${this.votes.map(x => html` +
  • + ${x?.content?.vote?.expression} + + ${new Date(x?.timestamp).toLocaleString()} +
  • + `)} +
+
+
` : undefined; + } +} + +customElements.define('tf-reactions-modal', TfReactionsModalElement);