summaryrefslogtreecommitdiff
path: root/ui/lib/components
diff options
context:
space:
mode:
authorKit La Touche <kit@transneptune.net>2024-11-07 10:52:16 -0500
committerKit La Touche <kit@transneptune.net>2024-11-07 10:52:16 -0500
commitf31b4d8188ac7e38b6c42380649691c0e8e1e097 (patch)
tree62644664fdce6f10243ad9581b47bac547b53dd3 /ui/lib/components
parent8751155e24f020802d1c387af19318edceaa39d2 (diff)
parent104f1115286834f71013e37617f12a78b3ce5210 (diff)
Merge branch 'main' into wip/pwa
Diffstat (limited to 'ui/lib/components')
-rw-r--r--ui/lib/components/ActiveChannel.svelte27
-rw-r--r--ui/lib/components/MessageInput.svelte3
2 files changed, 4 insertions, 26 deletions
diff --git a/ui/lib/components/ActiveChannel.svelte b/ui/lib/components/ActiveChannel.svelte
index a4ccd24..f939dbd 100644
--- a/ui/lib/components/ActiveChannel.svelte
+++ b/ui/lib/components/ActiveChannel.svelte
@@ -1,34 +1,11 @@
<script>
- import { messages } from '$lib/store';
import MessageRun from './MessageRun.svelte';
- let { channel } = $props();
- let messageList = $derived(channel !== null ? $messages.inChannel(channel) : []);
-
- function* chunkBy(xs, fn) {
- let chunk;
- let key;
- for (let x of xs) {
- let newKey = fn(x);
- if (key !== newKey) {
- if (chunk !== undefined) {
- yield [key, chunk];
- }
-
- chunk = [x];
- key = newKey;
- } else {
- chunk.push(x);
- }
- }
- if (chunk !== undefined) {
- yield [key, chunk];
- }
- }
+ let { messageRuns } = $props();
</script>
<div class="container">
- {#each chunkBy(messageList, (msg) => msg.sender) as [sender, messages]}
+ {#each messageRuns as { sender, messages }}
<div>
<MessageRun {sender} {messages} />
</div>
diff --git a/ui/lib/components/MessageInput.svelte b/ui/lib/components/MessageInput.svelte
index 907391c..c071bea 100644
--- a/ui/lib/components/MessageInput.svelte
+++ b/ui/lib/components/MessageInput.svelte
@@ -18,7 +18,8 @@
}
function onKeyDown(event) {
- if (!event.altKey && event.key === 'Enter') {
+ let modifier = event.shiftKey || event.altKey || event.ctrlKey || event.metaKey;
+ if (!modifier && event.key === 'Enter') {
onSubmit(event);
}
}