From 100abf082da565299b4a50fd0de3df97caa473ae Mon Sep 17 00:00:00 2001 From: IRBorisov <8611739+IRBorisov@users.noreply.github.com> Date: Fri, 21 Jun 2024 19:27:36 +0300 Subject: [PATCH] Minor UI refactoring --- .../components/select/PickConstituenta.tsx | 6 ++-- .../select/PickMultiConstituenta.tsx | 6 ++-- .../src/components/select/PickSchema.tsx | 2 +- .../components/select/PickSubstitutions.tsx | 5 +-- .../components/select/SelectLocationHead.tsx | 2 +- .../frontend/src/components/ui/FlexColumn.tsx | 4 +-- .../frontend/src/components/ui/NoData.tsx | 13 ++++++++ .../frontend/src/components/ui/TextURL.tsx | 4 +-- .../DlgConstituentaTemplate/ArgumentsTab.tsx | 3 +- .../DlgEditWordForms/WordFormsTable.tsx | 5 +-- .../src/pages/LibraryPage/LibraryTable.tsx | 2 +- .../EditorConstituenta/FormConstituenta.tsx | 2 +- .../EditorRSFormCard/EditorLibraryItem.tsx | 33 ++++++++++++++----- .../pages/RSFormPage/EditorRSList/RSTable.tsx | 11 ++++--- .../RSFormPage/EditorTermGraph/ViewHidden.tsx | 7 ++-- .../ViewConstituents/ConstituentsTable.tsx | 6 ++-- .../UserProfilePage/ViewSubscriptions.tsx | 3 +- rsconcept/frontend/src/utils/labels.ts | 4 ++- 18 files changed, 76 insertions(+), 42 deletions(-) create mode 100644 rsconcept/frontend/src/components/ui/NoData.tsx diff --git a/rsconcept/frontend/src/components/select/PickConstituenta.tsx b/rsconcept/frontend/src/components/select/PickConstituenta.tsx index fce1d5be..5f656280 100644 --- a/rsconcept/frontend/src/components/select/PickConstituenta.tsx +++ b/rsconcept/frontend/src/components/select/PickConstituenta.tsx @@ -12,7 +12,7 @@ import { prefixes } from '@/utils/constants'; import { describeConstituenta } from '@/utils/labels'; import BadgeConstituenta from '../info/BadgeConstituenta'; -import FlexColumn from '../ui/FlexColumn'; +import NoData from '../ui/NoData'; interface PickConstituentaProps { id?: string; @@ -106,10 +106,10 @@ function PickConstituenta({ columns={columns} conditionalRowStyles={conditionalRowStyles} noDataComponent={ - +

Список конституент пуст

Измените параметры фильтра

-
+ } onRowClicked={onSelectValue} /> diff --git a/rsconcept/frontend/src/components/select/PickMultiConstituenta.tsx b/rsconcept/frontend/src/components/select/PickMultiConstituenta.tsx index e9f679df..ab1e216f 100644 --- a/rsconcept/frontend/src/components/select/PickMultiConstituenta.tsx +++ b/rsconcept/frontend/src/components/select/PickMultiConstituenta.tsx @@ -10,7 +10,7 @@ import { isBasicConcept } from '@/models/rsformAPI'; import { describeConstituenta } from '@/utils/labels'; import BadgeConstituenta from '../info/BadgeConstituenta'; -import FlexColumn from '../ui/FlexColumn'; +import NoData from '../ui/NoData'; import GraphSelectionToolbar from './GraphSelectionToolbar'; interface PickMultiConstituentaProps { @@ -103,9 +103,9 @@ function PickMultiConstituenta({ id, schema, prefixID, rows, selected, setSelect rowSelection={rowSelection} onRowSelectionChange={handleRowSelection} noDataComponent={ - +

Список пуст

-
+ } /> diff --git a/rsconcept/frontend/src/components/select/PickSchema.tsx b/rsconcept/frontend/src/components/select/PickSchema.tsx index 6117235d..a7f8b897 100644 --- a/rsconcept/frontend/src/components/select/PickSchema.tsx +++ b/rsconcept/frontend/src/components/select/PickSchema.tsx @@ -104,7 +104,7 @@ function PickSchema({ id, initialFilter = '', rows = 4, value, onSelectValue }: columns={columns} conditionalRowStyles={conditionalRowStyles} noDataComponent={ - +

Список схем пуст

Измените параметры фильтра

diff --git a/rsconcept/frontend/src/components/select/PickSubstitutions.tsx b/rsconcept/frontend/src/components/select/PickSubstitutions.tsx index c6fdcba1..c66a73af 100644 --- a/rsconcept/frontend/src/components/select/PickSubstitutions.tsx +++ b/rsconcept/frontend/src/components/select/PickSubstitutions.tsx @@ -23,6 +23,7 @@ import { IconRemove, IconReplace } from '../Icons'; +import NoData from '../ui/NoData'; interface PickSubstitutionsProps { prefixID: string; @@ -259,10 +260,10 @@ function PickSubstitutions({ columns={columns} headPosition='0' noDataComponent={ - +

Список пуст

Добавьте отождествление

-
+ } /> diff --git a/rsconcept/frontend/src/components/select/SelectLocationHead.tsx b/rsconcept/frontend/src/components/select/SelectLocationHead.tsx index bc6038c4..b8d415d0 100644 --- a/rsconcept/frontend/src/components/select/SelectLocationHead.tsx +++ b/rsconcept/frontend/src/components/select/SelectLocationHead.tsx @@ -14,7 +14,7 @@ import DropdownButton from '../ui/DropdownButton'; interface SelectLocationHeadProps { value: LocationHead; - onChange: (value: LocationHead) => void; + onChange: (newValue: LocationHead) => void; excluded?: LocationHead[]; } diff --git a/rsconcept/frontend/src/components/ui/FlexColumn.tsx b/rsconcept/frontend/src/components/ui/FlexColumn.tsx index dd822a2e..c5782130 100644 --- a/rsconcept/frontend/src/components/ui/FlexColumn.tsx +++ b/rsconcept/frontend/src/components/ui/FlexColumn.tsx @@ -2,9 +2,7 @@ import clsx from 'clsx'; import { CProps } from '../props'; -export interface FlexColumnProps extends CProps.Div {} - -function FlexColumn({ className, children, ...restProps }: FlexColumnProps) { +function FlexColumn({ className, children, ...restProps }: CProps.Div) { return (
{children} diff --git a/rsconcept/frontend/src/components/ui/NoData.tsx b/rsconcept/frontend/src/components/ui/NoData.tsx new file mode 100644 index 00000000..9b69ab37 --- /dev/null +++ b/rsconcept/frontend/src/components/ui/NoData.tsx @@ -0,0 +1,13 @@ +import clsx from 'clsx'; + +import { CProps } from '../props'; + +function NoData({ className, children, ...restProps }: CProps.Div) { + return ( +
+ {children} +
+ ); +} + +export default NoData; diff --git a/rsconcept/frontend/src/components/ui/TextURL.tsx b/rsconcept/frontend/src/components/ui/TextURL.tsx index 3c9ffcb3..09d617d3 100644 --- a/rsconcept/frontend/src/components/ui/TextURL.tsx +++ b/rsconcept/frontend/src/components/ui/TextURL.tsx @@ -18,9 +18,9 @@ function TextURL({ text, href, title, color = 'clr-text-url', onClick }: TextURL ); } else if (onClick) { return ( - + ); } else { return null; diff --git a/rsconcept/frontend/src/dialogs/DlgConstituentaTemplate/ArgumentsTab.tsx b/rsconcept/frontend/src/dialogs/DlgConstituentaTemplate/ArgumentsTab.tsx index 4c83957d..4790146d 100644 --- a/rsconcept/frontend/src/dialogs/DlgConstituentaTemplate/ArgumentsTab.tsx +++ b/rsconcept/frontend/src/dialogs/DlgConstituentaTemplate/ArgumentsTab.tsx @@ -9,6 +9,7 @@ import RSInput from '@/components/RSInput'; import PickConstituenta from '@/components/select/PickConstituenta'; import DataTable, { IConditionalStyle } from '@/components/ui/DataTable'; import MiniButton from '@/components/ui/MiniButton'; +import NoData from '@/components/ui/NoData'; import AnimateFade from '@/components/wrap/AnimateFade'; import { useConceptOptions } from '@/context/OptionsContext'; import { IConstituenta, IRSForm } from '@/models/rsform'; @@ -160,7 +161,7 @@ function ArgumentsTab({ state, schema, partialUpdate }: ArgumentsTabProps) { data={state.arguments} columns={columns} conditionalRowStyles={conditionalRowStyles} - noDataComponent={

Аргументы отсутствуют

} + noDataComponent={Аргументы отсутствуют} onRowClicked={handleSelectArgument} /> diff --git a/rsconcept/frontend/src/dialogs/DlgEditWordForms/WordFormsTable.tsx b/rsconcept/frontend/src/dialogs/DlgEditWordForms/WordFormsTable.tsx index c1109937..8bc65c0b 100644 --- a/rsconcept/frontend/src/dialogs/DlgEditWordForms/WordFormsTable.tsx +++ b/rsconcept/frontend/src/dialogs/DlgEditWordForms/WordFormsTable.tsx @@ -7,6 +7,7 @@ import { IconRemove } from '@/components/Icons'; import BadgeWordForm from '@/components/info/BadgeWordForm'; import DataTable, { createColumnHelper } from '@/components/ui/DataTable'; import MiniButton from '@/components/ui/MiniButton'; +import NoData from '@/components/ui/NoData'; import { IWordForm } from '@/models/language'; interface WordFormsTableProps { @@ -78,10 +79,10 @@ function WordFormsTable({ forms, setForms, onFormSelect }: WordFormsTableProps) columns={columns} headPosition='0' noDataComponent={ - +

Список пуст

Добавьте словоформу

-
+ } onRowClicked={onFormSelect} /> diff --git a/rsconcept/frontend/src/pages/LibraryPage/LibraryTable.tsx b/rsconcept/frontend/src/pages/LibraryPage/LibraryTable.tsx index 88cfa3a8..e8155336 100644 --- a/rsconcept/frontend/src/pages/LibraryPage/LibraryTable.tsx +++ b/rsconcept/frontend/src/pages/LibraryPage/LibraryTable.tsx @@ -164,7 +164,7 @@ function LibraryTable({ items, resetQuery, folderMode, toggleFolderMode }: Libra className={clsx('text-xs sm:text-sm cc-scroll-y', { 'border-l border-b': folderMode })} style={{ maxHeight: tableHeight }} noDataComponent={ - +

Список схем пуст

diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx index 20662235..80bfbc90 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx @@ -221,8 +221,8 @@ function FormConstituenta({

) : null} - + {accessLevel >= UserLevel.OWNER ? ( @@ -97,12 +102,22 @@ function EditorLibraryItem({ item, isModified, controller }: EditorLibraryItemPr ) : null} - + - + diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorRSList/RSTable.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorRSList/RSTable.tsx index 991bec09..d67c106f 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorRSList/RSTable.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorRSList/RSTable.tsx @@ -6,7 +6,8 @@ import { useCallback, useLayoutEffect, useMemo, useState } from 'react'; import BadgeConstituenta from '@/components/info/BadgeConstituenta'; import { CProps } from '@/components/props'; import DataTable, { createColumnHelper, RowSelectionState, VisibilityState } from '@/components/ui/DataTable'; -import FlexColumn from '@/components/ui/FlexColumn'; +import NoData from '@/components/ui/NoData'; +import TextURL from '@/components/ui/TextURL'; import { useConceptOptions } from '@/context/OptionsContext'; import useWindowSize from '@/hooks/useWindowSize'; import { ConstituentaID, IConstituenta } from '@/models/rsform'; @@ -135,12 +136,12 @@ function RSTable({ items, maxHeight, enableSelection, selected, setSelected, onE rowSelection={selected} onRowSelectionChange={setSelected} noDataComponent={ - +

Список пуст

-

onCreateNew()}> - Создать новую конституенту +

+

-
+ } /> ); diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/ViewHidden.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/ViewHidden.tsx index bb142b29..c3dd5cd0 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/ViewHidden.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/ViewHidden.tsx @@ -98,10 +98,11 @@ function ViewHidden({ items, selected, toggleSelection, setFocus, schema, colori const id = `${prefixes.cst_hidden_list}${cst.alias}`; return (
-
onEdit(cstID)} > {cst.alias} -
+
); diff --git a/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/ConstituentsTable.tsx b/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/ConstituentsTable.tsx index 606a6ce5..cb357f1f 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/ConstituentsTable.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/ConstituentsTable.tsx @@ -1,10 +1,10 @@ 'use client'; -import clsx from 'clsx'; import { useCallback, useLayoutEffect, useMemo, useState } from 'react'; import BadgeConstituenta from '@/components/info/BadgeConstituenta'; import DataTable, { createColumnHelper, IConditionalStyle, VisibilityState } from '@/components/ui/DataTable'; +import NoData from '@/components/ui/NoData'; import { useConceptOptions } from '@/context/OptionsContext'; import useWindowSize from '@/hooks/useWindowSize'; import { ConstituentaID, IConstituenta } from '@/models/rsform'; @@ -155,10 +155,10 @@ function ConstituentsTable({ items, activeCst, onOpenEdit, maxHeight, denseThres columnVisibility={columnVisibility} onColumnVisibilityChange={setColumnVisibility} noDataComponent={ -
+

Список конституент пуст

Измените параметры фильтра

-
+ } onRowClicked={handleRowClicked} /> diff --git a/rsconcept/frontend/src/pages/UserProfilePage/ViewSubscriptions.tsx b/rsconcept/frontend/src/pages/UserProfilePage/ViewSubscriptions.tsx index fcb2b0ca..33c20da7 100644 --- a/rsconcept/frontend/src/pages/UserProfilePage/ViewSubscriptions.tsx +++ b/rsconcept/frontend/src/pages/UserProfilePage/ViewSubscriptions.tsx @@ -6,6 +6,7 @@ import { useIntl } from 'react-intl'; import { urls } from '@/app/urls'; import DataTable, { createColumnHelper } from '@/components/ui/DataTable'; +import NoData from '@/components/ui/NoData'; import { useConceptNavigation } from '@/context/NavigationContext'; import { ILibraryItem } from '@/models/library'; import { animateSideView } from '@/styling/animations'; @@ -74,7 +75,7 @@ function ViewSubscriptions({ items }: ViewSubscriptionsProps) { id: 'time_update', desc: true }} - noDataComponent={
Отслеживаемые схемы отсутствуют
} + noDataComponent={Отслеживаемые схемы отсутствуют} onRowClicked={openRSForm} /> diff --git a/rsconcept/frontend/src/utils/labels.ts b/rsconcept/frontend/src/utils/labels.ts index 5a2b39b6..0a189366 100644 --- a/rsconcept/frontend/src/utils/labels.ts +++ b/rsconcept/frontend/src/utils/labels.ts @@ -942,7 +942,9 @@ export const prompts = { promptUnsaved: 'Присутствуют несохраненные изменения. Продолжить без их учета?', deleteLibraryItem: 'Вы уверены, что хотите удалить данную схему?', generateWordforms: 'Данное действие приведет к перезаписи словоформ при совпадении граммем. Продолжить?', - restoreArchive: 'При восстановлении архивной версии актуальная схему будет заменена. Продолжить?' + restoreArchive: 'При восстановлении архивной версии актуальная схему будет заменена. Продолжить?', + ownerChange: + 'Вы уверены, что хотите изменить владельца? Вы потеряете право управления данной схемой. Данное действие отменить нельзя' }; // ============== INTERNAL LABELS FOR DEVELOPERS TEXT ================