From 7a8d91ec9dfa12f658d323bc661ab8d5f31d01f2 Mon Sep 17 00:00:00 2001 From: Orkhan Ashrafov <70017511+webofpies@users.noreply.github.com> Date: Tue, 4 Feb 2025 13:15:59 +0400 Subject: [PATCH] refactor: languageform --- .../components/LanguageForm/LanguageForm.jsx | 83 +++---------------- .../components/DictionaryBars.jsx | 58 +++++++++++++ .../components/InsertDictionaryButton.jsx | 24 ++++++ 3 files changed, 93 insertions(+), 72 deletions(-) create mode 100644 frontend/src/features/language/components/LanguageForm/components/DictionaryBars.jsx create mode 100644 frontend/src/features/language/components/LanguageForm/components/InsertDictionaryButton.jsx diff --git a/frontend/src/features/language/components/LanguageForm/LanguageForm.jsx b/frontend/src/features/language/components/LanguageForm/LanguageForm.jsx index eb3923a2..b8b00e7d 100644 --- a/frontend/src/features/language/components/LanguageForm/LanguageForm.jsx +++ b/frontend/src/features/language/components/LanguageForm/LanguageForm.jsx @@ -3,16 +3,13 @@ import { useQuery } from "@tanstack/react-query"; import { useLocation, useSearchParams } from "react-router-dom"; import { useForm } from "@mantine/form"; import { randomId } from "@mantine/hooks"; -import { DragDropContext, Draggable, Droppable } from "@hello-pangea/dnd"; import { - ActionIcon, Box, Checkbox, Divider, Fieldset, Group, LoadingOverlay, - ScrollArea, Select, TextInput, } from "@mantine/core"; @@ -21,13 +18,13 @@ import { IconAlt, IconAnalyzeFilled, IconCut, - IconSquareRoundedPlusFilled, } from "@tabler/icons-react"; +import FormButtons from "@common/FormButtons/FormButtons"; import LanguageSelect from "./LanguageSelect"; -import DictionaryBar from "./components/DictionaryBar/DictionaryBar"; import LanguageCards from "../LanguageCards/LanguageCards"; -import FormButtons from "@common/FormButtons/FormButtons"; +import DictionaryBars from "./components/DictionaryBars"; import LanguageRadioLabel from "./components/LanguageRadioLabel"; +import InsertDictionaryButton from "./components/InsertDictionaryButton"; import { parsersQuery, predefinedListQuery, @@ -117,58 +114,23 @@ function LanguageForm() { legend: { fontWeight: 500 }, }}>
- - form.insertListItem("dictionaries", { - for: "terms", - type: "embedded", - url: "", - active: false, - key: randomId(), - }) - }> - - - - - - - {(provided) => ( -
- {form.getValues().dictionaries.map((dict, index) => ( - - {(provided) => ( - - )} - - ))} - {provided.placeholder} -
- )} -
-
-
+ +
+ + +