diff --git a/src/components/CustomSelect.tsx b/src/components/CustomSelect.tsx deleted file mode 100644 index 8e08b73..0000000 --- a/src/components/CustomSelect.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { useEffect, useState } from "react"; - -interface Props { - options: string[]; - customOption?: React.ReactNode; -} - -function CustomSelect({ options, customOption }: Props) { - const [selectedOption, setSelectedOption] = useState(null); - - // Сбрасываем selectedOption при изменении options - useEffect(() => { - setSelectedOption(null); - }, [options]); - - return ( -
- {options.map((option, index) => ( -
setSelectedOption(option)}> - {customOption ? customOption(option) : option} -
- ))} -
- ); -} - -export default CustomSelect; \ No newline at end of file diff --git a/src/components/SearchInput.tsx b/src/components/SearchInput.tsx index 83631cc..fc8f49c 100644 --- a/src/components/SearchInput.tsx +++ b/src/components/SearchInput.tsx @@ -7,6 +7,7 @@ import clsx from "clsx"; function SearchInput( props: React.InputHTMLAttributes & { onEnter?: () => void; + setSearch: React.Dispatch>; } ) { const ref = useRef(null); @@ -47,7 +48,16 @@ function SearchInput( // } // }} > -
+
{ + if (ref.current) { + ref.current.value = ""; + ref.current.focus(); + props.setSearch(ref.current.value); + } + }} + >
diff --git a/src/components/SessionComments.tsx b/src/components/SessionComments.tsx index e7b940f..9977fe6 100644 --- a/src/components/SessionComments.tsx +++ b/src/components/SessionComments.tsx @@ -72,7 +72,12 @@ function SessionComments({ sessionId }: { sessionId: string }) { e.preventDefault(); const textarea = textareaRef.current; - if (!textarea?.value || textarea.value.length > 200) return; + if ( + !textarea?.value || + textarea.value.length > 200 || + textarea.value.trim() === "" + ) + return; createComment(textarea.value); textarea.value = ""; diff --git a/src/components/modals/EditTableModal.tsx b/src/components/modals/EditTableModal.tsx index 20d656c..7d7274d 100644 --- a/src/components/modals/EditTableModal.tsx +++ b/src/components/modals/EditTableModal.tsx @@ -18,7 +18,7 @@ function EditTable({ table }: { table: Server }) { return api.put(`servers/${table.id}`, { json: { name: tableName, - location: tableDescription, + description: tableDescription, }, }); }, diff --git a/src/pages/SessionsPage.tsx b/src/pages/SessionsPage.tsx index e340e4f..e7b34c3 100644 --- a/src/pages/SessionsPage.tsx +++ b/src/pages/SessionsPage.tsx @@ -80,6 +80,7 @@ function SessionsPage() { value={search || ""} onChange={(e) => setSearch(e.target.value)} onEnter={() => {}} + setSearch={setSearch} />