From aaf9ad451882c93faaf86ee13b619676250caea7 Mon Sep 17 00:00:00 2001 From: talksik Date: Thu, 30 Apr 2026 17:23:17 -0700 Subject: [PATCH] show progress during upload More explicit feedback of the state of their upload. Also prevents recording more media at the same time or interacting with the stream which would feel stale to the human since they just created something and it's yet to be present in the stream. --- .../src/features/compose/ComposeDock.tsx | 29 ++++++++-- .../src/features/compose/ReviewSheet.tsx | 55 ++++++++++++++----- 2 files changed, 63 insertions(+), 21 deletions(-) diff --git a/js/mobile/src/features/compose/ComposeDock.tsx b/js/mobile/src/features/compose/ComposeDock.tsx index 4b2f80a..25a6577 100644 --- a/js/mobile/src/features/compose/ComposeDock.tsx +++ b/js/mobile/src/features/compose/ComposeDock.tsx @@ -36,7 +36,12 @@ type ComposeUiState = uri: string; durationMs: number; } - | { kind: "uploading" }; + | { + kind: "uploading"; + mode: RecordingMode; + uri: string; + durationMs: number; + }; interface SubmitMediaParams { fileUri: string; @@ -125,7 +130,12 @@ export function ComposeDock({ const sendReview = useEvent(async () => { if (ui.kind !== "review" || !userId) return; const captured = ui; - setUi({ kind: "uploading" }); + setUi({ + kind: "uploading", + mode: captured.mode, + uri: captured.uri, + durationMs: captured.durationMs, + }); try { const mimeType = captured.mode === "audio" ? "audio/mp4" : "video/mp4"; @@ -251,10 +261,17 @@ export function ComposeDock({ ) : null} Promise; onRetake: () => void; onCancel: () => void; @@ -32,6 +38,7 @@ export function ReviewSheet({ uri, mode, durationMs, + sending, onSend, onRetake, onCancel, @@ -41,22 +48,22 @@ export function ReviewSheet({ p.muted = false; p.audioMixingMode = "mixWithOthers"; }); - const [submitting, setSubmitting] = useState(false); useEffect(() => { - if (open && uri) { + if (!open || !uri) return; + if (sending) { + player.pause(); + } else { player.play(); } - }, [open, uri, player]); + }, [open, uri, sending, player]); const handleSend = async () => { - if (submitting) return; - setSubmitting(true); + if (sending) return; try { await onSend(); } catch (err) { toast.error(toUserMessage(err)); - setSubmitting(false); } }; @@ -67,7 +74,7 @@ export function ReviewSheet({ visible={open} animationType="fade" transparent={false} - onRequestClose={onCancel} + onRequestClose={sending ? undefined : onCancel} > @@ -110,10 +117,18 @@ export function ReviewSheet({ - Cancel + + Cancel + @@ -125,8 +140,11 @@ export function ReviewSheet({ Retake @@ -134,19 +152,26 @@ export function ReviewSheet({ - {submitting ? "Sending..." : "Send"} + {sending ? "Sending..." : "Send"} + + {sending ? ( + + + Sending... + + ) : null}