- {#if !activeRoom}
-
- #
-
- {:else if messages.length === 0}
- select a room to start chatting
-
- #
-
- {:else}
- {#if hasOlderMessages}
-
- {/if}
- {#each messages as msg, i (full(msg.id))}
- no messages yet — say hello
- {
- const items: ContextMenuItem[] = [
- { label: 'Copy message', action: () => navigator.clipboard.writeText(msg.body) },
- { label: 'Reply', action: () => replyTo = msg },
- { label: 'React +1', action: () => onToggleReaction(full(msg.id), '+1') },
- ];
- if (user && full(msg.author) === full(user.id) && !msg.deleted) {
- items.push({ label: 'Edit message', action: () => beginEdit(msg) });
- items.push({ label: 'Delete message', action: () => onDeleteMessage(full(msg.id)) });
- }
- onShowMenu(e, items);
- }}
- >
- {#if !isGrouped(i)}
-
- { e.stopPropagation(); onShowMenu(e, [
- { label: 'Copy username', action: () => navigator.clipboard.writeText(msg.author_username ?? sid(msg.author)) },
- { label: 'Copy user ID', action: () => navigator.clipboard.writeText(sid(msg.author)) },
- ]); }}
- >{msg.author_username ?? sid(msg.author)}
- {fmt(msg.created)}
- {#if msg.updated}edited{/if}
+
+
+ {#if !activeRoom}
+
-
-
- {#if replyTo}
-
+ #
+
- {/if}
- {#if msg.reply_to}
- select a room to start chatting
replying to {sid(msg.reply_to)}
- {/if}
- {#if !msg.deleted}
-
-
-
- {#if user && full(msg.author) === full(user.id)}
-
- {/if}
+ {:else if messages.length === 0}
+
- {/each}
- {/if}
-
+ #
+
- {/if}
- {#if msg.deleted}
- no messages yet — say hello
message deleted
- {:else if editingId === full(msg.id)} -
-
-
-
-
- {:else}
- {msg.body}
- {/if} - {#if msg.reactions?.length} -
- {#each msg.reactions as reaction}
+ {:else}
+ {#if hasOlderMessages}
- {/each}
-
- {/if}
-
- replying to {replyTo.author_username ?? sid(replyTo.author)}
-
+ {/if}
+ {#each messages as msg, i (full(msg.id))}
+
- {/if}
- {
+ const items: ContextMenuItem[] = [
+ {
+ label: "Copy message",
+ action: () =>
+ navigator.clipboard.writeText(msg.body),
+ },
+ { label: "Reply", action: () => (replyTo = msg) },
+ {
+ label: "React +1",
+ action: () =>
+ onToggleReaction(full(msg.id), "+1"),
+ },
+ ];
+ if (
+ user &&
+ full(msg.author) === full(user.id) &&
+ !msg.deleted
+ ) {
+ items.push({
+ label: "Edit message",
+ action: () => beginEdit(msg),
+ });
+ items.push({
+ label: "Delete message",
+ action: () => onDeleteMessage(full(msg.id)),
+ });
+ }
+ onShowMenu(e, items);
+ }}
+ >
+ {#if !isGrouped(i)}
+
+ {/each}
+ {/if}
+ {
+ e.stopPropagation();
+ onShowMenu(e, [
+ {
+ label: "Copy username",
+ action: () =>
+ navigator.clipboard.writeText(
+ msg.author_username ??
+ sid(msg.author),
+ ),
+ },
+ {
+ label: "Copy user ID",
+ action: () =>
+ navigator.clipboard.writeText(
+ sid(msg.author),
+ ),
+ },
+ ]);
+ }}
+ >{msg.author_username ?? sid(msg.author)}
+ {fmt(msg.created)}
+ {#if msg.updated}edited{/if}
+
+ {/if}
+ {#if msg.reply_to}
+
+ replying to {sid(msg.reply_to)}
+
+ {/if}
+ {#if !msg.deleted}
+
+
+
+ {#if user && full(msg.author) === full(user.id)}
+
+ {/if}
+
+ {/if}
+ {#if msg.deleted}
+ message deleted
+ {:else if editingId === full(msg.id)} +
+
+
+
+
+ {:else}
+ {msg.body}
+ {/if} + {#if msg.reactions?.length} +
+ {#each msg.reactions as reaction}
+
+ {/each}
+
+ {/if}
+
-
-
-
+
+ {#if replyTo}
+
+ replying to {replyTo.author_username ??
+ sid(replyTo.author)}
+
+
+ {/if}
+
+
+
+
diff --git a/src/lib/components/ContextMenu.svelte b/src/lib/components/ContextMenu.svelte
index 99613b2..1216846 100644
--- a/src/lib/components/ContextMenu.svelte
+++ b/src/lib/components/ContextMenu.svelte
@@ -1,112 +1,133 @@
- e.stopPropagation()}
- onkeydown={(e) => e.stopPropagation()}
- oncontextmenu={(e) => { e.preventDefault(); e.stopPropagation(); }}
- role="menu"
+ class="ctx-menu"
+ bind:this={menuEl}
+ style="left:{x}px; top:{y}px"
+ onclick={(e) => e.stopPropagation()}
+ onkeydown={(e) => e.stopPropagation()}
+ oncontextmenu={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ }}
+ role="menu"
>
- {#each items as item, i}
-
- - - - {/each} + {#each items as item, i} +
- + + + {/each}
- OXYDE
-
+ OXYDE
+
diff --git a/src/lib/components/Sidebar.svelte b/src/lib/components/Sidebar.svelte
index 8850e79..af1532d 100644
--- a/src/lib/components/Sidebar.svelte
+++ b/src/lib/components/Sidebar.svelte
@@ -1,554 +1,877 @@
-