From fa9965b2a02775256eb6292f8b64fe8e1f806370 Mon Sep 17 00:00:00 2001 From: Thomas Mathews Date: Fri, 18 Nov 2022 19:04:48 -0800 Subject: [PATCH] web: added open thread view --- web/css/styles.css | 8 ++++++++ web/js/damus.js | 1 + web/js/ui/render.js | 3 +++ web/js/ui/util.js | 8 ++++++++ 4 files changed, 20 insertions(+) diff --git a/web/css/styles.css b/web/css/styles.css index 82581c3..f49e09c 100644 --- 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 index b8cd12c..7204a34 100644 --- 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 index 699fce4..4a8158f 100644 --- a/web/js/ui/render.js +++ b/web/js/ui/render.js @@ -194,6 +194,9 @@ function render_event(damus, view, ev, opts={}) {
${render_name(ev.pubkey, profile)} ${delta} +
${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 index 9db8ee0..7b02878 100644 --- 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"); +}