diff --git a/web/js/damus.js b/web/js/damus.js index efef17c..f6387ff 100644 --- a/web/js/damus.js +++ b/web/js/damus.js @@ -2,8 +2,8 @@ let DAMUS const BOOTSTRAP_RELAYS = [ "wss://relay.damus.io", - //"wss://nostr-relay.wlvs.space", - //"wss://nostr-pub.wellorder.net", + "wss://nostr-relay.wlvs.space", + "wss://nostr-pub.wellorder.net", ] // TODO autogenerate these constants with a bash script @@ -138,6 +138,8 @@ function on_pool_open(relay) { kinds: STANDARD_KINDS, limit: 500, }]); + + // TODO perhaps get our following list's history too } function on_pool_notice(relay, notice) { diff --git a/web/js/ui/state.js b/web/js/ui/state.js index a2af100..8190986 100644 --- a/web/js/ui/state.js +++ b/web/js/ui/state.js @@ -40,9 +40,7 @@ function view_timeline_apply_mode(model, mode, opts={}) { names[VM_THREAD] = "Thread"; // Do some visual updates - find_node("#view header > label").innerText = mode == VM_USER ? - fmt_profile_name(DAMUS.profiles[opts.pubkey], fmt_pubkey(opts.pubkey)) : - names[mode]; + find_node("#view header > label").innerText = names[mode]; find_node("#nav > div[data-active]").dataset.active = names[mode].toLowerCase(); find_node("#view [role='profile-info']").classList.toggle("hide", mode != VM_USER); find_node("#newpost").classList.toggle("hide", mode != VM_FRIENDS); @@ -213,6 +211,10 @@ function view_timeline_update_profiles(model, ev) { find_node(`.username[data-pubkey='${pk}']`, el).innerText = name; find_node(`img.pfp[data-pubkey='${pk}']`, el).src = pic; } + // Update the profile view if it's active + if (el.dataset.mode == VM_USER && el.dataset.pubkey == pk) { + view_update_profile(model, pk); + } } function view_timeline_update_timestamps() { diff --git a/web/js/ui/util.js b/web/js/ui/util.js index dbdf83f..e64f338 100644 --- a/web/js/ui/util.js +++ b/web/js/ui/util.js @@ -282,13 +282,18 @@ function open_thread(thread_id) { function open_profile(pubkey) { view_timeline_apply_mode(DAMUS, VM_USER, { pubkey }); + view_update_profile(DAMUS, pubkey); +} - const profile = DAMUS.profiles[pubkey] || {}; +function view_update_profile(model, pubkey) { + const profile = model.profiles[pubkey] || {}; const el = find_node("[role='profile-info']"); - + + const name = fmt_profile_name(profile, fmt_pubkey(pubkey)); + find_node("#view header > label").innerText = name; find_node("[role='profile-image']", el).src = get_picture(pubkey, profile); find_nodes("[role='profile-name']", el).forEach(el => { - el.innerText = fmt_profile_name(profile, fmt_pubkey(pubkey)); + el.innerText = name; }); const el_nip5 = find_node("[role='profile-nip5']", el)