diff options
| author | Adam Malczewski <[email protected]> | 2026-10-21 19:39:47 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-10-21 19:39:47 +0900 |
| commit | 7b7d6d01cf94ecad1dcaaa4b87670d50fe15790a (patch) | |
| tree | 29bbfa52183b2a6639d96ad21d66806fb8ccea30 /src/features/chat/ui | |
| parent | ac43e92d174ed1f081c387944e9044643ee9efc2 (diff) | |
| download | dispatch-web-7b7d6d01cf94ecad1dcaaa4b87670d50fe15790a.tar.gz dispatch-web-7b7d6d01cf94ecad1dcaaa4b87670d50fe15790a.zip | |
fix(chat): bound live subscriptions and preserve unconfirmed input
Diffstat (limited to 'src/features/chat/ui')
| -rw-r--r-- | src/features/chat/ui/PendingInputs.svelte | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/features/chat/ui/PendingInputs.svelte b/src/features/chat/ui/PendingInputs.svelte new file mode 100644 index 0000000..cbaf35f --- /dev/null +++ b/src/features/chat/ui/PendingInputs.svelte @@ -0,0 +1,34 @@ +<script lang="ts"> + import type { PendingInput } from "../pending-inputs"; + + let { + inputs, + onDiscard, + }: { + inputs: readonly PendingInput[]; + onDiscard: (requestId: string) => void; + } = $props(); +</script> + +{#each inputs as input (input.request.requestId)} + <div class="m-3 rounded border border-warning p-3 text-sm" role="status"> + <p> + {input.rejection + ? `Message rejected: ${input.rejection}` + : "Delivery unconfirmed. Your input is saved on this device."} + </p> + <p>Check the conversation history before sending again to avoid a duplicate.</p> + <textarea + class="textarea textarea-bordered mt-2 w-full" + aria-label="Saved message" + readonly + value={input.request.type === "chat.send" ? input.request.message : input.request.text} + ></textarea> + {#each input.request.images ?? [] as image} + <img class="my-2 max-h-32" src={image.url} alt="Saved attachment" /> + {/each} + <button class="btn btn-sm mt-2" onclick={() => onDiscard(input.request.requestId)} + >Discard saved copy</button + > + </div> +{/each} |
