From 2b7a4c04ce8d0a92931937835c3282a982c4fb33 Mon Sep 17 00:00:00 2001 From: IRBorisov <8611739+IRBorisov@users.noreply.github.com> Date: Sat, 3 Feb 2024 15:33:28 +0300 Subject: [PATCH] Refactor constituenta selection and tooltip visibility --- .../src/components/SelectedCounter.tsx | 10 +- .../frontend/src/components/ui/Button.tsx | 3 + .../frontend/src/components/ui/MiniButton.tsx | 4 +- .../src/components/ui/SelectorButton.tsx | 7 +- .../src/pages/LibraryPage/PickerStrategy.tsx | 1 + .../EditorConstituenta/EditorConstituenta.tsx | 77 +++------ .../EditorConstituenta/FormConstituenta.tsx | 24 +-- .../RSFormPage/EditorRSForm/EditorRSForm.tsx | 4 +- .../RSFormPage/EditorRSForm/FormRSForm.tsx | 4 +- .../RSFormPage/EditorRSList/EditorRSList.tsx | 151 +++++++----------- .../RSFormPage/EditorRSList/RSListToolbar.tsx | 1 + .../EditorTermGraph/EditorTermGraph.tsx | 83 +++++----- .../RSFormPage/EditorTermGraph/TermGraph.tsx | 50 +++--- .../EditorTermGraph/useGraphFilter.ts | 6 +- .../frontend/src/pages/RSFormPage/RSTabs.tsx | 136 +++++++++++----- .../src/pages/RSFormPage/RSTabsMenu.tsx | 3 + .../ViewConstituents/ConstituentsSearch.tsx | 9 +- 17 files changed, 268 insertions(+), 305 deletions(-) diff --git a/rsconcept/frontend/src/components/SelectedCounter.tsx b/rsconcept/frontend/src/components/SelectedCounter.tsx index 8ba9d0f5..e8d0b4bd 100644 --- a/rsconcept/frontend/src/components/SelectedCounter.tsx +++ b/rsconcept/frontend/src/components/SelectedCounter.tsx @@ -1,19 +1,19 @@ import Overlay from '@/components/ui/Overlay'; interface SelectedCounterProps { - total: number; - selected: number; + totalCount: number; + selectedCount: number; position?: string; hideZero?: boolean; } -function SelectedCounter({ total, selected, hideZero, position = 'top-0 left-0' }: SelectedCounterProps) { - if (selected === 0 && hideZero) { +function SelectedCounter({ totalCount, selectedCount, hideZero, position = 'top-0 left-0' }: SelectedCounterProps) { + if (selectedCount === 0 && hideZero) { return null; } return ( - Выбор {selected} из {total} + Выбор {selectedCount} из {totalCount} ); } diff --git a/rsconcept/frontend/src/components/ui/Button.tsx b/rsconcept/frontend/src/components/ui/Button.tsx index 942721fe..475a7a44 100644 --- a/rsconcept/frontend/src/components/ui/Button.tsx +++ b/rsconcept/frontend/src/components/ui/Button.tsx @@ -9,6 +9,7 @@ interface ButtonProps extends CProps.Control, CProps.Colors, CProps.Button { icon?: React.ReactNode; dense?: boolean; + hideTitle?: boolean; loading?: boolean; } @@ -19,6 +20,7 @@ function Button({ loading, dense, disabled, + hideTitle, noBorder, noOutline, colors = 'clr-btn-default', @@ -46,6 +48,7 @@ function Button({ )} data-tooltip-id={title ? globalIDs.tooltip : undefined} data-tooltip-content={title} + data-tooltip-hidden={hideTitle} {...restProps} > {icon ? icon : null} diff --git a/rsconcept/frontend/src/components/ui/MiniButton.tsx b/rsconcept/frontend/src/components/ui/MiniButton.tsx index 74d24dad..370724c1 100644 --- a/rsconcept/frontend/src/components/ui/MiniButton.tsx +++ b/rsconcept/frontend/src/components/ui/MiniButton.tsx @@ -7,9 +7,10 @@ import { CProps } from '../props'; interface MiniButtonProps extends CProps.Button { icon: React.ReactNode; noHover?: boolean; + hideTitle?: boolean; } -function MiniButton({ icon, noHover, tabIndex, title, className, ...restProps }: MiniButtonProps) { +function MiniButton({ icon, noHover, hideTitle, tabIndex, title, className, ...restProps }: MiniButtonProps) { return (