Skip to content

Commit c52c82f

Browse files
committed
feat: hide send button when input is empty
1 parent e39f9e6 commit c52c82f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/components/InputPanel.tsx

+19-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ function InputPanel({
9494
}
9595

9696
function SendButton() {
97-
if (status === 'idle' || status === 'recording' || status === 'connecting') {
97+
if (
98+
(status === 'idle' || status === 'recording' || status === 'connecting') &&
99+
userInput.length > 0
100+
) {
98101
return (
99102
<button
100103
type="button"
@@ -105,6 +108,20 @@ function InputPanel({
105108
<div>{i18n.t('common.send')}</div>
106109
</button>
107110
);
111+
} else if (
112+
(status === 'idle' || status === 'recording' || status === 'connecting') &&
113+
userInput.length == 0
114+
) {
115+
return (
116+
<button
117+
type="button"
118+
className="flex flex-row items-center space-x-2 rounded-lg px-4 py-2 font-medium text-white bg-gradient-to-tr from-indigo-500 to-purple-500 transition-colors duration-300 cursor-not-allowed"
119+
onClick={handleSend}
120+
>
121+
<IconSend className="h-5 w-5" />
122+
<div>{i18n.t('common.send')}</div>
123+
</button>
124+
);
108125
} else {
109126
return (
110127
<button
@@ -133,7 +150,7 @@ function InputPanel({
133150
/>
134151
<div className="flex flex-row space-x-2 justify-end">
135152
{/*<div className="self-end text-gray-700">{i18n.t('common.status')}: {status}</div>*/}
136-
<RecordButton />
153+
{!disableMicrophone && <RecordButton />}
137154
<SendButton />
138155
</div>
139156
</div>

0 commit comments

Comments
 (0)