diff options
| author | Adrien Hopkins <[email protected]> | 2026-02-14 11:03:08 -0500 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-14 17:50:35 -0800 |
| commit | 1baa0612d5fe9779a205db34564c2a10453ddc07 (patch) | |
| tree | 161b023ee4844de1032e60b1f06ca2f27b6d8a71 /src | |
| parent | e4fcbff25f21c21bc5259b41f409f79516b5ab60 (diff) | |
| download | coinos-ui-1baa0612d5fe9779a205db34564c2a10453ddc07.tar.gz coinos-ui-1baa0612d5fe9779a205db34564c2a10453ddc07.zip | |
Hide empty chats when unselected
The only way these chats appear is if you add them, so if you leave them
without sending a message, they are removed from the list. You can
always add them again using the same way you got them.
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/(app)/dm/+page.svelte | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/routes/(app)/dm/+page.svelte b/src/routes/(app)/dm/+page.svelte index edc067d6..a0ad4f27 100644 --- a/src/routes/(app)/dm/+page.svelte +++ b/src/routes/(app)/dm/+page.svelte @@ -139,6 +139,16 @@ let canSendExpiring = $state(false); let nostrUserInfo: any = $state({}); + const selectedChatEmpty = () => !messageRumours || messageRumours.size == 0; + + const removeChat = (pubkey: string) => { + for (let i = 0; i < chats.length; i++) { + if (chats[i].pubkey === pubkey) { + chats.splice(i, 1); + } + } + }; + const includesPubkey = (chats: any[], pubkey: string) => { for (const c of chats) { if (c.pubkey === pubkey) { @@ -149,6 +159,10 @@ }; const selectChat = (c: any) => { + if (selectedChat && selectedChatEmpty()) { + removeChat(selectedChat.pubkey); + } + selectedChat = c; if (!includesPubkey(chats, c.pubkey)) { chats.unshift(c); |
