From fa6fef5fa54f7be2eea44a5c12d5b13ffe83062f Mon Sep 17 00:00:00 2001 From: IRBorisov <8611739+IRBorisov@users.noreply.github.com> Date: Thu, 4 Jan 2024 19:30:10 +0300 Subject: [PATCH] Refactoring: rework application files structure --- rsconcept/frontend/src/App.tsx | 102 -------------- .../frontend/src/app/ApplicationLayout.tsx | 42 ++++++ .../{components => app}/ConceptToaster.tsx | 0 .../src/{components => app}/ErrorFallback.tsx | 4 +- .../src/{components => app}/Footer.tsx | 2 +- .../src/{ => app}/GlobalProviders.tsx | 2 +- .../{components => app}/Navigation/Logo.tsx | 0 .../Navigation/Navigation.tsx | 0 .../Navigation/NavigationButton.tsx | 0 .../Navigation/ToggleNavigationButton.tsx | 0 .../Navigation/UserDropdown.tsx | 0 .../Navigation/UserMenu.tsx | 0 .../{components => app}/Navigation/index.tsx | 0 rsconcept/frontend/src/app/Router.tsx | 60 ++++++++ rsconcept/frontend/src/app/index.tsx | 9 ++ .../{Tristate.tsx => CheckboxTristate.tsx} | 15 +- .../Common/{ConceptLoader.tsx => Loader.tsx} | 4 +- .../{ConceptSearch.tsx => SearchBar.tsx} | 7 +- .../src/components/Common/SwitchButton.tsx | 47 ------- .../Common/{ConceptTab.tsx => TabLabel.tsx} | 16 +-- .../{ConceptTooltip.tsx => Tooltip.tsx} | 14 +- .../src/components/DataTable/SelectAll.tsx | 4 +- .../src/components/{Common => }/GraphUI.tsx | 0 .../components/Help/ConstituentaTooltip.tsx | 6 +- .../frontend/src/components/Help/HelpAPI.tsx | 21 +-- .../src/components/Help/HelpButton.tsx | 6 +- .../components/Shared/ConstituentaPicker.tsx | 4 +- .../frontend/src/context/ThemeContext.tsx | 4 +- .../DlgConstituentaTemplate.tsx | 8 +- .../DlgEditReference/DlgEditReference.tsx | 6 +- rsconcept/frontend/src/dialogs/DlgShowAST.tsx | 2 +- rsconcept/frontend/src/main.tsx | 4 +- .../src/pages/LibraryPage/LibraryPage.tsx | 4 +- .../src/pages/LibraryPage/SearchPanel.tsx | 4 +- .../EditorRSExpression/StatusBar.tsx | 4 +- .../RSFormPage/EditorRSForm/EditorRSForm.tsx | 95 ++++++------- .../RSFormPage/EditorRSForm/RSFormStats.tsx | 114 +++++---------- .../RSFormPage/EditorRSForm/RSFormToolbar.tsx | 130 ++++++++++-------- .../RSFormPage/EditorTermGraph/TermGraph.tsx | 9 +- .../frontend/src/pages/RSFormPage/RSTabs.tsx | 14 +- .../ViewConstituents/ConstituentsSearch.tsx | 4 +- rsconcept/frontend/src/pages/RegisterPage.tsx | 6 +- .../src/pages/UserProfilePage/UserTabs.tsx | 4 +- 43 files changed, 362 insertions(+), 415 deletions(-) delete mode 100644 rsconcept/frontend/src/App.tsx create mode 100644 rsconcept/frontend/src/app/ApplicationLayout.tsx rename rsconcept/frontend/src/{components => app}/ConceptToaster.tsx (100%) rename rsconcept/frontend/src/{components => app}/ErrorFallback.tsx (82%) rename rsconcept/frontend/src/{components => app}/Footer.tsx (95%) rename rsconcept/frontend/src/{ => app}/GlobalProviders.tsx (95%) rename rsconcept/frontend/src/{components => app}/Navigation/Logo.tsx (100%) rename rsconcept/frontend/src/{components => app}/Navigation/Navigation.tsx (100%) rename rsconcept/frontend/src/{components => app}/Navigation/NavigationButton.tsx (100%) rename rsconcept/frontend/src/{components => app}/Navigation/ToggleNavigationButton.tsx (100%) rename rsconcept/frontend/src/{components => app}/Navigation/UserDropdown.tsx (100%) rename rsconcept/frontend/src/{components => app}/Navigation/UserMenu.tsx (100%) rename rsconcept/frontend/src/{components => app}/Navigation/index.tsx (100%) create mode 100644 rsconcept/frontend/src/app/Router.tsx create mode 100644 rsconcept/frontend/src/app/index.tsx rename rsconcept/frontend/src/components/Common/{Tristate.tsx => CheckboxTristate.tsx} (86%) rename rsconcept/frontend/src/components/Common/{ConceptLoader.tsx => Loader.tsx} (78%) rename rsconcept/frontend/src/components/Common/{ConceptSearch.tsx => SearchBar.tsx} (79%) delete mode 100644 rsconcept/frontend/src/components/Common/SwitchButton.tsx rename rsconcept/frontend/src/components/Common/{ConceptTab.tsx => TabLabel.tsx} (59%) rename rsconcept/frontend/src/components/Common/{ConceptTooltip.tsx => Tooltip.tsx} (79%) rename rsconcept/frontend/src/components/{Common => }/GraphUI.tsx (100%) diff --git a/rsconcept/frontend/src/App.tsx b/rsconcept/frontend/src/App.tsx deleted file mode 100644 index de59d2d0..00000000 --- a/rsconcept/frontend/src/App.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import { createBrowserRouter, Outlet, RouterProvider } from 'react-router-dom'; - -import ConceptToaster from '@/components/ConceptToaster'; -import Footer from '@/components/Footer'; -import Navigation from '@/components/Navigation'; -import { NavigationState } from '@/context/NavigationContext'; -import { useConceptTheme } from '@/context/ThemeContext'; -import CreateRSFormPage from '@/pages/CreateRSFormPage'; -import HomePage from '@/pages/HomePage'; -import LibraryPage from '@/pages/LibraryPage'; -import LoginPage from '@/pages/LoginPage'; -import ManualsPage from '@/pages/ManualsPage'; -import NotFoundPage from '@/pages/NotFoundPage'; -import RegisterPage from '@/pages/RegisterPage'; -import RestorePasswordPage from '@/pages/RestorePasswordPage'; -import RSFormPage from '@/pages/RSFormPage'; -import UserProfilePage from '@/pages/UserProfilePage'; -import { globalIDs } from '@/utils/constants'; - -function Root() { - const { viewportHeight, mainHeight, showScroll } = useConceptTheme(); - return ( - -
- - - - -
-
- -
-
-
-
- ); -} - -const router = createBrowserRouter([ - { - path: '/', - element: , - errorElement: , - children: [ - { - path: '', - element: - }, - { - path: 'login', - element: - }, - { - path: 'signup', - element: - }, - { - path: 'restore-password', - element: - }, - { - path: 'profile', - element: - }, - { - path: 'manuals', - element: - }, - { - path: 'library', - element: - }, - { - path: 'library/create', - element: - }, - { - path: 'rsforms/:id', - element: - } - ] - } -]); - -function App() { - return ; -} - -export default App; diff --git a/rsconcept/frontend/src/app/ApplicationLayout.tsx b/rsconcept/frontend/src/app/ApplicationLayout.tsx new file mode 100644 index 00000000..1257194f --- /dev/null +++ b/rsconcept/frontend/src/app/ApplicationLayout.tsx @@ -0,0 +1,42 @@ +import { Outlet } from 'react-router-dom'; + +import ConceptToaster from '@/app/ConceptToaster'; +import Footer from '@/app/Footer'; +import Navigation from '@/app/Navigation'; +import { NavigationState } from '@/context/NavigationContext'; +import { useConceptTheme } from '@/context/ThemeContext'; +import { globalIDs } from '@/utils/constants'; + +function ApplicationLayout() { + const { viewportHeight, mainHeight, showScroll } = useConceptTheme(); + return ( + +
+ + + + +
+
+ +
+
+
+
+
+ ); +} + +export default ApplicationLayout; diff --git a/rsconcept/frontend/src/components/ConceptToaster.tsx b/rsconcept/frontend/src/app/ConceptToaster.tsx similarity index 100% rename from rsconcept/frontend/src/components/ConceptToaster.tsx rename to rsconcept/frontend/src/app/ConceptToaster.tsx diff --git a/rsconcept/frontend/src/components/ErrorFallback.tsx b/rsconcept/frontend/src/app/ErrorFallback.tsx similarity index 82% rename from rsconcept/frontend/src/components/ErrorFallback.tsx rename to rsconcept/frontend/src/app/ErrorFallback.tsx index 77e352f1..48e6cd6d 100644 --- a/rsconcept/frontend/src/components/ErrorFallback.tsx +++ b/rsconcept/frontend/src/app/ErrorFallback.tsx @@ -1,7 +1,7 @@ import { type FallbackProps } from 'react-error-boundary'; -import Button from './Common/Button'; -import InfoError from './InfoError'; +import Button from '../components/Common/Button'; +import InfoError from '../components/InfoError'; function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) { return ( diff --git a/rsconcept/frontend/src/components/Footer.tsx b/rsconcept/frontend/src/app/Footer.tsx similarity index 95% rename from rsconcept/frontend/src/components/Footer.tsx rename to rsconcept/frontend/src/app/Footer.tsx index 621a9212..e04159f8 100644 --- a/rsconcept/frontend/src/components/Footer.tsx +++ b/rsconcept/frontend/src/app/Footer.tsx @@ -3,7 +3,7 @@ import clsx from 'clsx'; import { useConceptTheme } from '@/context/ThemeContext'; import { urls } from '@/utils/constants'; -import TextURL from './Common/TextURL'; +import TextURL from '../components/Common/TextURL'; function Footer() { const { noNavigation, noFooter } = useConceptTheme(); diff --git a/rsconcept/frontend/src/GlobalProviders.tsx b/rsconcept/frontend/src/app/GlobalProviders.tsx similarity index 95% rename from rsconcept/frontend/src/GlobalProviders.tsx rename to rsconcept/frontend/src/app/GlobalProviders.tsx index 60802d95..59e337b3 100644 --- a/rsconcept/frontend/src/GlobalProviders.tsx +++ b/rsconcept/frontend/src/app/GlobalProviders.tsx @@ -9,7 +9,7 @@ import { LibraryState } from '@/context/LibraryContext'; import { ThemeState } from '@/context/ThemeContext'; import { UsersState } from '@/context/UsersContext'; -import ErrorFallback from './components/ErrorFallback'; +import ErrorFallback from './ErrorFallback'; pdfjs.GlobalWorkerOptions.workerSrc = new URL('pdfjs-dist/build/pdf.worker.min.js', import.meta.url).toString(); diff --git a/rsconcept/frontend/src/components/Navigation/Logo.tsx b/rsconcept/frontend/src/app/Navigation/Logo.tsx similarity index 100% rename from rsconcept/frontend/src/components/Navigation/Logo.tsx rename to rsconcept/frontend/src/app/Navigation/Logo.tsx diff --git a/rsconcept/frontend/src/components/Navigation/Navigation.tsx b/rsconcept/frontend/src/app/Navigation/Navigation.tsx similarity index 100% rename from rsconcept/frontend/src/components/Navigation/Navigation.tsx rename to rsconcept/frontend/src/app/Navigation/Navigation.tsx diff --git a/rsconcept/frontend/src/components/Navigation/NavigationButton.tsx b/rsconcept/frontend/src/app/Navigation/NavigationButton.tsx similarity index 100% rename from rsconcept/frontend/src/components/Navigation/NavigationButton.tsx rename to rsconcept/frontend/src/app/Navigation/NavigationButton.tsx diff --git a/rsconcept/frontend/src/components/Navigation/ToggleNavigationButton.tsx b/rsconcept/frontend/src/app/Navigation/ToggleNavigationButton.tsx similarity index 100% rename from rsconcept/frontend/src/components/Navigation/ToggleNavigationButton.tsx rename to rsconcept/frontend/src/app/Navigation/ToggleNavigationButton.tsx diff --git a/rsconcept/frontend/src/components/Navigation/UserDropdown.tsx b/rsconcept/frontend/src/app/Navigation/UserDropdown.tsx similarity index 100% rename from rsconcept/frontend/src/components/Navigation/UserDropdown.tsx rename to rsconcept/frontend/src/app/Navigation/UserDropdown.tsx diff --git a/rsconcept/frontend/src/components/Navigation/UserMenu.tsx b/rsconcept/frontend/src/app/Navigation/UserMenu.tsx similarity index 100% rename from rsconcept/frontend/src/components/Navigation/UserMenu.tsx rename to rsconcept/frontend/src/app/Navigation/UserMenu.tsx diff --git a/rsconcept/frontend/src/components/Navigation/index.tsx b/rsconcept/frontend/src/app/Navigation/index.tsx similarity index 100% rename from rsconcept/frontend/src/components/Navigation/index.tsx rename to rsconcept/frontend/src/app/Navigation/index.tsx diff --git a/rsconcept/frontend/src/app/Router.tsx b/rsconcept/frontend/src/app/Router.tsx new file mode 100644 index 00000000..9bbb41c4 --- /dev/null +++ b/rsconcept/frontend/src/app/Router.tsx @@ -0,0 +1,60 @@ +import { createBrowserRouter } from 'react-router-dom'; + +import CreateRSFormPage from '@/pages/CreateRSFormPage'; +import HomePage from '@/pages/HomePage'; +import LibraryPage from '@/pages/LibraryPage'; +import LoginPage from '@/pages/LoginPage'; +import ManualsPage from '@/pages/ManualsPage'; +import NotFoundPage from '@/pages/NotFoundPage'; +import RegisterPage from '@/pages/RegisterPage'; +import RestorePasswordPage from '@/pages/RestorePasswordPage'; +import RSFormPage from '@/pages/RSFormPage'; +import UserProfilePage from '@/pages/UserProfilePage'; + +import ApplicationLayout from './ApplicationLayout'; + +export const Router = createBrowserRouter([ + { + path: '/', + element: , + errorElement: , + children: [ + { + path: '', + element: + }, + { + path: 'login', + element: + }, + { + path: 'signup', + element: + }, + { + path: 'restore-password', + element: + }, + { + path: 'profile', + element: + }, + { + path: 'manuals', + element: + }, + { + path: 'library', + element: + }, + { + path: 'library/create', + element: + }, + { + path: 'rsforms/:id', + element: + } + ] + } +]); diff --git a/rsconcept/frontend/src/app/index.tsx b/rsconcept/frontend/src/app/index.tsx new file mode 100644 index 00000000..e8f95bdf --- /dev/null +++ b/rsconcept/frontend/src/app/index.tsx @@ -0,0 +1,9 @@ +import { RouterProvider } from 'react-router-dom'; + +import { Router } from './Router'; + +function App() { + return ; +} + +export default App; diff --git a/rsconcept/frontend/src/components/Common/Tristate.tsx b/rsconcept/frontend/src/components/Common/CheckboxTristate.tsx similarity index 86% rename from rsconcept/frontend/src/components/Common/Tristate.tsx rename to rsconcept/frontend/src/components/Common/CheckboxTristate.tsx index 95b2cfe5..2715666c 100644 --- a/rsconcept/frontend/src/components/Common/Tristate.tsx +++ b/rsconcept/frontend/src/components/Common/CheckboxTristate.tsx @@ -6,12 +6,21 @@ import { globalIDs } from '@/utils/constants'; import { CheckboxCheckedIcon, CheckboxNullIcon } from '../Icons'; import { CheckboxProps } from './Checkbox'; -export interface TristateProps extends Omit { +export interface CheckboxTristateProps extends Omit { value: boolean | null; setValue?: (newValue: boolean | null) => void; } -function Tristate({ id, disabled, label, title, className, value, setValue, ...restProps }: TristateProps) { +function CheckboxTristate({ + id, + disabled, + label, + title, + className, + value, + setValue, + ...restProps +}: CheckboxTristateProps) { const cursor = useMemo(() => { if (disabled) { return 'cursor-not-allowed'; @@ -71,4 +80,4 @@ function Tristate({ id, disabled, label, title, className, value, setValue, ...r ); } -export default Tristate; +export default CheckboxTristate; diff --git a/rsconcept/frontend/src/components/Common/ConceptLoader.tsx b/rsconcept/frontend/src/components/Common/Loader.tsx similarity index 78% rename from rsconcept/frontend/src/components/Common/ConceptLoader.tsx rename to rsconcept/frontend/src/components/Common/Loader.tsx index 829790c8..875ce966 100644 --- a/rsconcept/frontend/src/components/Common/ConceptLoader.tsx +++ b/rsconcept/frontend/src/components/Common/Loader.tsx @@ -4,11 +4,11 @@ import { ThreeDots } from 'react-loader-spinner'; import { useConceptTheme } from '@/context/ThemeContext'; -interface ConceptLoaderProps { +interface LoaderProps { size?: number; } -export function ConceptLoader({ size = 10 }: ConceptLoaderProps) { +export function Loader({ size = 10 }: LoaderProps) { const { colors } = useConceptTheme(); return (
diff --git a/rsconcept/frontend/src/components/Common/ConceptSearch.tsx b/rsconcept/frontend/src/components/Common/SearchBar.tsx similarity index 79% rename from rsconcept/frontend/src/components/Common/ConceptSearch.tsx rename to rsconcept/frontend/src/components/Common/SearchBar.tsx index ce05e519..1dfcc2b2 100644 --- a/rsconcept/frontend/src/components/Common/ConceptSearch.tsx +++ b/rsconcept/frontend/src/components/Common/SearchBar.tsx @@ -4,13 +4,13 @@ import { CProps } from '../props'; import Overlay from './Overlay'; import TextInput from './TextInput'; -interface ConceptSearchProps extends CProps.Styling { +interface SearchBarProps extends CProps.Styling { value: string; onChange?: (newValue: string) => void; noBorder?: boolean; } -function ConceptSearch({ value, onChange, noBorder, ...restProps }: ConceptSearchProps) { +function SearchBar({ value, onChange, noBorder, ...restProps }: SearchBarProps) { return (
@@ -19,6 +19,7 @@ function ConceptSearch({ value, onChange, noBorder, ...restProps }: ConceptSearc extends CProps.Styling { - id?: string; - value: ValueType; - label?: string; - icon?: React.ReactNode; - title?: string; - - isSelected?: boolean; - onSelect: (value: ValueType) => void; -} - -function SwitchButton({ - value, - icon, - label, - className, - isSelected, - onSelect, - ...restProps -}: SwitchButtonProps) { - return ( - - ); -} - -export default SwitchButton; diff --git a/rsconcept/frontend/src/components/Common/ConceptTab.tsx b/rsconcept/frontend/src/components/Common/TabLabel.tsx similarity index 59% rename from rsconcept/frontend/src/components/Common/ConceptTab.tsx rename to rsconcept/frontend/src/components/Common/TabLabel.tsx index 2ddb97ed..0425f7c0 100644 --- a/rsconcept/frontend/src/components/Common/ConceptTab.tsx +++ b/rsconcept/frontend/src/components/Common/TabLabel.tsx @@ -1,16 +1,16 @@ import clsx from 'clsx'; -import type { TabProps } from 'react-tabs'; -import { Tab } from 'react-tabs'; +import type { TabProps as TabPropsImpl } from 'react-tabs'; +import { Tab as TabImpl } from 'react-tabs'; import { globalIDs } from '@/utils/constants'; -interface ConceptTabProps extends Omit { +interface TabLabelProps extends Omit { label?: string; } -function ConceptTab({ label, title, className, ...otherProps }: ConceptTabProps) { +function TabLabel({ label, title, className, ...otherProps }: TabLabelProps) { return ( - {label} - + ); } -ConceptTab.tabsRole = 'Tab'; +TabLabel.tabsRole = 'Tab'; -export default ConceptTab; +export default TabLabel; diff --git a/rsconcept/frontend/src/components/Common/ConceptTooltip.tsx b/rsconcept/frontend/src/components/Common/Tooltip.tsx similarity index 79% rename from rsconcept/frontend/src/components/Common/ConceptTooltip.tsx rename to rsconcept/frontend/src/components/Common/Tooltip.tsx index a07ab623..f8ff4a80 100644 --- a/rsconcept/frontend/src/components/Common/ConceptTooltip.tsx +++ b/rsconcept/frontend/src/components/Common/Tooltip.tsx @@ -3,16 +3,16 @@ import clsx from 'clsx'; import { ReactNode } from 'react'; import { createPortal } from 'react-dom'; -import { ITooltip, Tooltip } from 'react-tooltip'; +import { ITooltip, Tooltip as TooltipImpl } from 'react-tooltip'; import { useConceptTheme } from '@/context/ThemeContext'; -interface ConceptTooltipProps extends Omit { +interface TooltipProps extends Omit { layer?: string; text?: string; } -function ConceptTooltip({ +function Tooltip({ text, children, layer = 'z-tooltip', @@ -20,13 +20,13 @@ function ConceptTooltip({ className, style, ...restProps -}: ConceptTooltipProps) { +}: TooltipProps) { const { darkMode } = useConceptTheme(); if (typeof window === 'undefined') { return null; } return createPortal( - {text ? text : null} {children as ReactNode} - , + , document.body ); } -export default ConceptTooltip; +export default Tooltip; diff --git a/rsconcept/frontend/src/components/DataTable/SelectAll.tsx b/rsconcept/frontend/src/components/DataTable/SelectAll.tsx index 7d64f870..4d679b61 100644 --- a/rsconcept/frontend/src/components/DataTable/SelectAll.tsx +++ b/rsconcept/frontend/src/components/DataTable/SelectAll.tsx @@ -1,6 +1,6 @@ import { Table } from '@tanstack/react-table'; -import Tristate from '@/components/Common/Tristate'; +import CheckboxTristate from '@/components/Common/CheckboxTristate'; interface SelectAllProps { table: Table; @@ -8,7 +8,7 @@ interface SelectAllProps { function SelectAll({ table }: SelectAllProps) { return ( - + - + ); } diff --git a/rsconcept/frontend/src/components/Help/HelpAPI.tsx b/rsconcept/frontend/src/components/Help/HelpAPI.tsx index b47d6d46..4dfcdf7f 100644 --- a/rsconcept/frontend/src/components/Help/HelpAPI.tsx +++ b/rsconcept/frontend/src/components/Help/HelpAPI.tsx @@ -3,13 +3,18 @@ import { urls } from '@/utils/constants'; function HelpAPI() { return ( -
-

Программный интерфейс Портала

-

В качестве программного интерфейса сервера используется REST API, реализованный с помощью Django.

-

На данный момент API находится в разработке, поэтому поддержка внешних запросов не производится.

-

С описанием интерфейса можно ознакомиться .

-

-
); +
+

Программный интерфейс Портала

+

В качестве программного интерфейса сервера используется REST API, реализованный с помощью Django.

+

На данный момент API находится в разработке, поэтому поддержка внешних запросов не производится.

+

+ С описанием интерфейса можно ознакомиться . +

+

+ +

+
+ ); } -export default HelpAPI; \ No newline at end of file +export default HelpAPI; diff --git a/rsconcept/frontend/src/components/Help/HelpButton.tsx b/rsconcept/frontend/src/components/Help/HelpButton.tsx index 64f66210..3fdfe026 100644 --- a/rsconcept/frontend/src/components/Help/HelpButton.tsx +++ b/rsconcept/frontend/src/components/Help/HelpButton.tsx @@ -1,7 +1,7 @@ import { BiInfoCircle } from 'react-icons/bi'; -import ConceptTooltip from '@/components/Common/ConceptTooltip'; import TextURL from '@/components/Common/TextURL'; +import Tooltip from '@/components/Common/Tooltip'; import { HelpTopic } from '@/models/miscellaneous'; import { CProps } from '../props'; @@ -16,14 +16,14 @@ function HelpButton({ topic, ...restProps }: HelpButtonProps) { return (
- +
-
+
); } diff --git a/rsconcept/frontend/src/components/Shared/ConstituentaPicker.tsx b/rsconcept/frontend/src/components/Shared/ConstituentaPicker.tsx index aea610b6..55149400 100644 --- a/rsconcept/frontend/src/components/Shared/ConstituentaPicker.tsx +++ b/rsconcept/frontend/src/components/Shared/ConstituentaPicker.tsx @@ -1,6 +1,6 @@ import { useEffect, useMemo, useState } from 'react'; -import ConceptSearch from '@/components/Common/ConceptSearch'; +import SearchBar from '@/components/Common/SearchBar'; import DataTable, { createColumnHelper, IConditionalStyle } from '@/components/DataTable'; import { useConceptTheme } from '@/context/ThemeContext'; import { CstMatchMode } from '@/models/miscellaneous'; @@ -83,7 +83,7 @@ function ConstituentaPicker({ return (
- setFilterText(newValue)} /> + setFilterText(newValue)} /> { }} > <> - - - - + + + diff --git a/rsconcept/frontend/src/dialogs/DlgEditReference/DlgEditReference.tsx b/rsconcept/frontend/src/dialogs/DlgEditReference/DlgEditReference.tsx index 622081e0..063738d2 100644 --- a/rsconcept/frontend/src/dialogs/DlgEditReference/DlgEditReference.tsx +++ b/rsconcept/frontend/src/dialogs/DlgEditReference/DlgEditReference.tsx @@ -4,7 +4,7 @@ import clsx from 'clsx'; import { useState } from 'react'; import { TabList, TabPanel, Tabs } from 'react-tabs'; -import ConceptTab from '@/components/Common/ConceptTab'; +import TabLabel from '@/components/Common/TabLabel'; import Modal from '@/components/Common/Modal'; import Overlay from '@/components/Common/Overlay'; import HelpButton from '@/components/Help/HelpButton'; @@ -64,12 +64,12 @@ function DlgEditReference({ hideWindow, items, initial, onSave }: DlgEditReferen onSelect={setActiveTab} > - - diff --git a/rsconcept/frontend/src/pages/LibraryPage/LibraryPage.tsx b/rsconcept/frontend/src/pages/LibraryPage/LibraryPage.tsx index ccbfbe1d..42eda81e 100644 --- a/rsconcept/frontend/src/pages/LibraryPage/LibraryPage.tsx +++ b/rsconcept/frontend/src/pages/LibraryPage/LibraryPage.tsx @@ -2,7 +2,7 @@ import { useCallback, useLayoutEffect, useState } from 'react'; -import { ConceptLoader } from '@/components/Common/ConceptLoader'; +import { Loader } from '@/components/Common/Loader'; import InfoError from '@/components/InfoError'; import { useAuth } from '@/context/AuthContext'; import { useLibrary } from '@/context/LibraryContext'; @@ -65,7 +65,7 @@ function LibraryPage() { return ( <> - {library.loading ? : null} + {library.loading ? : null} {library.error ? : null} {!library.loading && library.items ? ( <> diff --git a/rsconcept/frontend/src/pages/LibraryPage/SearchPanel.tsx b/rsconcept/frontend/src/pages/LibraryPage/SearchPanel.tsx index acff324d..ec7dffa6 100644 --- a/rsconcept/frontend/src/pages/LibraryPage/SearchPanel.tsx +++ b/rsconcept/frontend/src/pages/LibraryPage/SearchPanel.tsx @@ -3,7 +3,7 @@ import clsx from 'clsx'; import { useCallback } from 'react'; -import ConceptSearch from '@/components/Common/ConceptSearch'; +import SearchBar from '@/components/Common/SearchBar'; import { useConceptNavigation } from '@/context/NavigationContext'; import { ILibraryFilter } from '@/models/miscellaneous'; import { LibraryFilterStrategy } from '@/models/miscellaneous'; @@ -67,7 +67,7 @@ function SearchPanel({ total, filtered, query, setQuery, strategy, setFilter }:
- +
diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorRSExpression/StatusBar.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorRSExpression/StatusBar.tsx index 51721446..c6b304f6 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorRSExpression/StatusBar.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorRSExpression/StatusBar.tsx @@ -3,7 +3,7 @@ import clsx from 'clsx'; import { useMemo } from 'react'; -import { ConceptLoader } from '@/components/Common/ConceptLoader'; +import { Loader } from '@/components/Common/Loader'; import { useConceptTheme } from '@/context/ThemeContext'; import { ExpressionStatus } from '@/models/rsform'; import { type IConstituenta } from '@/models/rsform'; @@ -52,7 +52,7 @@ function StatusBar({ isModified, processing, constituenta, parseData, onAnalyze onClick={onAnalyze} > {processing ? ( - + ) : ( <> diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/EditorRSForm.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/EditorRSForm.tsx index 1adc933a..ac6bd329 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/EditorRSForm.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/EditorRSForm.tsx @@ -14,21 +14,26 @@ import RSFormStats from './RSFormStats'; import RSFormToolbar from './RSFormToolbar'; interface EditorRSFormProps { - isModified: boolean - isMutable: boolean - - setIsModified: Dispatch> - onDestroy: () => void - onClaim: () => void - onShare: () => void - onDownload: () => void - onToggleSubscribe: () => void + isModified: boolean; + isMutable: boolean; + + setIsModified: Dispatch>; + onDestroy: () => void; + onClaim: () => void; + onShare: () => void; + onDownload: () => void; + onToggleSubscribe: () => void; } function EditorRSForm({ - isModified, isMutable, - onDestroy, onClaim, onShare, setIsModified, - onDownload, onToggleSubscribe + isModified, + isMutable, + onDestroy, + onClaim, + onShare, + setIsModified, + onDownload, + onToggleSubscribe }: EditorRSFormProps) { const { schema, isClaimable, isSubscribed, processing } = useRSForm(); const { user } = useAuth(); @@ -50,41 +55,39 @@ function EditorRSForm({ } return ( - <> - -
- - + <> + +
+ + - - - - + - -
- ); + +
+ + +
+ + ); } -export default EditorRSForm; \ No newline at end of file +export default EditorRSForm; diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/RSFormStats.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/RSFormStats.tsx index dc6bcbd8..006ed3ec 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/RSFormStats.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/RSFormStats.tsx @@ -3,7 +3,7 @@ import LabeledValue from '@/components/Common/LabeledValue'; import { type IRSFormStats } from '@/models/rsform'; interface RSFormStatsProps { - stats?: IRSFormStats + stats?: IRSFormStats; } function RSFormStats({ stats }: RSFormStatsProps) { @@ -11,84 +11,46 @@ function RSFormStats({ stats }: RSFormStatsProps) { return null; } return ( -
- - - {stats.count_property !== 0 ? - : null} - {stats.count_incalculable !== 0 ? - : null} +
+ + + {stats.count_property !== 0 ? ( + + ) : null} + {stats.count_incalculable !== 0 ? ( + + ) : null} - + - - - + + + - + - {stats.count_base !== 0 ? - : null} - { stats.count_constant !== 0 ? - : null} - {stats.count_structured !== 0 ? - : null} - {stats.count_axiom !== 0 ? - : null} - {stats.count_term !== 0 ? - : null} - {stats.count_function !== 0 ? - : null} - {stats.count_predicate !== 0 ? - : null} - {stats.count_theorem !== 0 ? - : null} -
); + {stats.count_base !== 0 ? ( + + ) : null} + {stats.count_constant !== 0 ? ( + + ) : null} + {stats.count_structured !== 0 ? ( + + ) : null} + {stats.count_axiom !== 0 ? : null} + {stats.count_term !== 0 ? : null} + {stats.count_function !== 0 ? ( + + ) : null} + {stats.count_predicate !== 0 ? ( + + ) : null} + {stats.count_theorem !== 0 ? ( + + ) : null} +
+ ); } -export default RSFormStats; \ No newline at end of file +export default RSFormStats; diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/RSFormToolbar.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/RSFormToolbar.tsx index 89354383..8ae1272c 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/RSFormToolbar.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/RSFormToolbar.tsx @@ -11,70 +11,82 @@ import HelpButton from '@/components/Help/HelpButton'; import { HelpTopic } from '@/models/miscellaneous'; interface RSFormToolbarProps { - isMutable: boolean - isSubscribed: boolean - modified: boolean - claimable: boolean - anonymous: boolean - processing: boolean + isMutable: boolean; + isSubscribed: boolean; + modified: boolean; + claimable: boolean; + anonymous: boolean; + processing: boolean; - onSubmit: () => void - onShare: () => void - onDownload: () => void - onClaim: () => void - onDestroy: () => void - onToggleSubscribe: () => void + onSubmit: () => void; + onShare: () => void; + onDownload: () => void; + onClaim: () => void; + onDestroy: () => void; + onToggleSubscribe: () => void; } function RSFormToolbar({ - isMutable, modified, claimable, anonymous, - isSubscribed, onToggleSubscribe, processing, - onSubmit, onShare, onDownload, - onClaim, onDestroy + isMutable, + modified, + claimable, + anonymous, + isSubscribed, + onToggleSubscribe, + processing, + onSubmit, + onShare, + onDownload, + onClaim, + onDestroy }: RSFormToolbarProps) { - const canSave = useMemo(() => (modified && isMutable), [modified, isMutable]); - return ( - - } - onClick={onSubmit} - /> - } - onClick={onShare} - /> - } - onClick={onDownload} - /> - - : - } - style={{outlineColor: 'transparent'}} - onClick={onToggleSubscribe} + const canSave = useMemo(() => modified && isMutable, [modified, isMutable]); + return ( + + } + onClick={onSubmit} /> - } - disabled={!claimable || anonymous || processing} - onClick={onClaim} - /> - } - /> - - ); + } + onClick={onShare} + /> + } + onClick={onDownload} + /> + + ) : ( + + ) + } + style={{ outlineColor: 'transparent' }} + onClick={onToggleSubscribe} + /> + } + disabled={!claimable || anonymous || processing} + onClick={onClaim} + /> + } + /> + + + ); } -export default RSFormToolbar; \ No newline at end of file +export default RSFormToolbar; diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/TermGraph.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/TermGraph.tsx index 95ac47d1..c6221b99 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/TermGraph.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/TermGraph.tsx @@ -2,14 +2,7 @@ import { useCallback, useLayoutEffect, useMemo, useRef } from 'react'; -import GraphUI, { - GraphCanvasRef, - GraphEdge, - GraphNode, - LayoutTypes, - Sphere, - useSelection -} from '@/components/Common/GraphUI'; +import GraphUI, { GraphCanvasRef, GraphEdge, GraphNode, LayoutTypes, Sphere, useSelection } from '@/components/GraphUI'; import { useConceptTheme } from '@/context/ThemeContext'; import { graphDarkT, graphLightT } from '@/utils/color'; import { resources } from '@/utils/constants'; diff --git a/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx b/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx index c616230d..1b5e63ad 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx @@ -8,8 +8,8 @@ import { useCallback, useLayoutEffect, useMemo, useState } from 'react'; import { TabList, TabPanel, Tabs } from 'react-tabs'; import { toast } from 'react-toastify'; -import { ConceptLoader } from '@/components/Common/ConceptLoader'; -import ConceptTab from '@/components/Common/ConceptTab'; +import { Loader } from '@/components/Common/Loader'; +import TabLabel from '@/components/Common/TabLabel'; import TextURL from '@/components/Common/TextURL'; import InfoError, { ErrorData } from '@/components/InfoError'; import { useAccessMode } from '@/context/AccessModeContext'; @@ -360,7 +360,7 @@ function RSTabs() { return ( <> - {loading ? : null} + {loading ? : null} {error ? : null} {showUpload ? setShowUpload(false)} /> : null} @@ -425,13 +425,13 @@ function RSTabs() { showCloneDialog={promptClone} showUploadDialog={() => setShowUpload(true)} /> - - + - - + + diff --git a/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/ConstituentsSearch.tsx b/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/ConstituentsSearch.tsx index 0ff681f5..3c8374a9 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/ConstituentsSearch.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/ConstituentsSearch.tsx @@ -3,9 +3,9 @@ import { useCallback, useLayoutEffect } from 'react'; import { BiCog, BiFilterAlt } from 'react-icons/bi'; -import ConceptSearch from '@/components/Common/ConceptSearch'; import Dropdown from '@/components/Common/Dropdown'; import DropdownButton from '@/components/Common/DropdownButton'; +import SearchBar from '@/components/Common/SearchBar'; import SelectorButton from '@/components/Common/SelectorButton'; import useDropdown from '@/hooks/useDropdown'; import useLocalStorage from '@/hooks/useLocalStorage'; @@ -75,7 +75,7 @@ function ConstituentsSearch({ schema, activeID, activeExpression, setFiltered }: return (
- +
- +

- используйте уникальный пароль

- портал функционирует в тестовом режиме

-
+
- {loading ? : null} + {loading ? : null} {error ? : null} {user ? (