);
diff --git a/rsconcept/frontend/src/pages/NotFoundPage.tsx b/rsconcept/frontend/src/pages/NotFoundPage.tsx
index 27a23c8a..f8906642 100644
--- a/rsconcept/frontend/src/pages/NotFoundPage.tsx
+++ b/rsconcept/frontend/src/pages/NotFoundPage.tsx
@@ -1,8 +1,11 @@
+import TextURL from '../components/Common/TextURL';
+
export function NotFoundPage() {
return (
-
-
Error 404 - Not Found
-
Данная страница не существует или запрашиваемый объект отсутствует в базы данных
+
+
Ошибка 404 - Страница не найдена
+
Данная страница не существует или запрашиваемый объект отсутствует в базе данных
+
);
}
diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta.tsx
index abb37287..cea063aa 100644
--- a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta.tsx
+++ b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta.tsx
@@ -9,6 +9,7 @@ import TextArea from '../../components/Common/TextArea';
import HelpConstituenta from '../../components/Help/HelpConstituenta';
import { DumpBinIcon, HelpIcon, PenIcon, SaveIcon, SmallPlusIcon } from '../../components/Icons';
import { useRSForm } from '../../context/RSFormContext';
+import useModificationPrompt from '../../hooks/useModificationPrompt';
import { CstType, EditMode, ICstCreateData, ICstRenameData, ICstUpdateData, SyntaxTree } from '../../utils/models';
import { getCstTypificationLabel } from '../../utils/staticUI';
import EditorRSExpression from './EditorRSExpression';
@@ -33,7 +34,8 @@ function EditorConstituenta({ activeID, onShowAST, onCreateCst, onRenameCst, onO
return schema?.items?.find((cst) => cst.id === activeID);
}, [schema?.items, activeID]);
- const [isModified, setIsModified] = useState(false);
+ const { isModified, setIsModified } = useModificationPrompt();
+
const [editMode, setEditMode] = useState(EditMode.TEXT);
const [alias, setAlias] = useState('');
@@ -59,7 +61,7 @@ function EditorConstituenta({ activeID, onShowAST, onCreateCst, onRenameCst, onO
);
}, [activeCst, activeCst?.term, activeCst?.definition.formal,
activeCst?.definition.text.raw, activeCst?.convention,
- term, textDefinition, expression, convention]);
+ term, textDefinition, expression, convention, setIsModified]);
useLayoutEffect(
() => {
diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm.tsx
index a2682356..ef1d81aa 100644
--- a/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm.tsx
+++ b/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm.tsx
@@ -13,6 +13,7 @@ import { CrownIcon, DownloadIcon, DumpBinIcon, HelpIcon, SaveIcon, ShareIcon } f
import { useAuth } from '../../context/AuthContext';
import { useRSForm } from '../../context/RSFormContext';
import { useUsers } from '../../context/UsersContext';
+import useModificationPrompt from '../../hooks/useModificationPrompt';
import { IRSFormCreateData, LibraryItemType } from '../../utils/models';
interface EditorRSFormProps {
@@ -37,7 +38,7 @@ function EditorRSForm({ onDestroy, onClaim, onShare, onDownload }: EditorRSFormP
const [common, setCommon] = useState(false);
const [canonical, setCanonical] = useState(false);
- const [isModified, setIsModified] = useState(true);
+ const { isModified, setIsModified } = useModificationPrompt();
useLayoutEffect(() => {
if (!schema) {
@@ -53,7 +54,7 @@ function EditorRSForm({ onDestroy, onClaim, onShare, onDownload }: EditorRSFormP
);
}, [schema, schema?.title, schema?.alias, schema?.comment,
schema?.is_common, schema?.is_canonical,
- title, alias, comment, common, canonical]);
+ title, alias, comment, common, canonical, setIsModified]);
useLayoutEffect(() => {
if (schema) {
diff --git a/rsconcept/frontend/src/pages/UserProfilePage/EditorProfile.tsx b/rsconcept/frontend/src/pages/UserProfilePage/EditorProfile.tsx
index 5e3cac26..14a15cea 100644
--- a/rsconcept/frontend/src/pages/UserProfilePage/EditorProfile.tsx
+++ b/rsconcept/frontend/src/pages/UserProfilePage/EditorProfile.tsx
@@ -4,6 +4,7 @@ import { toast } from 'react-toastify';
import SubmitButton from '../../components/Common/SubmitButton';
import TextInput from '../../components/Common/TextInput';
import { useUserProfile } from '../../context/UserProfileContext';
+import useModificationPrompt from '../../hooks/useModificationPrompt';
import { IUserUpdateData } from '../../utils/models';
function EditorProfile() {
@@ -14,7 +15,7 @@ function EditorProfile() {
const [first_name, setFirstName] = useState('');
const [last_name, setLastName] = useState('');
- const [isModified, setIsModified] = useState(true);
+ const { isModified, setIsModified } = useModificationPrompt();
useLayoutEffect(() => {
if (!user) {
@@ -26,7 +27,7 @@ function EditorProfile() {
user.first_name !== first_name ||
user.last_name !== last_name
);
- }, [user, user?.email, user?.first_name, user?.last_name, email, first_name, last_name]);
+ }, [user, user?.email, user?.first_name, user?.last_name, email, first_name, last_name, setIsModified]);
useLayoutEffect(() => {
if (user) {
From 5fda409929b67237ab25312dbc28d86c66dfe8b9 Mon Sep 17 00:00:00 2001
From: IRBorisov <8611739+IRBorisov@users.noreply.github.com>
Date: Sun, 27 Aug 2023 22:14:42 +0300
Subject: [PATCH 3/8] Use createRoot to enable React18 features
---
rsconcept/frontend/src/main.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rsconcept/frontend/src/main.tsx b/rsconcept/frontend/src/main.tsx
index 1030cfd4..55db8e0c 100644
--- a/rsconcept/frontend/src/main.tsx
+++ b/rsconcept/frontend/src/main.tsx
@@ -1,7 +1,7 @@
import './index.css'
import React from 'react'
-import ReactDOM from 'react-dom/client'
+import { createRoot } from 'react-dom/client'
import { ErrorBoundary } from 'react-error-boundary';
import { IntlProvider } from 'react-intl';
@@ -24,7 +24,7 @@ const logError = (error: Error, info: { componentStack: string }) => {
console.log('Component stack: ' + info.componentStack)
};
-ReactDOM.createRoot(document.getElementById('root')!).render(
+createRoot(document.getElementById('root')!).render(
Date: Sun, 27 Aug 2023 23:04:57 +0300
Subject: [PATCH 4/8] Embed youtube video
---
.../src/components/Common/EmbedYoutube.tsx | 31 +++++++++++++
.../src/components/Help/HelpRSLang.tsx | 44 ++++++++++++++-----
rsconcept/frontend/src/hooks/useWindowSize.ts | 31 +++++++++++++
rsconcept/frontend/src/utils/constants.ts | 4 ++
4 files changed, 100 insertions(+), 10 deletions(-)
create mode 100644 rsconcept/frontend/src/components/Common/EmbedYoutube.tsx
create mode 100644 rsconcept/frontend/src/hooks/useWindowSize.ts
diff --git a/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx b/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx
new file mode 100644
index 00000000..bbb4da35
--- /dev/null
+++ b/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx
@@ -0,0 +1,31 @@
+interface EmbedYoutubeProps {
+ videoID: string
+ pxHeight: number
+ pxWidth?: number
+}
+
+function EmbedYoutube({ videoID, pxHeight, pxWidth }: EmbedYoutubeProps) {
+ if (!pxWidth) {
+ pxWidth = pxHeight * 16 / 9;
+ console.log(pxWidth);
+ }
+ return (
+
+ VIDEO
+
+ );
+}
+
+export default EmbedYoutube;
diff --git a/rsconcept/frontend/src/components/Help/HelpRSLang.tsx b/rsconcept/frontend/src/components/Help/HelpRSLang.tsx
index 3daac446..dfe749cf 100644
--- a/rsconcept/frontend/src/components/Help/HelpRSLang.tsx
+++ b/rsconcept/frontend/src/components/Help/HelpRSLang.tsx
@@ -1,16 +1,40 @@
-import { urls } from '../../utils/constants';
+import { useMemo } from 'react';
+
+import useWindowSize from '../../hooks/useWindowSize';
+import { urls, youtube } from '../../utils/constants';
+import EmbedYoutube from '../Common/EmbedYoutube';
+
+const OPT_VIDEO_H = 1080
function HelpRSLang() {
+ const windowSize = useWindowSize();
+
+ const videoHeight = useMemo(
+ () => {
+ const viewH = windowSize.height ?? 0;
+ const viewW = windowSize.width ?? 0;
+ return Math.min(OPT_VIDEO_H, viewH - 370, Math.floor((viewW - 250)*9/16));
+ }, [windowSize]);
+
return (
-
-
Язык родов структур
-
Формальная запись (экспликация ) концептуальных схем осуществляется с помощью языка родов структур. Данный математический аппарат основан на аксиоматической теории множеств Цермелло-Френкеля и аппарате родов структур Н.Бурбаки.
-
Для ознакомления с основами родов структур можно использовать следующие материалы:
-
+
+
+
Язык родов структур
+
Формальная запись (экспликация ) концептуальных схем осуществляется с помощью языка родов структур.
+
Данный математический аппарат основан на аксиоматической теории множеств Цермелло-Френкеля и аппарате родов структур Н.Бурбаки.
+
Для ознакомления с основами родов структур можно использовать следующие материалы:
+
+
+
+
+
);
}
diff --git a/rsconcept/frontend/src/hooks/useWindowSize.ts b/rsconcept/frontend/src/hooks/useWindowSize.ts
new file mode 100644
index 00000000..0bf2e8de
--- /dev/null
+++ b/rsconcept/frontend/src/hooks/useWindowSize.ts
@@ -0,0 +1,31 @@
+import { useEffect, useState } from 'react';
+
+function useWindowSize() {
+ const isClient = typeof window === "object";
+
+ function getSize() {
+ return {
+ width: isClient ? window.innerWidth : undefined,
+ height: isClient ? window.innerHeight : undefined
+ };
+ }
+
+ const [windowSize, setWindowSize] = useState(getSize);
+
+ useEffect(
+ () => {
+ if (!isClient) {
+ return;
+ }
+ function handleResize() {
+ setWindowSize(getSize());
+ }
+ window.addEventListener("resize", handleResize);
+ return () => window.removeEventListener("resize", handleResize);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
+ return windowSize;
+}
+
+export default useWindowSize;
\ No newline at end of file
diff --git a/rsconcept/frontend/src/utils/constants.ts b/rsconcept/frontend/src/utils/constants.ts
index 933b6e94..226cf559 100644
--- a/rsconcept/frontend/src/utils/constants.ts
+++ b/rsconcept/frontend/src/utils/constants.ts
@@ -13,6 +13,10 @@ const dev = {
export const config = process.env.NODE_ENV === 'production' ? prod : dev;
export const TIMEOUT_UI_REFRESH = 100;
+export const youtube = {
+ intro: '0Ty9mu9sOJo'
+};
+
export const urls = {
concept: 'https://www.acconcept.ru/',
exteor32: 'https://drive.google.com/open?id=1IHlMMwaYlAUBRSxU1RU_hXM5mFU9-oyK&usp=drive_fs',
From cac74272f290de697b7b259f566384e1e4416602 Mon Sep 17 00:00:00 2001
From: IRBorisov <8611739+IRBorisov@users.noreply.github.com>
Date: Sun, 27 Aug 2023 23:09:34 +0300
Subject: [PATCH 5/8] Update ThemeContext.tsx
---
rsconcept/frontend/src/context/ThemeContext.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rsconcept/frontend/src/context/ThemeContext.tsx b/rsconcept/frontend/src/context/ThemeContext.tsx
index ad14c34a..4947a99f 100644
--- a/rsconcept/frontend/src/context/ThemeContext.tsx
+++ b/rsconcept/frontend/src/context/ThemeContext.tsx
@@ -58,7 +58,7 @@ export const ThemeState = ({ children }: ThemeStateProps) => {
const mainHeight = useMemo(
() => {
return !noNavigation ?
- 'calc(100vh - 8.6rem)'
+ 'calc(100vh - 8rem)'
: '100vh';
}, [noNavigation]);
From 91c318f36a44182a175bb49e70c35e2b3ed39f6f Mon Sep 17 00:00:00 2001
From: IRBorisov <8611739+IRBorisov@users.noreply.github.com>
Date: Mon, 28 Aug 2023 00:03:31 +0300
Subject: [PATCH 6/8] Cleanup logging
---
rsconcept/frontend/src/components/BackendError.tsx | 2 +-
rsconcept/frontend/src/components/Common/EmbedYoutube.tsx | 1 -
rsconcept/frontend/src/components/ErrorFallback.tsx | 2 +-
rsconcept/frontend/src/hooks/useCheckExpression.ts | 1 -
4 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/rsconcept/frontend/src/components/BackendError.tsx b/rsconcept/frontend/src/components/BackendError.tsx
index 771f66a0..02e7d911 100644
--- a/rsconcept/frontend/src/components/BackendError.tsx
+++ b/rsconcept/frontend/src/components/BackendError.tsx
@@ -9,7 +9,7 @@ interface BackendErrorProps {
}
function DescribeError(error: ErrorInfo) {
- console.log(error);
+ reportError(error);
if (!error) {
return
Ошибки отсутствуют
;
} else if (typeof error === 'string') {
diff --git a/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx b/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx
index bbb4da35..37264450 100644
--- a/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx
+++ b/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx
@@ -7,7 +7,6 @@ interface EmbedYoutubeProps {
function EmbedYoutube({ videoID, pxHeight, pxWidth }: EmbedYoutubeProps) {
if (!pxWidth) {
pxWidth = pxHeight * 16 / 9;
- console.log(pxWidth);
}
return (
Something went wrong!
diff --git a/rsconcept/frontend/src/hooks/useCheckExpression.ts b/rsconcept/frontend/src/hooks/useCheckExpression.ts
index fcb7ba57..fc0f1fc9 100644
--- a/rsconcept/frontend/src/hooks/useCheckExpression.ts
+++ b/rsconcept/frontend/src/hooks/useCheckExpression.ts
@@ -9,7 +9,6 @@ import { getCstExpressionPrefix } from '../utils/staticUI';
const LOGIC_TYPIIFCATION = 'LOGIC';
function checkTypeConsistency(type: CstType, typification: string, args: IFunctionArg[]): boolean {
- console.log(typification)
switch (type) {
case CstType.BASE:
case CstType.CONSTANT:
From 329c2f943e5a7930381d67157a82cba719aa33e5 Mon Sep 17 00:00:00 2001
From: IRBorisov <8611739+IRBorisov@users.noreply.github.com>
Date: Mon, 28 Aug 2023 10:50:07 +0300
Subject: [PATCH 7/8] Fix bug on deleting last cst
---
.../frontend/src/pages/RSFormPage/EditorConstituenta.tsx | 2 --
rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx | 6 ++++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta.tsx
index cea063aa..f832ec7b 100644
--- a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta.tsx
+++ b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta.tsx
@@ -72,8 +72,6 @@ function EditorConstituenta({ activeID, onShowAST, onCreateCst, onRenameCst, onO
setTextDefinition(activeCst.definition?.text?.raw ?? '');
setExpression(activeCst.definition?.formal ?? '');
setTypification(activeCst ? getCstTypificationLabel(activeCst) : 'N/A');
- } else if (schema && schema?.items.length > 0) {
- onOpenEdit(schema.items[0].id);
}
}, [activeCst, onOpenEdit, schema]);
diff --git a/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx b/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx
index ac2bb7b6..d25b1db3 100644
--- a/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx
+++ b/rsconcept/frontend/src/pages/RSFormPage/RSTabs.tsx
@@ -163,6 +163,12 @@ function RSTabs() {
while (activeIndex < schema.items.length && deleted.find(id => id === schema.items[activeIndex].id)) {
++activeIndex;
}
+ if (activeIndex >= schema.items.length) {
+ activeIndex = schema.items.length - 1;
+ while (activeIndex >= 0 && deleted.find(id => id === schema.items[activeIndex].id)) {
+ --activeIndex;
+ }
+ }
navigateTo(activeTab, schema.items[activeIndex].id);
}
if (afterDelete) afterDelete(deleted);
From aba28f7b3975b3478bc90b73a6059439dd18f6e0 Mon Sep 17 00:00:00 2001
From: IRBorisov <8611739+IRBorisov@users.noreply.github.com>
Date: Mon, 28 Aug 2023 10:50:10 +0300
Subject: [PATCH 8/8] Update backendAPI.ts
---
rsconcept/frontend/src/utils/backendAPI.ts | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/rsconcept/frontend/src/utils/backendAPI.ts b/rsconcept/frontend/src/utils/backendAPI.ts
index c40712bb..5b81e25a 100644
--- a/rsconcept/frontend/src/utils/backendAPI.ts
+++ b/rsconcept/frontend/src/utils/backendAPI.ts
@@ -117,7 +117,7 @@ export function getActiveUsers(request: FrontPull) {
export function getLibrary(request: FrontPull) {
AxiosGet({
- title: 'Available RSForms (Library) list',
+ title: 'Available LibraryItems list',
endpoint: '/api/library/active',
request: request
});
@@ -138,7 +138,7 @@ export function postNewRSForm(request: FrontExchange) {
AxiosPost({
- title: 'clone RSForm',
+ title: 'Clone RSForm',
endpoint: `/api/library/${target}/clone`,
request: request
});
@@ -154,7 +154,7 @@ export function getRSFormDetails(target: string, request: FrontPull
export function patchLibraryItem(target: string, request: FrontExchange) {
AxiosPatch({
- title: `RSForm id=${target}`,
+ title: `LibraryItem id=${target}`,
endpoint: `/api/library/${target}`,
request: request
});
@@ -162,7 +162,7 @@ export function patchLibraryItem(target: string, request: FrontExchange) {
AxiosPost({
- title: `Claim on RSForm id=${target}`,
+ title: `Claim on LibrartyItem id=${target}`,
endpoint: `/api/library/${target}/claim`,
request: request
});
@@ -178,7 +178,7 @@ export function postClaimLibraryItem(target: string, request: FrontPull