aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrien Hopkins <[email protected]>2025-12-23 17:19:05 -0500
committerAdrien Hopkins <[email protected]>2025-12-23 17:19:05 -0500
commitdc5e28b08b701de05139476c001b25c500a505ce (patch)
tree53dbcaf5d8340d70b8c3bb76f20a6ad1b08f081a
parent09502c9d2843f801a1558278f07b167492e669d7 (diff)
downloadcoinos-ui-dc5e28b08b701de05139476c001b25c500a505ce.tar.gz
coinos-ui-dc5e28b08b701de05139476c001b25c500a505ce.zip
Make selectedChat the whole object
-rw-r--r--src/routes/(app)/dm/+page.svelte10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/routes/(app)/dm/+page.svelte b/src/routes/(app)/dm/+page.svelte
index f29df543..280b63d3 100644
--- a/src/routes/(app)/dm/+page.svelte
+++ b/src/routes/(app)/dm/+page.svelte
@@ -153,9 +153,9 @@
<div class={"sidebar " + ($theme === "light" ? "light-sidebar" : "dark-sidebar")}>
<h2 class="text-xl chat-header">Chats</h2>
{#each chats as c}
- <button class={"chat-btn " + ($theme === "light" ? "light-chat-btn" : "dark-chat-btn") + (selectedChat == c.name ? ($theme === "light" ? " light-selected" : " dark-selected") : "")} on:click={() => selectedChat = c.name}>
- <span class="text-xl">{c.name}</span> <span class={(!c.nip05 || c.valid ? "" : "invalid ") + "secondary text-xs"}>{c.nip05 || c.pubkey.substring(0, 16)}</span>{#if c.valid} &#x2713;{/if}
- </button>
+ <button class={"chat-btn " + ($theme === "light" ? "light-chat-btn" : "dark-chat-btn") + (selectedChat && selectedChat.pubkey == c.pubkey ? ($theme === "light" ? " light-selected" : " dark-selected") : "")} on:click={() => selectedChat = c}>
+ <span class="text-xl">{c.name}</span> <span class={(!c.nip05 || c.valid ? "" : "invalid ") + "secondary text-xs"}>{c.nip05 || c.pubkey.substring(0, 16)}</span>{#if c.valid} &#x2713;{/if}
+ </button>
{/each}
</div>
<div class="main container space-y-2 mx-auto space-y-5 lg:max-w-xl xl:max-w-2xl lg:pl-10 mt-5 lg:mt-0">
@@ -163,6 +163,8 @@
class="text-5xl font-medium text-left w-full mx-auto lg:mx-0 md:w-[500px]"
>{$t("dm.header")}</h1>
- <p>You are talking to <a href="/dm/{selectedChat}">{selectedChat}</a>.</p>
+ {#if selectedChat}
+ <p>You are talking to <a href="/dm/{selectedChat.name}">{selectedChat.name}</a>.</p>
+ {/if}
</div>
</div>