mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-09 07:12:39 +02:00
disable message sending if the image processing hasnt completed yet
This commit is contained in:
parent
b5f5301761
commit
08c0232184
1 changed files with 11 additions and 1 deletions
|
|
@ -37,6 +37,9 @@ export function ComposeBoxPlayground({
|
||||||
}, [messages.length, shouldAutoFocus]);
|
}, [messages.length, shouldAutoFocus]);
|
||||||
|
|
||||||
function handleInput() {
|
function handleInput() {
|
||||||
|
// Mirror send-button disable rules to block Enter submits
|
||||||
|
if (disabled || loading || uploading) return;
|
||||||
|
if (pendingImage?.url && pendingImage.description === undefined) return;
|
||||||
const text = input.trim();
|
const text = input.trim();
|
||||||
if (!text && !pendingImage) {
|
if (!text && !pendingImage) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -181,7 +184,14 @@ export function ComposeBoxPlayground({
|
||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
isIconOnly
|
isIconOnly
|
||||||
disabled={disabled || uploading || (loading ? false : (!input.trim() && !pendingImage))}
|
disabled={
|
||||||
|
disabled
|
||||||
|
|| uploading
|
||||||
|
// If an image is selected but description isn't ready yet, keep disabled
|
||||||
|
|| (pendingImage?.url && pendingImage.description === undefined)
|
||||||
|
// When not loading a response, require either text or a ready image
|
||||||
|
|| (loading ? false : (!input.trim() && !pendingImage))
|
||||||
|
}
|
||||||
onPress={loading ? onCancel : handleInput}
|
onPress={loading ? onCancel : handleInput}
|
||||||
className={`
|
className={`
|
||||||
transition-all duration-200
|
transition-all duration-200
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue