diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-10-10 21:51:10 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-10-10 21:52:26 -0400 |
| commit | 215b0c5cb2ff0ef0b2c7b5549704e23d651a4df9 (patch) | |
| tree | 356484ce699539f2937b768d1a1c9b83f0c7a402 /ui/src/lib/components/MessageInput.svelte | |
| parent | 4401dce2b5545ce8117818812d8e3c8919f5f7fd (diff) | |
Hoist the UI one step up further
Diffstat (limited to 'ui/src/lib/components/MessageInput.svelte')
| -rw-r--r-- | ui/src/lib/components/MessageInput.svelte | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/ui/src/lib/components/MessageInput.svelte b/ui/src/lib/components/MessageInput.svelte deleted file mode 100644 index b33574b..0000000 --- a/ui/src/lib/components/MessageInput.svelte +++ /dev/null @@ -1,30 +0,0 @@ -<script> - import { tick } from 'svelte'; - import { postToChannel } from '$lib/apiServer'; - import { activeChannel } from '$lib/store'; - - let input; - let value; - let disabled; - activeChannel.subscribe((value) => { - disabled = !value.isSet(); - if (input && !disabled) { - input.focus(); - } - }); - - async function handleSubmit(event) { - disabled = true; - // TODO try/catch: - await postToChannel($activeChannel.get(), value); - value = ''; - disabled = false; - await tick(); - input.focus(); - } -</script> - -<form on:submit|preventDefault={handleSubmit} class="flex flex-row flex-nowrap"> - <input bind:this={input} bind:value={value} disabled={disabled} type="search" class="flex-auto h-6 input rounded-r-none" /> - <button color="primary variant-filled-secondary" type="submit" class="flex-none w-6 h-6 btn-icon variant-filled rounded-l-none">»</button> -</form> |
