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}