feat(logging): report important keyboard events

This commit is contained in:
2026-07-01 18:45:03 +08:00
parent ae6578923b
commit b59da8f7e4
4 changed files with 49 additions and 11 deletions
+26 -2
View File
@@ -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