From c1a994bc0ce487285fd2d06629179050942358b8 Mon Sep 17 00:00:00 2001 From: IRBorisov <8611739+IRBorisov@users.noreply.github.com> Date: Tue, 5 Dec 2023 01:22:44 +0300 Subject: [PATCH] UI components refactoring and DOM optimization --- .../frontend/src/components/BackendError.tsx | 7 +- .../frontend/src/components/Common/Button.tsx | 2 +- .../src/components/Common/ConceptSearch.tsx | 5 +- .../src/components/Common/Dropdown.tsx | 3 +- .../src/components/Common/DropdownButton.tsx | 17 ++- .../components/Common/DropdownCheckbox.tsx | 23 ++-- .../src/components/Common/EmbedYoutube.tsx | 30 ++--- .../src/components/Common/FileInput.tsx | 37 +++--- .../frontend/src/components/Common/Form.tsx | 24 ++-- .../frontend/src/components/Common/Label.tsx | 15 +-- .../src/components/Common/LabeledText.tsx | 27 ++-- .../src/components/Common/MiniButton.tsx | 17 ++- .../frontend/src/components/Common/Modal.tsx | 7 +- .../src/components/Common/Overlay.tsx | 21 +++ .../src/components/Common/SelectMulti.tsx | 29 ++--- .../src/components/Common/SelectSingle.tsx | 29 ++--- .../src/components/Common/SelectorButton.tsx | 17 ++- .../src/components/Common/SubmitButton.tsx | 2 +- .../src/components/Common/TextArea.tsx | 29 ++--- .../src/components/Common/TextInput.tsx | 27 ++-- .../src/components/Common/TextURL.tsx | 28 +++- .../src/components/Common/Tristate.tsx | 37 +++--- .../src/components/ConceptToaster.tsx | 9 +- .../src/components/DataTable/DataTable.tsx | 10 +- .../components/DataTable/PaginationTools.tsx | 120 +++++++++--------- rsconcept/frontend/src/components/Footer.tsx | 27 ++-- .../components/Help/ConstituentaTooltip.tsx | 13 +- .../src/components/Help/HelpButton.tsx | 38 ++++++ .../Help/HelpTerminologyControl.tsx | 2 +- .../src/components/Help/InfoTopic.tsx | 33 +++++ rsconcept/frontend/src/components/Icons.tsx | 29 ++--- .../src/components/Navigation/Logo.tsx | 41 +++--- .../src/components/Navigation/Navigation.tsx | 77 +++++------ .../Navigation/NavigationButton.tsx | 17 ++- .../Navigation/ToggleNavigationButton.tsx | 28 ++++ .../components/Navigation/UserDropdown.tsx | 35 +++-- .../src/components/Navigation/UserMenu.tsx | 41 +++--- .../src/components/RSInput/RSInput.tsx | 6 +- .../src/components/RSInput/rslang/index.ts | 2 +- .../src/components/RefsInput/RefsInput.tsx | 1 - .../src/components/RefsInput/parse/index.ts | 2 +- .../components/Shared/ConstituentaBadge.tsx | 3 +- .../components/Shared/ConstituentaPicker.tsx | 4 +- .../src/components/Shared/SelectedCounter.tsx | 11 +- .../frontend/src/context/AuthContext.tsx | 11 +- .../frontend/src/context/LibraryContext.tsx | 27 ++-- .../src/context/NagivationContext.tsx | 11 +- .../frontend/src/context/RSFormContext.tsx | 71 +++++------ .../frontend/src/context/ThemeContext.tsx | 21 ++- .../src/context/UserProfileContext.tsx | 2 +- .../frontend/src/context/UsersContext.tsx | 15 +-- .../DlgConstituentaTemplate.tsx | 61 ++++----- .../DlgConstituentaTemplate/TemplateTab.tsx | 2 +- .../frontend/src/dialogs/DlgDeleteCst.tsx | 5 +- .../DlgEditReference/DlgEditReference.tsx | 49 +++---- .../frontend/src/dialogs/DlgEditWordForms.tsx | 42 ++---- .../frontend/src/dialogs/DlgRenameCst.tsx | 7 +- rsconcept/frontend/src/dialogs/DlgShowAST.tsx | 4 +- .../frontend/src/hooks/useCheckExpression.ts | 4 +- .../frontend/src/hooks/useConceptText.ts | 2 +- .../frontend/src/hooks/useRSFormDetails.ts | 4 +- .../frontend/src/hooks/useResolveText.ts | 2 +- rsconcept/frontend/src/models/language.ts | 12 +- .../frontend/src/pages/CreateRSFormPage.tsx | 88 +++++++------ .../src/pages/LibraryPage/ItemIcons.tsx | 31 +++++ .../src/pages/LibraryPage/LibraryPage.tsx | 12 +- .../src/pages/LibraryPage/ViewLibrary.tsx | 72 ++++------- .../src/pages/ManualsPage/TopicsList.tsx | 31 +++-- .../src/pages/ManualsPage/ViewTopic.tsx | 24 +--- .../ConstituentaToolbar.tsx | 33 ++--- .../EditorConstituenta/EditorRSExpression.tsx | 18 ++- .../EditorConstituenta/FormConstituenta.tsx | 10 +- .../ViewSideConstituents.tsx | 2 +- .../RSFormPage/EditorRSForm/RSFormToolbar.tsx | 24 ++-- .../RSFormPage/EditorRSList/EditorRSList.tsx | 2 +- .../RSFormPage/EditorRSList/RSListToolbar.tsx | 20 +-- .../EditorTermGraph/EditorTermGraph.tsx | 18 +-- .../EditorTermGraph/GraphSidebar.tsx | 2 +- .../EditorTermGraph/GraphToolbar.tsx | 24 ++-- .../EditorTermGraph/useGraphFilter.ts | 2 +- .../src/pages/RSFormPage/RSFormPage.tsx | 7 +- .../src/pages/RSFormPage/RSTabsMenu.tsx | 12 +- .../pages/UserProfilePage/EditorPassword.tsx | 6 +- .../src/pages/UserProfilePage/UserTabs.tsx | 29 ++--- rsconcept/frontend/src/utils/codemirror.ts | 16 +-- rsconcept/frontend/src/utils/color.ts | 8 +- rsconcept/frontend/src/utils/labels.ts | 2 +- 87 files changed, 915 insertions(+), 912 deletions(-) create mode 100644 rsconcept/frontend/src/components/Common/Overlay.tsx create mode 100644 rsconcept/frontend/src/components/Help/HelpButton.tsx create mode 100644 rsconcept/frontend/src/components/Help/InfoTopic.tsx create mode 100644 rsconcept/frontend/src/components/Navigation/ToggleNavigationButton.tsx create mode 100644 rsconcept/frontend/src/pages/LibraryPage/ItemIcons.tsx diff --git a/rsconcept/frontend/src/components/BackendError.tsx b/rsconcept/frontend/src/components/BackendError.tsx index 756a7fed..161bc68b 100644 --- a/rsconcept/frontend/src/components/BackendError.tsx +++ b/rsconcept/frontend/src/components/BackendError.tsx @@ -59,10 +59,9 @@ function DescribeError(error: ErrorInfo) { function BackendError({ error }: BackendErrorProps) { return ( -
- {DescribeError(error)} -
- ); +
+ {DescribeError(error)} +
); } export default BackendError; diff --git a/rsconcept/frontend/src/components/Common/Button.tsx b/rsconcept/frontend/src/components/Common/Button.tsx index f0d6b17c..c4d4c206 100644 --- a/rsconcept/frontend/src/components/Common/Button.tsx +++ b/rsconcept/frontend/src/components/Common/Button.tsx @@ -1,4 +1,4 @@ -import { IColorsProps, IControlProps } from '../commonInterfaces' +import { IColorsProps, IControlProps } from '../commonInterfaces'; interface ButtonProps extends IControlProps, IColorsProps, Omit, 'className' | 'children' | 'title'| 'type'> { diff --git a/rsconcept/frontend/src/components/Common/ConceptSearch.tsx b/rsconcept/frontend/src/components/Common/ConceptSearch.tsx index a12f3435..e6f1a3d7 100644 --- a/rsconcept/frontend/src/components/Common/ConceptSearch.tsx +++ b/rsconcept/frontend/src/components/Common/ConceptSearch.tsx @@ -14,10 +14,9 @@ function ConceptSearch({ value, onChange, dense }: ConceptSearchProps) {
- (onChange ? onChange(event.target.value) : undefined)} diff --git a/rsconcept/frontend/src/components/Common/Dropdown.tsx b/rsconcept/frontend/src/components/Common/Dropdown.tsx index 1ad70286..f2e9a239 100644 --- a/rsconcept/frontend/src/components/Common/Dropdown.tsx +++ b/rsconcept/frontend/src/components/Common/Dropdown.tsx @@ -10,8 +10,7 @@ function Dropdown({ children, dimensions = 'w-fit', stretchLeft }: DropdownProps
{children}
- - ); + ); } export default Dropdown; diff --git a/rsconcept/frontend/src/components/Common/DropdownButton.tsx b/rsconcept/frontend/src/components/Common/DropdownButton.tsx index 60999f63..62f56f63 100644 --- a/rsconcept/frontend/src/components/Common/DropdownButton.tsx +++ b/rsconcept/frontend/src/components/Common/DropdownButton.tsx @@ -9,15 +9,14 @@ function DropdownButton({ tooltip, onClick, disabled, children }: DropdownButton const behavior = onClick ? 'cursor-pointer disabled:cursor-not-allowed clr-hover' : 'cursor-default'; const text = disabled ? 'text-controls' : ''; return ( - - ); + ); } export default DropdownButton; diff --git a/rsconcept/frontend/src/components/Common/DropdownCheckbox.tsx b/rsconcept/frontend/src/components/Common/DropdownCheckbox.tsx index 2fe4afe7..404a8725 100644 --- a/rsconcept/frontend/src/components/Common/DropdownCheckbox.tsx +++ b/rsconcept/frontend/src/components/Common/DropdownCheckbox.tsx @@ -11,18 +11,17 @@ interface DropdownCheckboxProps { function DropdownCheckbox({ tooltip, setValue, disabled, ...restProps }: DropdownCheckboxProps) { const behavior = (setValue && !disabled) ? 'clr-hover' : ''; return ( -
- -
- ); +
+ +
); } export default DropdownCheckbox; diff --git a/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx b/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx index f33f515b..88fd20d7 100644 --- a/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx +++ b/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx @@ -9,22 +9,20 @@ function EmbedYoutube({ videoID, pxHeight, pxWidth }: EmbedYoutubeProps) { pxWidth = pxHeight * 16 / 9; } return ( -
-