From 7798ca9b0bfaef3fc6b763104ca6dff57315b3ec Mon Sep 17 00:00:00 2001 From: Ivan <8611739+IRBorisov@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:16:06 +0300 Subject: [PATCH] F: Remove unused dependencies --- README.md | 2 - rsconcept/frontend/package-lock.json | 225 +----------------- rsconcept/frontend/package.json | 2 - .../frontend/src/app/Navigation/UserMenu.tsx | 3 +- rsconcept/frontend/src/components/props.d.ts | 6 - .../frontend/src/components/ui/Loader.tsx | 82 +++++-- .../src/components/wrap/AnimateFade.tsx | 42 ---- .../EditorConstituenta/FormConstituenta.tsx | 19 +- .../EditorRSExpression/EditorRSExpression.tsx | 2 +- .../EditorRSExpression/StatusBar.tsx | 36 +-- .../ViewConstituents/ViewConstituents.tsx | 50 +--- 11 files changed, 106 insertions(+), 363 deletions(-) delete mode 100644 rsconcept/frontend/src/components/wrap/AnimateFade.tsx diff --git a/README.md b/README.md index 2a040332..4a2a93a2 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,6 @@ This readme file is used mostly to document project dependencies and conventions - react-icons - react-router - react-toastify - - react-loader-spinner - react-tabs - react-intl - react-select @@ -49,7 +48,6 @@ This readme file is used mostly to document project dependencies and conventions - @uiw/codemirror-themes - @lezer/lr - @dagrejs/dagre - - @react-spring/web
diff --git a/rsconcept/frontend/package-lock.json b/rsconcept/frontend/package-lock.json index 1c5c873e..ae28862f 100644 --- a/rsconcept/frontend/package-lock.json +++ b/rsconcept/frontend/package-lock.json @@ -10,7 +10,6 @@ "dependencies": { "@dagrejs/dagre": "^1.1.4", "@lezer/lr": "^1.4.2", - "@react-spring/web": "^9.7.5", "@tanstack/react-table": "^8.20.5", "@uiw/codemirror-themes": "^4.23.6", "@uiw/react-codemirror": "^4.23.6", @@ -23,7 +22,6 @@ "react-error-boundary": "^4.1.2", "react-icons": "^5.4.0", "react-intl": "^7.0.4", - "react-loader-spinner": "^6.1.6", "react-router": "^7.0.2", "react-select": "^5.9.0", "react-tabs": "^6.0.2", @@ -803,21 +801,6 @@ "integrity": "sha512-MyqliTZGuOm3+5ZRSaaBGP3USLw6+EGykkwZns2EPC5g8jJ4z9OrdZY9apkl3+UP9+sdz76YYkwCKP5gh8iY3g==", "license": "MIT" }, - "node_modules/@emotion/is-prop-valid": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.2.2.tgz", - "integrity": "sha512-uNsoYd37AFmaCdXlg6EYD1KaPOaRWRByMCYzbKUX4+hhMfrxdVSelShywL4JVaAeM/eHUOSprYBQls+/neX3pw==", - "license": "MIT", - "dependencies": { - "@emotion/memoize": "^0.8.1" - } - }, - "node_modules/@emotion/is-prop-valid/node_modules/@emotion/memoize": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.1.tgz", - "integrity": "sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA==", - "license": "MIT" - }, "node_modules/@emotion/memoize": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.9.0.tgz", @@ -2293,78 +2276,6 @@ "node": ">=14" } }, - "node_modules/@react-spring/animated": { - "version": "9.7.5", - "resolved": "https://registry.npmjs.org/@react-spring/animated/-/animated-9.7.5.tgz", - "integrity": "sha512-Tqrwz7pIlsSDITzxoLS3n/v/YCUHQdOIKtOJf4yL6kYVSDTSmVK1LI1Q3M/uu2Sx4X3pIWF3xLUhlsA6SPNTNg==", - "license": "MIT", - "dependencies": { - "@react-spring/shared": "~9.7.5", - "@react-spring/types": "~9.7.5" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - } - }, - "node_modules/@react-spring/core": { - "version": "9.7.5", - "resolved": "https://registry.npmjs.org/@react-spring/core/-/core-9.7.5.tgz", - "integrity": "sha512-rmEqcxRcu7dWh7MnCcMXLvrf6/SDlSokLaLTxiPlAYi11nN3B5oiCUAblO72o+9z/87j2uzxa2Inm8UbLjXA+w==", - "license": "MIT", - "dependencies": { - "@react-spring/animated": "~9.7.5", - "@react-spring/shared": "~9.7.5", - "@react-spring/types": "~9.7.5" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/react-spring/donate" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - } - }, - "node_modules/@react-spring/rafz": { - "version": "9.7.5", - "resolved": "https://registry.npmjs.org/@react-spring/rafz/-/rafz-9.7.5.tgz", - "integrity": "sha512-5ZenDQMC48wjUzPAm1EtwQ5Ot3bLIAwwqP2w2owG5KoNdNHpEJV263nGhCeKKmuA3vG2zLLOdu3or6kuDjA6Aw==", - "license": "MIT" - }, - "node_modules/@react-spring/shared": { - "version": "9.7.5", - "resolved": "https://registry.npmjs.org/@react-spring/shared/-/shared-9.7.5.tgz", - "integrity": "sha512-wdtoJrhUeeyD/PP/zo+np2s1Z820Ohr/BbuVYv+3dVLW7WctoiN7std8rISoYoHpUXtbkpesSKuPIw/6U1w1Pw==", - "license": "MIT", - "dependencies": { - "@react-spring/rafz": "~9.7.5", - "@react-spring/types": "~9.7.5" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - } - }, - "node_modules/@react-spring/types": { - "version": "9.7.5", - "resolved": "https://registry.npmjs.org/@react-spring/types/-/types-9.7.5.tgz", - "integrity": "sha512-HVj7LrZ4ReHWBimBvu2SKND3cDVUPWKLqRTmWe/fNY6o1owGOX0cAHbdPDTMelgBlVbrTKrre6lFkhqGZErK/g==", - "license": "MIT" - }, - "node_modules/@react-spring/web": { - "version": "9.7.5", - "resolved": "https://registry.npmjs.org/@react-spring/web/-/web-9.7.5.tgz", - "integrity": "sha512-lmvqGwpe+CSttsWNZVr+Dg62adtKhauGwLyGE/RRyZ8AAMLgb9x3NDMA5RMElXo+IMyTkPp7nxTB8ZQlmhb6JQ==", - "license": "MIT", - "dependencies": { - "@react-spring/animated": "~9.7.5", - "@react-spring/core": "~9.7.5", - "@react-spring/shared": "~9.7.5", - "@react-spring/types": "~9.7.5" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" - } - }, "node_modules/@reactflow/background": { "version": "11.3.14", "resolved": "https://registry.npmjs.org/@reactflow/background/-/background-11.3.14.tgz", @@ -3233,12 +3144,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/stylis": { - "version": "4.2.5", - "resolved": "https://registry.npmjs.org/@types/stylis/-/stylis-4.2.5.tgz", - "integrity": "sha512-1Xve+NMN7FWjY14vLoY5tL3BVEQ/n42YLwaqJIPYhotZ9uBHt87VceMwWQpzmdEt2TNXIorIFG+YeCUUW7RInw==", - "license": "MIT" - }, "node_modules/@types/yargs": { "version": "17.0.33", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", @@ -4216,15 +4121,6 @@ "node": ">= 6" } }, - "node_modules/camelize": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.1.tgz", - "integrity": "sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/caniuse-lite": { "version": "1.0.30001688", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001688.tgz", @@ -4536,26 +4432,6 @@ "node": ">= 8" } }, - "node_modules/css-color-keywords": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz", - "integrity": "sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg==", - "license": "ISC", - "engines": { - "node": ">=4" - } - }, - "node_modules/css-to-react-native": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-3.2.0.tgz", - "integrity": "sha512-e8RKaLXMOFii+02mOlqwjbD00KSEKqblnpO9e++1aXS1fPQOpS1YoqdVHBqPjHNoxeF2mimzVqawm2KCbEdtHQ==", - "license": "MIT", - "dependencies": { - "camelize": "^1.0.0", - "css-color-keywords": "^1.0.0", - "postcss-value-parser": "^4.0.2" - } - }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -7863,6 +7739,7 @@ "version": "3.3.8", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", + "dev": true, "funding": [ { "type": "github", @@ -8519,6 +8396,7 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true, "license": "MIT" }, "node_modules/prelude-ls": { @@ -8719,25 +8597,9 @@ "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true, "license": "MIT" }, - "node_modules/react-loader-spinner": { - "version": "6.1.6", - "resolved": "https://registry.npmjs.org/react-loader-spinner/-/react-loader-spinner-6.1.6.tgz", - "integrity": "sha512-x5h1Jcit7Qn03MuKlrWcMG9o12cp9SNDVHVJTNRi9TgtGPKcjKiXkou4NRfLAtXaFB3+Z8yZsVzONmPzhv2ErA==", - "license": "MIT", - "dependencies": { - "react-is": "^18.2.0", - "styled-components": "^6.1.2" - }, - "engines": { - "node": ">= 12" - }, - "peerDependencies": { - "react": "^16.0.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0" - } - }, "node_modules/react-refresh": { "version": "0.14.2", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz", @@ -9196,12 +9058,6 @@ "node": ">= 0.4" } }, - "node_modules/shallowequal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz", - "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==", - "license": "MIT" - }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -9339,6 +9195,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" @@ -9593,80 +9450,6 @@ "integrity": "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw==", "license": "MIT" }, - "node_modules/styled-components": { - "version": "6.1.13", - "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.1.13.tgz", - "integrity": "sha512-M0+N2xSnAtwcVAQeFEsGWFFxXDftHUD7XrKla06QbpUMmbmtFBMMTcKWvFXtWxuD5qQkB8iU5gk6QASlx2ZRMw==", - "license": "MIT", - "dependencies": { - "@emotion/is-prop-valid": "1.2.2", - "@emotion/unitless": "0.8.1", - "@types/stylis": "4.2.5", - "css-to-react-native": "3.2.0", - "csstype": "3.1.3", - "postcss": "8.4.38", - "shallowequal": "1.1.0", - "stylis": "4.3.2", - "tslib": "2.6.2" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/styled-components" - }, - "peerDependencies": { - "react": ">= 16.8.0", - "react-dom": ">= 16.8.0" - } - }, - "node_modules/styled-components/node_modules/@emotion/unitless": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.8.1.tgz", - "integrity": "sha512-KOEGMu6dmJZtpadb476IsZBclKvILjopjUii3V+7MnXIQCYh8W3NgNcgwo21n9LXZX6EDIKvqfjYxXebDwxKmQ==", - "license": "MIT" - }, - "node_modules/styled-components/node_modules/postcss": { - "version": "8.4.38", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", - "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "nanoid": "^3.3.7", - "picocolors": "^1.0.0", - "source-map-js": "^1.2.0" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/styled-components/node_modules/stylis": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.2.tgz", - "integrity": "sha512-bhtUjWd/z6ltJiQwg0dUfxEJ+W+jdqQd8TbWLWyeIJHlnsqmGLRFFd8e5mA0AZi/zx90smXRlN66YMTcaSFifg==", - "license": "MIT" - }, - "node_modules/styled-components/node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "license": "0BSD" - }, "node_modules/stylis": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.2.0.tgz", diff --git a/rsconcept/frontend/package.json b/rsconcept/frontend/package.json index 8b1336de..99fe5dfe 100644 --- a/rsconcept/frontend/package.json +++ b/rsconcept/frontend/package.json @@ -14,7 +14,6 @@ "dependencies": { "@dagrejs/dagre": "^1.1.4", "@lezer/lr": "^1.4.2", - "@react-spring/web": "^9.7.5", "@tanstack/react-table": "^8.20.5", "@uiw/codemirror-themes": "^4.23.6", "@uiw/react-codemirror": "^4.23.6", @@ -27,7 +26,6 @@ "react-error-boundary": "^4.1.2", "react-icons": "^5.4.0", "react-intl": "^7.0.4", - "react-loader-spinner": "^6.1.6", "react-router": "^7.0.2", "react-select": "^5.9.0", "react-tabs": "^6.0.2", diff --git a/rsconcept/frontend/src/app/Navigation/UserMenu.tsx b/rsconcept/frontend/src/app/Navigation/UserMenu.tsx index ecad9510..7075c2fe 100644 --- a/rsconcept/frontend/src/app/Navigation/UserMenu.tsx +++ b/rsconcept/frontend/src/app/Navigation/UserMenu.tsx @@ -16,6 +16,7 @@ function UserMenu() { const menu = useDropdown(); const navigateLogin = () => router.push(urls.login); + return (
{loading ? : null} @@ -27,7 +28,7 @@ function UserMenu() { onClick={navigateLogin} /> ) : null} - {user ? ( + {user && !loading ? ( } diff --git a/rsconcept/frontend/src/components/props.d.ts b/rsconcept/frontend/src/components/props.d.ts index e5d37483..2070fdc1 100644 --- a/rsconcept/frontend/src/components/props.d.ts +++ b/rsconcept/frontend/src/components/props.d.ts @@ -1,5 +1,4 @@ // =========== Module contains interfaces for common UI elements. ========== -import { animated } from '@react-spring/web'; import React from 'react'; export namespace CProps { @@ -89,11 +88,6 @@ export namespace CProps { */ export type Input = Titled & React.ComponentProps<'input'>; - /** - * Represents `div` component with animation properties. - */ - export type AnimatedDiv = React.ComponentPropsWithoutRef; - /** * Represents `mouse event` in React. */ diff --git a/rsconcept/frontend/src/components/ui/Loader.tsx b/rsconcept/frontend/src/components/ui/Loader.tsx index eb1e59d4..2747b5b4 100644 --- a/rsconcept/frontend/src/components/ui/Loader.tsx +++ b/rsconcept/frontend/src/components/ui/Loader.tsx @@ -1,7 +1,5 @@ 'use client'; -import { ThreeCircles, ThreeDots } from 'react-loader-spinner'; - import { useConceptOptions } from '@/context/ConceptOptionsContext'; interface LoaderProps { @@ -12,6 +10,47 @@ interface LoaderProps { circular?: boolean; } +const animateRotation = (duration: string) => { + return ( + + ); +}; + +const animatePulse = (startBig: boolean, duration: string) => { + return ( + <> + + + + ); +}; + /** * Displays animated loader. */ @@ -19,22 +58,35 @@ function Loader({ scale = 5, circular }: LoaderProps) { const { colors } = useConceptOptions(); if (circular) { return ( - +
+ + + {animateRotation('2.25s')} + + + {animateRotation('1.75s')} + + + {animateRotation('0.75s')} + + +
); } else { return ( - +
+ + + {animatePulse(true, '0.8s')} + + + {animatePulse(false, '0.8s')} + + + {animatePulse(true, '0.8s')} + + +
); } } diff --git a/rsconcept/frontend/src/components/wrap/AnimateFade.tsx b/rsconcept/frontend/src/components/wrap/AnimateFade.tsx deleted file mode 100644 index 5269648b..00000000 --- a/rsconcept/frontend/src/components/wrap/AnimateFade.tsx +++ /dev/null @@ -1,42 +0,0 @@ -'use client'; - -import { animated, useSpring } from '@react-spring/web'; -import { useState } from 'react'; - -import { CProps } from '@/components/props'; -import { PARAMETER } from '@/utils/constants'; - -interface AnimateFadeProps extends CProps.AnimatedDiv { - noFadeIn?: boolean; - noFadeOut?: boolean; - hideContent?: boolean; -} - -function AnimateFade({ style, noFadeIn, noFadeOut, hideContent, children, ...restProps }: AnimateFadeProps) { - const [isAnimating, setIsAnimating] = useState(false); - - const springs = useSpring({ - config: { duration: PARAMETER.fadeDuration, clamp: true }, - from: { opacity: noFadeIn ? 1 : 0 }, - to: { - opacity: hideContent ? 0 : 1, - display: hideContent === undefined ? undefined : !isAnimating || (noFadeOut && hideContent) ? 'none' : 'block' - }, - enter: { opacity: 0 }, - leave: { opacity: noFadeOut ? 1 : 0 }, - onStart: () => { - if (!hideContent) setIsAnimating(true); - }, - onRest: () => { - if (hideContent) setIsAnimating(false); - } - }); - - return ( - - {children} - - ); -} - -export default AnimateFade; diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx index 3fdb5d71..31a3e2e4 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/FormConstituenta.tsx @@ -11,7 +11,6 @@ import Indicator from '@/components/ui/Indicator'; import Overlay from '@/components/ui/Overlay'; import SubmitButton from '@/components/ui/SubmitButton'; import TextArea from '@/components/ui/TextArea'; -import AnimateFade from '@/components/wrap/AnimateFade'; import { useRSForm } from '@/context/RSFormContext'; import DlgShowTypeGraph from '@/dialogs/DlgShowTypeGraph'; import { ConstituentaID, CstType, IConstituenta, ICstUpdateData } from '@/models/rsform'; @@ -199,7 +198,7 @@ function FormConstituenta({ ) : null} {state ? ( <> - + {!!state.definition_formal || !isElementary ? ( - - + ) : null} + {!!state.definition_raw || !isElementary ? ( setTextDefinition(newValue)} /> - - + ) : null} + + {showConvention ? (