diff options
| author | Adam Soltys <[email protected]> | 2026-08-04 01:55:02 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-04 01:55:02 -0700 |
| commit | 7ff9861f545aaa8e05a61b43d73cf762eec72595 (patch) | |
| tree | 0711188fe1cf2ed832e869770fc5f9c88b88cf7d /src | |
| parent | 78f947817b8a6f2d15d042d39eb5f2e9d5cb7d1c (diff) | |
| download | coinosv3-7ff9861f545aaa8e05a61b43d73cf762eec72595.tar.gz coinosv3-7ff9861f545aaa8e05a61b43d73cf762eec72595.zip | |
Five conversations, then 'show all' — communities stay in reach
Co-Authored-By: Claude Fable 5 <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/features/messages.js | 13 | ||||
| -rw-r--r-- | src/i18n.js | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/features/messages.js b/src/features/messages.js index 0a17b03..65a71a8 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -1344,9 +1344,14 @@ export function messagesFeature(ctx) { ? h('div', { class: 'list' }, resultRows(h, dmSearch.rows, (r) => openThread(r.pk))) : 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); kids.push( dmRows.length - ? h('div', { class: 'list' }, dmRows.map(({ peer, last }) => + ? h('div', { class: 'list' }, shownDms.map(({ peer, last }) => h('div', { class: 'item chat-thread-row', onClick: () => { ui.msgView = 'dm'; ui.msgPeer = peer; ui.msgStick = true; render(); }, @@ -1358,6 +1363,12 @@ export function messagesFeature(ctx) { h('span', { class: 'chat-time' }, timeLabel(last.rumor.created_at * 1000))), h('div', { class: 'muted small chat-preview' }, (last.mine ? t('msgYouPrefix') + ' ' : '') + last.rumor.content))))) : h('div', { class: 'muted small' }, t('msgNoDms'))); + 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) + kids.push(h('button', { class: 'linklike small', onClick: () => { ui.msgAllDms = false; render(); } }, + t('msgShowFewerDms'))); // ---- communities kids.push(h('div', { class: 'row between mt16', style: 'align-items:baseline' }, diff --git a/src/i18n.js b/src/i18n.js index 91fdcf7..d29accc 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -172,6 +172,8 @@ const STR = { msgCommunitiesTitle: 'Communities', msgNewDm: 'New message', msgNoDms: 'No conversations yet.', + msgShowAllDms: 'Show all {n} conversations', + msgShowFewerDms: 'Show fewer', msgNoDmsYet: 'No messages yet — say hi!', msgDmPlaceholder: 'Message', msgDmEncrypted: 'Private message · end-to-end encrypted', |
