diff --git a/.vscode/settings.json b/.vscode/settings.json index cdda5ed1..37daf584 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,137 +1,133 @@ { - "search.exclude": { + "search.exclude": { ".mypy_cache/": true, ".pytest_cache/": true - }, - "python.testing.unittestArgs": [ - "-v", - "-s", - "./tests", - "-p", - "test*.py" - ], - "python.testing.pytestEnabled": false, - "python.testing.unittestEnabled": true, - "eslint.workingDirectories": [ - { - "mode": "auto" - } - ], - "python.analysis.typeCheckingMode": "off", - "python.analysis.diagnosticSeverityOverrides": { - // "reportOptionalMemberAccess": "none" - }, - "python.analysis.ignore": ["**/tests/**", "**/node_modules/**", "**/venv/**"], - "python.analysis.packageIndexDepths": [ + }, + "python.testing.unittestArgs": ["-v", "-s", "./tests", "-p", "test*.py"], + "python.testing.pytestEnabled": false, + "python.testing.unittestEnabled": true, + "eslint.workingDirectories": [ { - "name": "django", - "depth": 5 + "mode": "auto" } - ], - "colorize.include": [".tsx", ".jsx", ".ts", ".js"], - "colorize.languages": [ - "typescript", - "javascript", - "css", - "typescriptreact", - "javascriptreact" - ], - "cSpell.words": [ - "ablt", - "accs", - "actv", - "ADJF", - "ADJS", - "ADVB", - "Analyse", - "Backquote", - "BIGPR", - "cctext", - "CIHT", - "clsx", - "codemirror", - "Constituenta", - "csrftoken", - "cstlist", - "csttype", - "datv", - "Debool", - "Decart", - "EMPTYSET", - "exteor", - "femn", - "filterset", - "forceatlas", - "futr", - "Grammeme", - "Grammemes", - "GRND", - "impr", - "inan", - "indc", - "INFN", - "Infr", - "INTJ", - "Keymap", - "lezer", - "Litr", - "loct", - "moprho", - "nomn", - "nooverlap", - "NPRO", - "NUMR", - "perfectivity", - "ponomarev", - "PRCL", - "PRTF", - "PRTS", - "pssv", - "pyconcept", - "pymorphy", - "Quantor", - "razdel", - "reagraph", - "Reindex", - "rsedit", - "rseditor", - "rsform", - "rsforms", - "rslang", - "rstemplates", - "SIDELIST", - "signup", - "Slng", - "SMALLPR", - "tanstack", - "toastify", - "tooltipic", - "Viewset", - "viewsets", - "wordform", - "Wordforms", - "Булеан", - "Бурбаки", - "Десинглетон", - "компаратив", - "конституент", - "Конституента", - "конституенту", - "конституенты", - "неинтерпретируемый", - "неитерируемого", - "пересинтез", - "Родоструктурная", - "Родоструктурное", - "Синглетон", - "твор", - "Терминологизация", - "Цермелло", - "ЦИВТ", - "Экстеор", - "Экстеора", - "Экстеоре" - ], - "cSpell.language": "en,ru", - "cSpell.ignorePaths": ["node_modules/**", "*.json"] -} \ No newline at end of file + ], + "python.analysis.typeCheckingMode": "off", + "python.analysis.diagnosticSeverityOverrides": { + // "reportOptionalMemberAccess": "none" + }, + "python.analysis.ignore": ["**/tests/**", "**/node_modules/**", "**/venv/**"], + "python.analysis.packageIndexDepths": [ + { + "name": "django", + "depth": 5 + } + ], + "colorize.include": [".tsx", ".jsx", ".ts", ".js"], + "colorize.languages": [ + "typescript", + "javascript", + "css", + "typescriptreact", + "javascriptreact" + ], + "cSpell.words": [ + "ablt", + "accs", + "actv", + "ADJF", + "ADJS", + "ADVB", + "Analyse", + "Backquote", + "BIGPR", + "cctext", + "CIHT", + "clsx", + "codemirror", + "Constituenta", + "csrftoken", + "cstlist", + "csttype", + "datv", + "Debool", + "Decart", + "Downvote", + "EMPTYSET", + "exteor", + "femn", + "filterset", + "forceatlas", + "futr", + "Grammeme", + "Grammemes", + "GRND", + "impr", + "inan", + "indc", + "INFN", + "Infr", + "INTJ", + "Keymap", + "lezer", + "Litr", + "loct", + "moprho", + "nomn", + "nooverlap", + "NPRO", + "NUMR", + "perfectivity", + "ponomarev", + "PRCL", + "PRTF", + "PRTS", + "pssv", + "pyconcept", + "pymorphy", + "Quantor", + "razdel", + "reagraph", + "Reindex", + "rsedit", + "rseditor", + "rsform", + "rsforms", + "rslang", + "rstemplates", + "SIDELIST", + "signup", + "Slng", + "SMALLPR", + "tanstack", + "toastify", + "tooltipic", + "Upvote", + "Viewset", + "viewsets", + "wordform", + "Wordforms", + "Булеан", + "Бурбаки", + "Десинглетон", + "компаратив", + "конституент", + "Конституента", + "конституенту", + "конституенты", + "неинтерпретируемый", + "неитерируемого", + "пересинтез", + "Родоструктурная", + "Родоструктурное", + "Синглетон", + "твор", + "Терминологизация", + "Цермелло", + "ЦИВТ", + "Экстеор", + "Экстеора", + "Экстеоре" + ], + "cSpell.language": "en,ru", + "cSpell.ignorePaths": ["node_modules/**", "*.json"] +} diff --git a/rsconcept/frontend/.prettierrc.json b/rsconcept/frontend/.prettierrc.json new file mode 100644 index 00000000..d4dd284f --- /dev/null +++ b/rsconcept/frontend/.prettierrc.json @@ -0,0 +1,13 @@ +{ + "semi": true, + "useTabs": false, + "printWidth": 120, + "tabWidth": 2, + "trailingComma": "none", + "arrowParens": "avoid", + "singleQuote": true, + "jsxSingleQuote": true, + "quoteProps": "consistent", + "bracketSameLine": false, + "bracketSpacing": true +} \ No newline at end of file diff --git a/rsconcept/frontend/src/App.tsx b/rsconcept/frontend/src/App.tsx index 4da3370a..67888739 100644 --- a/rsconcept/frontend/src/App.tsx +++ b/rsconcept/frontend/src/App.tsx @@ -20,35 +20,33 @@ import { globalIDs } from './utils/constants'; function Root() { const { viewportHeight, mainHeight, showScroll } = useConceptTheme(); return ( - -
+ +
+ - - - + -
-
- -
-
-
-
-
); +
+
+ +
+
+
+
+ ); } const router = createBrowserRouter([ @@ -59,48 +57,46 @@ const router = createBrowserRouter([ children: [ { path: '', - element: , + element: }, { path: 'login', - element: , + element: }, { path: 'signup', - element: , + element: }, { path: 'restore-password', - element: , + element: }, { path: 'profile', - element: , + element: }, { path: 'manuals', - element: , + element: }, { path: 'library', - element: , + element: }, { path: 'library/create', - element: , + element: }, { path: 'rsforms/:id', - element: , - }, + element: + } ] - }, + } ]); -function App () { - return ( - - ); +function App() { + return ; } -export default App; \ No newline at end of file +export default App; diff --git a/rsconcept/frontend/src/GlobalProviders.tsx b/rsconcept/frontend/src/GlobalProviders.tsx index 05f1fd8f..60802d95 100644 --- a/rsconcept/frontend/src/GlobalProviders.tsx +++ b/rsconcept/frontend/src/GlobalProviders.tsx @@ -11,13 +11,10 @@ import { UsersState } from '@/context/UsersContext'; import ErrorFallback from './components/ErrorFallback'; -pdfjs.GlobalWorkerOptions.workerSrc = new URL( - 'pdfjs-dist/build/pdf.worker.min.js', - import.meta.url, -).toString(); +pdfjs.GlobalWorkerOptions.workerSrc = new URL('pdfjs-dist/build/pdf.worker.min.js', import.meta.url).toString(); const resetState = () => { - console.log('Resetting state after error fallback') + console.log('Resetting state after error fallback'); }; const logError = (error: Error, info: { componentStack?: string | null | undefined }) => { @@ -27,6 +24,7 @@ const logError = (error: Error, info: { componentStack?: string | null | undefin } }; +// prettier-ignore function GlobalProviders({ children }: { children: React.ReactNode }) { return ( ); } -export default GlobalProviders; \ No newline at end of file +export default GlobalProviders; diff --git a/rsconcept/frontend/src/components/Common/Button.tsx b/rsconcept/frontend/src/components/Common/Button.tsx index 4233a3c2..f58c0961 100644 --- a/rsconcept/frontend/src/components/Common/Button.tsx +++ b/rsconcept/frontend/src/components/Common/Button.tsx @@ -4,47 +4,54 @@ import { globalIDs } from '@/utils/constants'; import { CProps } from '../props'; -interface ButtonProps -extends CProps.Control, CProps.Colors, CProps.Button { - text?: string - icon?: React.ReactNode +interface ButtonProps extends CProps.Control, CProps.Colors, CProps.Button { + text?: string; + icon?: React.ReactNode; - dense?: boolean - loading?: boolean + dense?: boolean; + loading?: boolean; } function Button({ - text, icon, title, - loading, dense, disabled, noBorder, noOutline, + text, + icon, + title, + loading, + dense, + disabled, + noBorder, + noOutline, colors = 'clr-btn-default', className, ...restProps }: ButtonProps) { return ( - ); + + ); } -export default Button; \ No newline at end of file +export default Button; diff --git a/rsconcept/frontend/src/components/Common/Checkbox.tsx b/rsconcept/frontend/src/components/Common/Checkbox.tsx index 4afae034..b79b8273 100644 --- a/rsconcept/frontend/src/components/Common/Checkbox.tsx +++ b/rsconcept/frontend/src/components/Common/Checkbox.tsx @@ -7,21 +7,16 @@ import { CheckboxCheckedIcon } from '../Icons'; import { CProps } from '../props'; import Label from './Label'; -export interface CheckboxProps -extends Omit { - label?: string - disabled?: boolean +export interface CheckboxProps extends Omit { + label?: string; + disabled?: boolean; - value: boolean - setValue?: (newValue: boolean) => void + value: boolean; + setValue?: (newValue: boolean) => void; } -function Checkbox({ - id, disabled, label, title, - className, value, setValue, ...restProps -}: CheckboxProps) { - const cursor = useMemo( - () => { +function Checkbox({ id, disabled, label, title, className, value, setValue, ...restProps }: CheckboxProps) { + const cursor = useMemo(() => { if (disabled) { return 'cursor-not-allowed'; } else if (setValue) { @@ -40,32 +35,31 @@ function Checkbox({ } return ( - ); + + ); } -export default Checkbox; \ No newline at end of file +export default Checkbox; diff --git a/rsconcept/frontend/src/components/Common/ConceptLoader.tsx b/rsconcept/frontend/src/components/Common/ConceptLoader.tsx index 20c0337d..829790c8 100644 --- a/rsconcept/frontend/src/components/Common/ConceptLoader.tsx +++ b/rsconcept/frontend/src/components/Common/ConceptLoader.tsx @@ -5,18 +5,14 @@ import { ThreeDots } from 'react-loader-spinner'; import { useConceptTheme } from '@/context/ThemeContext'; interface ConceptLoaderProps { - size?: number + size?: number; } -export function ConceptLoader({size=10}: ConceptLoaderProps) { - const {colors} = useConceptTheme(); +export function ConceptLoader({ size = 10 }: ConceptLoaderProps) { + const { colors } = useConceptTheme(); return ( -
- -
); -} \ No newline at end of file +
+ +
+ ); +} diff --git a/rsconcept/frontend/src/components/Common/ConceptSearch.tsx b/rsconcept/frontend/src/components/Common/ConceptSearch.tsx index 640ec6f4..06efbfae 100644 --- a/rsconcept/frontend/src/components/Common/ConceptSearch.tsx +++ b/rsconcept/frontend/src/components/Common/ConceptSearch.tsx @@ -4,30 +4,28 @@ import { CProps } from '../props'; import Overlay from './Overlay'; import TextInput from './TextInput'; -interface ConceptSearchProps -extends CProps.Styling { - value: string - onChange?: (newValue: string) => void - noBorder?: boolean +interface ConceptSearchProps extends CProps.Styling { + value: string; + onChange?: (newValue: string) => void; + noBorder?: boolean; } function ConceptSearch({ value, onChange, noBorder, ...restProps }: ConceptSearchProps) { return ( -
- - - - (onChange ? onChange(event.target.value) : undefined)} - /> -
); +
+ + + + (onChange ? onChange(event.target.value) : undefined)} + /> +
+ ); } -export default ConceptSearch; \ No newline at end of file +export default ConceptSearch; diff --git a/rsconcept/frontend/src/components/Common/ConceptTab.tsx b/rsconcept/frontend/src/components/Common/ConceptTab.tsx index 383b01d9..c975e841 100644 --- a/rsconcept/frontend/src/components/Common/ConceptTab.tsx +++ b/rsconcept/frontend/src/components/Common/ConceptTab.tsx @@ -4,33 +4,30 @@ import { Tab } from 'react-tabs'; import { globalIDs } from '@/utils/constants'; -interface ConceptTabProps -extends Omit { - label?: string +interface ConceptTabProps extends Omit { + label?: string; } -function ConceptTab({ - label, title, className, - ...otherProps -}: ConceptTabProps) { +function ConceptTab({ label, title, className, ...otherProps }: ConceptTabProps) { return ( - - {label} - ); + + {label} + + ); } ConceptTab.tabsRole = 'Tab'; -export default ConceptTab; \ No newline at end of file +export default ConceptTab; diff --git a/rsconcept/frontend/src/components/Common/ConceptTooltip.tsx b/rsconcept/frontend/src/components/Common/ConceptTooltip.tsx index 8d44e18e..a07ab623 100644 --- a/rsconcept/frontend/src/components/Common/ConceptTooltip.tsx +++ b/rsconcept/frontend/src/components/Common/ConceptTooltip.tsx @@ -7,16 +7,16 @@ import { ITooltip, Tooltip } from 'react-tooltip'; import { useConceptTheme } from '@/context/ThemeContext'; -interface ConceptTooltipProps -extends Omit { - layer?: string - text?: string +interface ConceptTooltipProps extends Omit { + layer?: string; + text?: string; } function ConceptTooltip({ - text, children, - layer='z-tooltip', - place='bottom', + text, + children, + layer = 'z-tooltip', + place = 'bottom', className, style, ...restProps @@ -26,25 +26,22 @@ function ConceptTooltip({ return null; } return createPortal( - ( - {text ? text : null} - {children as ReactNode} - ), document.body); + + {text ? text : null} + {children as ReactNode} + , + document.body + ); } -export default ConceptTooltip; \ No newline at end of file +export default ConceptTooltip; diff --git a/rsconcept/frontend/src/components/Common/Divider.tsx b/rsconcept/frontend/src/components/Common/Divider.tsx index 5dc05648..f6f786e2 100644 --- a/rsconcept/frontend/src/components/Common/Divider.tsx +++ b/rsconcept/frontend/src/components/Common/Divider.tsx @@ -1,19 +1,19 @@ import clsx from 'clsx'; interface DividerProps { - vertical?: boolean - margins?: string + vertical?: boolean; + margins?: string; } function Divider({ vertical, margins = 'mx-2' }: DividerProps) { return ( -
); +
+ ); } -export default Divider; \ No newline at end of file +export default Divider; diff --git a/rsconcept/frontend/src/components/Common/Dropdown.tsx b/rsconcept/frontend/src/components/Common/Dropdown.tsx index 8e4ebf9c..258c3488 100644 --- a/rsconcept/frontend/src/components/Common/Dropdown.tsx +++ b/rsconcept/frontend/src/components/Common/Dropdown.tsx @@ -5,43 +5,38 @@ import { animateDropdown } from '@/utils/animations'; import { CProps } from '../props'; -interface DropdownProps -extends CProps.Styling { - stretchLeft?: boolean - isOpen: boolean - children: React.ReactNode +interface DropdownProps extends CProps.Styling { + stretchLeft?: boolean; + isOpen: boolean; + children: React.ReactNode; } -function Dropdown({ - isOpen, stretchLeft, - className, - children, - ...restProps -}: DropdownProps) { +function Dropdown({ isOpen, stretchLeft, className, children, ...restProps }: DropdownProps) { return ( -
- - {children} - -
); +
+ + {children} + +
+ ); } -export default Dropdown; \ No newline at end of file +export default Dropdown; diff --git a/rsconcept/frontend/src/components/Common/DropdownButton.tsx b/rsconcept/frontend/src/components/Common/DropdownButton.tsx index 0adeb5c2..fa5dc6dd 100644 --- a/rsconcept/frontend/src/components/Common/DropdownButton.tsx +++ b/rsconcept/frontend/src/components/Common/DropdownButton.tsx @@ -6,44 +6,39 @@ import { globalIDs } from '@/utils/constants'; import { CProps } from '../props'; -interface DropdownButtonProps -extends CProps.AnimatedButton { - text?: string - icon?: React.ReactNode +interface DropdownButtonProps extends CProps.AnimatedButton { + text?: string; + icon?: React.ReactNode; - children?: React.ReactNode + children?: React.ReactNode; } -function DropdownButton({ - text, icon, - className, title, - onClick, - children, - ...restProps -}: DropdownButtonProps) { +function DropdownButton({ text, icon, className, title, onClick, children, ...restProps }: DropdownButtonProps) { return ( - - {children ? children : null} - {!children && icon ? icon : null} - {!children && text ? {text} : null} - ); + + {children ? children : null} + {!children && icon ? icon : null} + {!children && text ? {text} : null} + + ); } -export default DropdownButton; \ No newline at end of file +export default DropdownButton; diff --git a/rsconcept/frontend/src/components/Common/DropdownCheckbox.tsx b/rsconcept/frontend/src/components/Common/DropdownCheckbox.tsx index a87e3598..1bd59e6d 100644 --- a/rsconcept/frontend/src/components/Common/DropdownCheckbox.tsx +++ b/rsconcept/frontend/src/components/Common/DropdownCheckbox.tsx @@ -6,31 +6,28 @@ import { animateDropdownItem } from '@/utils/animations'; import Checkbox from './Checkbox'; interface DropdownCheckboxProps { - value: boolean - label?: string - title?: string - disabled?: boolean - setValue?: (newValue: boolean) => void + value: boolean; + label?: string; + title?: string; + disabled?: boolean; + setValue?: (newValue: boolean) => void; } function DropdownCheckbox({ title, setValue, disabled, ...restProps }: DropdownCheckboxProps) { return ( - - - ); + + + + ); } -export default DropdownCheckbox; \ No newline at end of file +export default DropdownCheckbox; diff --git a/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx b/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx index db3734ce..edca95bf 100644 --- a/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx +++ b/rsconcept/frontend/src/components/Common/EmbedYoutube.tsx @@ -1,35 +1,37 @@ interface EmbedYoutubeProps { - videoID: string - pxHeight: number - pxWidth?: number + videoID: string; + pxHeight: number; + pxWidth?: number; } function EmbedYoutube({ videoID, pxHeight, pxWidth }: EmbedYoutubeProps) { if (!pxWidth) { - pxWidth = pxHeight * 16 / 9; + pxWidth = (pxHeight * 16) / 9; } return ( -
-