From 88b7c75fca9db45611ebdc02af150e56f6818120 Mon Sep 17 00:00:00 2001 From: Ev Bogue Date: Sat, 23 Nov 2019 14:08:31 -0600 Subject: add name to buttons --- views.js | 72 +++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/views.js b/views.js index 1758e63..de61501 100644 --- a/views.js +++ b/views.js @@ -33,54 +33,52 @@ function profilePage (src, keys) { profile.appendChild(h('br')) - var mentionsButton = h('button', { - onclick: function () { - location.href = '#?' + src - } - }, ['Mentions']) - quickName(src).then(name => { - console.log(name) + var mentionsButton = h('button', { + onclick: function () { + location.href = '#?' + src + } + }, [name + '\'s Mentions']) + profile.appendChild(mentionsButton) var respond = h('button', { onclick: function () { scroller.insertBefore(composer(keys, msg, name), scroller.childNodes[1]) } }, ['Reply to ' + name]) profile.appendChild(respond) - }) - profile.appendChild(identify(src, profile, keys)) - profile.appendChild(mentionsButton) + if (src != keys.publicKey) { + localforage.getItem('subscriptions').then(function (subs) { + if (subs.includes(src)) { + profile.appendChild(h('button', { + onclick: function () { + subs = subs.filter(a => a !== src) + localforage.setItem('subscriptions', subs).then(function () { location.reload() }) + } + }, ['Unsubscribe from ' + name])) + } else { + profile.appendChild(h('button', { + onclick: function () { + subs.push(src) + localforage.setItem('subscriptions', subs).then(function () { location.reload() }) + } + }, ['Subscribe to ' + name])) + } + }) + } - if (src != keys.publicKey) { - localforage.getItem('subscriptions').then(function (subs) { - if (subs.includes(src)) { - profile.appendChild(h('button', { - onclick: function () { - subs = subs.filter(a => a !== src) - localforage.setItem('subscriptions', subs).then(function () { location.reload() }) - } - }, ['Unsubscribe'])) - } else { - profile.appendChild(h('button', { - onclick: function () { - subs.push(src) - localforage.setItem('subscriptions', subs).then(function () { location.reload() }) - } - }, ['Subscribe'])) + profile.appendChild(h('button', { + onclick: function () { + localforage.removeItem(src).then(function () { + var home = true + regenerate(home) + }) } - }) - } + }, ['Delete ' + name + '\'s feed'])) + }) + + profile.appendChild(identify(src, profile, keys)) - profile.appendChild(h('button', { - onclick: function () { - localforage.removeItem(src).then(function () { - var home = true - regenerate(home) - }) - } - }, ['Delete feed'])) - async function addPosts (posts, keys) { posts.forEach(function (msg) { if (msg.author === src) { -- cgit v1.2.3-70-g09d2