got rid of console.logs
This commit is contained in:
parent
8ee87b88e9
commit
171e8fd458
8 changed files with 14 additions and 44 deletions
|
@ -6,11 +6,11 @@ interface InputProps {
|
|||
onSendClick: (message: string, override: boolean) => void;
|
||||
onMicClick: () => void;
|
||||
inputDisabled: boolean;
|
||||
isRecording: boolean
|
||||
isRecording: boolean;
|
||||
}
|
||||
|
||||
const InputFrontend = React.forwardRef<HTMLDivElement, InputProps>(
|
||||
({ message, onSendClick, onMicClick, inputDisabled, isRecording }, ref: ForwardedRef<HTMLDivElement>) => {
|
||||
({ message, onSendClick, onMicClick, inputDisabled, isRecording}, ref: ForwardedRef<HTMLDivElement>) => {
|
||||
const [inputValue, setInputValue] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -31,6 +31,13 @@ const InputFrontend = React.forwardRef<HTMLDivElement, InputProps>(
|
|||
}
|
||||
};
|
||||
|
||||
const handleSendClick = () => {
|
||||
if (inputValue.trim() !== "") {
|
||||
onSendClick(inputValue, false); // Send message to parent component
|
||||
setInputValue(''); // Clear input after sending
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="input" id="inputForm" ref={ref}>
|
||||
<input
|
||||
|
@ -41,7 +48,7 @@ const InputFrontend = React.forwardRef<HTMLDivElement, InputProps>(
|
|||
onChange={handleInputChange}
|
||||
onKeyDown={handleKeyDown}
|
||||
/>
|
||||
<button type="button" onClick={() => onSendClick(inputValue, false)} disabled={inputDisabled ? true : false}>
|
||||
<button type="button" onClick={handleSendClick} disabled={inputDisabled ? true : false}>
|
||||
<img src="/img/send.svg" alt="send" />
|
||||
</button>
|
||||
<button className={`microphone-button ${isRecording ? "red" : "var(--input-button-color)"}`} type="button" onClick={onMicClick}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue