aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/messages.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-28 21:41:22 -0700
committerAdam Soltys <[email protected]>2026-09-28 21:41:22 -0700
commitb22b0c98c673df984f347db2be580c2551e113f7 (patch)
tree9c4acce4b593fc293da63a1913bbb2c60c707efd /src/features/messages.js
parent63e7746f98d7910053cd0b9e1a4a2ed3e6612af3 (diff)
downloadcoinosv3-b22b0c98c673df984f347db2be580c2551e113f7.tar.gz
coinosv3-b22b0c98c673df984f347db2be580c2551e113f7.zip
The chat list shows four conversations and four communities, the rest behind Show all.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/features/messages.js')
-rw-r--r--src/features/messages.js21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 64754d0..90410fb 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -8244,11 +8244,10 @@ export function messagesFeature(ctx) {
? h('div', { class: 'list' }, resultRows(h, dmSearch.rows, (r) => openThread(r.pk), (pk, node) => hook('wrapAvatar', pk, node)))
: h('div', { class: 'small muted' }, t('msgNoMatches'))));
}
- // A long DM history must not bury the communities below it: past a
- // handful, the rest waits behind "show all". (No cap for barely-over —
- // a "show 2 more" button costs more than the rows it hides.)
- const DM_PREVIEW = 5;
- const shownDms = (ui.msgAllDms || dmRows.length <= DM_PREVIEW + 2) ? dmRows : dmRows.slice(0, DM_PREVIEW);
+ // A long DM history must not bury the communities below it: past four,
+ // the rest waits behind "show all". Communities get the same cap.
+ const LIST_PREVIEW = 4;
+ const shownDms = ui.msgAllDms ? dmRows : dmRows.slice(0, LIST_PREVIEW);
kids.push(
dmRows.length
? h('div', { class: 'list' }, shownDms.map(({ peer, last, unread }) =>
@@ -8268,7 +8267,7 @@ export function messagesFeature(ctx) {
if (shownDms.length < dmRows.length)
kids.push(h('button', { class: 'linklike small', onClick: () => { ui.msgAllDms = true; render(); } },
t('msgShowAllDms', { n: dmRows.length })));
- else if (ui.msgAllDms && dmRows.length > DM_PREVIEW + 2)
+ else if (ui.msgAllDms && dmRows.length > LIST_PREVIEW)
kids.push(h('button', { class: 'linklike small', onClick: () => { ui.msgAllDms = false; render(); } },
t('msgShowFewerDms')));
@@ -8305,7 +8304,9 @@ export function messagesFeature(ctx) {
value: ui.msgNewName || '', onInput: (e) => { ui.msgNewName = e.target.value; },
}),
h('button', { class: 'btn-sm', onClick: () => createCommunity(ui.msgNewName || '') }, t('msgCreate'))));
- kids.push(h('div', { class: 'list' }, communities().map((jm) => {
+ const allRooms = communities();
+ const shownRooms = ui.msgAllRooms ? allRooms : allRooms.slice(0, LIST_PREVIEW);
+ kids.push(h('div', { class: 'list' }, shownRooms.map((jm) => {
const room = rooms.get(jm.community_id);
const name = room?.folded?.metadata?.name || jm.name;
// Last session's settled count anchors the number: while the guestbook
@@ -8329,6 +8330,12 @@ export function messagesFeature(ctx) {
// the row's own centring puts the dot mid-height, off the edge
unread ? h('i', { class: 'thread-dot' }) : null);
})));
+ if (shownRooms.length < allRooms.length)
+ kids.push(h('button', { class: 'linklike small', onClick: () => { ui.msgAllRooms = true; render(); } },
+ t('msgShowAllCommunities', { n: allRooms.length })));
+ else if (ui.msgAllRooms && allRooms.length > LIST_PREVIEW)
+ kids.push(h('button', { class: 'linklike small', onClick: () => { ui.msgAllRooms = false; render(); } },
+ t('msgShowFewerDms')));
return h('div', { class: 'card col chat-page', style: 'gap:10px' }, ...kids);
}