Merge pull request 'Merge pull request 'Merge pull request 'Merge pull request 'Fixed the Models utilising useEffect' (#49) from sageTheDm/interstellar_ai:main into main' (#19) from React-Group/interstellar_ai:main into main' (#50) from sageTheDm/interstellar_ai:main into…' (#20) from React-Group/interstellar_ai:main into main

Reviewed-on: https://interstellardevelopment.org/code/code/sageTheDm/interstellar_ai/pulls/20
This commit is contained in:
sageTheDm 2024-09-26 09:53:53 +02:00
commit 58fb335794
11 changed files with 179 additions and 57 deletions

View file

@ -1,14 +1,16 @@
import React, { useState, ForwardedRef, useEffect } from 'react';
import "../styles/variables.css"
interface InputProps {
message: string;
onSendClick: (message: string, override: boolean) => void;
onMicClick: () => void;
inputDisabled: boolean
inputDisabled: boolean;
isRecording:boolean
}
const InputFrontend = React.forwardRef<HTMLDivElement, InputProps>(
({ message, onSendClick, onMicClick, inputDisabled }, ref: ForwardedRef<HTMLDivElement>) => {
({ message, onSendClick, onMicClick, inputDisabled, isRecording}, ref: ForwardedRef<HTMLDivElement>) => {
const [inputValue, setInputValue] = useState('');
useEffect(() => {
@ -29,6 +31,10 @@ const InputFrontend = React.forwardRef<HTMLDivElement, InputProps>(
}
};
const styles = {
}
return (
<div className="input" id="inputForm" ref={ref}>
<input
@ -42,7 +48,7 @@ const InputFrontend = React.forwardRef<HTMLDivElement, InputProps>(
<button type="button" onClick={() => onSendClick(inputValue, false)} disabled={inputDisabled ? true : false}>
<img src="/img/send.svg" alt="send" />
</button>
<button type="button" onClick={onMicClick}>
<button className={`microphone-button ${isRecording ? "red":"green"}`} type="button" onClick={onMicClick}>
<img src="/img/microphone.svg" alt="microphone" />
</button>
</div>