mirror of
https://github.com/infinilabs/coco-app.git
synced 2025-12-16 11:37:47 +01:00
refactor: auto-focus input field when switching to compact mode (#990)
This commit is contained in:
@@ -115,7 +115,7 @@ const AutoResizeTextarea = forwardRef<
|
||||
autoComplete="off"
|
||||
autoCapitalize="none"
|
||||
spellCheck="false"
|
||||
className="text-base flex-1 outline-none w-full min-w-[200px] text-[#333] dark:text-[#d8d8d8] placeholder-text-xs placeholder-[#999] dark:placeholder-gray-500 bg-transparent custom-scrollbar resize-none overflow-y-auto"
|
||||
className="auto-resize-textarea text-base flex-1 outline-none w-full min-w-[200px] text-[#333] dark:text-[#d8d8d8] placeholder-text-xs placeholder-[#999] dark:placeholder-gray-500 bg-transparent custom-scrollbar resize-none overflow-y-auto"
|
||||
placeholder={chatPlaceholder || t("search.textarea.placeholder")}
|
||||
aria-label={t("search.textarea.ariaLabel")}
|
||||
value={input}
|
||||
|
||||
@@ -138,12 +138,16 @@ function SearchChat({
|
||||
if (height < 590) {
|
||||
const { compactModeAutoCollapseDelay } = useConnectStore.getState();
|
||||
|
||||
console.log("compactModeAutoCollapseDelay", compactModeAutoCollapseDelay);
|
||||
|
||||
collapseWindowTimer.current = setTimeout(() => {
|
||||
setHideMiddleBorder(true);
|
||||
setSuppressErrors(true);
|
||||
|
||||
const textarea = document.querySelector(".auto-resize-textarea");
|
||||
|
||||
if (textarea instanceof HTMLTextAreaElement) {
|
||||
textarea.focus();
|
||||
}
|
||||
|
||||
platformAdapter.setWindowSize(width, height);
|
||||
}, compactModeAutoCollapseDelay * 1000);
|
||||
} else {
|
||||
|
||||
@@ -220,8 +220,6 @@ export function useSearch() {
|
||||
);
|
||||
|
||||
const debouncedSearch = useMemo(() => {
|
||||
console.log("searchDelay", searchDelay);
|
||||
|
||||
return debounce(performSearch, searchDelay);
|
||||
}, [performSearch, searchDelay]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user