- Less buggy show more button
- Switched edit profile button to word instead of icon
This commit is contained in:
Thomas Mathews 2023-01-27 10:25:22 -08:00
parent 84a6cf6c96
commit 7c4274ee32
2 changed files with 22 additions and 6 deletions

View file

@ -158,7 +158,8 @@
name="profile-website" action="open-link">
<img class="icon svg" src="/icon/profile-website.svg"/>
</button>
<button class="icon link hide"
<button class="icon link hide"
title="Copy Lightning Address"
name="profile-lud06" action="open-lud06">
<img class="icon svg" src="/icon/profile-zap.svg"/>
</button>
@ -166,14 +167,16 @@
title="Directly Message">
<img class="icon svg" src="/icon/message-user.svg"/>
</button>
<button class="icon hide" name="edit-profile"
title="Edit Profile">
<img class="icon svg" src="/icon/edit-profile.svg"/></button>
<button class="icon" name="copy-pk"
data-pk="" title="Copy Public Key">
<img class="icon svg" src="/icon/pubkey.svg"/></button>
<button class="action" name="follow-user"
data-pk="">Follow</button>
<button class="action" name="edit-profile"
title="Update Profile">
Update
</button>
</div>
</div>
<div>

View file

@ -116,6 +116,7 @@ function view_timeline_apply_mode(model, mode, opts={}, push_state=true) {
}
// Do some visual updates
find_node("#show-more").classList.add("hide");
find_node("#view header > label").innerText = name;
find_node("#nav > div[data-active]").dataset.active = names[mode].toLowerCase();
find_node("#view [role='profile-info']").classList.toggle("hide", mode != VM_USER);
@ -188,7 +189,9 @@ function view_timeline_refresh(model, mode, opts={}) {
model_get_dm(model, opts.pubkey).events.concat().reverse() :
model_events_arr(model);
const fragment = new DocumentFragment();
for (let i = evs.length - 1; i >= 0 && count < limit; i--) {
let show_more = true;
let i = evs.length - 1;
for (; i >= 0 && count < limit; i--) {
const ev = evs[i];
if (!view_mode_contains_event(model, ev, mode, opts))
continue;
@ -204,9 +207,19 @@ function view_timeline_refresh(model, mode, opts={}) {
view_timeline_update_timestamps();
view_show_spinner(false);
}
// Reduce i to 0 if there are no more events to show, otherwise exit at
// first instance. Determine show_more base on these facts
for (; i > 0; i--) {
if (view_mode_contains_event(model, evs[i], mode, opts))
break;
}
if (i < 0 || count < limit)
show_more = false;
// If we reached the limit there is "probably" more to show so show
// the more button
if (count == limit) {
const is_more_mode = mode == VM_FRIENDS || mode == VM_NOTIFICATIONS ||
mode == VM_EXPLORE;
if (is_more_mode && show_more) {
find_node("#show-more").classList.remove("hide");
}
}