feat(logging): report important keyboard events
This commit is contained in:
@@ -26,13 +26,31 @@ export function ChatInputBar({ disabled = false }: ChatInputBarProps) {
|
||||
useKeyboardHeight({
|
||||
targetRef: textareaRef,
|
||||
active: isFocused,
|
||||
onKeyboardDismiss: () => setIsFocused(false),
|
||||
onKeyboardDismiss: () => {
|
||||
log.important("info", "[chat-input-bar] keyboard dismissed", {
|
||||
contentLength: input.length,
|
||||
hasContent,
|
||||
disabled,
|
||||
wasFocused: isFocused,
|
||||
});
|
||||
setIsFocused(false);
|
||||
},
|
||||
});
|
||||
|
||||
const handleInputChange = (value: string) => {
|
||||
setInput(value);
|
||||
};
|
||||
|
||||
const handleFocusChange = (focused: boolean) => {
|
||||
log.important("info", "[chat-input-bar] focus change", {
|
||||
focused,
|
||||
contentLength: input.length,
|
||||
hasContent,
|
||||
disabled,
|
||||
});
|
||||
setIsFocused(focused);
|
||||
};
|
||||
|
||||
const handleSend = () => {
|
||||
if (!hasContent) return;
|
||||
log.debug("[chat-input-bar] handleSend", {
|
||||
@@ -42,6 +60,12 @@ export function ChatInputBar({ disabled = false }: ChatInputBarProps) {
|
||||
disabled,
|
||||
isFocused,
|
||||
});
|
||||
log.important("info", "[chat-input-bar] send", {
|
||||
contentLength: input.length,
|
||||
hasContent,
|
||||
disabled,
|
||||
isFocused,
|
||||
});
|
||||
dispatch({ type: "ChatSendMessage", content: input });
|
||||
setInput("");
|
||||
textareaRef.current?.focus();
|
||||
@@ -55,7 +79,7 @@ export function ChatInputBar({ disabled = false }: ChatInputBarProps) {
|
||||
value={input}
|
||||
onChange={handleInputChange}
|
||||
onSubmit={handleSend}
|
||||
onFocusChange={setIsFocused}
|
||||
onFocusChange={handleFocusChange}
|
||||
disabled={disabled}
|
||||
/>
|
||||
<ChatSendButton
|
||||
|
||||
Reference in New Issue
Block a user