From db1d5077c798c6654d127f3f14e423dc91c9500c Mon Sep 17 00:00:00 2001 From: IRBorisov <8611739+IRBorisov@users.noreply.github.com> Date: Mon, 18 Dec 2023 19:42:27 +0300 Subject: [PATCH] Refactoring: attribute names + introducing namespace --- .../frontend/src/components/Common/Button.tsx | 11 ++- .../src/components/Common/Checkbox.tsx | 7 +- .../src/components/Common/ConceptSearch.tsx | 9 +-- .../src/components/Common/ConceptTab.tsx | 7 +- .../src/components/Common/ConceptTooltip.tsx | 2 +- .../src/components/Common/Dropdown.tsx | 15 ++-- .../src/components/Common/DropdownButton.tsx | 20 +++--- .../components/Common/DropdownCheckbox.tsx | 6 +- .../src/components/Common/FileInput.tsx | 29 ++++---- .../src/components/Common/FlexColumn.tsx | 26 +++++++ .../frontend/src/components/Common/Label.tsx | 9 ++- .../src/components/Common/LabeledValue.tsx | 6 +- .../src/components/Common/MiniButton.tsx | 13 ++-- .../frontend/src/components/Common/Modal.tsx | 22 +++--- .../src/components/Common/Overlay.tsx | 22 ++++-- .../src/components/Common/PageControls.tsx | 4 +- .../src/components/Common/SelectorButton.tsx | 19 +++-- .../src/components/Common/SubmitButton.tsx | 8 +-- .../src/components/Common/SwitchButton.tsx | 14 ++-- .../src/components/Common/TextArea.tsx | 8 +-- .../src/components/Common/TextInput.tsx | 7 +- .../src/components/Common/TextURL.tsx | 12 ++-- .../src/components/Common/Tristate.tsx | 3 +- .../src/components/Common/commonInterfaces.ts | 20 ------ .../src/components/DataTable/DataTable.tsx | 4 +- .../src/components/DataTable/SelectAll.tsx | 2 +- .../components/Help/ConstituentaTooltip.tsx | 2 +- .../src/components/Help/HelpButton.tsx | 10 +-- .../components/Navigation/UserDropdown.tsx | 6 +- .../src/components/RSInput/RSInput.tsx | 19 ++--- .../src/components/Shared/SelectGrammeme.tsx | 4 -- rsconcept/frontend/src/components/props.d.ts | 36 ++++++++++ .../src/dialogs/DlgCloneLibraryItem.tsx | 6 +- .../DlgConstituentaTemplate/ArgumentsTab.tsx | 20 +++--- .../ConstituentaTab.tsx | 4 +- .../DlgConstituentaTemplate.tsx | 17 ++--- .../DlgConstituentaTemplate/TemplateTab.tsx | 72 +++++++++---------- .../frontend/src/dialogs/DlgCreateCst.tsx | 6 +- .../src/dialogs/DlgDeleteCst/DlgDeleteCst.tsx | 11 ++- .../DlgEditReference/DlgEditReference.tsx | 10 +-- .../dialogs/DlgEditReference/EntityTab.tsx | 9 +-- .../DlgEditWordForms/DlgEditWordForms.tsx | 18 ++--- .../DlgEditWordForms/WordFormsTable.tsx | 2 +- .../frontend/src/dialogs/DlgGraphParams.tsx | 10 +-- .../frontend/src/dialogs/DlgRenameCst.tsx | 2 +- .../frontend/src/dialogs/DlgUploadRSForm.tsx | 3 +- .../frontend/src/pages/CreateRSFormPage.tsx | 10 +-- .../src/pages/LibraryPage/PickerStrategy.tsx | 6 +- .../src/pages/LibraryPage/SearchPanel.tsx | 2 +- .../src/pages/LibraryPage/ViewLibrary.tsx | 2 +- rsconcept/frontend/src/pages/LoginPage.tsx | 5 +- .../src/pages/ManualsPage/TopicsList.tsx | 3 +- .../ConstituentaToolbar.tsx | 10 +-- .../EditorConstituenta/FormConstituenta.tsx | 10 +-- .../EditorRSExpression/EditorRSExpression.tsx | 4 +- .../EditorRSExpression/RSEditControls.tsx | 54 +++++++------- .../EditorRSExpression/RSLocalButton.tsx | 6 +- .../RSFormPage/EditorRSForm/EditorRSForm.tsx | 5 +- .../RSFormPage/EditorRSForm/FormRSForm.tsx | 15 ++-- .../RSFormPage/EditorRSForm/RSFormStats.tsx | 2 +- .../RSFormPage/EditorRSForm/RSFormToolbar.tsx | 13 ++-- .../RSFormPage/EditorRSList/RSListToolbar.tsx | 14 ++-- .../EditorTermGraph/EditorTermGraph.tsx | 9 +-- .../EditorTermGraph/GraphToolbar.tsx | 14 ++-- .../RSFormPage/EditorTermGraph/ViewHidden.tsx | 2 +- .../frontend/src/pages/RSFormPage/RSTabs.tsx | 4 +- .../src/pages/RSFormPage/RSTabsMenu.tsx | 18 ++--- .../ViewConstituents/ConstituentsSearch.tsx | 10 +-- rsconcept/frontend/src/pages/RegisterPage.tsx | 18 ++--- .../pages/UserProfilePage/EditorPassword.tsx | 5 +- .../pages/UserProfilePage/EditorProfile.tsx | 10 ++- .../src/pages/UserProfilePage/UserTabs.tsx | 2 +- rsconcept/frontend/src/utils/codemirror.ts | 6 +- rsconcept/frontend/src/utils/constants.ts | 8 +++ 74 files changed, 458 insertions(+), 381 deletions(-) create mode 100644 rsconcept/frontend/src/components/Common/FlexColumn.tsx delete mode 100644 rsconcept/frontend/src/components/Common/commonInterfaces.ts create mode 100644 rsconcept/frontend/src/components/props.d.ts diff --git a/rsconcept/frontend/src/components/Common/Button.tsx b/rsconcept/frontend/src/components/Common/Button.tsx index 0479c7b5..8496c5b5 100644 --- a/rsconcept/frontend/src/components/Common/Button.tsx +++ b/rsconcept/frontend/src/components/Common/Button.tsx @@ -1,9 +1,9 @@ import clsx from 'clsx'; -import { IColorsProps, IControlProps } from './commonInterfaces'; +import { CProps } from '../props'; interface ButtonProps -extends IControlProps, IColorsProps, Omit, 'children' | 'title'| 'type'> { +extends CProps.Control, CProps.Colors, CProps.Button { text?: string icon?: React.ReactNode @@ -12,7 +12,7 @@ extends IControlProps, IColorsProps, Omit diff --git a/rsconcept/frontend/src/components/Common/Checkbox.tsx b/rsconcept/frontend/src/components/Common/Checkbox.tsx index 0395cabe..609d2aa8 100644 --- a/rsconcept/frontend/src/components/Common/Checkbox.tsx +++ b/rsconcept/frontend/src/components/Common/Checkbox.tsx @@ -2,20 +2,20 @@ import clsx from 'clsx'; import { useMemo } from 'react'; import { CheckboxCheckedIcon } from '../Icons'; +import { CProps } from '../props'; import Label from './Label'; export interface CheckboxProps -extends Omit, 'children' | 'title' | 'value' | 'onClick' > { +extends Omit { label?: string disabled?: boolean - tooltip?: string value: boolean setValue?: (newValue: boolean) => void } function Checkbox({ - id, disabled, tooltip, label, + id, disabled, label, className, value, setValue, ...restProps }: CheckboxProps) { const cursor = useMemo( @@ -46,7 +46,6 @@ function Checkbox({ cursor, className )} - title={tooltip} disabled={disabled} onClick={handleClick} {...restProps} diff --git a/rsconcept/frontend/src/components/Common/ConceptSearch.tsx b/rsconcept/frontend/src/components/Common/ConceptSearch.tsx index 8bb67596..640ec6f4 100644 --- a/rsconcept/frontend/src/components/Common/ConceptSearch.tsx +++ b/rsconcept/frontend/src/components/Common/ConceptSearch.tsx @@ -1,18 +1,19 @@ import { BiSearchAlt2 } from 'react-icons/bi'; +import { CProps } from '../props'; import Overlay from './Overlay'; import TextInput from './TextInput'; -interface ConceptSearchProps { +interface ConceptSearchProps +extends CProps.Styling { value: string onChange?: (newValue: string) => void noBorder?: boolean - dimensions?: string } -function ConceptSearch({ value, onChange, noBorder, dimensions }: ConceptSearchProps) { +function ConceptSearch({ value, onChange, noBorder, ...restProps }: ConceptSearchProps) { return ( -
+
{ - className?: string - tooltip?: string +extends Omit { label?: string } -function ConceptTab({ label, tooltip, className, ...otherProps }: ConceptTabProps) { +function ConceptTab({ label, className, ...otherProps }: ConceptTabProps) { return ( {label} diff --git a/rsconcept/frontend/src/components/Common/ConceptTooltip.tsx b/rsconcept/frontend/src/components/Common/ConceptTooltip.tsx index 13d9b454..ecf3a42f 100644 --- a/rsconcept/frontend/src/components/Common/ConceptTooltip.tsx +++ b/rsconcept/frontend/src/components/Common/ConceptTooltip.tsx @@ -12,9 +12,9 @@ extends Omit { } function ConceptTooltip({ - className, layer='z-tooltip', place='bottom', + className, style, ...restProps }: ConceptTooltipProps) { diff --git a/rsconcept/frontend/src/components/Common/Dropdown.tsx b/rsconcept/frontend/src/components/Common/Dropdown.tsx index 3d310976..a3ba3ca3 100644 --- a/rsconcept/frontend/src/components/Common/Dropdown.tsx +++ b/rsconcept/frontend/src/components/Common/Dropdown.tsx @@ -1,17 +1,19 @@ import clsx from 'clsx'; +import { CProps } from '../props'; import Overlay from './Overlay'; -interface DropdownProps { +interface DropdownProps +extends CProps.Styling { stretchLeft?: boolean - dimensions?: string children: React.ReactNode } function Dropdown({ - dimensions = 'w-fit', + className, stretchLeft, - children + children, + ...restProps }: DropdownProps) { return ( {children} ); diff --git a/rsconcept/frontend/src/components/Common/DropdownButton.tsx b/rsconcept/frontend/src/components/Common/DropdownButton.tsx index c06c431c..79cea12b 100644 --- a/rsconcept/frontend/src/components/Common/DropdownButton.tsx +++ b/rsconcept/frontend/src/components/Common/DropdownButton.tsx @@ -1,27 +1,22 @@ import clsx from 'clsx'; -interface DropdownButtonProps { +import { CProps } from '../props'; + +interface DropdownButtonProps +extends CProps.Button { text?: string icon?: React.ReactNode - className?: string - tooltip?: string | undefined - onClick?: () => void - disabled?: boolean - children?: React.ReactNode } function DropdownButton({ - text, icon, children, - tooltip, className, - disabled, - onClick + text, icon, className, onClick, + children, + ...restProps }: DropdownButtonProps) { return (