[Update] Main Page: Message Input Box. Add startTyping and stopTyping.(send backend and show 「・・・」)
This commit is contained in:
@@ -14,6 +14,8 @@ export const MessageInputBox = () => {
|
|||||||
currentMessageLogs,
|
currentMessageLogs,
|
||||||
currentMessageInputValue,
|
currentMessageInputValue,
|
||||||
updateMessageInputValue,
|
updateMessageInputValue,
|
||||||
|
startTyping,
|
||||||
|
stopTyping,
|
||||||
} = useMessage();
|
} = useMessage();
|
||||||
|
|
||||||
const { currentEnableAutoClearMessageInputBox } = useEnableAutoClearMessageInputBox();
|
const { currentEnableAutoClearMessageInputBox } = useEnableAutoClearMessageInputBox();
|
||||||
@@ -45,7 +47,9 @@ export const MessageInputBox = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onChangeFunction = (e) => {
|
const onChangeFunction = (e) => {
|
||||||
updateMessageInputValue(e.currentTarget.value);
|
const value = e.currentTarget.value;
|
||||||
|
updateMessageInputValue(value);
|
||||||
|
value.trim() ? startTyping() : stopTyping();
|
||||||
};
|
};
|
||||||
|
|
||||||
const onKeyDownFunction = (e) => {
|
const onKeyDownFunction = (e) => {
|
||||||
@@ -86,6 +90,7 @@ export const MessageInputBox = () => {
|
|||||||
<textarea
|
<textarea
|
||||||
className={styles.message_box_input_area}
|
className={styles.message_box_input_area}
|
||||||
onChange={onChangeFunction}
|
onChange={onChangeFunction}
|
||||||
|
onBlur={stopTyping}
|
||||||
placeholder="Input Textfield"
|
placeholder="Input Textfield"
|
||||||
value={currentMessageInputValue.data}
|
value={currentMessageInputValue.data}
|
||||||
onKeyDown={onKeyDownFunction}
|
onKeyDown={onKeyDownFunction}
|
||||||
|
|||||||
@@ -42,6 +42,13 @@ export const useMessage = () => {
|
|||||||
addMessageLogs(message_object);
|
addMessageLogs(message_object);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const startTyping = () => {
|
||||||
|
asyncStdoutToPython("/run/typing_message_box");
|
||||||
|
};
|
||||||
|
const stopTyping = () => {
|
||||||
|
asyncStdoutToPython("/run/stop_typing_message_box");
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentMessageLogs,
|
currentMessageLogs,
|
||||||
sendMessage,
|
sendMessage,
|
||||||
@@ -51,6 +58,9 @@ export const useMessage = () => {
|
|||||||
|
|
||||||
currentMessageInputValue,
|
currentMessageInputValue,
|
||||||
updateMessageInputValue,
|
updateMessageInputValue,
|
||||||
|
|
||||||
|
startTyping,
|
||||||
|
stopTyping,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user