damus.io

damus.io website
git clone git://jb55.com/damus.io
Log | Files | Refs | README | LICENSE

commit fa9965b2a02775256eb6292f8b64fe8e1f806370
parent bd317fa05b9da4b783c0f158e9fbb63b91caa5e3
Author: Thomas Mathews <thomas.c.mathews@gmail.com>
Date:   Fri, 18 Nov 2022 19:04:48 -0800

web: added open thread view

Diffstat:
Mweb/css/styles.css | 8++++++++
Mweb/js/damus.js | 1+
Mweb/js/ui/render.js | 3+++
Mweb/js/ui/util.js | 8++++++++
4 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/web/css/styles.css b/web/css/styles.css @@ -183,6 +183,14 @@ button.nav > img.icon { .event-content > .info { display: inline-block; } +.event-content > .info button[role="view-event"] { + margin-left: 10px; + opacity: 0; + transition: opacity 0.2s linear; +} +.event:hover .event-content > .info button[role="view-event"] { + opacity: 0.6; +} .username { font-weight: 800; font-size: var(--fsReduced); diff --git a/web/js/damus.js b/web/js/damus.js @@ -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: {}, diff --git a/web/js/ui/render.js b/web/js/ui/render.js @@ -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)} diff --git a/web/js/ui/util.js b/web/js/ui/util.js @@ -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"); +}