web: added open thread view

This commit is contained in:
Thomas Mathews 2022-11-18 19:04:48 -08:00 committed by William Casarin
parent bd317fa05b
commit fa9965b2a0
4 changed files with 20 additions and 0 deletions

View file

@ -67,6 +67,7 @@ function init_home_model() {
},
notifications: init_timeline('notifications'),
profile: init_timeline('profile'),
thread: init_timeline('thread'),
},
pow: 0, // pow difficulty target
deleted: {},

View file

@ -194,6 +194,9 @@ function render_event(damus, view, ev, opts={}) {
<div class="info">
${render_name(ev.pubkey, profile)}
<span class="timestamp">${delta}</span>
<button class="icon" title="View Thread" role="view-event" data-eid="${ev.id}" onclick="click_event(this)">
<img class="icon small" src="icon/open-thread.svg"/>
</button>
</div>
<div class="comment">
${deleted ? render_deleted_comment_body(ev, deleted) : render_comment_body(damus, ev, opts)}

View file

@ -105,3 +105,11 @@ function click_copy_pk(el) {
function click_toggle_follow_user(el) {
alert("sorry not implemented");
}
/* click_event opens the thread view from the element's specified element id
* "dataset.eid".
*/
function click_event(el) {
console.info(`thread to open: ${el.dataset.eid}`);
switch_view("thread");
}