diff --git a/.dependency-cruiser.js b/.dependency-cruiser.js index b69c7b9cc..c606ee1b9 100644 --- a/.dependency-cruiser.js +++ b/.dependency-cruiser.js @@ -1,227 +1,209 @@ /** @type {import('dependency-cruiser').IConfiguration} */ module.exports = { - forbidden: [ - { - name: 'no-circular', - severity: 'warn', - comment: - 'This dependency is part of a circular relationship. You might want to revise ' + - 'your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ', - from: {}, - to: { - circular: true - } - }, - { - name: 'no-orphans', - comment: - "This is an orphan module - it's likely not used (anymore?). Either use it or " + - "remove it. If it's logical this module is an orphan (i.e. it's a config file), " + - "add an exception for it in your dependency-cruiser configuration. By default " + - "this rule does not scrutinize dot-files (e.g. .eslintrc.js), TypeScript declaration " + - "files (.d.ts), tsconfig.json and some of the babel and webpack configs.", - severity: 'warn', - from: { - orphan: true, - pathNot: [ - '(^|/)[.][^/]+[.](?:js|cjs|mjs|ts|cts|mts|json)$', // dot files - '[.]d[.]ts$', // TypeScript declaration files - '(^|/)tsconfig[.]json$', // TypeScript config - '(^|/)(?:babel|webpack)[.]config[.](?:js|cjs|mjs|ts|cts|mts|json)$' // other configs - ] - }, - to: {}, - }, - { - name: 'no-deprecated-core', - comment: - 'A module depends on a node core module that has been deprecated. Find an alternative - these are ' + - "bound to exist - node doesn't deprecate lightly.", - severity: 'warn', - from: {}, - to: { - dependencyTypes: [ - 'core' - ], - path: [ - '^v8/tools/codemap$', - '^v8/tools/consarray$', - '^v8/tools/csvparser$', - '^v8/tools/logreader$', - '^v8/tools/profile_view$', - '^v8/tools/profile$', - '^v8/tools/SourceMap$', - '^v8/tools/splaytree$', - '^v8/tools/tickprocessor-driver$', - '^v8/tools/tickprocessor$', - '^node-inspect/lib/_inspect$', - '^node-inspect/lib/internal/inspect_client$', - '^node-inspect/lib/internal/inspect_repl$', - '^async_hooks$', - '^punycode$', - '^domain$', - '^constants$', - '^sys$', - '^_linklist$', - '^_stream_wrap$' - ], - } - }, - { - name: 'not-to-deprecated', - comment: - 'This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later ' + - 'version of that module, or find an alternative. Deprecated modules are a security risk.', - severity: 'warn', - from: {}, - to: { - dependencyTypes: [ - 'deprecated' - ] - } - }, - { - name: 'no-non-package-json', - severity: 'error', - comment: - "This module depends on an npm package that isn't in the 'dependencies' section of your package.json. " + - "That's problematic as the package either (1) won't be available on live (2 - worse) will be " + - "available on live with an non-guaranteed version. Fix it by adding the package to the dependencies " + - "in your package.json.", - from: {}, - to: { - dependencyTypes: [ - 'npm-no-pkg', - 'npm-unknown' - ] - } - }, - { - name: 'not-to-unresolvable', - comment: - "This module depends on a module that cannot be found ('resolved to disk'). If it's an npm " + - 'module: add it to your package.json. In all other cases you likely already know what to do.', - severity: 'error', - from: {}, - to: { - couldNotResolve: true - } - }, - { - name: 'no-duplicate-dep-types', - comment: - "Likely this module depends on an external ('npm') package that occurs more than once " + - "in your package.json i.e. bot as a devDependencies and in dependencies. This will cause " + - "maintenance problems later on.", - severity: 'warn', - from: {}, - to: { - moreThanOneDependencyType: true, - // as it's pretty common to have a type import be a type only import - // _and_ (e.g.) a devDependency - don't consider type-only dependency - // types for this rule - dependencyTypesNot: ["type-only"] - } - }, + forbidden: [ + { + name: 'no-circular', + severity: 'warn', + comment: + 'This dependency is part of a circular relationship. You might want to revise ' + + 'your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ', + from: {}, + to: { + circular: true, + }, + }, + { + name: 'no-orphans', + comment: + "This is an orphan module - it's likely not used (anymore?). Either use it or " + + "remove it. If it's logical this module is an orphan (i.e. it's a config file), " + + 'add an exception for it in your dependency-cruiser configuration. By default ' + + 'this rule does not scrutinize dot-files (e.g. .eslintrc.js), TypeScript declaration ' + + 'files (.d.ts), tsconfig.json and some of the babel and webpack configs.', + severity: 'warn', + from: { + orphan: true, + pathNot: [ + '(^|/)[.][^/]+[.](?:js|cjs|mjs|ts|cts|mts|json)$', // dot files + '[.]d[.]ts$', // TypeScript declaration files + '(^|/)tsconfig[.]json$', // TypeScript config + '(^|/)(?:babel|webpack)[.]config[.](?:js|cjs|mjs|ts|cts|mts|json)$', // other configs + ], + }, + to: {}, + }, + { + name: 'no-deprecated-core', + comment: + 'A module depends on a node core module that has been deprecated. Find an alternative - these are ' + + "bound to exist - node doesn't deprecate lightly.", + severity: 'warn', + from: {}, + to: { + dependencyTypes: ['core'], + path: [ + '^v8/tools/codemap$', + '^v8/tools/consarray$', + '^v8/tools/csvparser$', + '^v8/tools/logreader$', + '^v8/tools/profile_view$', + '^v8/tools/profile$', + '^v8/tools/SourceMap$', + '^v8/tools/splaytree$', + '^v8/tools/tickprocessor-driver$', + '^v8/tools/tickprocessor$', + '^node-inspect/lib/_inspect$', + '^node-inspect/lib/internal/inspect_client$', + '^node-inspect/lib/internal/inspect_repl$', + '^async_hooks$', + '^punycode$', + '^domain$', + '^constants$', + '^sys$', + '^_linklist$', + '^_stream_wrap$', + ], + }, + }, + { + name: 'not-to-deprecated', + comment: + 'This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later ' + + 'version of that module, or find an alternative. Deprecated modules are a security risk.', + severity: 'warn', + from: {}, + to: { + dependencyTypes: ['deprecated'], + }, + }, + { + name: 'no-non-package-json', + severity: 'error', + comment: + "This module depends on an npm package that isn't in the 'dependencies' section of your package.json. " + + "That's problematic as the package either (1) won't be available on live (2 - worse) will be " + + 'available on live with an non-guaranteed version. Fix it by adding the package to the dependencies ' + + 'in your package.json.', + from: {}, + to: { + dependencyTypes: ['npm-no-pkg', 'npm-unknown'], + }, + }, + { + name: 'not-to-unresolvable', + comment: + "This module depends on a module that cannot be found ('resolved to disk'). If it's an npm " + + 'module: add it to your package.json. In all other cases you likely already know what to do.', + severity: 'error', + from: {}, + to: { + couldNotResolve: true, + }, + }, + { + name: 'no-duplicate-dep-types', + comment: + "Likely this module depends on an external ('npm') package that occurs more than once " + + 'in your package.json i.e. bot as a devDependencies and in dependencies. This will cause ' + + 'maintenance problems later on.', + severity: 'warn', + from: {}, + to: { + moreThanOneDependencyType: true, + // as it's pretty common to have a type import be a type only import + // _and_ (e.g.) a devDependency - don't consider type-only dependency + // types for this rule + dependencyTypesNot: ['type-only'], + }, + }, - /* rules you might want to tweak for your specific situation: */ - - { - name: 'not-to-spec', - comment: - 'This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. ' + - "If there's something in a spec that's of use to other modules, it doesn't have that single " + - 'responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.', - severity: 'error', - from: {}, - to: { - path: '[.](?:spec|test)[.](?:js|mjs|cjs|jsx|ts|mts|cts|tsx|ls|coffee|litcoffee|coffee[.]md)$' - } - }, - { - name: 'not-to-dev-dep', - severity: 'error', - comment: - "This module depends on an npm package from the 'devDependencies' section of your " + - 'package.json. It looks like something that ships to production, though. To prevent problems ' + - "with npm packages that aren't there on production declare it (only!) in the 'dependencies'" + - 'section of your package.json. If this module is development only - add it to the ' + - 'from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration', - from: { - path: '^(src)', - pathNot: '[.](?:spec|test)[.](?:js|mjs|cjs|jsx|ts|mts|cts|tsx|ls|coffee|litcoffee|coffee[.]md)$' - }, - to: { - dependencyTypes: [ - 'npm-dev', - ], - // type only dependencies are not a problem as they don't end up in the - // production code or are ignored by the runtime. - dependencyTypesNot: [ - 'type-only' - ], - pathNot: [ - 'node_modules/@types/' - ] - } - }, - { - name: 'optional-deps-used', - severity: 'info', - comment: - "This module depends on an npm package that is declared as an optional dependency " + - "in your package.json. As this makes sense in limited situations only, it's flagged here. " + - "If you're using an optional dependency here by design - add an exception to your" + - "dependency-cruiser configuration.", - from: {}, - to: { - dependencyTypes: [ - 'npm-optional' - ] - } - }, - { - name: 'peer-deps-used', - comment: - "This module depends on an npm package that is declared as a peer dependency " + - "in your package.json. This makes sense if your package is e.g. a plugin, but in " + - "other cases - maybe not so much. If the use of a peer dependency is intentional " + - "add an exception to your dependency-cruiser configuration.", - severity: 'warn', - from: {}, - to: { - dependencyTypes: [ - 'npm-peer' - ] - } - } - ], - options: { + /* rules you might want to tweak for your specific situation: */ - /* Which modules not to follow further when encountered */ - doNotFollow: { - /* path: an array of regular expressions in strings to match against */ - path: ['node_modules'] - }, + { + name: 'not-to-spec', + comment: + 'This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. ' + + "If there's something in a spec that's of use to other modules, it doesn't have that single " + + 'responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.', + severity: 'error', + from: {}, + to: { + path: '[.](?:spec|test)[.](?:js|mjs|cjs|jsx|ts|mts|cts|tsx|ls|coffee|litcoffee|coffee[.]md)$', + }, + }, + { + name: 'not-to-dev-dep', + severity: 'error', + comment: + "This module depends on an npm package from the 'devDependencies' section of your " + + 'package.json. It looks like something that ships to production, though. To prevent problems ' + + "with npm packages that aren't there on production declare it (only!) in the 'dependencies'" + + 'section of your package.json. If this module is development only - add it to the ' + + 'from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration', + from: { + path: '^(src)', + pathNot: '[.](?:spec|test)[.](?:js|mjs|cjs|jsx|ts|mts|cts|tsx|ls|coffee|litcoffee|coffee[.]md)$', + }, + to: { + dependencyTypes: ['npm-dev'], + // type only dependencies are not a problem as they don't end up in the + // production code or are ignored by the runtime. + dependencyTypesNot: ['type-only'], + pathNot: ['node_modules/@types/'], + }, + }, + { + name: 'optional-deps-used', + severity: 'info', + comment: + 'This module depends on an npm package that is declared as an optional dependency ' + + "in your package.json. As this makes sense in limited situations only, it's flagged here. " + + "If you're using an optional dependency here by design - add an exception to your" + + 'dependency-cruiser configuration.', + from: {}, + to: { + dependencyTypes: ['npm-optional'], + }, + }, + { + name: 'peer-deps-used', + comment: + 'This module depends on an npm package that is declared as a peer dependency ' + + 'in your package.json. This makes sense if your package is e.g. a plugin, but in ' + + 'other cases - maybe not so much. If the use of a peer dependency is intentional ' + + 'add an exception to your dependency-cruiser configuration.', + severity: 'warn', + from: {}, + to: { + dependencyTypes: ['npm-peer'], + }, + }, + ], + options: { + /* Which modules not to follow further when encountered */ + doNotFollow: { + /* path: an array of regular expressions in strings to match against */ + path: ['node_modules'], + }, - /* Which modules to exclude */ - // exclude : { - // /* path: an array of regular expressions in strings to match against */ - // path: '', - // }, + /* Which modules to exclude */ + // exclude : { + // /* path: an array of regular expressions in strings to match against */ + // path: '', + // }, - /* Which modules to exclusively include (array of regular expressions in strings) + /* Which modules to exclusively include (array of regular expressions in strings) dependency-cruiser will skip everything not matching this pattern */ - // includeOnly : [''], + // includeOnly : [''], - /* dependency-cruiser will include modules matching against the focus + /* dependency-cruiser will include modules matching against the focus regular expression in its output, as well as their direct neighbours (dependencies and dependents) */ - // focus : '', + // focus : '', - /* List of module systems to cruise. + /* List of module systems to cruise. When left out dependency-cruiser will fall back to the list of _all_ module systems it knows of. It's the default because it's the safe option It might come at a performance penalty, though. @@ -230,37 +212,37 @@ module.exports = { As in practice only commonjs ('cjs') and ecmascript modules ('es6') are widely used, you can limit the moduleSystems to those. */ - - // moduleSystems: ['cjs', 'es6'], - /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/develop/' + // moduleSystems: ['cjs', 'es6'], + + /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/develop/' to open it on your online repo or `vscode://file/${process.cwd()}/` to open it in visual studio code), */ - // prefix: `vscode://file/${process.cwd()}/`, + // prefix: `vscode://file/${process.cwd()}/`, - /* false (the default): ignore dependencies that only exist before typescript-to-javascript compilation + /* false (the default): ignore dependencies that only exist before typescript-to-javascript compilation true: also detect dependencies that only exist before typescript-to-javascript compilation "specify": for each dependency identify whether it only exists before compilation or also after */ - tsPreCompilationDeps: true, - - /* list of extensions to scan that aren't javascript or compile-to-javascript. + tsPreCompilationDeps: true, + + /* list of extensions to scan that aren't javascript or compile-to-javascript. Empty by default. Only put extensions in here that you want to take into account that are _not_ parsable. */ - // extraExtensionsToScan: [".json", ".jpg", ".png", ".svg", ".webp"], + // extraExtensionsToScan: [".json", ".jpg", ".png", ".svg", ".webp"], - /* if true combines the package.jsons found from the module up to the base + /* if true combines the package.jsons found from the module up to the base folder the cruise is initiated from. Useful for how (some) mono-repos manage dependencies & dependency definitions. */ - // combinedDependencies: false, + // combinedDependencies: false, - /* if true leave symlinks untouched, otherwise use the realpath */ - // preserveSymlinks: false, + /* if true leave symlinks untouched, otherwise use the realpath */ + // preserveSymlinks: false, - /* TypeScript project file ('tsconfig.json') to use for + /* TypeScript project file ('tsconfig.json') to use for (1) compilation and (2) resolution (e.g. with the paths property) @@ -268,11 +250,11 @@ module.exports = { dependency-cruiser's current working directory). When not provided defaults to './tsconfig.json'. */ - tsConfig: { - fileName: 'tsconfig.json' - }, + tsConfig: { + fileName: 'tsconfig.json', + }, - /* Webpack configuration to use to get resolve options from. + /* Webpack configuration to use to get resolve options from. The (optional) fileName attribute specifies which file to take (relative to dependency-cruiser's current working directory. When not provided defaults @@ -282,42 +264,42 @@ module.exports = { your webpack config is a function and takes them (see webpack documentation for details) */ - // webpackConfig: { - // fileName: 'webpack.config.js', - // env: {}, - // arguments: {} - // }, + // webpackConfig: { + // fileName: 'webpack.config.js', + // env: {}, + // arguments: {} + // }, - /* Babel config ('.babelrc', '.babelrc.json', '.babelrc.json5', ...) to use + /* Babel config ('.babelrc', '.babelrc.json', '.babelrc.json5', ...) to use for compilation (and whatever other naughty things babel plugins do to source code). */ - // babelConfig: { - // fileName: '.babelrc', - // }, + // babelConfig: { + // fileName: '.babelrc', + // }, - /* List of strings you have in use in addition to cjs/ es6 requires + /* List of strings you have in use in addition to cjs/ es6 requires & imports to declare module dependencies. Use this e.g. if you've re-declared require, use a require-wrapper or use window.require as a hack. */ - // exoticRequireStrings: [], - - /* options to pass on to enhanced-resolve, the package dependency-cruiser + // exoticRequireStrings: [], + + /* options to pass on to enhanced-resolve, the package dependency-cruiser uses to resolve module references to disk. The values below should be suitable for most situations If you use webpack: you can also set these in webpack.conf.js. The set there will override the ones specified here. */ - enhancedResolveOptions: { - /* What to consider as an 'exports' field in package.jsons */ - exportsFields: ["exports"], - /* List of conditions to check for in the exports field. + enhancedResolveOptions: { + /* What to consider as an 'exports' field in package.jsons */ + exportsFields: ['exports'], + /* List of conditions to check for in the exports field. Only works when the 'exportsFields' array is non-empty. */ - conditionNames: ["import", "require", "node", "default", "types"], - /* + conditionNames: ['import', 'require', 'node', 'default', 'types'], + /* The extensions, by default are the same as the ones dependency-cruiser can access (run `npx depcruise --info` to see which ones that are in _your_ environment. If that list is larger than you need you can pass @@ -325,14 +307,14 @@ module.exports = { up the most expensive step in dependency cruising (module resolution) quite a bit. */ - // extensions: [".js", ".jsx", ".ts", ".tsx", ".d.ts"], - /* What to consider a 'main' field in package.json */ - - // if you migrate to ESM (or are in an ESM environment already) you will want to - // have "module" in the list of mainFields, like so: - // mainFields: ["module", "main", "types", "typings"], - mainFields: ["main", "types", "typings"], - /* + // extensions: [".js", ".jsx", ".ts", ".tsx", ".d.ts"], + /* What to consider a 'main' field in package.json */ + + // if you migrate to ESM (or are in an ESM environment already) you will want to + // have "module" in the list of mainFields, like so: + // mainFields: ["module", "main", "types", "typings"], + mainFields: ['main', 'types', 'typings'], + /* A list of alias fields in package.jsons See [this specification](https://github.com/defunctzombie/package-browser-field-spec) and the [resolve.alias](https://webpack.js.org/configuration/resolve/#resolvealiasfields) @@ -340,54 +322,55 @@ module.exports = { Defaults to an empty array (don't use any alias fields). */ - // aliasFields: ["browser"], - }, - reporterOptions: { - dot: { - /* pattern of modules that can be consolidated in the detailed + // aliasFields: ["browser"], + }, + reporterOptions: { + dot: { + /* pattern of modules that can be consolidated in the detailed graphical dependency graph. The default pattern in this configuration collapses everything in node_modules to one folder deep so you see the external modules, but not the innards your app depends upon. */ - collapsePattern: 'node_modules/(?:@[^/]+/[^/]+|[^/]+)', + collapsePattern: 'node_modules/(?:@[^/]+/[^/]+|[^/]+)', - /* Options to tweak the appearance of your graph.See + /* Options to tweak the appearance of your graph.See https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#reporteroptions for details and some examples. If you don't specify a theme don't worry - dependency-cruiser will fall back to the default one. */ - // theme: { - // graph: { - // /* splines: "ortho" will give you straight lines at the expense of - // being slow to render on big graphs - // splines: "true" will give you bezier curves which are faster - // but might not look as nice - // */ - // splines: "true" - // }, - // } - }, - archi: { - /* pattern of modules that can be consolidated in the high level + // theme: { + // graph: { + // /* splines: "ortho" will give you straight lines at the expense of + // being slow to render on big graphs + // splines: "true" will give you bezier curves which are faster + // but might not look as nice + // */ + // splines: "true" + // }, + // } + }, + archi: { + /* pattern of modules that can be consolidated in the high level graphical dependency graph. If you use the high level graphical dependency graph reporter (`archi`) you probably want to tweak this collapsePattern to your situation. */ - collapsePattern: '^(?:packages|src|lib(s?)|app(s?)|bin|test(s?)|spec(s?))/[^/]+|node_modules/(?:@[^/]+/[^/]+|[^/]+)', + collapsePattern: + '^(?:packages|src|lib(s?)|app(s?)|bin|test(s?)|spec(s?))/[^/]+|node_modules/(?:@[^/]+/[^/]+|[^/]+)', - /* Options to tweak the appearance of your graph.See + /* Options to tweak the appearance of your graph.See https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#reporteroptions for details and some examples. If you don't specify a theme for 'archi' dependency-cruiser will use the one specified in the dot section above and otherwise use the default one. */ - // theme: { - // }, - }, - "text": { - "highlightFocused": true - }, - } - } -}; + // theme: { + // }, + }, + text: { + highlightFocused: true, + }, + }, + }, +} // generated: dependency-cruiser@16.2.4 on 2024-05-10T21:13:31.592Z diff --git a/.eslintrc.js b/.eslintrc.js index 5f23efcd4..256f64929 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,23 +1,50 @@ module.exports = { parser: '@typescript-eslint/parser', parserOptions: { - project: 'tsconfig.json', + project: 'tsconfig.eslint.json', sourceType: 'module', tsconfigRootDir: __dirname, }, - extends: ['plugin:@typescript-eslint/recommended', 'plugin:react/recommended', 'plugin:prettier/recommended'], - plugins: ['prettier', '@typescript-eslint', "react"], + plugins: ['prettier', '@typescript-eslint', 'react', 'boundaries', 'react-refresh'], + extends: [ + 'plugin:@typescript-eslint/recommended', + 'plugin:react/recommended', + 'plugin:prettier/recommended', + 'plugin:boundaries/strict', + ], env: { browser: true, es6: true, }, settings: { + 'import/resolver': { + typescript: { + alwaysTryTypes: true, + }, + }, react: { version: 'detect', }, + 'boundaries/include': ['src/*/**'], + 'boundaries/elements': [ + { type: 'consts', pattern: 'src/shared/consts/**' }, + { type: 'lib', pattern: 'src/shared/lib/**' }, + { type: 'api', pattern: 'src/shared/api/**' }, + { type: 'session', pattern: 'src/shared/session/**' }, + { type: 'routing', pattern: 'src/shared/routing/**' }, + { type: 'ui', pattern: 'src/shared/ui/**' }, + { type: 'tutorial', pattern: 'src/shared/tutorial/**' }, + { type: 'shared', pattern: 'src/shared/**' }, + { type: 'entities', pattern: 'src/entities/**' }, + { type: 'features', pattern: 'src/features/**' }, + { type: 'widgets', pattern: 'src/widgets/**' }, + { type: 'pages', pattern: 'src/pages/**' }, + { type: 'app', pattern: 'src/app/**' }, + ], }, rules: { - "react/react-in-jsx-scope": "off", + 'react-refresh/only-export-components': 'warn', + 'react/react-in-jsx-scope': 'off', 'linebreak-style': 'off', 'prettier/prettier': [ 'off', @@ -29,12 +56,84 @@ module.exports = { }, ], 'no-console': 'warn', + '@typescript-eslint/no-unused-vars': 'warn', '@typescript-eslint/no-empty-function': 'off', 'no-eval': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/no-explicit-any': 'off', 'react/jsx-key': 1, - "react/react-in-jsx-scope": 2, + 'react/react-in-jsx-scope': 2, + 'boundaries/element-types': [ + 'error', + { + default: 'disallow', + rules: [ + { + from: 'app', + allow: [ + 'pages', + 'widgets', + 'features', + 'entities', + 'shared', + 'ui', + 'tutorial', + 'routing', + 'session', + 'api', + 'lib', + 'consts', + ], + }, + { + from: 'pages', + allow: [ + 'widgets', + 'features', + 'entities', + 'shared', + 'ui', + 'tutorial', + 'routing', + 'session', + 'api', + 'lib', + 'consts', + ], + }, + { + from: 'widgets', + allow: [ + 'features', + 'entities', + 'shared', + 'ui', + 'tutorial', + 'routing', + 'session', + 'api', + 'lib', + 'consts', + ], + }, + { + from: 'features', + allow: ['entities', 'shared', 'ui', 'tutorial', 'routing', 'session', 'api', 'lib', 'consts'], + }, + { + from: 'entities', + allow: ['shared', 'ui', 'tutorial', 'routing', 'session', 'api', 'lib', 'consts'], + }, + { from: 'shared', allow: ['ui', 'tutorial', 'routing', 'session', 'api', 'lib', 'consts'] }, + { from: 'tutorial', allow: ['ui', 'routing', 'session', 'api', 'lib', 'consts'] }, + { from: 'ui', allow: ['routing', 'session', 'api', 'lib', 'consts'] }, + { from: 'routing', allow: ['session', 'api', 'lib', 'consts'] }, + { from: 'session', allow: ['api', 'lib', 'consts'] }, + { from: 'api', allow: ['lib', 'consts'] }, + { from: 'lib', allow: ['consts'] }, + ], + }, + ], }, -} \ No newline at end of file +} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 98f768666..57010ebec 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -97,7 +97,6 @@ jobs: cd client-app/LK echo ${{ secrets.TEST_SERVER_PASSWORD }} | sudo -S docker compose -p web pull echo ${{ secrets.TEST_SERVER_PASSWORD }} | sudo -S docker compose -p web up -d - - name: Kill VPN connection if: always() run: | diff --git a/.prettierignore b/.prettierignore index bf6a52f61..d61574f5f 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,3 @@ -*.js +# *.js locale docker-compose.yml \ No newline at end of file diff --git a/.prettierrc.js b/.prettierrc.js index 5a2633bf9..ce34b0883 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,27 +1,27 @@ module.exports = { - singleQuote: true, - trailingComma: 'all', - printWidth: 120, - tabWidth: 4, - semi: false, - plugins: ['@trivago/prettier-plugin-sort-imports'], - importOrderGroupNamespaceSpecifiers: true, - importOrderParserPlugins: ['typescript', 'jsx'], - importOrderSortSpecifiers: true, - importOrderSeparation: true, - importOrder: [ - '^react', - '', - '^@(.*).css$', - '^@app(.*)$', - '^@pages(.*)$', - '^@layouts(.*)$', - '^@widgets(.*)$', - '^@features(.*)$', - '^@entities(.*)$', - '^@shared(.*)$', - '^@ui(.*)$', - '^@utils(.*)$', - '^[./]', - ], + singleQuote: true, + trailingComma: 'all', + printWidth: 120, + tabWidth: 4, + semi: false, + plugins: ['@trivago/prettier-plugin-sort-imports'], + importOrderGroupNamespaceSpecifiers: true, + importOrderParserPlugins: ['typescript', 'jsx'], + importOrderSortSpecifiers: true, + importOrderSeparation: true, + importOrder: [ + '^react', + '', + '^@(.*).css$', + '^@app(.*)$', + '^@pages(.*)$', + '^@layouts(.*)$', + '^@widgets(.*)$', + '^@features(.*)$', + '^@entities(.*)$', + '^@shared(.*)$', + '^@ui(.*)$', + '^@utils(.*)$', + '^[./]', + ], } diff --git a/package-lock.json b/package-lock.json index f52011e2b..86d22978c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54,15 +54,18 @@ "@vitejs/plugin-react": "^4.3.0", "core-js": "^3.39.0", "dependency-cruiser": "^16.2.4", - "eslint": "^8.40.0", + "eslint": "^8.57.1", "eslint-config-prettier": "^10.0.1", + "eslint-import-resolver-typescript": "^3.7.0", + "eslint-plugin-boundaries": "^5.0.1", "eslint-plugin-prettier": "^5.2.3", "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-refresh": "^0.4.18", "knip": "^3.0.2", "prettier": "^3.4.2", "tiny-invariant": "^1.3.1", - "typescript": "^5.0.4", + "typescript": "^5.7.3", "vite": "^4.3.6", "vite-plugin-checker": "^0.6.0", "vite-plugin-svgr": "^3.2.0", @@ -2233,23 +2236,25 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.1.tgz", - "integrity": "sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ==", + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", "dev": true, + "license": "MIT", "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, "node_modules/@eslint/eslintrc": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.3.tgz", - "integrity": "sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, + "license": "MIT", "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.5.2", + "espree": "^9.6.0", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -2265,10 +2270,11 @@ } }, "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, + "license": "MIT", "dependencies": { "type-fest": "^0.20.2" }, @@ -2284,6 +2290,7 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, + "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" }, @@ -2292,10 +2299,11 @@ } }, "node_modules/@eslint/js": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.42.0.tgz", - "integrity": "sha512-6SWlXpWU5AvId8Ac7zjzmIOqMOba/JWY8XZ4A7q7Gn1Vlfg/SFFIlrtHXt9nPn4op9ZPAkl91Jao+QQv3r/ukw==", + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", "dev": true, + "license": "MIT", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } @@ -2309,13 +2317,15 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", - "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", + "deprecated": "Use @eslint/config-array instead", "dev": true, + "license": "Apache-2.0", "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", + "@humanwhocodes/object-schema": "^2.0.3", + "debug": "^4.3.1", "minimatch": "^3.0.5" }, "engines": { @@ -2336,10 +2346,12 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", - "dev": true + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", + "dev": true, + "license": "BSD-3-Clause" }, "node_modules/@isaacs/cliui": { "version": "8.0.2", @@ -2488,6 +2500,16 @@ "node": ">= 8" } }, + "node_modules/@nolyfill/is-core-module": { + "version": "1.0.39", + "resolved": "https://registry.npmjs.org/@nolyfill/is-core-module/-/is-core-module-1.0.39.tgz", + "integrity": "sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.4.0" + } + }, "node_modules/@npmcli/map-workspaces": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/@npmcli/map-workspaces/-/map-workspaces-3.0.4.tgz", @@ -3565,10 +3587,11 @@ } }, "node_modules/@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", - "dev": true + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" }, "node_modules/@types/node": { "version": "20.11.17", @@ -3655,10 +3678,11 @@ "license": "MIT" }, "node_modules/@types/semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==", - "dev": true + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", + "dev": true, + "license": "MIT" }, "node_modules/@types/styled-components": { "version": "5.1.20", @@ -3676,6 +3700,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.6.tgz", "integrity": "sha512-sXtOgJNEuRU5RLwPUb1jxtToZbgvq3M6FPpY4QENxoOggK+UpTxUBpj6tD8+Qh2g46Pi9We87E+eHnUw8YcGsw==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.4.0", "@typescript-eslint/scope-manager": "5.59.6", @@ -3710,6 +3735,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.6.tgz", "integrity": "sha512-7pCa6al03Pv1yf/dUg/s1pXz/yGMUBAw5EeWqNTFiSueKvRNonze3hma3lhdsOrQcaOXhbk5gKu2Fludiho9VA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "@typescript-eslint/scope-manager": "5.59.6", "@typescript-eslint/types": "5.59.6", @@ -3737,6 +3763,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.6.tgz", "integrity": "sha512-gLbY3Le9Dxcb8KdpF0+SJr6EQ+hFGYFl6tVY8VxLPFDfUZC7BHFw+Vq7bM5lE9DwWPfx4vMWWTLGXgpc0mAYyQ==", "dev": true, + "license": "MIT", "dependencies": { "@typescript-eslint/types": "5.59.6", "@typescript-eslint/visitor-keys": "5.59.6" @@ -3754,6 +3781,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.6.tgz", "integrity": "sha512-A4tms2Mp5yNvLDlySF+kAThV9VTBPCvGf0Rp8nl/eoDX9Okun8byTKoj3fJ52IJitjWOk0fKPNQhXEB++eNozQ==", "dev": true, + "license": "MIT", "dependencies": { "@typescript-eslint/typescript-estree": "5.59.6", "@typescript-eslint/utils": "5.59.6", @@ -3781,6 +3809,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.6.tgz", "integrity": "sha512-tH5lBXZI7T2MOUgOWFdVNUILsI02shyQvfzG9EJkoONWugCG77NDDa1EeDGw7oJ5IvsTAAGVV8I3Tk2PNu9QfA==", "dev": true, + "license": "MIT", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, @@ -3794,6 +3823,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.6.tgz", "integrity": "sha512-vW6JP3lMAs/Tq4KjdI/RiHaaJSO7IUsbkz17it/Rl9Q+WkQ77EOuOnlbaU8kKfVIOJxMhnRiBG+olE7f3M16DA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "@typescript-eslint/types": "5.59.6", "@typescript-eslint/visitor-keys": "5.59.6", @@ -3821,6 +3851,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.6.tgz", "integrity": "sha512-vzaaD6EXbTS29cVH0JjXBdzMt6VBlv+hE31XktDRMX1j3462wZCJa7VzO2AxXEXcIl8GQqZPcOPuW/Z1tZVogg==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@types/json-schema": "^7.0.9", @@ -3847,6 +3878,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.6.tgz", "integrity": "sha512-zEfbFLzB9ETcEJ4HZEEsCR9HHeNku5/Qw1jSS5McYJv5BR+ftYXwFFAH5Al+xkGaZEqowMwl7uoJjQb1YSPF8Q==", "dev": true, + "license": "MIT", "dependencies": { "@typescript-eslint/types": "5.59.6", "eslint-visitor-keys": "^3.3.0" @@ -3859,6 +3891,13 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "dev": true, + "license": "ISC" + }, "node_modules/@vitejs/plugin-legacy": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/@vitejs/plugin-legacy/-/plugin-legacy-4.0.3.tgz", @@ -3995,6 +4034,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -4030,6 +4070,22 @@ "node": ">=8" } }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/anymatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", @@ -4112,6 +4168,7 @@ "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -4290,12 +4347,13 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, + "license": "MIT", "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -4411,6 +4469,46 @@ ], "license": "CC-BY-4.0" }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -4483,6 +4581,26 @@ "node": ">=6" } }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -4647,11 +4765,12 @@ "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==" }, "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "license": "MIT", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -4916,6 +5035,7 @@ "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, + "license": "MIT", "dependencies": { "path-type": "^4.0.0" }, @@ -5254,27 +5374,30 @@ } }, "node_modules/eslint": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.42.0.tgz", - "integrity": "sha512-ulg9Ms6E1WPf67PHaEY4/6E2tEn5/f7FXGzr3t9cBMugOmf1INYvuUwwh1aXQN4MfJ6a5K2iNwP3w4AColvI9A==", + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", + "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.4.0", - "@eslint/eslintrc": "^2.0.3", - "@eslint/js": "8.42.0", - "@humanwhocodes/config-array": "^0.11.10", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", - "ajv": "^6.10.0", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.0", - "eslint-visitor-keys": "^3.4.1", - "espree": "^9.5.2", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -5284,7 +5407,6 @@ "globals": "^13.19.0", "graphemer": "^1.4.0", "ignore": "^5.2.0", - "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", @@ -5294,9 +5416,8 @@ "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", + "optionator": "^0.9.3", "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" }, "bin": { @@ -5322,6 +5443,125 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-import-resolver-typescript": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.7.0.tgz", + "integrity": "sha512-Vrwyi8HHxY97K5ebydMtffsWAn1SCR9eol49eCd5fJS4O1WV7PaAjbcjmbfJJSMz/t4Mal212Uz/fQZrOB8mow==", + "dev": true, + "license": "ISC", + "dependencies": { + "@nolyfill/is-core-module": "1.0.39", + "debug": "^4.3.7", + "enhanced-resolve": "^5.15.0", + "fast-glob": "^3.3.2", + "get-tsconfig": "^4.7.5", + "is-bun-module": "^1.0.2", + "is-glob": "^4.0.3", + "stable-hash": "^0.0.4" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts/projects/eslint-import-resolver-ts" + }, + "peerDependencies": { + "eslint": "*", + "eslint-plugin-import": "*", + "eslint-plugin-import-x": "*" + }, + "peerDependenciesMeta": { + "eslint-plugin-import": { + "optional": true + }, + "eslint-plugin-import-x": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.0.tgz", + "integrity": "sha512-wALZ0HFoytlyh/1+4wuZ9FJCD/leWHQzzrxJ8+rebyReSLk7LApMyd3WJaLVoN+D5+WIdJyDK1c6JnE65V4Zyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^3.2.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-boundaries": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-boundaries/-/eslint-plugin-boundaries-5.0.1.tgz", + "integrity": "sha512-QBw1TgoA3JnD+AQ8EHqZL8LtiFVREnFmD2BnHzVl38UKtRTds8rawIg03ZLwFs/90yKSh+DVVXRpvVK631Z/0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "4.1.2", + "eslint-import-resolver-node": "0.3.9", + "eslint-module-utils": "2.12.0", + "micromatch": "4.0.8" + }, + "engines": { + "node": ">=18.18" + }, + "peerDependencies": { + "eslint": ">=6.0.0" + } + }, + "node_modules/eslint-plugin-boundaries/node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/eslint-plugin-prettier": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.3.tgz", @@ -5394,6 +5634,16 @@ "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" } }, + "node_modules/eslint-plugin-react-refresh": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.18.tgz", + "integrity": "sha512-IRGEoFn3OKalm3hjfolEWGqoF/jPqeEYFp+C8B0WMzwGwBMvlRDQd06kghDhF0C61uJ6WfSDhEZE/sAQjduKgw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "eslint": ">=8.40" + } + }, "node_modules/eslint-plugin-react/node_modules/doctrine": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", @@ -5437,6 +5687,7 @@ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^4.1.1" @@ -5450,15 +5701,17 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } }, "node_modules/eslint-visitor-keys": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz", - "integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, + "license": "Apache-2.0", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, @@ -5466,55 +5719,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/eslint/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/eslint/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/eslint/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/eslint/node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -5528,10 +5732,11 @@ } }, "node_modules/eslint/node_modules/eslint-scope": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", - "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" @@ -5558,27 +5763,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/eslint/node_modules/type-fest": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", @@ -5592,12 +5776,13 @@ } }, "node_modules/espree": { - "version": "9.5.2", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.5.2.tgz", - "integrity": "sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw==", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "acorn": "^8.8.0", + "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^3.4.1" }, @@ -5699,7 +5884,8 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fast-levenshtein": { "version": "2.0.6", @@ -5764,10 +5950,11 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, + "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -5917,10 +6104,14 @@ } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/function.prototype.name": { "version": "1.1.5", @@ -6000,6 +6191,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-tsconfig": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.0.tgz", + "integrity": "sha512-kGzZ3LWWQcGIAmg6iWvXn0ei6WDtV26wzHRMwDSzmAbcXrTEXxHy6IehI6/4eT6VRKyMP1eF1VqwrVUmE/LR7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -6075,6 +6279,7 @@ "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, + "license": "MIT", "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", @@ -6118,7 +6323,8 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/graphemer": { "version": "1.4.0", @@ -6212,6 +6418,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/history": { "version": "4.10.1", "resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz", @@ -6449,6 +6668,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-bun-module": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-bun-module/-/is-bun-module-1.3.0.tgz", + "integrity": "sha512-DgXeu5UWI0IsMQundYb5UAOzm6G2eVnarJ0byP6Tm55iZNKceD59LNPA2L4VvsScTtHcw0yEkVwSf7PC+QoLSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.6.3" + } + }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -6462,12 +6691,16 @@ } }, "node_modules/is-core-module": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", - "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", "dev": true, + "license": "MIT", "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -6572,6 +6805,7 @@ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.12.0" } @@ -6802,7 +7036,8 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -7269,9 +7504,10 @@ } }, "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" }, "node_modules/nanoid": { "version": "3.3.6", @@ -7300,7 +7536,8 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/ndjson": { "version": "2.0.0", @@ -7504,17 +7741,18 @@ } }, "node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, + "license": "MIT", "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "word-wrap": "^1.2.5" }, "engines": { "node": ">= 0.8.0" @@ -8513,18 +8751,22 @@ } }, "node_modules/resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", "dev": true, + "license": "MIT", "dependencies": { - "is-core-module": "^2.11.0", + "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -8543,6 +8785,16 @@ "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz", "integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==" }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -8696,13 +8948,11 @@ } }, "node_modules/semver": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", - "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -8722,24 +8972,6 @@ "node": "^14||^16||>=18" } }, - "node_modules/semver/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/semver/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, "node_modules/shallowequal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz", @@ -8809,6 +9041,7 @@ "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -8863,6 +9096,13 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/stable-hash": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.4.tgz", + "integrity": "sha512-LjdcbuBeLcdETCrPn9i8AYAZ1eCtu4ECAWtP7UleOiZ9LzVxRzzUZEoZ8zB24nhkQnDWyET0I+3sWokSDS3E7g==", + "dev": true, + "license": "MIT" + }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -9046,6 +9286,7 @@ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" }, @@ -9234,6 +9475,7 @@ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, + "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, @@ -9298,76 +9540,6 @@ "node": ">=10.13.0" } }, - "node_modules/tsconfig-paths-webpack-plugin/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/tsconfig-paths-webpack-plugin/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/tsconfig-paths-webpack-plugin/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/tsconfig-paths-webpack-plugin/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/tsconfig-paths-webpack-plugin/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/tsconfig-paths-webpack-plugin/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/tsconfig-paths/node_modules/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", @@ -9381,13 +9553,15 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/tsutils": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", "dev": true, + "license": "MIT", "dependencies": { "tslib": "^1.8.1" }, @@ -9437,10 +9611,11 @@ } }, "node_modules/typescript": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", - "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -9757,55 +9932,6 @@ } } }, - "node_modules/vite-plugin-checker/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/vite-plugin-checker/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/vite-plugin-checker/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/vite-plugin-checker/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/vite-plugin-checker/node_modules/commander": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", @@ -9815,27 +9941,6 @@ "node": ">= 12" } }, - "node_modules/vite-plugin-checker/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/vite-plugin-checker/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/vite-plugin-svgr": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/vite-plugin-svgr/-/vite-plugin-svgr-3.2.0.tgz", @@ -10018,10 +10123,11 @@ } }, "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -10061,39 +10167,6 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", diff --git a/package.json b/package.json index 74e4928bb..e3044c4ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lk", - "version": "3.16.5", + "version": "4.0.0", "description": "", "main": "index.js", "keywords": [], @@ -14,7 +14,8 @@ "reinstall": "rm -rf node_modules && rm -rf package-lock.json && npm cache clean -f && npm i", "reinstall-win": "npm rm -rf node_modules && npm rm -rf package-lock.json && npm cache clean -f && npm i", "knip": "knip", - "start:external": "npm run start -- --host" + "start:external": "npm run start -- --host", + "lint": "eslint src --ext .js,.jsx,.ts,.tsx" }, "dependencies": { "@farfetched/core": "^0.12.4", @@ -62,15 +63,18 @@ "@vitejs/plugin-react": "^4.3.0", "core-js": "^3.39.0", "dependency-cruiser": "^16.2.4", - "eslint": "^8.40.0", + "eslint": "^8.57.1", "eslint-config-prettier": "^10.0.1", + "eslint-import-resolver-typescript": "^3.7.0", + "eslint-plugin-boundaries": "^5.0.1", "eslint-plugin-prettier": "^5.2.3", "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-refresh": "^0.4.18", "knip": "^3.0.2", "prettier": "^3.4.2", "tiny-invariant": "^1.3.1", - "typescript": "^5.0.4", + "typescript": "^5.7.3", "vite": "^4.3.6", "vite-plugin-checker": "^0.6.0", "vite-plugin-svgr": "^3.2.0", diff --git a/public/service-worker.js b/public/service-worker.js deleted file mode 100644 index 89fd2100f..000000000 --- a/public/service-worker.js +++ /dev/null @@ -1,65 +0,0 @@ -// Set this to true for production -let doCache = false; - -// Name our cache -let CACHE_NAME = 'my-pwa-cache-v3'; - -// Delete old caches that are not our current one! -// eslint-disable-next-line no-restricted-globals -self.addEventListener("activate", event => { - const cacheWhitelist = [CACHE_NAME]; - event.waitUntil( - caches.keys() - .then(keyList => - Promise.all(keyList.map(key => { - if (!cacheWhitelist.includes(key)) { - console.log('Deleting cache: ' + key) - return caches.delete(key); - } - })) - ) - ); -}); - -self.addEventListener('controllerchange', () => window.location.reload()); - -// The first time the user starts up the PWA, 'install' is triggered. -// eslint-disable-next-line no-restricted-globals -self.addEventListener('install', function(event) { - if (doCache) { - event.waitUntil( - caches.open(CACHE_NAME) - .then(function(cache) { - // Get the assets manifest so we can see what our js file is named - // This is because webpack hashes it - fetch("asset-manifest.json") - .then(response => { - response.json() - }) - .then(assets => { - // Open a cache and cache our files - // We want to cache the page and the main.js generated by webpack - // We could also cache any static assets like CSS or images - const urlsToCache = [ - assets["main.js"] - ] - cache.addAll(urlsToCache) - console.log('cached'); - }) - }) - ); - } -}); - -// When the webpage goes to fetch files, we intercept that request and serve up the matching files -// if we have them -// eslint-disable-next-line no-restricted-globals -self.addEventListener('fetch', function(event) { - if (doCache) { - event.respondWith( - caches.match(event.request).then(function(response) { - return fetch(event.request); - }) - ); - } -}); diff --git a/service-worker.js b/service-worker.js deleted file mode 100644 index 8a4f75dc1..000000000 --- a/service-worker.js +++ /dev/null @@ -1,66 +0,0 @@ -// Set this to true for production -let doCache = false; - -// Name our cache -let CACHE_NAME = 'my-pwa-cache-v1'; - -// Delete old caches that are not our current one! -// eslint-disable-next-line no-restricted-globals -self.addEventListener("activate", event => { - const cacheWhitelist = [CACHE_NAME]; - event.waitUntil( - caches.keys() - .then(keyList => - Promise.all(keyList.map(key => { - if (!cacheWhitelist.includes(key)) { - console.log('Deleting cache: ' + key) - return caches.delete(key); - } - })) - ) - ); -}); - -self.addEventListener('controllerchange', () => window.location.reload()); - -// The first time the user starts up the PWA, 'install' is triggered. -// eslint-disable-next-line no-restricted-globals -self.addEventListener('install', function (event) { - if (doCache) { - event.waitUntil( - caches.open(CACHE_NAME) - .then(function (cache) { - // Get the assets manifest so we can see what our js file is named - // This is because webpack hashes it - fetch("asset-manifest.json") - .then(response => { - response.json() - }) - .then(assets => { - // Open a cache and cache our files - // We want to cache the page and the main.js generated by webpack - // We could also cache any static assets like CSS or images - const urlsToCache = [ - "/", - assets["main.js"] - ] - cache.addAll(urlsToCache) - console.log('cached'); - }) - }) - ); - } -}); - -// When the webpage goes to fetch files, we intercept that request and serve up the matching files -// if we have them -// eslint-disable-next-line no-restricted-globals -self.addEventListener('fetch', function (event) { - if (doCache) { - event.respondWith( - caches.match(event.request).then(function (response) { - return response || fetch(event.request); - }) - ); - } -}); diff --git a/src/app/index.tsx b/src/app/index.tsx index 715ae8232..eb8f9f4c7 100644 --- a/src/app/index.tsx +++ b/src/app/index.tsx @@ -2,12 +2,11 @@ import React, { useEffect } from 'react' import { HashRouter } from 'react-router-dom' import 'react-virtualized/styles.css' -import { ModalProvider } from 'widgets/modal/lib' - -import { appStarted } from '@shared/models/app-started' +import { appStarted } from '@shared/consts/models/app-started' import ErrorBoundary from '@shared/ui/error-boundary' +import { ModalProvider } from '@shared/ui/modal' -import Router from './routers/router' +import Router from './routing/router' const App = () => { useEffect(() => { diff --git a/src/app/routers/private-router.tsx b/src/app/routers/private-router.tsx deleted file mode 100644 index f5e028e91..000000000 --- a/src/app/routers/private-router.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import React from 'react' -import { Redirect, Route, Switch } from 'react-router' - -import { HOME_ROUTE } from '@app/routes/general-routes' - -import { menuModel } from '@entities/menu' - -const PrivateRouter = () => { - const { allRoutes } = menuModel.selectors.useMenu() - - if (!allRoutes) return null - - return ( - - {Object.values(allRoutes).map(({ path, Component, isTemplate }) => { - return - })} - - - ) -} - -export default React.memo(PrivateRouter) diff --git a/src/app/routers/router.tsx b/src/app/routers/router.tsx deleted file mode 100644 index bf2bdf38f..000000000 --- a/src/app/routers/router.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import React, { Suspense, useEffect } from 'react' -import { Redirect, Route, Switch } from 'react-router-dom' - -import ContentLayout from 'widgets/content-layout' -import { useSetTutorial } from 'widgets/tutorial/lib/use-set-tutorial' - -import { LOGIN_ROUTE, publicRoutes } from '@app/routes/general-routes' - -import { loadDivisions } from '@pages/hr-applications/model/divisions' - -import { adminLinksModel } from '@entities/admin-links' -import { allowancesModel } from '@entities/allowances' -import { applicationsModel } from '@entities/applications' -import { peTeacherModel } from '@entities/pe-teacher' -import { phonebookModel } from '@entities/phonebook' -import { initializeTutorials } from '@entities/tutorial/lib/initialize' - -import { useScrollToTop } from '@shared/lib/hooks/use-scroll-to-top' - -import { userModel } from '../../entities/user' - -const Router = () => { - const { - data: { isAuthenticated, user }, - } = userModel.selectors.useUser() - - // scroll window to top when change route - useScrollToTop(window) - - useEffect(() => { - if (window.location.href === 'https://e.mospolytech.ru/?p=children#/home') { - window.location.replace('https://e.mospolytech.ru/old/index.php?p=children') - } - }, [window.location.href]) - - // TODO: sample with $userStore clock - useEffect(() => { - if (isAuthenticated) { - applicationsModel.effects.getUserDataApplicationsFx() - // chatsModel.events.load() - if (user?.guid) { - initializeTutorials() - } - if (user?.user_status === 'staff') { - adminLinksModel.effects.getFx() - applicationsModel.effects.getWorkerPosts() - phonebookModel.events.getSubdivisions() - allowancesModel.events.appStarted() - loadDivisions() - } - peTeacherModel.events.load() - } - }, [isAuthenticated, user]) - useSetTutorial() - - return isAuthenticated ? ( - - ) : ( - - - {publicRoutes.map(({ path, Component }, i) => { - return - })} - - - - ) -} - -export default Router diff --git a/src/widgets/content-layout/hooks/use-content-layout.tsx b/src/app/routing/content-layout/hooks/use-content-layout.tsx similarity index 70% rename from src/widgets/content-layout/hooks/use-content-layout.tsx rename to src/app/routing/content-layout/hooks/use-content-layout.tsx index 64261a134..8b5616f08 100644 --- a/src/widgets/content-layout/hooks/use-content-layout.tsx +++ b/src/app/routing/content-layout/hooks/use-content-layout.tsx @@ -1,12 +1,13 @@ import React, { useEffect } from 'react' -import { WhatsNew } from 'widgets' -import useModal from 'widgets/modal' +import useIsShowWhatsNew from '@app/routing/content-layout/hooks/use-is-whats-new' + +import WhatsNew from '@widgets/whats-new' import useLkNotifications from '@entities/lk-notifications/hooks/use-lk-notifications' -import useCurrentExactPage from '@shared/lib/hooks/use-current-exact-page' -import useIsShowWhatsNew from '@shared/lib/hooks/use-is-whats-new' +import useCurrentExactPage from '@shared/routing/hooks/use-current-exact-page' +import { useModal } from '@shared/ui/modal' const useContentLayout = () => { const currentPage = useCurrentExactPage() diff --git a/src/shared/lib/hooks/use-is-whats-new.ts b/src/app/routing/content-layout/hooks/use-is-whats-new.ts similarity index 88% rename from src/shared/lib/hooks/use-is-whats-new.ts rename to src/app/routing/content-layout/hooks/use-is-whats-new.ts index a14cda644..8f3eb872e 100644 --- a/src/shared/lib/hooks/use-is-whats-new.ts +++ b/src/app/routing/content-layout/hooks/use-is-whats-new.ts @@ -2,10 +2,9 @@ import { useEffect, useState } from 'react' import { useUnit } from 'effector-react' -import { tutorialModel } from '@entities/tutorial' -import { userModel } from '@entities/user' - -import { LastUpdateWhatsNew } from '@shared/constants' +import { LastUpdateWhatsNew } from '@shared/consts' +import { userModel } from '@shared/session' +import { tutorialModel } from '@shared/tutorial' const useIsShowWhatsNew = () => { const { diff --git a/src/widgets/content-layout/index.tsx b/src/app/routing/content-layout/index.tsx similarity index 73% rename from src/widgets/content-layout/index.tsx rename to src/app/routing/content-layout/index.tsx index 72b529573..bde144dc6 100644 --- a/src/widgets/content-layout/index.tsx +++ b/src/app/routing/content-layout/index.tsx @@ -1,23 +1,27 @@ import React, { Suspense, useRef, useState } from 'react' -import { Confirm, HintModal, MobileBottomMenu, PopUpMessage } from 'widgets' -import ContextMenu from 'widgets/context-menu' -import Header from 'widgets/header' -import { Modal } from 'widgets/modal' -import PopUpNotifications from 'widgets/pop-up-notifications' -import { TutorialHero } from 'widgets/tutorial' -import { LeftSideBarTutorial } from 'widgets/tutorial/tutorials/left-sidebar-tutorial' +import { useScrollToTop } from '@app/routing/hooks/use-scroll-to-top' +import PrivateRouter from '@app/routing/private-router' -import PrivateRouter from '@app/routers/private-router' +import ConfirmMessage from '@widgets/confirm' +import Header from '@widgets/header' +import HintModal from '@widgets/hint-modal' +import { LeftSideBarTutorial } from '@widgets/navbar/leftside-bar' +import MobileBottomMenu from '@widgets/navbar/mobile-bottom-menu' +import PopUpMessage from '@widgets/pop-up-message' +import PopUpNotifications from '@widgets/pop-up-notifications' + +import ContextMenu from '@features/context-menu' import { menuModel } from '@entities/menu' -import { userModel } from '@entities/user' -import { useScrollToTop } from '@shared/lib/hooks/use-scroll-to-top' +import { userModel } from '@shared/session' +import { TutorialHero } from '@shared/tutorial/ui/tutorial-hero' import ErrorBoundary from '@shared/ui/error-boundary' +import { Modal } from '@shared/ui/modal' -import InitialLoader from '../../shared/ui/initial-loader' -import Story from '../../shared/ui/story' +import InitialLoader from '../../../shared/ui/initial-loader' +import Story from '../../../widgets/story' import useContentLayout from './hooks/use-content-layout' import { ContentWrapper, PageContent } from './styled' @@ -75,7 +79,7 @@ const ContentLayout = () => { - + diff --git a/src/widgets/content-layout/styled.ts b/src/app/routing/content-layout/styled.ts similarity index 100% rename from src/widgets/content-layout/styled.ts rename to src/app/routing/content-layout/styled.ts diff --git a/src/app/routing/hooks/use-redirect.ts b/src/app/routing/hooks/use-redirect.ts new file mode 100644 index 000000000..2dd9b2ffc --- /dev/null +++ b/src/app/routing/hooks/use-redirect.ts @@ -0,0 +1,9 @@ +import { useEffect } from 'react' + +export const useRedirect = () => { + useEffect(() => { + if (window.location.href === 'https://e.mospolytech.ru/?p=children#/home') { + window.location.replace('https://e.mospolytech.ru/old/index.php?p=children') + } + }, [window.location.href]) +} diff --git a/src/shared/lib/hooks/use-scroll-to-top.tsx b/src/app/routing/hooks/use-scroll-to-top.tsx similarity index 100% rename from src/shared/lib/hooks/use-scroll-to-top.tsx rename to src/app/routing/hooks/use-scroll-to-top.tsx diff --git a/src/app/routing/private-router.tsx b/src/app/routing/private-router.tsx new file mode 100644 index 000000000..cd4fedd72 --- /dev/null +++ b/src/app/routing/private-router.tsx @@ -0,0 +1,27 @@ +import React from 'react' +import { Redirect, Route, Switch } from 'react-router' + +import { useUnit } from 'effector-react' + +import { menuModel } from '@entities/menu' + +import { HOME_ROUTE } from '@shared/routing' + +import { $allPages } from './routes/pages' + +const PrivateRouter = () => { + const allPages = useUnit($allPages) + const { allRoutes: availableRoutes } = menuModel.selectors.useMenu() + if (!availableRoutes || !allPages) return null + + return ( + + {Object.values(availableRoutes).map(({ path, isTemplate, id }) => { + return + })} + + + ) +} + +export default React.memo(PrivateRouter) diff --git a/src/app/routing/router.tsx b/src/app/routing/router.tsx new file mode 100644 index 000000000..186569be4 --- /dev/null +++ b/src/app/routing/router.tsx @@ -0,0 +1,38 @@ +import React, { Suspense } from 'react' +import { Redirect, Route, Switch } from 'react-router-dom' + +import { useUnit } from 'effector-react' + +import ContentLayout from '@app/routing/content-layout' +import { useScrollToTop } from '@app/routing/hooks/use-scroll-to-top' + +import { LOGIN_ROUTE } from '@shared/routing' +import { publicRoutes } from '@shared/routing/routes/public' +import { userModel } from '@shared/session' +import { useSetTutorial } from '@shared/tutorial/lib/use-set-tutorial' + +import { useRedirect } from './hooks/use-redirect' +import { publicPages } from './routes/public' + +const Router = () => { + useScrollToTop(window) // scroll window to top when change route + useRedirect() // redirect on broken links + useSetTutorial() + + const isAuthenticated = useUnit(userModel.stores.isAuthenticated) + + return isAuthenticated ? ( + + ) : ( + + + {publicRoutes.map(({ path, id }, i) => { + return + })} + + + + ) +} + +export default Router diff --git a/src/app/routing/routes/employee.tsx b/src/app/routing/routes/employee.tsx new file mode 100644 index 000000000..e41e1fe4a --- /dev/null +++ b/src/app/routing/routes/employee.tsx @@ -0,0 +1,258 @@ +import React from 'react' +import { Redirect } from 'react-router-dom' + +import AllStaff from '@pages/all-staff' +import AllTeachersPage from '@pages/all-teachers' +import DownloadAdminFilesPage from '@pages/download-admin-files' +import PageIsNotReady from '@pages/page-is-not-ready' +import PaymentsPage from '@pages/payments' + +import { OLD_LK_URL, isProduction } from '@shared/consts' +import { + CENTERS_ROUTE, + DOCUMENT_BLANKS_ROUTE, + KPI_ADMIN_ROUTE, + KPI_PPS_ROUTE, + ONBOARDING, + OOP_ROUTE, + ORDERS_ROUTE, + PPS_VOTE_ROUTE, + SC_NEWS_ROUTE, +} from '@shared/routing' + +import { + AllowanceInfo, + Allowances, + Article, + ArticleList, + CertificateFromPlaceOfWorkPage, + CertificateOfWorkExperiencePage, + CertificateTimeParentalLeavePage, + CertificationAndIssuanceOfDocs, + CertifiedCopiesOfMilitaryDocs, + Children, + ConnectingComputerPage, + ContactDetails, + ContactDetailsForm, + ContactInfoActualizationPage, + CopiesOfDocumentsFromPersonalFilePage, + CopyOfEmploymentRecordPage, + CourierPage, + CreateAllowance, + DataVerificationPage, + DefermentFromConscription, + EditPhonebookEmail, + EditPhonebookInnerPhone, + EditPhonebookSubdivision, + EmployeeArbitraryRequestPage, + GettingComputerEquipmentPage, + GuestPass, + GuestsAccommodationOnCampus, + GuestsPassageToCampus, + HelpfulInformation, + IncreaseAntiplagiatLimits, + IssuanceOfLicensesPage, + IssuanceOfPass, + LivingInResidentialPremises, + NumberOfUnusedVacationDaysPage, + Onboarding, + OtherItServicesPage, + PaymentForChildCarePage, + PaymentOfChildBirthAllowancePage, + PersonaIncomeTaxReferencePage, + PersonalNotificationsPage, + PhysicalEducationStudent, + PrinterMaintenancePage, + QuestionPersonalAccountPage, + QuestionSedPage, + Relocation, + Science, + TeacherPhysicalEducation, + TeachersApplicationsPage, + TerminationOfAgreement, + VacationSchedule, + VisaCertificatePage, + WorkOnTermsOfExternalConcurrencyPage, +} from './pages' +import { ApplicationRedirect } from './pages/redirect' +import { privateHiddenPages, privatePages } from './private' + +export const employeePages = { + onboarding: Onboarding, + ...privatePages, + + // свою основную задачу форма выполнила, а дальше ее скрываем. на случай, если надо будет проводить очередную сверку + 'contact-details': isProduction + ? () => PageIsNotReady({ errorText: 'Страница еще находится в разработке.', isRedirectButtonVisible: false }) + : ContactDetails, + 'contact-details-form': isProduction + ? () => PageIsNotReady({ errorText: 'Страница еще находится в разработке.', isRedirectButtonVisible: false }) + : ContactDetailsForm, + 'download-agreements': DownloadAdminFilesPage, + children: Children, + 'electronic-statements': () => { + React.useEffect(() => { + window.location.replace(`${OLD_LK_URL}/stats.php?m=items&act=st_list`) + }, []) + + return null + }, + 'project-activity': () => { + React.useEffect(() => { + window.location.replace(`${OLD_LK_URL}/?p=proj_main`) + }, []) + + return null + }, + payments: PaymentsPage, + 'pps-contest': () => { + React.useEffect(() => { + window.location.replace('https://mospolytech.ru/contest-pps/') + }, []) + + return null + }, + 'kpi-pps': () => { + React.useEffect(() => { + window.location.replace(`${OLD_LK_URL}/?p=${KPI_PPS_ROUTE?.slice(1, KPI_PPS_ROUTE.length)}`) + }, []) + + return null + }, + 'kpi-admin': () => { + React.useEffect(() => { + window.location.replace(`${OLD_LK_URL}/?p=${KPI_ADMIN_ROUTE?.slice(1, KPI_ADMIN_ROUTE.length)}`) + }, []) + + return null + }, + 'sc-news': () => PageIsNotReady({ oldVersionUrl: SC_NEWS_ROUTE }), + orders: () => PageIsNotReady({ oldVersionUrl: ORDERS_ROUTE }), + 'document-blanks': () => PageIsNotReady({ oldVersionUrl: DOCUMENT_BLANKS_ROUTE }), + doclist: PersonalNotificationsPage, + calendar: VacationSchedule, + 'physical-education': TeacherPhysicalEducation, + 'physical-education-student': PhysicalEducationStudent, + oop: () => PageIsNotReady({ oldVersionUrl: OOP_ROUTE }), + centers: () => PageIsNotReady({ oldVersionUrl: CENTERS_ROUTE }), + info: HelpfulInformation, + applications: TeachersApplicationsPage, + allowances: Allowances, + 'data-verification': DataVerificationPage, + 'all-staff': AllStaff, + 'publication-activity': Science, + 'article-list': ArticleList, + 'open-publication': () => { + React.useEffect(() => { + window.location.replace('https://e.mospolytech.ru/old/index.php?p=exp_concl') + }, []) + + return null + }, + 'export-control': () => { + React.useEffect(() => { + window.location.replace('https://e.mospolytech.ru/old/index.php?p=export_control') + }, []) + + return null + }, + // 'generate-schedule': GenerateSchedule, + kedo: () => { + React.useEffect(() => { + window.open('https://lk-staff.mospolytech.ru/applications/1SKabinet-sotrudnika') + window.history.back() + }, []) + return null + }, +} + +export const employeeHiddenPages = { + ...privateHiddenPages, + // remove after mobile version is ready + // #ASM + 'all-teachers': AllTeachersPage, + 'doclist-type': PersonalNotificationsPage, + 'allowances-role': Allowances, + 'allowance-info': AllowanceInfo, + 'create-allowances': CreateAllowance, + 'pps-vote': () => PageIsNotReady({ oldVersionUrl: PPS_VOTE_ROUTE }), + 'issuance-of-licenses-page': isProduction ? ApplicationRedirect : IssuanceOfLicensesPage, + 'getting-computer-equipment': GettingComputerEquipmentPage, + 'connecting-computer': ConnectingComputerPage, + 'printer-maintenance': PrinterMaintenancePage, + 'question-sed': QuestionSedPage, + 'question-personal-account': QuestionPersonalAccountPage, + 'other-it-services': OtherItServicesPage, + 'certificate-form-place-of-work': CertificateFromPlaceOfWorkPage, + 'visa-certificate': VisaCertificatePage, + 'certificate-of-work-experience': isProduction ? ApplicationRedirect : CertificateOfWorkExperiencePage, + 'number-of-unused-vacation-days': NumberOfUnusedVacationDaysPage, + 'increase-antiplagiat-limits': isProduction + ? () => + : IncreaseAntiplagiatLimits, + 'edit-phonebook-subdivision': EditPhonebookSubdivision, + 'edit-phonebook-inner-phone': EditPhonebookInnerPhone, + 'edit-phonebook-email': EditPhonebookEmail, + 'copy-of-employment-record': isProduction ? ApplicationRedirect : CopyOfEmploymentRecordPage, + 'copies-of-documents-from-personal-file': isProduction + ? ApplicationRedirect + : CopiesOfDocumentsFromPersonalFilePage, + 'work-on-terms-of-external-concurrency': isProduction ? ApplicationRedirect : WorkOnTermsOfExternalConcurrencyPage, + 'certificate-time-parental-leave': isProduction ? ApplicationRedirect : CertificateTimeParentalLeavePage, + 'arbitrary-request': isProduction ? ApplicationRedirect : EmployeeArbitraryRequestPage, + courier: isProduction ? ApplicationRedirect : CourierPage, + 'personal-income-tax-reference': isProduction ? ApplicationRedirect : PersonaIncomeTaxReferencePage, + 'payment-of-child-birth-allowance': isProduction ? ApplicationRedirect : PaymentOfChildBirthAllowancePage, + 'payment-for-child-care': isProduction ? ApplicationRedirect : PaymentForChildCarePage, + 'contact-info-actualization': ContactInfoActualizationPage, + 'data-verification': DataVerificationPage, + 'living-in-residential-premises': isProduction ? ApplicationRedirect : LivingInResidentialPremises, + 'guests-accommodation-on-campus': isProduction ? ApplicationRedirect : GuestsAccommodationOnCampus, + 'guests-passage-to-campus': isProduction ? ApplicationRedirect : GuestsPassageToCampus, + relocation: isProduction ? ApplicationRedirect : Relocation, + 'termination-of-agreement': isProduction ? ApplicationRedirect : TerminationOfAgreement, + 'issuance-of-pass': isProduction ? ApplicationRedirect : IssuanceOfPass, + 'guest-pass': isProduction ? ApplicationRedirect : GuestPass, + 'certification-and-issuance-of-docs': isProduction ? ApplicationRedirect : CertificationAndIssuanceOfDocs, + 'deferment-from-conscription': isProduction ? ApplicationRedirect : DefermentFromConscription, + 'certified-copies-of-military-docs': isProduction ? ApplicationRedirect : CertifiedCopiesOfMilitaryDocs, + 'social-environment': () => { + window.location.href = 'https://profkommospolytech.ru/' + + return + }, + 'psychological-help': () => { + window.location.href = + 'https://mospolytech.ru/studencheskaya-zhizn/medical-help/slujba-psihologicheskoy-pomoschi/' + + return + }, + 'health-care': () => { + window.location.href = 'https://mospolytech.ru/studencheskaya-zhizn/medical-help/medicinskaya-slujba/' + + return + }, + 'wifi-at-the-university': () => { + window.location.href = + 'https://e.mospolytech.ru/old/storage/files/Instruktsiya_dostupa_k_internetu_v_auditoriyah.pdf' + + return + }, + brandbook: () => { + window.location.href = 'https://mospolytech.ru/ob-universitete/brandbook/' + + return + }, + 'addresses-and-contacts': () => { + window.location.href = 'https://mospolytech.ru/ob-universitete/adresa-i-kontakty/' + + return + }, + 'structure-of-the-university': () => { + window.location.href = + 'https://mospolytech.ru/ob-universitete/rukovodstvo-i-struktura/strukturnye-podrazdeleniya/' + + return + }, + article: Article, +} diff --git a/src/app/routing/routes/pages/all-pages.ts b/src/app/routing/routes/pages/all-pages.ts new file mode 100644 index 000000000..130f137cc --- /dev/null +++ b/src/app/routing/routes/pages/all-pages.ts @@ -0,0 +1,23 @@ +import { createStore, sample } from 'effector' + +import { PageRoute } from '@shared/routing' +import { userModel } from '@shared/session' + +import { employeeHiddenPages, employeePages } from '../employee' +import { privateHiddenPages, privatePages } from '../private' +import { hiddenStudentPages, studentPages } from '../student' + +export const $allPages = createStore(null) + +sample({ + clock: userModel.stores.user, + source: userModel.stores.userRole, + fn: (userRoles) => ({ + ...privatePages, + ...privateHiddenPages, + ...(userRoles === 'stud' + ? { ...studentPages, ...hiddenStudentPages } + : { ...employeePages, ...employeeHiddenPages }), + }), + target: $allPages, +}) diff --git a/src/app/routes/teacher-routes/pages.ts b/src/app/routing/routes/pages/employee.ts similarity index 80% rename from src/app/routes/teacher-routes/pages.ts rename to src/app/routing/routes/pages/employee.ts index d2cbcea48..2da196810 100644 --- a/src/app/routes/teacher-routes/pages.ts +++ b/src/app/routing/routes/pages/employee.ts @@ -15,7 +15,7 @@ export const DataVerificationPage = lazy(() => import('@pages/teachers-applicati export const DownloadAdminFilesPage = lazy(() => import('@pages/download-admin-files')) export const PersonalNotificationsPage = lazy(() => import('@pages/personal-notifications')) export const TeachersApplicationsPage = lazy(() => import('@pages/teachers-applications')) -export const ArbitraryRequestPage = lazy(() => import('@pages/teachers-applications/pages/arbitrary-request')) +export const EmployeeArbitraryRequestPage = lazy(() => import('@pages/teachers-applications/pages/arbitrary-request')) export const CertificateOfWorkExperiencePage = lazy( () => import('@pages/teachers-applications/pages/certificate-of-work-experience'), ) @@ -28,7 +28,6 @@ export const CopyOfEmploymentRecordPage = lazy( ) export const CourierPage = lazy(() => import('@pages/teachers-applications/pages/courier')) export const TeacherPhysicalEducation = lazy(() => import('@pages/teacher-physical-education')) -export const PhysicalEducationStudent = lazy(() => import('@pages/pe-student')) export const GettingComputerEquipmentPage = lazy( () => import('@pages/teachers-applications/pages/getting-computer-equipment'), ) @@ -69,8 +68,8 @@ export const WorkOnTermsOfExternalConcurrencyPage = lazy( export const LivingInResidentialPremises = lazy( () => import('@pages/teachers-applications/pages/campus-office/living-in-residential-premises'), ) -export const GuestsAccomodationOnCampus = lazy( - () => import('@pages/teachers-applications/pages/campus-office/guests-accomodation-on-campus'), +export const GuestsAccommodationOnCampus = lazy( + () => import('@pages/teachers-applications/pages/campus-office/guests-accommodation-on-campus'), ) export const GuestsPassageToCampus = lazy( () => import('@pages/teachers-applications/pages/campus-office/guests-passage-to-campus'), @@ -99,22 +98,10 @@ export const CertifiedCopiesOfMilitaryDocs = lazy( export const VacationSchedule = lazy(() => import('@pages/vacation-schedule')) -export const AllTeachersPage = lazy(() => import('@pages/all-teachers')) export const HelpfulInformation = lazy(() => import('@pages/helpful-information')) -export const HrApplicationsPage = lazy(() => import('@pages/hr-applications')) export const Allowances = lazy(() => import('@pages/allowances/pages/allowances')) export const AllowanceInfo = lazy(() => import('@pages/allowances/pages/info')) export const CreateAllowance = lazy(() => import('@pages/allowances/pages/create-allowance')) -export const PartTimeEmployment = lazy(() => import('@pages/hr-applications/pages/part-time-employment')) -export const Dismissal = lazy(() => import('@pages/hr-applications/pages/dismissal')) -export const ExtraHolidayColl = lazy(() => import('@pages/hr-applications/pages/extra-holiday-coll')) -export const HolidayWork = lazy(() => import('@pages/hr-applications/pages/holiday-work')) -export const MedicalExamination = lazy(() => import('@pages/hr-applications/pages/medical-examination')) -export const HolidayPlanning = lazy(() => import('@pages/hr-applications/pages/holiday-planning')) -export const HolidayTransfer = lazy(() => import('@pages/hr-applications/pages/holiday-transfer')) -export const WorkTransfer = lazy(() => import('@pages/hr-applications/pages/work-transfer')) -export const WorkTransferChangeRate = lazy(() => import('@pages/hr-applications/pages/work-transfer-change-rate')) -export const DismissalBufferPage = lazy(() => import('@pages/hr-applications/pages/buffer-dismissal')) export const Onboarding = lazy(() => import('@pages/onboarding')) export const Science = lazy(() => import('@pages/science/pages/upload')) export const ArticleList = lazy(() => import('@pages/science/pages/article-list')) diff --git a/src/app/routing/routes/pages/index.ts b/src/app/routing/routes/pages/index.ts new file mode 100644 index 000000000..493ada4cc --- /dev/null +++ b/src/app/routing/routes/pages/index.ts @@ -0,0 +1,5 @@ +export * from './public' +export * from './private' +export * from './employee' +export * from './student' +export * from './all-pages' diff --git a/src/app/routes/general-routes/pages.ts b/src/app/routing/routes/pages/private.ts similarity index 57% rename from src/app/routes/general-routes/pages.ts rename to src/app/routing/routes/pages/private.ts index c2d6ae416..ba0cf3324 100644 --- a/src/app/routes/general-routes/pages.ts +++ b/src/app/routing/routes/pages/private.ts @@ -1,30 +1,23 @@ import { lazy } from 'react' export const AllPages = lazy(() => import('@pages/all-pages')) +export const ApplicationsPage = lazy(() => import('@pages/applications')) export const AllStudentsPage = lazy(() => import('@pages/all-students')) export const AllTeachersPage = lazy(() => import('@pages/all-teachers')) export const AllStaff = lazy(() => import('@pages/all-staff')) -export const CantAccessPage = lazy(() => import('@pages/cant-access')) export const ElectronicInteractionAgreementPage = lazy(() => import('@pages/electronic-interaction-agreement')) -export const FeedbackPage = lazy(() => import('@pages/feedback')) -export const ForgotPasswordPage = lazy(() => import('@pages/forgot-password')) export const AlertsPage = lazy(() => import('@pages/alerts')) export const Home = lazy(() => import('@pages/home')) -export const InstructionsPage = lazy(() => import('@pages/instructions')) +export const InstructionsPage = lazy(() => import('@features/helpful-information/instructions')) export const SafetyInformation = lazy(() => import('@pages/safety-information')) export const PaymentsPage = lazy(() => import('@pages/payments')) export const ProfilePage = lazy(() => import('@pages/profile')) export const SchedulePage = lazy(() => import('@pages/schedule')) -export const ScheduleCurrent = lazy(() => import('@pages/schedule/ui/current-schedule')) -export const ScheduleSemestr = lazy(() => import('@pages/schedule/ui/semestr-schedule')) -export const ScheduleSession = lazy(() => import('@pages/schedule/ui/session-schedule')) -export const ScheduleRetake = lazy(() => import('@pages/schedule/ui/retake-schedule')) export const DecreisDirectivesPage = lazy(() => import('@pages/decreis-directives')) -export const GetYourLoginPage = lazy(() => import('@pages/get-your-login')) -export const MemoFreshmenPage = lazy(() => import('@pages/memo-freshmen')) -export const MemoTeacherPage = lazy(() => import('@pages/memo-teacher')) export const MedicalCertificate = lazy(() => import('@pages/medical-certificate')) export const LkNotificationsPage = lazy(() => import('@pages/lk-notifications')) export const TechnicalMaintenance = lazy(() => import('@pages/teachers-applications/pages/technical-maintenance')) +export const PhysicalEducationStudent = lazy(() => import('@pages/pe-student')) +export const ChatPage = lazy(() => import('@pages/chat')) diff --git a/src/app/routing/routes/pages/public.ts b/src/app/routing/routes/pages/public.ts new file mode 100644 index 000000000..94135302c --- /dev/null +++ b/src/app/routing/routes/pages/public.ts @@ -0,0 +1,9 @@ +import { lazy } from 'react' + +export const LoginPage = lazy(() => import('@pages/login')) +export const ForgotPasswordPage = lazy(() => import('@pages/forgot-password')) +export const FeedbackPage = lazy(() => import('@pages/feedback')) +export const CantAccessPage = lazy(() => import('@pages/cant-access')) +export const GetYourLoginPage = lazy(() => import('@pages/get-your-login')) +export const MemoFreshmenPage = lazy(() => import('@pages/memo-freshmen')) +export const MemoTeacherPage = lazy(() => import('@pages/memo-teacher')) diff --git a/src/app/routing/routes/pages/redirect.tsx b/src/app/routing/routes/pages/redirect.tsx new file mode 100644 index 000000000..8c490af00 --- /dev/null +++ b/src/app/routing/routes/pages/redirect.tsx @@ -0,0 +1,3 @@ +import PageIsNotReady from '@pages/page-is-not-ready' + +export const ApplicationRedirect = () => PageIsNotReady({ oldVersionUrl: '' }) diff --git a/src/app/routes/other-routes/pages.ts b/src/app/routing/routes/pages/student.ts similarity index 97% rename from src/app/routes/other-routes/pages.ts rename to src/app/routing/routes/pages/student.ts index c175f2b55..9e2601ef0 100644 --- a/src/app/routes/other-routes/pages.ts +++ b/src/app/routing/routes/pages/student.ts @@ -3,14 +3,12 @@ import { lazy } from 'react' export const ApplicationForSuperiorRoom = lazy(() => import('@pages/application-for-superior-room')) export const AcadPerformance = lazy(() => import('@pages/acad-performance')) export const DormitoryPage = lazy(() => import('@pages/dormitory')) -export const StudentEmploymentPage = lazy(() => import('@pages/student-employment')) export const ClarificationOfPassportDataApplication = lazy( () => import('@pages/applications/pages/multifunctional-center/clarification-of-passport-data'), ) export const ApplicationForSocialScrollarship = lazy( () => import('@pages/applications/pages/trade-union-organization/social-scollarship'), ) -export const PhysicalEducationStudent = lazy(() => import('@pages/pe-student')) export const ApplicationForCertificateOfAttendance = lazy( () => import('@pages/applications/pages/multifunctional-center/certificate-of-attendance'), @@ -26,8 +24,6 @@ export const RegularAccommodationPage = lazy( () => import('@pages/applications/pages/campus-management/regular-accommodation'), ) -export const ApplicationsPage = lazy(() => import('@pages/applications')) - export const ProjectActivitiesPage = lazy(() => import('@pages/project-activities')) export const AcademicLeaveAccommodationPage = lazy( @@ -127,6 +123,7 @@ export const AccommodationCorrespondenceFormPage = lazy( export const FamilyRoomPage = lazy(() => import('@pages/applications/pages/campus-management/family-room')) export const ArbitraryRequestPage = lazy(() => import('@pages/applications/pages/other/arbitrary-request')) +export const StudentEmploymentPage = lazy(() => import('@pages/student-employment')) export const StudentEmploymentApplicationPage = lazy(() => import('@pages/applications/pages/other/student-employment')) export const TaxCertificatesPage = lazy(() => import('@pages/payments/tax-certificate')) diff --git a/src/app/routing/routes/private.tsx b/src/app/routing/routes/private.tsx new file mode 100644 index 000000000..1e2c62463 --- /dev/null +++ b/src/app/routing/routes/private.tsx @@ -0,0 +1,62 @@ +import React from 'react' + +import { schedulePages } from '@pages/routes' +import SettingsPage from '@pages/settings' + +import { PageRoute } from '@shared/routing' + +import { + AlertsPage, + AllPages, + AllStudentsPage, + AllTeachersPage, + ChatPage, + DecreisDirectivesPage, + ElectronicInteractionAgreementPage, + FeedbackPage, + HelpfulInformation, + Home, + InstructionsPage, + LkNotificationsPage, + ProfilePage, + SafetyInformation, + SchedulePage, + TechnicalMaintenance, +} from './pages' + +export const privatePages: PageRoute = { + all: AllPages, + doclist: DecreisDirectivesPage, + alerts: AlertsPage, + home: Home, + settings: SettingsPage, + profile: ProfilePage, + 'lk-notifications': LkNotificationsPage, + 'electronic-interaction-agreement': ElectronicInteractionAgreementPage, + chat: ChatPage, + 'specific-chat': ChatPage, + schedule: SchedulePage, + 'all-students': AllStudentsPage, + feedback: FeedbackPage, + instructions: InstructionsPage, + vaccination: () => { + React.useEffect(() => { + window.location.replace('https://e.mospolytech.ru/old/index.php?p=vaccination') + }, []) + + return null + }, + 'safety-information': SafetyInformation, + 'technical-maintenance': TechnicalMaintenance, +} + +export const privateHiddenPages: PageRoute = { + // 'teachers-schedule': TeachersSchedule, + 'schedule-filter': SchedulePage, + ...schedulePages, + 'filtered-all-students': AllStudentsPage, + // move to student's after #ASM + 'filtered-all-teachers': AllTeachersPage, + + 'useful-info-template': HelpfulInformation, +} diff --git a/src/app/routing/routes/public.ts b/src/app/routing/routes/public.ts new file mode 100644 index 000000000..d85914ca5 --- /dev/null +++ b/src/app/routing/routes/public.ts @@ -0,0 +1,21 @@ +import { PageRoute } from '@shared/routing' + +import { + CantAccessPage, + FeedbackPage, + ForgotPasswordPage, + GetYourLoginPage, + LoginPage, + MemoFreshmenPage, + MemoTeacherPage, +} from './pages' + +export const publicPages: PageRoute = { + login: LoginPage, + 'forgot-password': ForgotPasswordPage, + feedback: FeedbackPage, + 'cant-access': CantAccessPage, + 'get-login': GetYourLoginPage, + 'student-attention': MemoFreshmenPage, + 'employee-attention': MemoTeacherPage, +} diff --git a/src/app/routing/routes/student.tsx b/src/app/routing/routes/student.tsx new file mode 100644 index 000000000..c7cfa9f37 --- /dev/null +++ b/src/app/routing/routes/student.tsx @@ -0,0 +1,128 @@ +import React from 'react' + +import AllTeachersPage from '@pages/all-teachers' +import FullTimePartTimeFormPage from '@pages/applications/pages/campus-management/full-time-part-time-form' +import ApplicationExitAcademicLeave from '@pages/applications/pages/multifunctional-center/exit-academic-leave' +import MedicalCertificate from '@pages/medical-certificate' +import PaymentsPage from '@pages/payments' + +import { isProduction } from '@shared/consts' + +import { + AcadPerformance, + AcademicLeaveAccommodationPage, + AccommodationCorrespondenceFormPage, + AccommodationForGraduatesPage, + ApplicationExtensionAttestation, + ApplicationForCertificateOfAttendance, + ApplicationForFinancialAssistance, + ApplicationForSocialScrollarship, + ApplicationForSuperiorRoom, + ApplicationHolidaysAfterTraining, + ApplicationIndependentlyDeduction, + ApplicationPaperCall, + ApplicationProvisionAcademicLeave, + ApplicationSocialAgencies, + ApplicationsPage, + ArbitraryRequestPage, + ChangingPersonalData, + ClarificationOfPassportDataApplication, + DormitoryPage, + FamilyRoomPage, + FinancialSupport, + HelpfulInformation, + IncreasedStateAcademicScholarship, + MedicalCertificates086, + MilitaryCopies, + MilitaryForm4, + MilitaryForm5, + MilitaryRegistration, + MilitaryRegistrationDocuments, + ParentContacts, + PaymentRecipient, + PhysicalEducationStudent, + PreferentialAccommodationPage, + ProjectActivitiesPage, + RegularAccommodationPage, + RelocationInsideHostelPage, + RelocationToAnotherHostelPage, + RestoringTheMagneticPass, + RetakeForDiploma, + StateAccreditation, + StudentEmploymentApplicationPage, + StudentEmploymentPage, + StudentStatus, + TaxCertificatePage, + TaxCertificatesPage, + TerminationOfEmploymentContractPage, +} from './pages' +import { ApplicationRedirect } from './pages/redirect' +import { privateHiddenPages, privatePages } from './private' + +export const studentPages = { + // On this position just to make necessary order + applications: ApplicationsPage, + ...privatePages, + payments: PaymentsPage, + dormitory: DormitoryPage, + softskills: () => { + React.useEffect(() => { + window.location.replace('https://softskills.rsv.ru/') + }, []) + + return null + }, + 'acad-performance': AcadPerformance, + 'physical-education': PhysicalEducationStudent, + 'project-activity': ProjectActivitiesPage, + 'helpful-information': HelpfulInformation, + 'application-for-superior-room': ApplicationForSuperiorRoom, + 'all-teachers': AllTeachersPage, +} + +export const hiddenStudentPages = { + ...privateHiddenPages, + 'student-employment': StudentEmploymentPage, + 'student-employment-type': StudentEmploymentPage, + 'clarification-of-passport-data': ClarificationOfPassportDataApplication, + 'arbitrary-request': ArbitraryRequestPage, + 'student-employment-app': isProduction ? ApplicationRedirect : StudentEmploymentApplicationPage, + 'social-scollarship': isProduction ? ApplicationRedirect : ApplicationForSocialScrollarship, + 'certificate-of-attendance': ApplicationForCertificateOfAttendance, + 'social-agencies': ApplicationSocialAgencies, + 'paper-call': ApplicationPaperCall, + 'medical-certificate': MedicalCertificate, + 'regular-accommodation': RegularAccommodationPage, + 'full-time-part-time-form': FullTimePartTimeFormPage, + 'accommodation-correspondence-form': AccommodationCorrespondenceFormPage, + 'academic-leave-accommodation': AcademicLeaveAccommodationPage, + 'preferential-accommodation': PreferentialAccommodationPage, + 'family-room': FamilyRoomPage, + 'termination-of-employment-contract': TerminationOfEmploymentContractPage, + 'relocation-inside-hostel': RelocationInsideHostelPage, + 'relocation-to-another-hostel': RelocationToAnotherHostelPage, + 'accommodation-for-graduates': AccommodationForGraduatesPage, + 'payment-recipient': PaymentRecipient, + 'restoring-the-magnetic-pass': RestoringTheMagneticPass, + 'military-registration-documents': MilitaryRegistrationDocuments, + 'military-registration': MilitaryRegistration, + 'military-form-4': MilitaryForm4, + 'military-form-5': MilitaryForm5, + 'military-copies': MilitaryCopies, + 'retake-for-diploma': RetakeForDiploma, + 'increased-state-academic-scholarship': IncreasedStateAcademicScholarship, + 'financial-support': isProduction ? ApplicationRedirect : FinancialSupport, + 'financial-assistance': isProduction ? ApplicationRedirect : ApplicationForFinancialAssistance, + 'changing-personal-data': ChangingPersonalData, + 'student-status': StudentStatus, + 'family-contacts': ParentContacts, + 'medical-certificates-086': MedicalCertificates086, + 'state-accreditation': StateAccreditation, + 'holidays-after-training': ApplicationHolidaysAfterTraining, + 'provision-academic-leave': ApplicationProvisionAcademicLeave, + 'exit-academic-leave': ApplicationExitAcademicLeave, + 'independently-deducted': ApplicationIndependentlyDeduction, + 'extension-attestation': ApplicationExtensionAttestation, + 'tax-certificate': TaxCertificatesPage, + 'tax-certificate-form': TaxCertificatePage, +} diff --git a/src/entities/acad-performance/lib/prepare.ts b/src/entities/acad-performance/lib/prepare.ts index d292a29d5..93b05d374 100644 --- a/src/entities/acad-performance/lib/prepare.ts +++ b/src/entities/acad-performance/lib/prepare.ts @@ -1,4 +1,4 @@ -import { AcadPerformance } from '@api/model/acad-performance' +import { AcadPerformance } from '@shared/api/model/acad-performance' // const EXAM = 'exam' // const TEST = 'test' diff --git a/src/entities/admin-links/index.ts b/src/entities/admin-links/index.ts index 3c34686ef..a5a76f06f 100644 --- a/src/entities/admin-links/index.ts +++ b/src/entities/admin-links/index.ts @@ -1,8 +1,18 @@ +import { sample } from 'effector' + import { adminLinksApi } from '@shared/api' import { createDefaultStore } from '@shared/effector/create-default-store' +import { userModel } from '@shared/session' export const adminLinksModel = createDefaultStore({ api: { get: adminLinksApi.get, }, }) + +sample({ + clock: userModel.events.authenticated, + source: userModel.stores.userRole, + filter: (role) => role === 'staff', + target: adminLinksModel.effects.getFx, +}) diff --git a/src/entities/all-students/model/index.ts b/src/entities/all-students/model/index.ts index 323ddf0a7..bc90691aa 100644 --- a/src/entities/all-students/model/index.ts +++ b/src/entities/all-students/model/index.ts @@ -1,9 +1,9 @@ -import { studentApi } from '@api' -import { TStudent } from '@api/model' import { createEffect } from 'effector' -import { createPaginationList } from 'shared/effector/create-pagination-list' -import { SelectPage } from '@features/select' +import { studentApi } from '@shared/api' +import { TStudent } from '@shared/api/model' +import { createPaginationList } from '@shared/effector/create-pagination-list' +import { SelectPage } from '@shared/ui/select' const getFetchStudentsFx = createEffect( async (request: ServerListRequest): Promise> => { diff --git a/src/entities/all-teachers/model/index.ts b/src/entities/all-teachers/model/index.ts index 44284058b..46a30ade0 100644 --- a/src/entities/all-teachers/model/index.ts +++ b/src/entities/all-teachers/model/index.ts @@ -1,9 +1,9 @@ -import { teacherApi } from '@api' -import { TTeacher } from '@api/model' import { createEffect } from 'effector' -import { createPaginationList } from 'shared/effector/create-pagination-list' -import { SelectPage } from '@features/select' +import { teacherApi } from '@shared/api' +import { TTeacher } from '@shared/api/model' +import { createPaginationList } from '@shared/effector/create-pagination-list' +import { SelectPage } from '@shared/ui/select' const getFetchTeachersFx = createEffect( async (request: ServerListRequest): Promise> => { diff --git a/src/entities/allowances/lib/get-error-code.ts b/src/entities/allowances/lib/get-error-code.ts index c01d6a28f..4eebaa36e 100644 --- a/src/entities/allowances/lib/get-error-code.ts +++ b/src/entities/allowances/lib/get-error-code.ts @@ -1,4 +1,4 @@ -import { JobRoles } from '@shared/api/allowances-api' +import { JobRoles } from '@shared/api/allowances/allowances-api' export function getAllowancesErrorCode(jobRoles: JobRoles) { return jobRoles.map((job) => { diff --git a/src/entities/allowances/lib/get-status.ts b/src/entities/allowances/lib/get-status.ts index 89024ad03..b7ac8112c 100644 --- a/src/entities/allowances/lib/get-status.ts +++ b/src/entities/allowances/lib/get-status.ts @@ -1,6 +1,6 @@ -import { MessageType } from '@shared/ui/types' +import { MessageType } from '@shared/consts' -import { ApprovalStatus } from '../types' +import { ApprovalStatus } from '../../../shared/api/allowances/types' export const getStatusType = (status: ApprovalStatus): MessageType => status === 'Approved' diff --git a/src/entities/allowances/model/index.ts b/src/entities/allowances/model/index.ts index 120ee2558..2904fa7f5 100644 --- a/src/entities/allowances/model/index.ts +++ b/src/entities/allowances/model/index.ts @@ -1,11 +1,6 @@ import { createMutation, createQuery } from '@farfetched/core' import { Unit, createEffect, createEvent, createStore, sample } from 'effector' -import { SelectPage } from '@features/select' - -import { popUpMessageModel } from '@entities/pop-up-message' -import { userModel } from '@entities/user' - import { ConfirmRequest, JobRoles, @@ -16,26 +11,27 @@ import { getAllowancesNotifications, getHandbook, getPersonalAllowances, - getRoles, getSubordinates, inspectAllowance, removeFile, uploadFile, viewNotification, -} from '@shared/api/allowances-api' +} from '@shared/api/allowances/allowances-api' +import { AllowanceModified, Employee, Role, Subordnate } from '@shared/api/allowances/types' import { createDatePeriodField } from '@shared/effector/form/create-date-period-field' import { createFilesField } from '@shared/effector/form/create-file-filed' import { createInputField } from '@shared/effector/form/create-input-field' import { createSelectField } from '@shared/effector/form/create-select-field' +import { userModel } from '@shared/session' +import { popUpMessageModel } from '@shared/ui/pop-up-message' +import { SelectPage } from '@shared/ui/select' -import { allowanceStatus } from '../consts' -import { Allowance, AllowanceModified, Employee, Role, Subordnate } from '../types' +import { allowanceStatus } from '../../../shared/api/allowances/consts' export type AllAllowancesModified = { initiatorAllowances: AllowanceModified[] approverAllowances: AllowanceModified[] } -export type AllAllowances = { initiatorAllowances: Allowance[]; approverAllowances: Allowance[] } const appStarted = createEvent() const pageMounted = createEvent() @@ -122,6 +118,13 @@ const getSubordinatesFx = createEffect(async (userId: string) => { return getSubordinates(userId) }) +sample({ + clock: userModel.events.authenticated, + source: userModel.stores.userRole, + filter: (role) => role === 'staff', + target: appStarted, +}) + sample({ clock: getSubordinatesEvent, target: getSubordinatesFx, @@ -230,11 +233,6 @@ sample({ }), target: veridctMutation.start, }) - -const roleQuery = createQuery({ - handler: getRoles, -}) -const $roles = roleQuery.$data.map((jobs) => jobs?.map((job) => job.roles).flat() ?? []) const paymentIdentifierQuery = createQuery({ handler: getHandbook, }) @@ -321,10 +319,6 @@ sample({ }) $completed.on(setCompleted, (_, val) => val) -sample({ - clock: appStarted, - target: roleQuery.start, -}) sample({ clock: appStarted, target: notificationsQuery.start, @@ -394,7 +388,7 @@ sample({ }) sample({ clock: pageMounted, - source: roleQuery.$data, + source: userModel.stores.jobRoles, filter: (roles) => roles !== null, fn: (roles) => roles as JobRoles, target: getAllAllowances, @@ -406,7 +400,7 @@ sample({ sample({ clock: pageMounted, - source: roleQuery.$data, + source: userModel.stores.jobRoles, filter: (roles) => roles !== null, fn: (roles) => roles as JobRoles, target: getAllEmployees, @@ -446,7 +440,6 @@ sample({ sample({ clock: userModel.events.logout, target: [ - roleQuery.reset, sourceOfFundingQuery.reset, paymentIdentifierQuery.reset, allowanceQuery.reset, @@ -470,7 +463,6 @@ sample({ export const events = { pageMounted, personalAllowancesMounted, - appStarted, createSupplement, setCompleted, infoPageMounted, @@ -484,10 +476,6 @@ export const events = { } export const stores = { - jobRoles: roleQuery.$data, - rolesPending: roleQuery.$pending, - roles: $roles, - paymentIdentifiers: $paymentIdentifiers, allowances: $allowances, fileUploading: uploadFileMutation.$pending, diff --git a/src/entities/applications/consts.ts b/src/entities/applications/consts.ts index 446c01e4a..de7b141bf 100644 --- a/src/entities/applications/consts.ts +++ b/src/entities/applications/consts.ts @@ -64,29 +64,4 @@ export const TeacherMethodObtainingOptions = [ { id: 1, title: 'Лично' }, ] -export type SpecialFieldsName = - | 'personalMethod' - | 'postMethod' - | 'personalNature' - | 'Compensation' - | 'Compensation2' - | 'Address' - | 'collHoliday1' - | 'collHoliday2' - | 'collHoliday3' - | 'collHoliday4' - | 'collHoliday5' - | 'Structure1' - | 'Structure2' - | 'PartTime' - | 'collDog' - | 'dueToWithdrawal' - | 'medicalReport' - | 'employed' - | 'unemployed' - | 'universityTransfer' - | null - -export type SpecialFieldsNameConfig = { [key: string]: SpecialFieldsName } - export type ApplicationStatusType = (typeof ApplicationsConstants)[keyof typeof ApplicationsConstants] diff --git a/src/shared/effector/create-form-store.ts b/src/entities/applications/lib/create-form-store.ts similarity index 97% rename from src/shared/effector/create-form-store.ts rename to src/entities/applications/lib/create-form-store.ts index 16dc6dc01..b00e3e7df 100644 --- a/src/shared/effector/create-form-store.ts +++ b/src/entities/applications/lib/create-form-store.ts @@ -3,9 +3,9 @@ import { Effect, EventCallable, createEffect, createEvent, createStore, sample } import { useStore } from 'effector-react' import { applicationsModel } from '@entities/applications' -import { popUpMessageModel } from '@entities/pop-up-message' -import { MessageType } from '@shared/ui/types' +import { MessageType } from '@shared/consts' +import { popUpMessageModel } from '@shared/ui/pop-up-message' export interface TemplateFormStore { data: DataType | null diff --git a/src/features/applications/lib/get-method-obstaing.ts b/src/entities/applications/lib/get-method-obstaing.ts similarity index 84% rename from src/features/applications/lib/get-method-obstaing.ts rename to src/entities/applications/lib/get-method-obstaing.ts index 826d7b961..7311e34af 100644 --- a/src/features/applications/lib/get-method-obstaing.ts +++ b/src/entities/applications/lib/get-method-obstaing.ts @@ -1,6 +1,5 @@ -import { SpecialFieldsName, SpecialFieldsNameConfig } from '@entities/applications/consts' - -import { IInputAreaData } from '@ui/input-area/model' +import { IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsName, SpecialFieldsNameConfig } from '@shared/ui/input-area/types' type radioType = { id: number; title: string } diff --git a/src/entities/applications/model/index.ts b/src/entities/applications/model/index.ts index f4209d5a2..6bebf60cc 100644 --- a/src/entities/applications/model/index.ts +++ b/src/entities/applications/model/index.ts @@ -1,14 +1,14 @@ -import { applicationApi } from '@api' -import { Application, UserApplication, WorkerApplication } from '@api/model' -import { ApplicationFormCodes, ApplicationTeachersFormCodes } from '@utility-types/application-form-codes' -import { combine, createEffect, createStore, forward, sample } from 'effector' +import { combine, createEffect, createStore, sample } from 'effector' import { useStore } from 'effector-react/compat' import { applicationsModel } from '@entities/hr-applications' -import { popUpMessageModel } from '@entities/pop-up-message' -import { userModel } from '@entities/user' -import { MessageType } from '@shared/ui/types' +import { applicationApi } from '@shared/api' +import { ApplicationCreating } from '@shared/api/applications/application-api' +import { Application, UserApplication, WorkerApplication } from '@shared/api/model' +import { MessageType } from '@shared/consts' +import { userModel } from '@shared/session' +import { popUpMessageModel } from '@shared/ui/pop-up-message' interface ApplicationsStore { listApplication: Application[] | null @@ -16,12 +16,6 @@ interface ApplicationsStore { dataWorkerApplication: WorkerApplication[] | null error: string | null } - -export interface ApplicationCreating { - formId: ApplicationFormCodes | ApplicationTeachersFormCodes - args: { [key: string]: any } -} - const DEFAULT_STORE = { listApplication: null, error: null, dataUserApplication: null, dataWorkerApplication: null } const getWorkerPostsFx = createEffect(async (): Promise => { @@ -77,7 +71,16 @@ const useApplications = () => { } } -forward({ from: postApplicationFx.doneData, to: getApplicationsFx }) +sample({ clock: userModel.events.authenticated, target: getUserDataApplicationsFx }) + +sample({ + clock: userModel.events.authenticated, + source: userModel.stores.userRole, + filter: (role) => role === 'staff', + target: getWorkerPostsFx, +}) + +sample({ clock: postApplicationFx.doneData, target: getApplicationsFx }) sample({ clock: postApplicationFx.failData, diff --git a/src/entities/chat-messages/model.ts b/src/entities/chat-messages/model.ts index f0c66c33d..b6535ba84 100644 --- a/src/entities/chat-messages/model.ts +++ b/src/entities/chat-messages/model.ts @@ -5,11 +5,11 @@ import { interval } from 'patronum' import sanitize from 'sanitize-html' import { Chat, LastMessage, chatModel, chatsModel } from '@entities/chats' -import { userModel } from '@entities/user' -import { getFullUserName } from '@entities/user/lib/get-full-user-name' import { User } from '@shared/api/model' -import { pageVisibility } from '@shared/models/window-focus' +import { pageVisibility } from '@shared/consts/models/window-focus' +import { userModel } from '@shared/session' +import { getFullUserName } from '@shared/session/lib/get-full-user-name' import { addMessage, getChatMessages } from './api' import { AddChatMessage, ChatMessage, LocalChatMessage } from './type' @@ -46,7 +46,7 @@ const addChatMessageFx = attach({ effect: async ([chatId, user], body: AddChatMessage) => { if (!chatId) throw new Error('Чат не выбран') - const currentUser = user.currentUser + const currentUser = user const data = await addMessage({ ...body, chatId }) return { ...data, currentUser } @@ -124,8 +124,8 @@ sample({ readed: false, readed_opponent: false, files: params.files ?? [], - author_id: user.currentUser?.id.toString() ?? '', - author_name: getFullUserName(user.currentUser), + author_id: user?.id.toString() ?? '', + author_name: getFullUserName(user), msg_id: params.localId, }, ], @@ -157,8 +157,8 @@ sample({ readed_opponent: false, readed: true, files: params.files ?? [], - author_id: user.currentUser?.id.toString() ?? '', - author_name: getFullUserName(user.currentUser), + author_id: user?.id.toString() ?? '', + author_name: getFullUserName(user), msg_id: params.localId, }, ], diff --git a/src/entities/chats/model/chats.ts b/src/entities/chats/model/chats.ts index 3a68fb993..a3fced746 100644 --- a/src/entities/chats/model/chats.ts +++ b/src/entities/chats/model/chats.ts @@ -2,9 +2,8 @@ import { cache, concurrency, createQuery, onAbort, sessionStorageCache } from '@ import { createEvent, createStore, sample } from 'effector' import { interval } from 'patronum' -import { userModel } from '@entities/user' - -import { pageVisibility } from '@shared/models/window-focus' +import { pageVisibility } from '@shared/consts/models/window-focus' +import { userModel } from '@shared/session' import { getAllChats } from '../api' @@ -63,7 +62,7 @@ sample({ clock: tick, target: chatsQuery.start }) sample({ clock: userModel.stores.user, - filter: (user) => !!user.currentUser, + filter: (user) => !!user, target: load, }) diff --git a/src/entities/children/model/index.ts b/src/entities/children/model/index.ts index b553a63a0..90f6a6455 100644 --- a/src/entities/children/model/index.ts +++ b/src/entities/children/model/index.ts @@ -1,13 +1,12 @@ import { createMutation, createQuery } from '@farfetched/core' import { createEvent, createStore, sample } from 'effector' -import { popUpMessageModel } from '@entities/pop-up-message' - -import { deleteChildren, getChildrens, saveChildrens } from '@shared/api/childrens-api' +import { deleteChildren, getChildrens, saveChildrens } from '@shared/api/childrens/childrens-api' import { createCheckboxField } from '@shared/effector/form/create-checkbox-field' import { isNumber } from '@shared/lib/is-number' +import { popUpMessageModel } from '@shared/ui/pop-up-message' -import { Children } from '../types' +import { Children } from '../../../shared/api/childrens/types' const getChildrensQuery = createQuery({ handler: getChildrens, diff --git a/src/entities/contact-details/index.ts b/src/entities/contact-details/index.ts index 7a0a31f91..06d3ac9af 100644 --- a/src/entities/contact-details/index.ts +++ b/src/entities/contact-details/index.ts @@ -1,5 +1,6 @@ +import { createFormStore } from '@entities/applications/lib/create-form-store' + import { contactDetailsApi } from '@shared/api' -import { createFormStore } from '@shared/effector/create-form-store' export const contactDetailsModel = createFormStore({ defaultStore: { diff --git a/src/entities/contact-info-actualization/model/index.ts b/src/entities/contact-info-actualization/model/index.ts index cd566ea56..27d351115 100644 --- a/src/entities/contact-info-actualization/model/index.ts +++ b/src/entities/contact-info-actualization/model/index.ts @@ -1,5 +1,6 @@ -import { contactInfoActualizationApi } from '@api' -import { createFormStore } from 'shared/effector/create-form-store' +import { createFormStore } from '@entities/applications/lib/create-form-store' + +import { contactInfoActualizationApi } from '@shared/api' export const { effects, events, selectors } = createFormStore({ defaultStore: { diff --git a/src/entities/context-menu/model/index.ts b/src/entities/context-menu/model/index.ts index 69b455d8c..f8c4d3b53 100644 --- a/src/entities/context-menu/model/index.ts +++ b/src/entities/context-menu/model/index.ts @@ -1,10 +1,7 @@ -import React from 'react' - import { createEvent, createStore } from 'effector' import { useStore } from 'effector-react' -import calcPosition from 'widgets/context-menu/lib/calc-position' -import { Coordinates } from '@ui/types' +import { ClickEvent, Coordinates } from '@shared/ui/types' type ClickType = 'left-click' | 'right-click' | 'both' @@ -15,7 +12,14 @@ interface ContextMenuStore { position: Coordinates } -export type ClickEvent = React.MouseEvent | React.MouseEvent +const calcPosition = (e: ClickEvent, width = 265, height = 200) => { + e.preventDefault() + + return { + x: e.clientX < window.innerWidth / 2 ? e.clientX : e.clientX - width, + y: e.clientY < window.innerHeight / 2 ? e.clientY : e.clientY - height, + } +} const DEFAULT_STORE: ContextMenuStore = { open: false, diff --git a/src/entities/electronic-interaction/model/index.ts b/src/entities/electronic-interaction/model/index.ts index 56c8f80a3..0885216b7 100644 --- a/src/entities/electronic-interaction/model/index.ts +++ b/src/entities/electronic-interaction/model/index.ts @@ -1,11 +1,10 @@ -import { pepApi } from '@api' -import { ElectronicInteraction } from '@api/model' import { createEffect, createEvent, createStore, sample } from 'effector' -import { popUpMessageModel } from '@entities/pop-up-message' -import { userModel } from '@entities/user' - -import { MessageType } from '@shared/ui/types' +import { pepApi } from '@shared/api' +import { ElectronicInteraction } from '@shared/api/model' +import { MessageType } from '@shared/consts' +import { userModel } from '@shared/session' +import { popUpMessageModel } from '@shared/ui/pop-up-message' const getElectronicInteraction = createEvent() const postElectronicInteraction = createEvent() diff --git a/src/entities/family-contacts/model/index.ts b/src/entities/family-contacts/model/index.ts index 179c52271..a63fc6b64 100644 --- a/src/entities/family-contacts/model/index.ts +++ b/src/entities/family-contacts/model/index.ts @@ -1,9 +1,8 @@ import { createQuery } from '@farfetched/core' import { createEvent, createStore, sample } from 'effector' -import { popUpMessageModel } from '@entities/pop-up-message' - import { FamilyContacts, getFamilyContacts, saveFamilyContacts } from '@shared/api/family-contacts-api' +import { popUpMessageModel } from '@shared/ui/pop-up-message' const getContacts = createEvent() const saveContacts = createEvent() diff --git a/src/entities/hint/model/index.ts b/src/entities/hint/model/index.ts index 1fef4599e..4d5c94d3b 100644 --- a/src/entities/hint/model/index.ts +++ b/src/entities/hint/model/index.ts @@ -1,7 +1,7 @@ import { createEvent, createStore } from 'effector' import { useStore } from 'effector-react/compat' -import { Coordinates } from '@ui/types' +import { Coordinates } from '@shared/ui/types' export interface Hint { isOpen: boolean diff --git a/src/entities/hr-applications/model/index.ts b/src/entities/hr-applications/model/index.ts index f8096a000..8dd2f9290 100644 --- a/src/entities/hr-applications/model/index.ts +++ b/src/entities/hr-applications/model/index.ts @@ -1,12 +1,13 @@ -import { hrApplicationApi } from '@api' -import { HrApplication, HrUserApplication } from '@api/model' import { createEvent, forward, sample } from 'effector' import { createEffect, createStore } from 'effector' import { useStore } from 'effector-react/compat' import { popUpMessageModelHr } from '@entities/pop-up-message-hr' -import { MessageType } from '@shared/ui/types' +import { hrApplicationApi } from '@shared/api' +import { ApplicationCreating } from '@shared/api/hr-application-api' +import { HrApplication, HrUserApplication } from '@shared/api/model' +import { MessageType } from '@shared/consts' interface ApplicationsStore { listApplication: HrApplication[] | null @@ -14,10 +15,6 @@ interface ApplicationsStore { error: string | null } -export interface ApplicationCreating { - [key: string]: any -} - const DEFAULT_STORE = { listApplication: null, error: null, dataUserApplication: null } const useApplications = () => { diff --git a/src/entities/increased-scholarship/model/index.ts b/src/entities/increased-scholarship/model/index.ts index 4e480231a..1171adf91 100644 --- a/src/entities/increased-scholarship/model/index.ts +++ b/src/entities/increased-scholarship/model/index.ts @@ -3,14 +3,13 @@ import axios from 'axios' import { createEvent, sample } from 'effector' import { applicationsModel } from '@entities/applications' -import { ApplicationCreating } from '@entities/applications/model' -import { popUpMessageModel } from '@entities/pop-up-message' -import { post } from '@shared/api/application-api' +import { ApplicationCreating, post } from '@shared/api/applications/application-api' import { createCheckboxField } from '@shared/effector/form/create-checkbox-field' import { createFilesField } from '@shared/effector/form/create-file-filed' import { createInputField } from '@shared/effector/form/create-input-field' import { createSelectField } from '@shared/effector/form/create-select-field' +import { popUpMessageModel } from '@shared/ui/pop-up-message' const pageMounted = createEvent() const sendForm = createEvent() diff --git a/src/entities/lk-notifications/consts.ts b/src/entities/lk-notifications/consts.ts new file mode 100644 index 000000000..d4799a170 --- /dev/null +++ b/src/entities/lk-notifications/consts.ts @@ -0,0 +1,13 @@ +import { AllowanceNotificationType } from '@shared/api/allowances/types' +import { ALLOWANCE_INFO_CUT, DOCLIST_ALLOWANCES } from '@shared/routing' + +export const NotificationLinks: Record = { + RecepientDeclinedByZkgu: ALLOWANCE_INFO_CUT, + RecepientDeclinedByAppover: ALLOWANCE_INFO_CUT, + RecepientSelfDeclined: ALLOWANCE_INFO_CUT, + RecepientSelfConfirmed: ALLOWANCE_INFO_CUT, + FullyCompleted: ALLOWANCE_INFO_CUT, + ToApprove: ALLOWANCE_INFO_CUT, + ToConfirm: DOCLIST_ALLOWANCES, + AllowanceOrderCompleted: DOCLIST_ALLOWANCES, +} as const diff --git a/src/entities/lk-notifications/hooks/use-lk-notifications.ts b/src/entities/lk-notifications/hooks/use-lk-notifications.ts index 9bc37127d..0fca0cdc3 100644 --- a/src/entities/lk-notifications/hooks/use-lk-notifications.ts +++ b/src/entities/lk-notifications/hooks/use-lk-notifications.ts @@ -5,9 +5,9 @@ import { useUnit } from 'effector-react' import { electronicInteractionModel } from '@entities/electronic-interaction' import { menuModel } from '@entities/menu' import { userSettingsModel } from '@entities/settings' -import { userModel } from '@entities/user' -import { NotificationsResponse } from '@shared/api/lk-notification-api' +import { NotificationsResponse } from '@shared/api/notifications/lk-notification-api' +import { userModel } from '@shared/session' import { lkNotificationModel } from '..' import createNotification from '../lib/create-notification' diff --git a/src/entities/lk-notifications/index.ts b/src/entities/lk-notifications/index.ts index 35988fce9..f7e01603c 100644 --- a/src/entities/lk-notifications/index.ts +++ b/src/entities/lk-notifications/index.ts @@ -1,2 +1,2 @@ export * as lkNotificationModel from './model' -export type { TNotification, NotificationType } from './types' +export type { TNotification, NotificationType } from '../../shared/api/notifications/types' diff --git a/src/entities/lk-notifications/lib/create-allowance-path.ts b/src/entities/lk-notifications/lib/create-allowance-path.ts index 1bf3c2e51..75a12e54b 100644 --- a/src/entities/lk-notifications/lib/create-allowance-path.ts +++ b/src/entities/lk-notifications/lib/create-allowance-path.ts @@ -1,5 +1,6 @@ -import { NotificationLinks } from '@entities/allowances/consts' -import { AllowanceNotification } from '@entities/allowances/types' +import { AllowanceNotification } from '@shared/api/allowances/types' + +import { NotificationLinks } from '../consts' export const createAllowancePath = (allowance: AllowanceNotification) => { const page = NotificationLinks[allowance.notificationType] diff --git a/src/entities/lk-notifications/lib/create-notification.tsx b/src/entities/lk-notifications/lib/create-notification.tsx index c768d006f..61ce7d1a0 100644 --- a/src/entities/lk-notifications/lib/create-notification.tsx +++ b/src/entities/lk-notifications/lib/create-notification.tsx @@ -1,18 +1,20 @@ +import { allowancesModel } from '@entities/allowances' + +import { AllowanceNotification } from '@shared/api/allowances/types' import { ALERTS_ROUTE, + APPLICATIONS_ROUTE, CHAT_ROUTE, + DOCLIST_ALLOWANCES, + DOCLIST_ROUTE, PAYMENTS_ROUTE, PERSONAL_ELECTRONIC_INTERACTION, + PPS_CONTEST_ROUTE, SCHEDULE_ROUTE, -} from '@app/routes/general-routes' -import { APPLICATIONS_ROUTE } from '@app/routes/routes' -import { DOCLIST_ALLOWANCES, DOCLIST_ROUTE, HR_APPLICATIONS_ROUTE, PPS_CONTEST_ROUTE } from '@app/routes/teacher-routes' - -import { allowancesModel } from '@entities/allowances' -import { NotificationLinks } from '@entities/allowances/consts' -import { AllowanceNotification } from '@entities/allowances/types' +} from '@shared/routing' -import { NotificationType, TNotification } from '../types' +import { NotificationType, TNotification } from '../../../shared/api/notifications/types' +import { NotificationLinks } from '../consts' const createNotification = ( type: NotificationType, @@ -74,14 +76,6 @@ const createNotification = ( pageId: 'chat', canClose: false, }, - 'hr-applications': { - id, - title: title ?? '', - text: text ?? 'У вашей заявки изменился статус', - type: 'hr-applications', - goTo: HR_APPLICATIONS_ROUTE, - pageId: 'hr-applications', - }, 'kpi-pps': { id, title: title ?? '', diff --git a/src/entities/lk-notifications/lib/filter-notifications-via-settings.ts b/src/entities/lk-notifications/lib/filter-notifications-via-settings.ts index 84db3184a..6fcd5d848 100644 --- a/src/entities/lk-notifications/lib/filter-notifications-via-settings.ts +++ b/src/entities/lk-notifications/lib/filter-notifications-via-settings.ts @@ -1,6 +1,5 @@ -import { UserSettings } from '@entities/settings/types' - -import { NotificationsResponse } from '@shared/api/lk-notification-api' +import { NotificationsResponse } from '@shared/api/notifications/lk-notification-api' +import { UserSettings } from '@shared/api/settings' const typeSettingsDictionary: Record = { message: 'messages', diff --git a/src/entities/lk-notifications/model/index.ts b/src/entities/lk-notifications/model/index.ts index a3fb53718..09060c7d1 100644 --- a/src/entities/lk-notifications/model/index.ts +++ b/src/entities/lk-notifications/model/index.ts @@ -1,17 +1,18 @@ -// sort-imports-ignore -import { menuModel } from '@entities/menu' -import { allowancesModel } from '@entities/allowances' -import { NotificationTitles } from '@entities/allowances/consts' -import { UserSettings } from '@entities/settings/types' -import { userModel } from '@entities/user' -import { allowancesApi, lkNotificationApi } from '@shared/api' import { createEffect, createEvent, createStore, forward, sample } from 'effector' import { useStore } from 'effector-react' +import { allowancesModel } from '@entities/allowances' +import { menuModel } from '@entities/menu' + +import { allowancesApi, lkNotificationApi } from '@shared/api' +import { NotificationTitles } from '@shared/api/allowances/consts' +import { UserSettings } from '@shared/api/settings' +import { userModel } from '@shared/session' + +import { TNotification } from '../../../shared/api/notifications/types' import { createAllowancePath } from '../lib/create-allowance-path' import createNotification from '../lib/create-notification' import { filterNotificationsViaSettings } from '../lib/filter-notifications-via-settings' -import { TNotification } from '../types' type TStore = { notifications: TNotification[] diff --git a/src/entities/menu/lib/find-routes-by-config.ts b/src/entities/menu/lib/find-routes-by-config.ts index d3279fd35..6ed018b14 100644 --- a/src/entities/menu/lib/find-routes-by-config.ts +++ b/src/entities/menu/lib/find-routes-by-config.ts @@ -1,4 +1,4 @@ -import { IRoute, IRoutes } from '@app/routes/general-routes' +import { IRoutes, Page } from '@shared/routing' const findRoutesWidthConfig = (config: string[], allRoutes: IRoutes): IRoutes => { return config.reduce( @@ -6,7 +6,7 @@ const findRoutesWidthConfig = (config: string[], allRoutes: IRoutes): IRoutes => acc[id] = allRoutes[id] return acc }, - {} as { [key: string]: IRoute }, + {} as { [key: string]: Page }, ) } diff --git a/src/entities/menu/model/index.ts b/src/entities/menu/model/index.ts index 7919d8c27..f796fc991 100644 --- a/src/entities/menu/model/index.ts +++ b/src/entities/menu/model/index.ts @@ -1,26 +1,29 @@ -import { AdminLinks, User } from '@api/model' import { combine, createEvent, createStore, sample } from 'effector' import { useUnit } from 'effector-react' -import { IRoute, IRoutes } from '@app/routes/general-routes' -import { hiddenRoutes, privateRoutes } from '@app/routes/routes' -import { teachersHiddenRoutes, teachersPrivateRoutes } from '@app/routes/teacher-routes' - import { adminLinksModel } from '@entities/admin-links' -import { allowancesModel } from '@entities/allowances' -import { Role } from '@entities/allowances/types' import { userSettingsModel } from '@entities/settings' -import { UserSettings } from '@entities/settings/types' -import { userModel } from '@entities/user' -import { MenuType, REQUIRED_LEFTSIDE_BAR_CONFIG, REQUIRED_TEACHER_LEFTSIDE_BAR_CONFIG } from '@shared/constants' +import { Role } from '@shared/api/allowances/types' +import { AdminLinks, User } from '@shared/api/model' +import { UserSettings } from '@shared/api/settings' +import { MenuType, REQUIRED_LEFTSIDE_BAR_CONFIG, REQUIRED_TEACHER_LEFTSIDE_BAR_CONFIG } from '@shared/consts' +import { + IRoutes, + Page, + employeeHiddenRoutes, + employeeRoutes, + studentHiddenRoutes, + studentRoutes, +} from '@shared/routing' +import { userModel } from '@shared/session' import findRoutesByConfig from '../lib/find-routes-by-config' export interface Menu { allRoutes: IRoutes | null visibleRoutes: IRoutes | null - currentPage: IRoute | null + currentPage: Page | null isOpen: boolean } @@ -86,7 +89,7 @@ const getNewNotifications = (page: string, notifications: number, routes: IRoute const filterTeachersPrivateRoutes = (adminLinks: AdminLinks | null, allowancesRoles: Role[]): IRoutes => { if (!adminLinks) { - return teachersPrivateRoutes({ allowancesRoles }) + return employeeRoutes({ allowancesRoles }) } const { accepts, agreements, checkdata, studLogins } = adminLinks @@ -94,7 +97,7 @@ const filterTeachersPrivateRoutes = (adminLinks: AdminLinks | null, allowancesRo const hasAdminLinks = !!accepts.length || !!agreements.length || !!checkdata.length || !!studLogins?.length const adminRoute = 'download-agreements' - const filteredRoutes = Object.entries(teachersPrivateRoutes({ allowancesRoles })).filter( + const filteredRoutes = Object.entries(employeeRoutes({ allowancesRoles })).filter( ([key]) => key !== adminRoute || (key === adminRoute && hasAdminLinks), ) return Object.fromEntries(filteredRoutes) @@ -104,18 +107,18 @@ const $leftSidebar = combine( userModel.stores.user, userSettingsModel.stores.userSettings, adminLinksModel.store, - allowancesModel.stores.roles, + userModel.stores.roles, (user, settings, adminLinks, allowancesRoles) => { if (!user || !settings) return null return findRoutesByConfig( - getLeftsideBarConfig(user.currentUser, settings!, adminLinks.data), - user.currentUser?.user_status === 'staff' + getLeftsideBarConfig(user, settings!, adminLinks.data), + user?.user_status === 'staff' ? { ...filterTeachersPrivateRoutes(adminLinks.data, allowancesRoles), - ...teachersHiddenRoutes({ allowancesRoles }), + ...employeeHiddenRoutes({ allowancesRoles }), } - : { ...privateRoutes(), ...hiddenRoutes(user.currentUser) }, + : { ...studentRoutes(), ...studentHiddenRoutes() }, ) }, ) @@ -124,18 +127,18 @@ const $homeRoutes = combine( userModel.stores.user, userSettingsModel.stores.userSettings, adminLinksModel.store, - allowancesModel.stores.roles, + userModel.stores.roles, (user, settings, adminLinks, allowancesRoles) => { if (!user || !settings) return null return findRoutesByConfig( settings?.homePage.pages ?? DEFAULT_HOME_CONFIG, - user.currentUser?.user_status === 'staff' + user?.user_status === 'staff' ? { ...filterTeachersPrivateRoutes(adminLinks.data, allowancesRoles), - ...teachersHiddenRoutes({ allowancesRoles }), + ...employeeHiddenRoutes({ allowancesRoles }), } - : { ...privateRoutes(), ...hiddenRoutes(user.currentUser) }, + : { ...studentRoutes(), ...studentHiddenRoutes() }, ) }, ) @@ -145,14 +148,14 @@ sample({ userStore: userModel.stores.user, settings: userSettingsModel.stores.userSettings, adminLinks: adminLinksModel.store, - allowancesRoles: allowancesModel.stores.roles, + allowancesRoles: userModel.stores.roles, }, filter: ({ settings, userStore }) => { - return Boolean(settings) && Boolean(userStore.currentUser) + return Boolean(settings) && Boolean(userStore) }, fn: ({ settings, adminLinks, userStore, allowancesRoles }) => ({ homeRoutes: settings!.homePage.pages, - user: userStore.currentUser!, + user: userStore!, adminLinks: adminLinks.data!, allowancesRoles: allowancesRoles, }), @@ -176,16 +179,16 @@ const $menu = createStore(DEFAULT_STORE) ? filterTeachersPrivateRoutes(adminLinks, allowancesRoles)[ window.location.hash.slice(2, window.location.hash.length) ] - : privateRoutes()[window.location.hash.slice(2, window.location.hash.length)], + : studentRoutes()[window.location.hash.slice(2, window.location.hash.length)], allRoutes: user?.user_status === 'staff' ? { ...filterTeachersPrivateRoutes(adminLinks, allowancesRoles), - ...teachersHiddenRoutes({ allowancesRoles }), + ...employeeHiddenRoutes({ allowancesRoles }), } - : { ...privateRoutes(), ...hiddenRoutes(user) }, + : { ...studentRoutes(), ...studentHiddenRoutes() }, visibleRoutes: - user?.user_status === 'staff' ? filterTeachersPrivateRoutes(adminLinks, allowancesRoles) : privateRoutes(), + user?.user_status === 'staff' ? filterTeachersPrivateRoutes(adminLinks, allowancesRoles) : studentRoutes(), })) .on(changeNotifications, (oldData, { page, notifications }) => ({ ...oldData, diff --git a/src/entities/notification/model/index.ts b/src/entities/notification/model/index.ts index 20bb8e646..244559c6f 100644 --- a/src/entities/notification/model/index.ts +++ b/src/entities/notification/model/index.ts @@ -1,9 +1,9 @@ -import { docsApi, notificationApi } from '@api' -import { Notifications } from '@api/model/notification' import { createEffect, createEvent, createStore } from 'effector' import { useStore } from 'effector-react/compat' -import { userModel } from '@entities/user' +import { docsApi, notificationApi } from '@shared/api' +import { Notifications } from '@shared/api/model/notification' +import { userModel } from '@shared/session' export type NotificationType = 'notifications' | 'docs' | 'allowances' interface PersonalNotificationsStore { diff --git a/src/entities/payments/index.ts b/src/entities/payments/index.ts index 1ff0f6ee0..8c60d959c 100644 --- a/src/entities/payments/index.ts +++ b/src/entities/payments/index.ts @@ -1,4 +1,4 @@ export * as paymentsModel from './model' export * as thirdPartyAgreementModel from './third-party-agreement-model' -export * from './tax-certificate/model' export * as thirdPartyInteractionModel from './third-party-agreement-model/electronic-interaction' +export * from './tax-certificate/model' diff --git a/src/entities/payments/lib/change-can-sign.ts b/src/entities/payments/lib/change-can-sign.ts index 3c62ea79b..a3ee73074 100644 --- a/src/entities/payments/lib/change-can-sign.ts +++ b/src/entities/payments/lib/change-can-sign.ts @@ -1,4 +1,4 @@ -import { Payments } from '@api/model' +import { Payments } from '@shared/api/model' const changeCanSign = (payments: Payments | null, contractId: string, value: boolean): Payments | null => { if (!payments) return null diff --git a/src/entities/payments/model/index.ts b/src/entities/payments/model/index.ts index d01694e14..fbe19235e 100644 --- a/src/entities/payments/model/index.ts +++ b/src/entities/payments/model/index.ts @@ -1,12 +1,12 @@ -import { paymentApi } from '@api' -import { Payments, PaymentsContract } from '@api/model' import { combine, createEffect, createEvent, createStore, sample } from 'effector' -import { popUpMessageModel } from '@entities/pop-up-message' -import { userModel } from '@entities/user' - +import { paymentApi } from '@shared/api' +import { Payments, PaymentsContract } from '@shared/api/model' import { agreementSubmit } from '@shared/api/payment-api' -import { MessageType } from '@shared/ui/types' +import { MessageType } from '@shared/consts' +import { userModel } from '@shared/session' +import { tutorialModel } from '@shared/tutorial' +import { popUpMessageModel } from '@shared/ui/pop-up-message' import changeCanSign from '../lib/change-can-sign' @@ -95,6 +95,18 @@ const $paymentType = combine($combinedDormLength, $combinedEduLength, (combinedD : 'none', ) +sample({ + clock: getPaymentsFx.doneData, + source: tutorialModel.stores.roles, + fn: (oldRoles, { dormitory, education }) => { + const roles = [...oldRoles] + if (dormitory.length && !roles.includes('dormitory')) roles.push('dormitory') + if (education.length && !roles.includes('education')) roles.push('education') + return roles + }, + target: tutorialModel.events.setRoles, +}) + export const stores = { $loading, $completed, diff --git a/src/entities/payments/tax-certificate/model.tsx b/src/entities/payments/tax-certificate/model.tsx index 1882ba78b..54b6ce276 100644 --- a/src/entities/payments/tax-certificate/model.tsx +++ b/src/entities/payments/tax-certificate/model.tsx @@ -3,43 +3,34 @@ import axios from 'axios' import { createEffect, createEvent, createStore, sample } from 'effector' import { and, not, reset } from 'patronum' -import { popUpMessageModel } from '@entities/pop-up-message' -import { userModel } from '@entities/user' - import { TaxCertificate, createTaxCertificate, getTaxCerts } from '@shared/api/payment-api' +import { userModel } from '@shared/session' +import { popUpMessageModel } from '@shared/ui/pop-up-message' const pageMounted = createEvent() const certificatedRequested = createEvent<{ year: string }>() - const $taxCerts = createStore(null) - const createTaxCertificateMutation = createMutation({ handler: createTaxCertificate, }) - const getTaxCertsFx = createEffect(getTaxCerts) - sample({ clock: getTaxCertsFx.doneData, target: $taxCerts, }) - const $presentYears = $taxCerts.map((certificates) => { if (!certificates) return new Set() return new Set(certificates.map((certificate) => certificate.year)) }) - sample({ clock: pageMounted, filter: not($taxCerts), target: getTaxCertsFx, }) - sample({ clock: certificatedRequested, target: createTaxCertificateMutation.start, }) - sample({ clock: createTaxCertificateMutation.$succeeded, target: [ @@ -50,7 +41,6 @@ sample({ getTaxCertsFx, ], }) - sample({ clock: createTaxCertificateMutation.finished.failure, fn: ({ error }) => ({ @@ -62,12 +52,10 @@ sample({ }), target: popUpMessageModel.events.evokePopUpMessage, }) - reset({ clock: userModel.events.logout, target: [$taxCerts], }) - export const taxCertificateModel = { pageMounted, certificatedRequested, diff --git a/src/entities/payments/third-party-agreement-model/index.ts b/src/entities/payments/third-party-agreement-model/index.ts index 55c6228c7..d8e12329a 100644 --- a/src/entities/payments/third-party-agreement-model/index.ts +++ b/src/entities/payments/third-party-agreement-model/index.ts @@ -2,9 +2,8 @@ import { createMutation } from '@farfetched/core' import axios from 'axios' import { createEffect, createEvent, createStore, sample } from 'effector' -import { popUpMessageModel } from '@entities/pop-up-message' - import { SendAgreementCodesReq, sendAgreementCodesApi, signThirdPartyAgreementApi } from '@shared/api/payment-api' +import { popUpMessageModel } from '@shared/ui/pop-up-message' import { paymentsModel } from '..' diff --git a/src/entities/pe-student-additional-points/model/pe-student-additional-points-model.ts b/src/entities/pe-student-additional-points/model/pe-student-additional-points-model.ts index a247b3881..f73fa77bb 100644 --- a/src/entities/pe-student-additional-points/model/pe-student-additional-points-model.ts +++ b/src/entities/pe-student-additional-points/model/pe-student-additional-points-model.ts @@ -1,12 +1,10 @@ import { createEffect, createEvent, sample } from 'effector' -import { modalModel } from 'widgets/modal/model' - -import { popUpMessageModel } from '@entities/pop-up-message' import { peApi } from '@shared/api' import { getPeErrorMsg } from '@shared/api/config/pe-config' - -import { AddStudentAdditionalPoints } from '../types' +import { AddStudentAdditionalPoints } from '@shared/api/physical-education' +import { modalModel } from '@shared/ui/modal/model' +import { popUpMessageModel } from '@shared/ui/pop-up-message' const addAdditionPoints = createEvent() const removeAdditionPoints = createEvent<{ id: string }>() diff --git a/src/entities/pe-student-additional-points/types/index.ts b/src/entities/pe-student-additional-points/types/index.ts deleted file mode 100644 index 8bcf7f695..000000000 --- a/src/entities/pe-student-additional-points/types/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -export interface AddStudentAdditionalPoints { - studentGuid: string - type: WorkType - date: string - points: number - comment: string -} - -export enum WorkType { - Activist = 'Activist', - Competition = 'Competition', - ExternalFitness = 'ExternalFitness', - GTO = 'GTO', - InternalTeam = 'InternalTeam', - OnlineWork = 'OnlineWork', - Science = 'Science', -} diff --git a/src/entities/pe-student-regulation-points/model/pe-student-regulation-points-model.ts b/src/entities/pe-student-regulation-points/model/pe-student-regulation-points-model.ts index 49277c2ed..dd6aa34a7 100644 --- a/src/entities/pe-student-regulation-points/model/pe-student-regulation-points-model.ts +++ b/src/entities/pe-student-regulation-points/model/pe-student-regulation-points-model.ts @@ -1,12 +1,10 @@ import { createEffect, createEvent, sample } from 'effector' -import { modalModel } from 'widgets/modal/model' - -import { popUpMessageModel } from '@entities/pop-up-message' import { peApi } from '@shared/api' import { getPeErrorMsg } from '@shared/api/config/pe-config' - -import { AddStudentRegulationPoints } from '../types' +import { AddStudentRegulationPoints } from '@shared/api/physical-education' +import { modalModel } from '@shared/ui/modal/model' +import { popUpMessageModel } from '@shared/ui/pop-up-message' const addRegulationPoints = createEvent() const removeRegulationPoints = createEvent<{ id: string }>() diff --git a/src/entities/pe-student-regulation-points/types/index.ts b/src/entities/pe-student-regulation-points/types/index.ts deleted file mode 100644 index 6021826d1..000000000 --- a/src/entities/pe-student-regulation-points/types/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -export interface AddStudentRegulationPoints { - studentGuid: string - type: RegulationType - date: string - points: number -} - -export enum RegulationType { - FlexionAndExtensionOfArms = 'FlexionAndExtensionOfArms', // сгибание и разгибание рук - JumpingRopeJumps = 'JumpingRopeJumps', // прыжки со скакалкой - Jumps = 'Jumps', // прыжки - PullUps = 'PullUps', // подтягивания - ShuttleRun = 'ShuttleRun', // челночный бег - Squats = 'Squats', // приседания - Tilts = 'Tilts', // наклон - TorsoLifts = 'TorsoLifts', // подъемы туловища - Other = 'Other', // другое -} diff --git a/src/entities/pe-student/constants.ts b/src/entities/pe-student/constants.ts deleted file mode 100644 index a2713f99a..000000000 --- a/src/entities/pe-student/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const STUDENT_PAGE_SIZE = 40 diff --git a/src/entities/pe-student/model/index.ts b/src/entities/pe-student/model/index.ts index 87ca77ba4..8e6d9efa7 100644 --- a/src/entities/pe-student/model/index.ts +++ b/src/entities/pe-student/model/index.ts @@ -4,3 +4,4 @@ export * as selectedPEStudentModel from './selected-pe-student-model' export * as peStudentCompetitionModel from './pe-student-competition-model' export * as peStudentHealthGroupModel from './pe-student-health-group-model' export * as peStudentSpecializationModel from './pe-student-specialization-model' +export * as pEStudentSearchModel from './search' diff --git a/src/entities/pe-student/model/pe-student-competition-model.ts b/src/entities/pe-student/model/pe-student-competition-model.ts index ef8dc63ad..9a73fa4df 100644 --- a/src/entities/pe-student/model/pe-student-competition-model.ts +++ b/src/entities/pe-student/model/pe-student-competition-model.ts @@ -1,9 +1,8 @@ import { createEffect, createEvent, createStore, sample } from 'effector' -import { popUpMessageModel } from '@entities/pop-up-message' - import { peApi } from '@shared/api' import { getPeErrorMsg } from '@shared/api/config/pe-config' +import { popUpMessageModel } from '@shared/ui/pop-up-message' const load = createEvent() const remove = createEvent() diff --git a/src/entities/pe-student/model/pe-student-health-group-model.ts b/src/entities/pe-student/model/pe-student-health-group-model.ts index 5ceea7406..50ccf52b4 100644 --- a/src/entities/pe-student/model/pe-student-health-group-model.ts +++ b/src/entities/pe-student/model/pe-student-health-group-model.ts @@ -1,12 +1,9 @@ import { createEffect, createEvent, sample } from 'effector' -import { popUpMessageModel } from '@entities/pop-up-message' - import { peApi } from '@shared/api' import { getPeErrorMsg } from '@shared/api/config/pe-config' - -import { HealthGroup } from '../types' -import { SetHealthGroup } from '../types/set-health-group' +import { HealthGroup, SetHealthGroup } from '@shared/api/physical-education' +import { popUpMessageModel } from '@shared/ui/pop-up-message' const setHealthGroup = createEvent<{ studentGuid: string; healthGroup: HealthGroup }>() diff --git a/src/entities/pe-student/model/pe-student-model.ts b/src/entities/pe-student/model/pe-student-model.ts index bb197ccb6..4aa287ab3 100644 --- a/src/entities/pe-student/model/pe-student-model.ts +++ b/src/entities/pe-student/model/pe-student-model.ts @@ -1,37 +1,16 @@ -import { attach, combine, createEvent, createStore, sample } from 'effector' -import { debounce } from 'patronum' +import { createEvent, createStore, sample } from 'effector' -import { pEStudentFilterModel } from '@pages/teacher-physical-education/model' - -import { PEStudent } from '@entities/pe-student/types' - -import { peApi } from '@shared/api' +import { PEStudent } from '@shared/api/physical-education' import { pEStudentVisitModel } from '.' const load = createEvent() const setPage = createEvent() -const $pEStudentsPage = createStore(0) - .on(setPage, (_, page) => page) - .on(pEStudentFilterModel.stores.$filters, () => 0) - -const loadPageFx = attach({ - source: { page: $pEStudentsPage, filters: pEStudentFilterModel.stores.$filters }, - effect: async ({ filters, page }) => { - const { data } = await peApi.getStudents(page, filters) - - return data.data - }, -}) - -debounce({ source: combine($pEStudentsPage, pEStudentFilterModel.stores.$filters), timeout: 200, target: load }) - -sample({ clock: load, target: loadPageFx }) +const $pEStudentsPage = createStore(0).on(setPage, (_, page) => page) -const $pEStudents = createStore([]).on(loadPageFx.doneData, (_, data) => data.students) -const $pEStudentsTotalCount = createStore(0).on(loadPageFx.doneData, (_, data) => data.totalCount) -const $loading = combine(loadPageFx.pending, Boolean) +const $pEStudents = createStore([]) +const $pEStudentsTotalCount = createStore(0) sample({ clock: pEStudentVisitModel.effects.addVisitFx.doneData, @@ -55,7 +34,6 @@ export const events = { } export const stores = { - $loading, $pEStudents, $pEStudentsPage, $pEStudentsTotalCount, diff --git a/src/entities/pe-student/model/pe-student-specialization-model.ts b/src/entities/pe-student/model/pe-student-specialization-model.ts index e0bf7812b..7ca0ff48d 100644 --- a/src/entities/pe-student/model/pe-student-specialization-model.ts +++ b/src/entities/pe-student/model/pe-student-specialization-model.ts @@ -1,12 +1,9 @@ import { createEffect, createEvent, sample } from 'effector' -import { popUpMessageModel } from '@entities/pop-up-message' - import { peApi } from '@shared/api' import { getPeErrorMsg } from '@shared/api/config/pe-config' - -import { Specialization } from '../types' -import { SetSpecialization } from '../types/set-specialization' +import { SetSpecialization, Specialization } from '@shared/api/physical-education' +import { popUpMessageModel } from '@shared/ui/pop-up-message' const setSpecialization = createEvent<{ studentGuid: string; specialization: Specialization }>() diff --git a/src/entities/pe-student/model/pe-student-visits-model.ts b/src/entities/pe-student/model/pe-student-visits-model.ts index fc5e2ea58..68b694aa4 100644 --- a/src/entities/pe-student/model/pe-student-visits-model.ts +++ b/src/entities/pe-student/model/pe-student-visits-model.ts @@ -1,12 +1,10 @@ import { createEffect, createEvent, sample } from 'effector' -import { modalModel } from 'widgets/modal/model' - -import { popUpMessageModel } from '@entities/pop-up-message' import { peApi } from '@shared/api' import { getPeErrorMsg } from '@shared/api/config/pe-config' - -import { AddStudentVisits } from '../types/add-student-visits' +import { AddStudentVisits } from '@shared/api/physical-education' +import { modalModel } from '@shared/ui/modal/model' +import { popUpMessageModel } from '@shared/ui/pop-up-message' const addVisit = createEvent() const removeVisit = createEvent<{ id: string }>() diff --git a/src/pages/teacher-physical-education/model/search.ts b/src/entities/pe-student/model/search.ts similarity index 100% rename from src/pages/teacher-physical-education/model/search.ts rename to src/entities/pe-student/model/search.ts diff --git a/src/entities/pe-student/model/selected-pe-student-model.ts b/src/entities/pe-student/model/selected-pe-student-model.ts index db088fc13..1bc8dfc48 100644 --- a/src/entities/pe-student/model/selected-pe-student-model.ts +++ b/src/entities/pe-student/model/selected-pe-student-model.ts @@ -4,11 +4,11 @@ import { peStudentAdditionalPointsModel } from '@entities/pe-student-additional- import { peStudentRegulationPointsModel } from '@entities/pe-student-regulation-points/model' import { peApi } from '@shared/api' +import { PEStudentProfile } from '@shared/api/physical-education' import * as peStudentHealthGroupModel from './pe-student-health-group-model' import * as peStudentSpecializationModel from './pe-student-specialization-model' import { pEStudentVisitModel } from '.' -import { PEStudentProfile } from '../types' const setCurrentStudentId = createEvent() const resetStudentId = createEvent() diff --git a/src/entities/pe-student/types/add-student-visits.ts b/src/entities/pe-student/types/add-student-visits.ts deleted file mode 100644 index 68882d308..000000000 --- a/src/entities/pe-student/types/add-student-visits.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface AddStudentVisits { - studentGuid: string - date: string -} diff --git a/src/entities/pe-student/types/set-health-group.ts b/src/entities/pe-student/types/set-health-group.ts deleted file mode 100644 index 5798598fb..000000000 --- a/src/entities/pe-student/types/set-health-group.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { HealthGroup } from './student' - -export type SetHealthGroup = { studentGuid: string; healthGroup: HealthGroup } diff --git a/src/entities/pe-student/types/set-specialization.ts b/src/entities/pe-student/types/set-specialization.ts deleted file mode 100644 index 5442101bb..000000000 --- a/src/entities/pe-student/types/set-specialization.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Specialization } from './student' - -export type SetSpecialization = { studentGuid: string; specialization: Specialization } diff --git a/src/entities/pe-student/types/student.ts b/src/entities/pe-student/types/student.ts index 45d440ba4..79ff36971 100644 --- a/src/entities/pe-student/types/student.ts +++ b/src/entities/pe-student/types/student.ts @@ -1,6 +1,4 @@ -import { WorkType } from '@entities/pe-student-additional-points/types' - -export type HealthGroup = 'None' | 'Basic' | 'Preparatory' | 'SpecialA' | 'SpecialB' | 'HealthLimitations' | 'Disabled' +import { HealthGroup, Specialization } from '@shared/api/physical-education' export const healthGroupToTitle: Record = { None: '-', @@ -11,22 +9,6 @@ export const healthGroupToTitle: Record = { HealthLimitations: 'ОВЗ', Disabled: 'Инвалид', } - -export type Specialization = - | 'None' - | 'Basketball' - | 'Volleyball' - | 'Aerobics' - | 'PowerLiftingAndCrossfit' - | 'StreetLiftingAndArmLifting' - | 'GeneralPhysicalTraining' - | 'GeneralPhysicalTrainingGym' - | 'FootRoom' - | 'SMG' - | 'TableTennis' - | 'NordicWalking' - | 'InternalTeam' - export const specializationToTitle: Record = { None: '-', Basketball: 'Баскетбол', @@ -42,55 +24,3 @@ export const specializationToTitle: Record = { NordicWalking: 'СМГ скандинавская ходьба', InternalTeam: 'Сборная', } - -export interface PEStudent { - studentGuid: string - fullName: string - groupNumber: string - hasDebt: boolean - visits: number - standardPoints: number - course: number - totalPoints: number - lmsPoints: number - healthGroup: HealthGroup - specialization: Specialization -} - -export type PEStudentProfile = { - studentGuid: string - fullName: string - groupNumber: string - hasDebt: boolean - healthGroup: HealthGroup - healthGroupTeacher: { guid: string; fullName: string } | null - specialization: Specialization - totalPoints: number - lmsPoints: number - visits: number - course: number - curator: { guid: string; fullName: string } | null - visitsHistory: { - id: number - date: string - teacherGuid: string - teacherFullName: string - }[] - pointsHistory: { - id: string - type: WorkType - comment: string - date: string - points: number - teacherGuid: string - teacherFullName: string - }[] - standardsHistory: { - id: string - type: string - teacherFullName: string - points: number - date: string - teacherGuid: string - }[] -} diff --git a/src/entities/pe-teacher/model.ts b/src/entities/pe-teacher/model.ts index 3f92d1e98..66b8c8d36 100644 --- a/src/entities/pe-teacher/model.ts +++ b/src/entities/pe-teacher/model.ts @@ -1,13 +1,12 @@ import { attach, createEvent, restore, sample } from 'effector' -import { userModel } from '@entities/user' - import { peApi } from '@shared/api' +import { userModel } from '@shared/session' const load = createEvent() const loadFx = attach({ - effect: async ({ currentUser }) => { + effect: async (currentUser) => { const { data } = await peApi.getTeacher(currentUser?.guid ?? '') return { ...data.data, id: currentUser?.guid ?? '' } @@ -17,6 +16,11 @@ const loadFx = attach({ const $peTeacher = restore(loadFx, null) +sample({ + clock: userModel.events.authenticated, + target: load, +}) + sample({ clock: load, target: loadFx }) const $isLoading = loadFx.pending diff --git a/src/entities/pe-teacher/types.ts b/src/entities/pe-teacher/types.ts deleted file mode 100644 index 26fd9f7e9..000000000 --- a/src/entities/pe-teacher/types.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type PETeacher = { - id: string - permissions: PeTeacherPermission[] - fullName: string - groups: string[] -} - -export enum PeTeacherPermission { - AdminAccess = 'AdminAccess', - DefaultAccess = 'DefaultAccess', - OnlineCourseAccess = 'OnlineCourseAccess', - SecretaryAccess = 'SecretaryAccess', - SuperUser = 'SuperUser', -} diff --git a/src/entities/phonebook/model.ts b/src/entities/phonebook/model.ts index 2c8b42047..686f615d8 100644 --- a/src/entities/phonebook/model.ts +++ b/src/entities/phonebook/model.ts @@ -2,6 +2,7 @@ import { createEffect, createEvent, createStore, sample } from 'effector' import { phonebookApi } from '@shared/api' import { Subdivision } from '@shared/api/model/phonebook' +import { userModel } from '@shared/session' const setSubdivisionPath = createEvent() @@ -19,7 +20,16 @@ const getSubdivisionsFx = createEffect(async (): Promise => { } throw new Error('Не удалось загрузить подразделения') }) + +sample({ + clock: userModel.events.authenticated, + source: userModel.stores.userRole, + filter: (role) => role === 'staff', + target: getSubdivisions, +}) + sample({ clock: getSubdivisions, target: getSubdivisionsFx }) + const $pedningGetSubdividions = getSubdivisionsFx.pending const clearSubdivisionData = createEvent() diff --git a/src/entities/pop-up-message-hr/model/index.ts b/src/entities/pop-up-message-hr/model/index.ts index 972bbddf8..88787d307 100644 --- a/src/entities/pop-up-message-hr/model/index.ts +++ b/src/entities/pop-up-message-hr/model/index.ts @@ -1,7 +1,7 @@ import { createEvent, createStore } from 'effector' import { useStore } from 'effector-react/compat' -import { MessageType } from '@ui/types' +import { MessageType } from '@shared/consts' interface IPopUpMessage { message: ChildrenType diff --git a/src/entities/project-activites/index.ts b/src/entities/project-activites/index.ts index d5029ad65..b3bbc2ace 100644 --- a/src/entities/project-activites/index.ts +++ b/src/entities/project-activites/index.ts @@ -1,8 +1,22 @@ +import { sample } from 'effector' + import { projectActivitesApi } from '@shared/api' import { createDefaultStore } from '@shared/effector/create-default-store' +import { tutorialModel } from '@shared/tutorial' export const projectActivitesModel = createDefaultStore({ api: { get: projectActivitesApi.get, }, }) + +sample({ + clock: projectActivitesModel.store, + source: tutorialModel.stores.roles, + filter: (roles) => !roles.includes('has PA last semester'), + fn: (roles, pa) => + pa.data?.last_semestr_result !== 'Данные отсутствуют' + ? ([...roles, 'has PA last semester'] as const) + : roles.filter((role) => role !== 'has PA last semester'), + target: tutorialModel.stores.roles, +}) diff --git a/src/entities/release/utils.ts b/src/entities/release/utils.ts deleted file mode 100644 index 38c85be90..000000000 --- a/src/entities/release/utils.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { userModel } from '@entities/user' - -import { BrowserStorageKey } from '@shared/constants/browser-storage-key' - -export const releaseClear = () => { - const currentVersion = '0.0.1' - - // Check if the browser has an older version stored in local storage - const storedVersion = localStorage.getItem(BrowserStorageKey.Version) - if (storedVersion !== currentVersion) { - // Clear any stale data from previous versions - localStorage.clear() - - // Store the new version number for next time - localStorage.setItem(BrowserStorageKey.Version, currentVersion) - - userModel.events.logout() - } -} diff --git a/src/entities/schedule/consts.ts b/src/entities/schedule/consts.ts index e72470c4c..0589c0986 100644 --- a/src/entities/schedule/consts.ts +++ b/src/entities/schedule/consts.ts @@ -1,11 +1,5 @@ import { IFullSchedule, IWeekEventSchedule } from '@shared/api/model' -import { IWeekDays, WEEK_DAYS } from '@shared/constants' - -export enum View { - day, - week, - month, -} +import { IWeekDays, WEEK_DAYS } from '@shared/consts' export const VIEWS = [ { diff --git a/src/entities/schedule/lib/get-calendar-schedule.tsx b/src/entities/schedule/lib/get-calendar-schedule.tsx index a4bf90b2c..2d56b21d6 100644 --- a/src/entities/schedule/lib/get-calendar-schedule.tsx +++ b/src/entities/schedule/lib/get-calendar-schedule.tsx @@ -1,12 +1,10 @@ import React from 'react' import { HiBookOpen } from 'react-icons/hi' -import { getSubjectIcon } from '@features/acad-performance/lib/get-subject-icon' - -import { ISubject, ITimeIntervalColor, TimeIntervalColor } from '@shared/api/model' -import { IWeekDays } from '@shared/constants' +import { DayCalendarEvent, ISubject, ITimeIntervalColor, TimeIntervalColor } from '@shared/api/model' +import { IWeekDays } from '@shared/consts' import { TimeType, getMinutesFromStringTime } from '@shared/lib/dates/get-minutes-from-string-time' -import { type DayCalendarEvent } from '@shared/ui/calendar' +import { getSubjectIcon } from '@shared/lib/get-subject-icon' import { getFullEndDate } from './get-full-end-date' import { getFullStartDate } from './get-full-start-date' diff --git a/src/entities/schedule/lib/get-current-day-schedule.ts b/src/entities/schedule/lib/get-current-day-schedule.ts index 9534e377a..023c7058e 100644 --- a/src/entities/schedule/lib/get-current-day-schedule.ts +++ b/src/entities/schedule/lib/get-current-day-schedule.ts @@ -1,5 +1,4 @@ -import { ISubject } from '@api/model' - +import { ISubject } from '@shared/api/model' import getDateWithoutTime from '@shared/lib/dates/get-date-without-time' import { getFullEndDate } from './get-full-end-date' diff --git a/src/entities/schedule/lib/get-full-end-date.ts b/src/entities/schedule/lib/get-full-end-date.ts index fc29e38e1..eae257689 100644 --- a/src/entities/schedule/lib/get-full-end-date.ts +++ b/src/entities/schedule/lib/get-full-end-date.ts @@ -1,4 +1,4 @@ -import { Months } from '@shared/models/months' +import { Months } from '@shared/consts/models/months' export const getFullEndDate = (endDate: string, startDate: string) => { const [endDay, endMonth] = endDate?.split(' ') ?? [null, null] diff --git a/src/entities/schedule/lib/get-full-start-date.ts b/src/entities/schedule/lib/get-full-start-date.ts index 371283a20..f6cea59e6 100644 --- a/src/entities/schedule/lib/get-full-start-date.ts +++ b/src/entities/schedule/lib/get-full-start-date.ts @@ -1,4 +1,4 @@ -import { Months } from '@shared/models/months' +import { Months } from '@shared/consts/models/months' export const getFullStartDate = (startDate: string) => { const [startDay, startMonth] = startDate.split(' ') diff --git a/src/shared/ui/calendar/ui/week-days/lib/get-monday.ts b/src/entities/schedule/lib/get-monday.ts similarity index 100% rename from src/shared/ui/calendar/ui/week-days/lib/get-monday.ts rename to src/entities/schedule/lib/get-monday.ts diff --git a/src/entities/schedule/lib/normalize-schedule.ts b/src/entities/schedule/lib/normalize-schedule.ts index c890ce81a..1910cfb46 100644 --- a/src/entities/schedule/lib/normalize-schedule.ts +++ b/src/entities/schedule/lib/normalize-schedule.ts @@ -1,4 +1,4 @@ -import { popUpMessageModel } from '@entities/pop-up-message' +import { getMonday } from '@entities/schedule/lib/get-monday' import { CapitalLettersWeekNames, @@ -10,9 +10,9 @@ import { RawSessionScheduleResponse, RawTeacherScheduleResponse, } from '@shared/api/model' -import { IWeekDayNames, TIME_IN_MS, WEEK_DAYS } from '@shared/constants' +import { IWeekDayNames, TIME_IN_MS, WEEK_DAYS } from '@shared/consts' import { getDateInSomeDays } from '@shared/lib/dates/get-date-in-some-days' -import { getMonday } from '@shared/ui/calendar/ui/week-days/lib/get-monday' +import { popUpMessageModel } from '@shared/ui/pop-up-message' import { EMPTY_WEEK, SCHEDULE_NO_RESULT } from '../consts' import { getCalendarSchedule } from './get-calendar-schedule' diff --git a/src/entities/schedule/lib/normalize-session-schedule.ts b/src/entities/schedule/lib/normalize-session-schedule.ts index da62626eb..d2e17df85 100644 --- a/src/entities/schedule/lib/normalize-session-schedule.ts +++ b/src/entities/schedule/lib/normalize-session-schedule.ts @@ -1,5 +1,5 @@ import { RawSessionScheduleResponse } from '@shared/api/model' -import { WEEK_DAYS } from '@shared/constants' +import { WEEK_DAYS } from '@shared/consts' import { getWeekDayFromDate } from '@shared/lib/dates/get-weekday-from-date' import { isValidDate } from '@shared/lib/dates/is-valid-date' diff --git a/src/entities/schedule/model/index.ts b/src/entities/schedule/model/index.ts index 6a3d67cb4..fc61a860d 100644 --- a/src/entities/schedule/model/index.ts +++ b/src/entities/schedule/model/index.ts @@ -1,10 +1,10 @@ -import { IFullSchedule, ISchedule, User } from '@api/model' import { createEffect, createEvent, createStore, sample } from 'effector' import { useStore } from 'effector-react/compat' -import { userModel } from '@entities/user' +import { IFullSchedule, ISchedule, User, View } from '@shared/api/model' +import { userModel } from '@shared/session' -import { EMPTY_WEEK, View } from '../consts' +import { EMPTY_WEEK } from '../consts' import { getGroupSchedule } from '../lib/get-group-schedule' import { getTeacherSchedule } from '../lib/get-teacher-schedule' diff --git a/src/pages/science/lib/get-default-columns.tsx b/src/entities/science/lib/get-default-columns.tsx similarity index 100% rename from src/pages/science/lib/get-default-columns.tsx rename to src/entities/science/lib/get-default-columns.tsx diff --git a/src/entities/science/model/article.ts b/src/entities/science/model/article.ts index b59c58c73..852eed97d 100644 --- a/src/entities/science/model/article.ts +++ b/src/entities/science/model/article.ts @@ -1,7 +1,7 @@ import { createQuery } from '@farfetched/core' import { createEvent, sample } from 'effector' -import { getArticle, getArticleDetails } from '@shared/api/science-api' +import { getArticle, getArticleDetails } from '@shared/api/science/science-api' const getDetailsClicked = createEvent() const pageMounted = createEvent() diff --git a/src/entities/science/model/index.ts b/src/entities/science/model/index.ts index 2b074d700..79aaa8da8 100644 --- a/src/entities/science/model/index.ts +++ b/src/entities/science/model/index.ts @@ -3,17 +3,16 @@ import { IndexRange } from 'react-virtualized' import { createMutation } from '@farfetched/core' import { createEffect, createEvent, createStore, sample } from 'effector' -import { getDefaultColumns } from '@pages/science/lib/get-default-columns' +import { getDefaultColumns } from '@entities/science/lib/get-default-columns' -import { popUpMessageModel } from '@entities/pop-up-message' - -import { UploadReq, getAllArticles, uploadArticle } from '@shared/api/science-api' +import { UploadReq, getAllArticles, uploadArticle } from '@shared/api/science/science-api' import { createCheckboxField } from '@shared/effector/form/create-checkbox-field' import { createInputField } from '@shared/effector/form/create-input-field' +import { popUpMessageModel } from '@shared/ui/pop-up-message' import { ColumnProps } from '@shared/ui/table/types' +import { Article, Filter, Sort } from '../../../shared/api/science/types' import { scienceNameMap } from '../lib/nameMap' -import { Article, Filter, Sort } from '../types' import { TABLE_SIZE } from './consts' const pageMounted = createEvent() diff --git a/src/entities/settings-account/index.ts b/src/entities/settings-account/index.ts deleted file mode 100644 index 59ed751d8..000000000 --- a/src/entities/settings-account/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * as settingsAccountModel from './model' diff --git a/src/entities/settings-account/model/index.ts b/src/entities/settings-account/model/index.ts deleted file mode 100644 index fee517d5e..000000000 --- a/src/entities/settings-account/model/index.ts +++ /dev/null @@ -1,136 +0,0 @@ -import { createEffect, createEvent, createStore } from 'effector' -import { useStore } from 'effector-react' - -import { settingsAccountApi } from '@shared/api' - -type TStore = { - data: T - loading: boolean - completed: boolean - error: string | null -} - -const DEFAULT = { - loading: false, - completed: false, - error: null, -} - -const AVATAR_STORE: TStore = { - data: [], - ...DEFAULT, -} - -const AD_PASS_STORE: TStore = { - data: '', - ...DEFAULT, -} - -const EMAIL_STORE: TStore = { - data: '', - ...DEFAULT, -} - -const changeAvatar = createEvent() -const changeCompleted = createEvent() - -const postAvatarFx = createEffect(async (photo: File[]) => { - try { - await settingsAccountApi.changeAvatar(photo) - } catch (_) { - throw new Error('Не удалось загрузить фотографию') - } -}) - -const $avatarStore = createStore(AVATAR_STORE) - .on(changeAvatar, (state, payload) => ({ - ...state, - data: payload, - })) - .on(postAvatarFx, (state) => ({ - ...state, - error: null, - loading: true, - completed: false, - })) - .on(postAvatarFx.doneData, (state) => ({ - ...state, - error: null, - loading: false, - completed: true, - })) - .on(postAvatarFx.fail, (state, { error }) => ({ - ...state, - error: error.message, - loading: false, - completed: false, - })) - .on(changeCompleted, (state, payload) => ({ - ...state, - completed: payload, - })) - -const changeEmail = createEvent() -const postNewEmail = createEffect(async (email: string) => { - try { - await settingsAccountApi.changeEmail(email) - } catch (_) { - throw new Error('Не удалось изменить email') - } -}) - -const $emailStore = createStore(EMAIL_STORE) - .on(changeEmail, (state, payload) => ({ - ...state, - data: payload, - })) - .on(postNewEmail, (state) => ({ - ...state, - loading: true, - })) - .on(postNewEmail.doneData, (state) => ({ - ...state, - loading: false, - completed: true, - error: null, - })) - .on(postNewEmail.failData, (state, error) => ({ - ...state, - loading: false, - completed: false, - error: error.message, - })) - -const changeADPass = createEvent() -// const postNewADPass = createEffect(async (adPass: string) => { -// try { -// await settingsAccountApi.changeADPass(adPass) -// } catch (_) { -// throw new Error('Не удалось изменить пароль') -// } -// }) - -const $ADpassStore = createStore(AD_PASS_STORE).on(changeADPass, (state, payload) => ({ - ...state, - data: payload, -})) - -const useData = () => { - return { - avatar: useStore($avatarStore), - adPass: useStore($ADpassStore), - email: useStore($emailStore), - } -} - -export const selectors = { useData } - -export const events = { - avatar: { changeAvatar, changeCompleted }, - email: { changeEmail }, -} - -export const effects = { - avatar: { postAvatarFx }, - email: { postNewEmail }, -} diff --git a/src/entities/settings/constants.ts b/src/entities/settings/constants.ts deleted file mode 100644 index 0295fc20f..000000000 --- a/src/entities/settings/constants.ts +++ /dev/null @@ -1,28 +0,0 @@ -import * as z from 'zod' - -import { ThemeVariant } from '@shared/constants' - -export const UserSettingsSchema = z.object({ - appearance: z.object({ - theme: z.enum([ThemeVariant.Light, ThemeVariant.Dark]), - }), - customizeMenu: z.object({ - pages: z.array(z.string()), - }), - homePage: z.object({ - pages: z.array(z.string()), - hasSchedule: z.boolean(), - hasPayment: z.boolean(), - hasNews: z.boolean(), - }), - notifications: z.object({ - all: z.boolean(), - messages: z.boolean(), - newVersion: z.boolean(), - schedule: z.boolean(), - news: z.boolean(), - applications: z.boolean(), - doclist: z.boolean(), - }), - syncAcrossAllDevices: z.boolean(), -}) diff --git a/src/entities/settings/lib/get-default-settings.ts b/src/entities/settings/lib/get-default-settings.ts index 40cd32de3..ce7c8c97b 100644 --- a/src/entities/settings/lib/get-default-settings.ts +++ b/src/entities/settings/lib/get-default-settings.ts @@ -1,6 +1,5 @@ -import { REQUIRED_LEFTSIDE_BAR_CONFIG, REQUIRED_TEACHER_LEFTSIDE_BAR_CONFIG, ThemeVariant } from '@shared/constants' - -import { UserSettings } from '../types' +import { UserSettings } from '@shared/api/settings' +import { REQUIRED_LEFTSIDE_BAR_CONFIG, REQUIRED_TEACHER_LEFTSIDE_BAR_CONFIG, ThemeVariant } from '@shared/consts' export const getDefaultNewSettings = (isEmployee: boolean): UserSettings => { // get default theme from user preferences @@ -31,9 +30,3 @@ export const getDefaultNewSettings = (isEmployee: boolean): UserSettings => { syncAcrossAllDevices: false, } } - -export type PhoneSettingsType = { - phone_staff?: string - allow_mobphone_in?: boolean - allow_mobphone_out?: boolean -} diff --git a/src/entities/settings/lib/get-settings-key.ts b/src/entities/settings/lib/get-settings-key.ts index 63f5d7f24..879d3019e 100644 --- a/src/entities/settings/lib/get-settings-key.ts +++ b/src/entities/settings/lib/get-settings-key.ts @@ -1,4 +1,4 @@ -import { BrowserStorageKey } from '@shared/constants/browser-storage-key' +import { BrowserStorageKey } from '@shared/consts/browser-storage-key' export const getSettingsKey = (userId: string) => { return `${BrowserStorageKey.Settings}-${userId}` diff --git a/src/entities/settings/model/server-settings.ts b/src/entities/settings/model/server-settings.ts index b32c303b4..e09164381 100644 --- a/src/entities/settings/model/server-settings.ts +++ b/src/entities/settings/model/server-settings.ts @@ -1,9 +1,8 @@ import { createQuery } from '@farfetched/core' import { sample } from 'effector' -import { userModel } from '@entities/user' - import { getServerSettings } from '@shared/api/settings' +import { userModel } from '@shared/session' export const serverSettingsQuery = createQuery({ handler: getServerSettings, @@ -11,6 +10,6 @@ export const serverSettingsQuery = createQuery({ sample({ clock: userModel.stores.user, - filter: ({ currentUser }) => Boolean(currentUser), + filter: (currentUser) => Boolean(currentUser), target: serverSettingsQuery.start, }) diff --git a/src/entities/settings/model/users-settings-model.ts b/src/entities/settings/model/users-settings-model.ts index d1ad9943b..1d5597e4a 100644 --- a/src/entities/settings/model/users-settings-model.ts +++ b/src/entities/settings/model/users-settings-model.ts @@ -1,14 +1,14 @@ import { attach, createEffect, createEvent, createStore, sample } from 'effector' -import { userModel } from '@entities/user' - -import { setServerSettings } from '@shared/api/settings' -import { ThemeVariant } from '@shared/constants' -import { BrowserStorageKey } from '@shared/constants/browser-storage-key' +import { UserSettings, setServerSettings } from '@shared/api/settings' +import { ThemeVariant } from '@shared/consts' +import { BrowserStorageKey } from '@shared/consts/browser-storage-key' +import { userModel } from '@shared/session' +import { tutorialModel } from '@shared/tutorial' import { getDefaultNewSettings } from '../lib/get-default-settings' import { getSettingsKey } from '../lib/get-settings-key' -import { SettingsOldType, UserSettings } from '../types' +import { SettingsOldType } from '../types' import { serverSettingsQuery } from './server-settings' const update = createEvent>() @@ -23,7 +23,7 @@ const saveSettingsGlobalFx = createEffect((settings: UserSettings) => { const getSettingsFx = attach({ source: { userStore: userModel.stores.user, serverSettingsQueryData: serverSettingsQuery.$data }, - effect: ({ userStore: { currentUser }, serverSettingsQueryData }): UserSettings => { + effect: ({ userStore: currentUser, serverSettingsQueryData }): UserSettings => { const userGuid = currentUser?.guid const newSettings = localStorage.getItem(getSettingsKey(userGuid ?? '')) const defaultSettings = getDefaultNewSettings(currentUser?.user_status === 'staff') @@ -73,7 +73,7 @@ const getSettingsFx = attach({ sample({ source: { userStore: userModel.stores.user, isServerSettingsLoaded: serverSettingsQuery.$finished }, - filter: ({ userStore, isServerSettingsLoaded }) => Boolean(userStore.currentUser && isServerSettingsLoaded), + filter: ({ userStore, isServerSettingsLoaded }) => Boolean(userStore && isServerSettingsLoaded), fn: ({ userStore }) => { return userStore }, @@ -96,9 +96,9 @@ sample({ clock: $theme, filter: Boolean, target: setThemeToDocument }) sample({ source: { settings: $userSettings, userStore: userModel.stores.user }, - filter: ({ userStore, settings }) => Boolean(userStore.currentUser) && Boolean(settings), + filter: ({ userStore, settings }) => Boolean(userStore) && Boolean(settings), fn: ({ settings, userStore: user }) => { - return { settings: settings!, userId: user!.currentUser?.guid ?? '' } + return { settings: settings!, userId: user?.guid ?? '' } }, target: saveUsersSettingsLocalFx, }) @@ -110,7 +110,7 @@ sample({ isSettingsLoadedFromServer: serverSettingsQuery.$succeeded, }, filter: ({ userStore, settings, isSettingsLoadedFromServer }) => - Boolean(userStore.currentUser && settings?.syncAcrossAllDevices && isSettingsLoadedFromServer), + Boolean(userStore && settings?.syncAcrossAllDevices && isSettingsLoadedFromServer), fn: ({ settings }) => { return settings! }, @@ -140,6 +140,17 @@ sample({ target: saveSettingsGlobalFx, }) +sample({ + clock: $userSettings, + source: tutorialModel.stores.roles, + filter: (_, settings) => Boolean(settings), + fn: (roles, settings) => + settings?.homePage.hasPayment && settings?.homePage.hasSchedule + ? ([...roles, 'has widgets'] as const) + : roles.filter((role) => role !== 'has widgets'), + target: tutorialModel.stores.roles, +}) + export const stores = { userSettings: $userSettings, theme: $theme, diff --git a/src/entities/settings/types.ts b/src/entities/settings/types.ts index 7e4cb736c..81e6e1604 100644 --- a/src/entities/settings/types.ts +++ b/src/entities/settings/types.ts @@ -1,10 +1,4 @@ -import * as z from 'zod' - -import { ThemeVariant } from '@shared/constants' - -import { UserSettingsSchema } from './constants' - -export type UserSettings = z.infer +import { ThemeVariant } from '@shared/consts' export enum OldNameSettings { 'settings-home-page' = 'settings-home-page', diff --git a/src/entities/story/model/index.ts b/src/entities/story/model/index.ts index c5edf1f03..1b8f3a860 100644 --- a/src/entities/story/model/index.ts +++ b/src/entities/story/model/index.ts @@ -1,7 +1,27 @@ import { createEvent, createStore } from 'effector' import { useStore } from 'effector-react/compat' -import { StoryProps } from '@ui/story/ui/story-page' +import { Align, VerticalAlign } from '@shared/ui/types' + +export type StyledProps = { + textAlign?: Align + color?: string + align: { horizontal: Align; vertical: VerticalAlign } + imageAlign?: { horizontal?: Align; vertical?: VerticalAlign } + background?: string +} + +export type StoryProps = StyledProps & { + title: string + text?: string + image?: string + children?: ChildrenType + imageSize?: { width: string; height: string } + link?: { + text: string + to: string + } +} export interface IStory { isOpen: boolean diff --git a/src/entities/superior-room/model/index.ts b/src/entities/superior-room/model/index.ts index 23ef6f7f0..6538d360c 100644 --- a/src/entities/superior-room/model/index.ts +++ b/src/entities/superior-room/model/index.ts @@ -1,10 +1,10 @@ -import { superiorRoomApi } from '@api' -import { SuperiorRoom } from '@api/model' import { createEffect, createEvent, createStore } from 'effector' import { useStore } from 'effector-react/compat' import { forward } from 'effector/effector.mjs' -import { userModel } from '@entities/user' +import { superiorRoomApi } from '@shared/api' +import { SuperiorRoom } from '@shared/api/model' +import { userModel } from '@shared/session' interface SuperiorRoomStore { superiorRoom: SuperiorRoom | null diff --git a/src/entities/teacher-data-verification/model/index.ts b/src/entities/teacher-data-verification/model/index.ts index bba56162b..4e5f2c92e 100644 --- a/src/entities/teacher-data-verification/model/index.ts +++ b/src/entities/teacher-data-verification/model/index.ts @@ -1,10 +1,10 @@ -import { teacherDataVerificationApi } from '@api' -import { TeacherDataVerification } from '@api/model' import { createEffect, createEvent, createStore } from 'effector' import { useStore } from 'effector-react/compat' import { forward } from 'effector/effector.mjs' -import { userModel } from '@entities/user' +import { teacherDataVerificationApi } from '@shared/api' +import { TeacherDataVerification } from '@shared/api/model' +import { userModel } from '@shared/session' interface TeacherDataVerificationStore { teacherDataVerification: TeacherDataVerification | null diff --git a/src/entities/teachers-statement/model/index.ts b/src/entities/teachers-statement/model/index.ts index dc6a59f05..3267e4d94 100644 --- a/src/entities/teachers-statement/model/index.ts +++ b/src/entities/teachers-statement/model/index.ts @@ -1,6 +1,7 @@ -import { teacherStatementApi } from '@api' -import { UserApplication } from '@api/model' -import { createFormStore } from 'shared/effector/create-form-store' +import { createFormStore } from '@entities/applications/lib/create-form-store' + +import { teacherStatementApi } from '@shared/api' +import { UserApplication } from '@shared/api/model' export const { effects, events, selectors } = createFormStore({ defaultStore: { diff --git a/src/entities/technical-maintenance/model/index.ts b/src/entities/technical-maintenance/model/index.ts index ec87925e4..72a247fcc 100644 --- a/src/entities/technical-maintenance/model/index.ts +++ b/src/entities/technical-maintenance/model/index.ts @@ -1,12 +1,11 @@ import { createMutation } from '@farfetched/core' import { createEvent, createStore, sample } from 'effector' -import { SelectPage } from '@features/select' - import { applicationsModel } from '@entities/applications' -import { popUpMessageModel } from '@entities/pop-up-message' import { TechnicalMaintenance, postTechnicalMaintenance } from '@shared/api/technical-maintenance-api' +import { popUpMessageModel } from '@shared/ui/pop-up-message' +import { SelectPage } from '@shared/ui/select' const pageMounted = createEvent() const sendForm = createEvent() diff --git a/src/entities/tutorial/index.ts b/src/entities/tutorial/index.ts deleted file mode 100644 index 0221cc51c..000000000 --- a/src/entities/tutorial/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * as tutorialModel from './model' diff --git a/src/entities/tutorial/lib/initialize.ts b/src/entities/tutorial/lib/initialize.ts deleted file mode 100644 index cde59367e..000000000 --- a/src/entities/tutorial/lib/initialize.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { TUTORIAL_HASH } from '@shared/constants' -import { stringToHash } from '@shared/lib/stringToHash' - -import { tutorialModel } from '..' -import { commonTutorialIds } from './tutorials' - -export const initializeTutorials = () => { - const hash = stringToHash(JSON.stringify(commonTutorialIds)) - - tutorialModel.events.setRoles([]) - - const oldHash = localStorage.getItem(TUTORIAL_HASH) - if (hash !== Number(oldHash)) { - return tutorialModel.events.initialized([...commonTutorialIds]) - } - return tutorialModel.events.getTutorialData() -} diff --git a/src/features/acad-performance/lib/create-select-items.ts b/src/features/acad-performance/lib/create-select-items.ts index de228b85f..ac7f34a35 100644 --- a/src/features/acad-performance/lib/create-select-items.ts +++ b/src/features/acad-performance/lib/create-select-items.ts @@ -1,6 +1,5 @@ -import { SelectPage } from '@features/select' - -import findSemestr from '@utils/find-semestr' +import findSemestr from '@shared/lib/find-semestr' +import { SelectPage } from '@shared/ui/select' const createSelectItems = (course: number | string) => { const count = findSemestr(new Date().toISOString(), course) diff --git a/src/features/acad-performance/lib/find-percentage.ts b/src/features/acad-performance/lib/find-percentage.ts index 1b673c393..916d97e95 100644 --- a/src/features/acad-performance/lib/find-percentage.ts +++ b/src/features/acad-performance/lib/find-percentage.ts @@ -1,6 +1,5 @@ -import { AcadPerformance } from '@api/model/acad-performance' - -import { GradeByScore } from '@shared/constants' +import { AcadPerformance } from '@shared/api/model/acad-performance' +import { GradeByScore } from '@shared/consts' type Percentage = { 5: number diff --git a/src/features/acad-performance/lib/find-progress-bar-color.ts b/src/features/acad-performance/lib/find-progress-bar-color.ts index 761433802..d0f7747c9 100644 --- a/src/features/acad-performance/lib/find-progress-bar-color.ts +++ b/src/features/acad-performance/lib/find-progress-bar-color.ts @@ -1,6 +1,4 @@ -import { IGrade } from '@api/model/acad-performance' - -import { ColorsByGrade, IColorPalette } from '@shared/constants' +import { ColorsByGrade, IColorPalette, IGrade } from '@shared/consts' const findProgressBarColor = (grade: keyof IGrade | undefined, returnColor?: boolean): IColorPalette | string => { if (!!grade) { diff --git a/src/features/acad-performance/lib/search.ts b/src/features/acad-performance/lib/search.ts index 77bf16315..6001b0292 100644 --- a/src/features/acad-performance/lib/search.ts +++ b/src/features/acad-performance/lib/search.ts @@ -1,10 +1,8 @@ -import { AcadPerformance } from '@api/model/acad-performance' - import { prepareData } from '@entities/acad-performance/lib/prepare' +import { AcadPerformance } from '@shared/api/model/acad-performance' import localizeDate from '@shared/lib/dates/localize-date' - -import normalizeString from '@utils/normalize-string' +import normalizeString from '@shared/lib/normalize-string' const search = (value: string, subjects: AcadPerformance[]) => { return prepareData( diff --git a/src/features/acad-performance/ui/atoms/subject-checker.tsx b/src/features/acad-performance/ui/atoms/subject-checker.tsx index ffdbf35c5..94612b854 100644 --- a/src/features/acad-performance/ui/atoms/subject-checker.tsx +++ b/src/features/acad-performance/ui/atoms/subject-checker.tsx @@ -1,12 +1,11 @@ import React from 'react' import { HiOutlineCheck, HiOutlineX } from 'react-icons/hi' -import { IGrade } from '@api/model/acad-performance' import styled from 'styled-components' import findProgressBarColor from '@features/acad-performance/lib/find-progress-bar-color' -import { GradeByScore } from '@shared/constants' +import { GradeByScore, IGrade } from '@shared/consts' interface Props { grade: keyof IGrade | undefined diff --git a/src/features/acad-performance/ui/molecules/subject-item.tsx b/src/features/acad-performance/ui/molecules/subject-item.tsx index 6a5cb048c..61d78e7d6 100644 --- a/src/features/acad-performance/ui/molecules/subject-item.tsx +++ b/src/features/acad-performance/ui/molecules/subject-item.tsx @@ -1,21 +1,20 @@ import React from 'react' -import { AcadPerformance } from '@api/model/acad-performance' import styled from 'styled-components' -import { useModal } from 'widgets' import findProgressBarColor from '@features/acad-performance/lib/find-progress-bar-color' -import { getSubjectIcon } from '@features/acad-performance/lib/get-subject-icon' -import { Icon } from '@features/all-pages' -import { GradeByScore, IColorPalette } from '@shared/constants' +import { AcadPerformance } from '@shared/api/model/acad-performance' +import { GradeByScore, IColorPalette } from '@shared/consts' import localizeDate from '@shared/lib/dates/localize-date' +import getShortName from '@shared/lib/get-short-name' +import { getSubjectIcon } from '@shared/lib/get-subject-icon' import DotSeparatedWords from '@shared/ui/dot-separated-words' import Flex from '@shared/ui/flex' +import { Icon } from '@shared/ui/icon' +import { useModal } from '@shared/ui/modal' import Subtext from '@shared/ui/subtext' -import getShortName from '@utils/get-short-name' - import { SubjectModal } from '.' import { SubjectCheker } from '../atoms' diff --git a/src/features/acad-performance/ui/molecules/subject-items.tsx b/src/features/acad-performance/ui/molecules/subject-items.tsx index 0aedd1cfa..5f3e8bb87 100644 --- a/src/features/acad-performance/ui/molecules/subject-items.tsx +++ b/src/features/acad-performance/ui/molecules/subject-items.tsx @@ -1,8 +1,7 @@ import React, { memo } from 'react' -import { AcadPerformance } from '@api/model/acad-performance' - -import { Divider } from '@ui/atoms' +import { AcadPerformance } from '@shared/api/model/acad-performance' +import { Divider } from '@shared/ui/atoms' import { SubjectItem } from '.' diff --git a/src/features/acad-performance/ui/molecules/subject-modal.tsx b/src/features/acad-performance/ui/molecules/subject-modal.tsx index 180818976..321fe3baf 100644 --- a/src/features/acad-performance/ui/molecules/subject-modal.tsx +++ b/src/features/acad-performance/ui/molecules/subject-modal.tsx @@ -1,19 +1,17 @@ import React from 'react' -import { AcadPerformance } from '@api/model/acad-performance' import styled from 'styled-components' -import { User } from 'widgets' import { SubjectIconAndBackground } from '@features/schedule/ui/subject/subject-icon-and-background' +import User from '@features/user' -import { IColorPalette } from '@shared/constants' +import { AcadPerformance } from '@shared/api/model/acad-performance' +import { IColorPalette } from '@shared/consts' import localizeDate from '@shared/lib/dates/localize-date' +import findSemestr from '@shared/lib/find-semestr' +import KeyValue from '@shared/ui/atoms/key-value' import { Title } from '@shared/ui/title' -import KeyValue from '@ui/atoms/key-value' - -import findSemestr from '@utils/find-semestr' - const Container = styled.div` width: 400px; diff --git a/src/features/acad-performance/ui/organisms/graphic-info.tsx b/src/features/acad-performance/ui/organisms/graphic-info.tsx deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/features/add-new-chat/index.tsx b/src/features/add-new-chat/index.tsx index fec14ed90..222df6a80 100644 --- a/src/features/add-new-chat/index.tsx +++ b/src/features/add-new-chat/index.tsx @@ -2,8 +2,9 @@ import React from 'react' import { HiOutlinePencilAlt } from 'react-icons/hi' import styled from 'styled-components' -import { useModal } from 'widgets' -import { TutorialComponent } from 'widgets/tutorial/lib/with-tutorial' + +import { useModal } from '@shared/ui/modal' +import { TutorialComponent } from '@shared/ui/types' import { Modal } from './ui/modal' diff --git a/src/features/add-new-chat/ui/modal.tsx b/src/features/add-new-chat/ui/modal.tsx index 8784538bc..2b9adc920 100644 --- a/src/features/add-new-chat/ui/modal.tsx +++ b/src/features/add-new-chat/ui/modal.tsx @@ -3,22 +3,22 @@ import { FiUsers } from 'react-icons/fi' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { useModal } from 'widgets' -import ListOfPeople from 'widgets/list-of-people' -import Slider from 'widgets/slider' import GroupModal from '@features/groups-list/group-modal' -import SearchWithHints from '@features/search-with-hints' +import ListOfPeople from '@features/list-of-people' import { paginationList as studentPaginationList } from '@entities/all-students' import { paginationList as teacherPaginationList } from '@entities/all-teachers' -import { userModel } from '@entities/user' import { studentApi } from '@shared/api' import { getGroups } from '@shared/api/student-api' import { getDivisions } from '@shared/api/teacher-api' import Masks from '@shared/lib/masks' +import { userModel } from '@shared/session' import { Wrapper } from '@shared/ui/atoms' +import { useModal } from '@shared/ui/modal' +import SearchWithHints from '@shared/ui/search-with-hints' +import Slider from '@shared/ui/slider' import { addNewChatModel } from '../model' import { SearchType } from '../type' @@ -40,16 +40,16 @@ export const Modal = () => { useEffect(() => { // doesn't work in sample xd - if (user.currentUser) { - addNewChatModel.events.setSearchMode(user.currentUser.user_status === 'stud' ? 'employee' : 'student') + if (user) { + addNewChatModel.events.setSearchMode(user.user_status === 'stud' ? 'employee' : 'student') } - }, [user.currentUser]) + }, [user]) useEffect(() => { setGroupSearch('') }, [searchMode]) - if (!user.currentUser) return null + if (!user) return null return ( diff --git a/src/features/all-pages/lib/get-group-pages.ts b/src/features/all-pages/lib/get-group-pages.ts index ff0a93303..909d61c48 100644 --- a/src/features/all-pages/lib/get-group-pages.ts +++ b/src/features/all-pages/lib/get-group-pages.ts @@ -1,8 +1,7 @@ -import { Groups, IRoutes } from '@app/routes/general-routes' +import { PETeacher } from '@shared/api/physical-education' +import { Groups, IRoutes, pageGroups } from '@shared/routing' -import { PETeacher } from '@entities/pe-teacher/types' - -type RoutesOrder = Record +type RoutesOrder = Record<(typeof pageGroups)[Groups], number> export const routesOrder: RoutesOrder = { Основное: 0, @@ -24,7 +23,7 @@ const getGroupPages = (routes: IRoutes | null, peTeacher: PETeacher | null, user ) .reduce( (acc, route) => { - const group = route?.group ? Groups[route.group] : Groups.OTHER + const group = (route?.group ? pageGroups[route.group] : pageGroups.OTHER) as Groups if (!acc[group]) acc[group] = {} acc[group][route.id] = route diff --git a/src/features/all-pages/lib/search.ts b/src/features/all-pages/lib/search.ts index b70192d2f..b44df6e05 100644 --- a/src/features/all-pages/lib/search.ts +++ b/src/features/all-pages/lib/search.ts @@ -1,19 +1,18 @@ -import { IRoute, IRoutes } from '@app/routes/general-routes' - -import normalizeString from '@utils/normalize-string' +import normalizeString from '@shared/lib/normalize-string' +import { IRoutes, Page } from '@shared/routing' const search = (value: string, routes: IRoutes) => { return Object.values(routes).reduce( (acc, el) => { if ( - normalizeString(el.title).includes(normalizeString(value)) || + normalizeString(el.title ?? '').includes(normalizeString(value)) || el?.keywords?.find((word) => normalizeString(word).includes(normalizeString(value))) ) { acc[el.id] = el } return acc }, - {} as { [key: string]: IRoute }, + {} as { [key: string]: Page }, ) } diff --git a/src/features/all-pages/model/index.ts b/src/features/all-pages/model/index.ts index 02f38fa9b..3b7e15733 100644 --- a/src/features/all-pages/model/index.ts +++ b/src/features/all-pages/model/index.ts @@ -1,16 +1,16 @@ import { combine, createEvent, sample } from 'effector' import { adminLinksModel } from '@entities/admin-links' -import { popUpMessageModel } from '@entities/pop-up-message' import { userSettingsModel } from '@entities/settings' -import { userModel } from '@entities/user' import { REQUIRED_HOME_PAGES_CONFIG, REQUIRED_LEFTSIDE_BAR_CONFIG, REQUIRED_TEACHER_LEFTSIDE_BAR_CONFIG, SIDEBAR_ITEMS_LIMIT_SIZE, -} from '@shared/constants' +} from '@shared/consts' +import { userModel } from '@shared/session' +import { popUpMessageModel } from '@shared/ui/pop-up-message' export const addPageToHome = createEvent<{ pageId: string }>() export const deletePageFromHome = createEvent<{ pageId: string }>() @@ -50,19 +50,15 @@ sample({ export const addPageToSidebar = createEvent<{ pageId: string }>() export const deletePageFromSidebar = createEvent<{ pageId: string }>() -export const $requiredSidebarItems = combine( - userModel.stores.user, - adminLinksModel.store, - ({ currentUser }, { data }) => { - if (currentUser?.status === '') { - return REQUIRED_LEFTSIDE_BAR_CONFIG - } +export const $requiredSidebarItems = combine(userModel.stores.user, adminLinksModel.store, (currentUser, { data }) => { + if (currentUser?.status === '') { + return REQUIRED_LEFTSIDE_BAR_CONFIG + } - const config = REQUIRED_TEACHER_LEFTSIDE_BAR_CONFIG + const config = REQUIRED_TEACHER_LEFTSIDE_BAR_CONFIG - return Object.values(data ?? {}).some((l) => l.length) ? [...config, 'download-agreements'] : config - }, -) + return Object.values(data ?? {}).some((l) => l.length) ? [...config, 'download-agreements'] : config +}) export const $sidebarItems = combine( $requiredSidebarItems, diff --git a/src/features/all-pages/ui/index.ts b/src/features/all-pages/ui/index.ts index 0279920ca..ca40c50e9 100644 --- a/src/features/all-pages/ui/index.ts +++ b/src/features/all-pages/ui/index.ts @@ -1,3 +1,2 @@ -export * from './atoms' export * from './molecules' export * from './organisms' diff --git a/src/features/all-pages/ui/molecules/all-pages-link.tsx b/src/features/all-pages/ui/molecules/all-pages-link.tsx index 25040bc07..0ac6b88d6 100644 --- a/src/features/all-pages/ui/molecules/all-pages-link.tsx +++ b/src/features/all-pages/ui/molecules/all-pages-link.tsx @@ -4,11 +4,11 @@ import { Link } from 'react-router-dom' import styled from 'styled-components' -import { ALL_ROUTE } from '@app/routes/general-routes' - import { menuModel } from '@entities/menu' -import Icon from '../atoms/icon' +import { ALL_ROUTE } from '@shared/routing' + +import Icon from '../../../../shared/ui/icon/icon' import { PageLinkWrapper } from './page-link-content' const AllPagesLinkWrapper = styled(PageLinkWrapper)` diff --git a/src/features/all-pages/ui/molecules/page-link-content.tsx b/src/features/all-pages/ui/molecules/page-link-content.tsx index 4d4f7abd5..97cdd3921 100644 --- a/src/features/all-pages/ui/molecules/page-link-content.tsx +++ b/src/features/all-pages/ui/molecules/page-link-content.tsx @@ -10,14 +10,12 @@ import LinkMoreButton from '@features/link-more-button' import { userSettingsModel } from '@entities/settings' -import { Colors, IColors } from '@shared/constants' +import { Colors, IColors } from '@shared/consts' +import getCorrectWordForm from '@shared/lib/get-correct-word-form' +import BlockWrapper from '@shared/ui/block/styles' +import { Button } from '@shared/ui/button' -import BlockWrapper from '@ui/block/styles' -import { Button } from '@ui/button' - -import getCorrectWordForm from '@utils/get-correct-word-form' - -import Icon from '../atoms/icon' +import Icon from '../../../../shared/ui/icon/icon' import { PageLinkProps } from './page-link' export const PageLinkWrapper = styled(BlockWrapper)<{ @@ -165,9 +163,9 @@ const PageLinkContent = (props: PageLinkProps & { maxWordLength: number }) => { notifications, title, isNew, - icon, - isExternalPage, - isOldLkPage, + icon: PageLinkIcon, + isExternal, + isOldLK, mode, id, orientation = 'vertical', @@ -189,19 +187,19 @@ const PageLinkContent = (props: PageLinkProps & { maxWordLength: number }) => { isVertical={isVertical} justifyContent="center" shadow={shadow} - color={color.length ? color : 'blue'} + color={color ?? 'blue'} hasNotifications={!!notifications} data-selected={props.isActive} > - {(isOldLkPage || isExternalPage) && isVertical && ( + {(isOldLK || isExternal) && isVertical && ( - {isOldLkPage && } - {isExternalPage && } + {isOldLK && } + {isExternal && } )}
- - {icon ?? } + + {PageLinkIcon ? : } {title} {!!notifications && ( diff --git a/src/features/all-pages/ui/molecules/page-link.tsx b/src/features/all-pages/ui/molecules/page-link.tsx index df1a735dd..6ac7dba35 100644 --- a/src/features/all-pages/ui/molecules/page-link.tsx +++ b/src/features/all-pages/ui/molecules/page-link.tsx @@ -2,14 +2,12 @@ import React from 'react' import { Link } from 'react-router-dom' import styled from 'styled-components' -import { useModal } from 'widgets' -import { TutorialComponent } from 'widgets/tutorial/lib/with-tutorial' - -import { IRoute } from '@app/routes/general-routes' import { menuModel } from '@entities/menu' -import { Direction } from '@ui/types' +import { Page } from '@shared/routing' +import { useModal } from '@shared/ui/modal' +import { Direction, TutorialComponent } from '@shared/ui/types' import PageLinkContent from './page-link-content' @@ -30,7 +28,7 @@ const AddPageWrapper = styled.div<{ width: number | string }>` export type PageLinkMode = 'use' | 'add' -export type PageLinkProps = IRoute & { +export type PageLinkProps = Page & { orientation?: Direction shadow?: boolean mode?: PageLinkMode diff --git a/src/features/all-pages/ui/organisms/found-pages.tsx b/src/features/all-pages/ui/organisms/found-pages.tsx index fbe5c95de..a0b38b87f 100644 --- a/src/features/all-pages/ui/organisms/found-pages.tsx +++ b/src/features/all-pages/ui/organisms/found-pages.tsx @@ -2,9 +2,8 @@ import React from 'react' import styled from 'styled-components' -import { IRoutes } from '@app/routes/general-routes' - -import { Error } from '@ui/error' +import { IRoutes } from '@shared/routing' +import { Error } from '@shared/ui/error' import { PageLink } from '../molecules' diff --git a/src/pages/all-staff/lib/find-employee-by-fio.ts b/src/features/all-staff/lib/find-employee-by-fio.ts similarity index 100% rename from src/pages/all-staff/lib/find-employee-by-fio.ts rename to src/features/all-staff/lib/find-employee-by-fio.ts diff --git a/src/pages/all-staff/lib/find-employee.ts b/src/features/all-staff/lib/find-employee.ts similarity index 100% rename from src/pages/all-staff/lib/find-employee.ts rename to src/features/all-staff/lib/find-employee.ts diff --git a/src/pages/all-staff/lib/find-subdivision-by-name.ts b/src/features/all-staff/lib/find-subdivision-by-name.ts similarity index 100% rename from src/pages/all-staff/lib/find-subdivision-by-name.ts rename to src/features/all-staff/lib/find-subdivision-by-name.ts diff --git a/src/pages/all-staff/lib/get-employee-info.ts b/src/features/all-staff/lib/get-employee-info.ts similarity index 100% rename from src/pages/all-staff/lib/get-employee-info.ts rename to src/features/all-staff/lib/get-employee-info.ts diff --git a/src/pages/all-staff/lib/get-subdivision-info.ts b/src/features/all-staff/lib/get-subdivision-info.ts similarity index 100% rename from src/pages/all-staff/lib/get-subdivision-info.ts rename to src/features/all-staff/lib/get-subdivision-info.ts diff --git a/src/pages/all-staff/lib/get-subdivision-path.ts b/src/features/all-staff/lib/get-subdivision-path.ts similarity index 100% rename from src/pages/all-staff/lib/get-subdivision-path.ts rename to src/features/all-staff/lib/get-subdivision-path.ts diff --git a/src/pages/all-staff/ui/staff-modal.tsx b/src/features/all-staff/staff-modal.tsx similarity index 72% rename from src/pages/all-staff/ui/staff-modal.tsx rename to src/features/all-staff/staff-modal.tsx index c3e223648..4682108f9 100644 --- a/src/pages/all-staff/ui/staff-modal.tsx +++ b/src/features/all-staff/staff-modal.tsx @@ -1,15 +1,17 @@ import React from 'react' import { useUnit } from 'effector-react' -import { UserProps } from 'widgets/user/types' -import { TeacherModal } from 'widgets/user/ui' + +import { TeacherModal } from '@features/user/ui' import { phonebookModel } from '@entities/phonebook' -import { userModel } from '@entities/user' -import { findEmployeeByFio } from '../lib/find-employee-by-fio' -import { getEmployeeInfo } from '../lib/get-employee-info' -import { PhonebookModal } from './phonebook-modal' +import { userModel } from '@shared/session' +import { UserProps } from '@shared/ui/user-header/types' + +import { findEmployeeByFio } from './lib/find-employee-by-fio' +import { getEmployeeInfo } from './lib/get-employee-info' +import { PhonebookModal } from './ui/phonebook-modal' type Props = Pick diff --git a/src/pages/all-staff/styled/index.ts b/src/features/all-staff/styled/index.ts similarity index 97% rename from src/pages/all-staff/styled/index.ts rename to src/features/all-staff/styled/index.ts index 810070511..a278b9b25 100644 --- a/src/pages/all-staff/styled/index.ts +++ b/src/features/all-staff/styled/index.ts @@ -2,7 +2,7 @@ import { Link } from 'react-router-dom' import styled from 'styled-components' -import { MEDIA_QUERIES } from '@shared/constants' +import { MEDIA_QUERIES } from '@shared/ui/consts' import Flex from '@shared/ui/flex' export const Header = styled.div<{ isEmployee: boolean }>` diff --git a/src/pages/all-staff/info-item.tsx b/src/features/all-staff/ui/info-item.tsx similarity index 100% rename from src/pages/all-staff/info-item.tsx rename to src/features/all-staff/ui/info-item.tsx diff --git a/src/pages/all-staff/ui/phonebook-modal.tsx b/src/features/all-staff/ui/phonebook-modal.tsx similarity index 95% rename from src/pages/all-staff/ui/phonebook-modal.tsx rename to src/features/all-staff/ui/phonebook-modal.tsx index 8db791038..4f699017e 100644 --- a/src/pages/all-staff/ui/phonebook-modal.tsx +++ b/src/features/all-staff/ui/phonebook-modal.tsx @@ -4,30 +4,28 @@ import { Link } from 'react-router-dom' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { useModal } from 'widgets' -import { ALL_TEACHERS_ROUTE, SCHEDULE_FILTER_ROUTE } from '@app/routes/general-routes' - -import { SiteName } from '@pages/teachers-applications/pages/contact-details/lib/get-form' - -import Avatar from '@features/home/ui/molecules/avatar' import { SendMessage } from '@features/send-first-message' import { getEnrichedTemplatePath } from '@entities/menu/lib/get-enriched-template-path' import { phonebookModel } from '@entities/phonebook' -import useCurrentDevice from '@shared/lib/hooks/use-current-device' +import { SiteName } from '@shared/lib' +import { ALL_TEACHERS_ROUTE, SCHEDULE_FILTER_ROUTE } from '@shared/routing' +import Avatar from '@shared/ui/avatar' import { Button } from '@shared/ui/button' import Flex from '@shared/ui/flex' +import useCurrentDevice from '@shared/ui/hooks/use-current-device' import List from '@shared/ui/list' +import { useModal } from '@shared/ui/modal' import UserHeaderBackground from '@shared/ui/user-header/user-header-background' -import { InfoItem } from '../info-item' import { findEmployeeByFio } from '../lib/find-employee-by-fio' import { findSubdivisionByName } from '../lib/find-subdivision-by-name' import { getEmployeeInfo } from '../lib/get-employee-info' import { getSubdivisionInfo } from '../lib/get-subdivision-info' import { AvatarWrapper, Buttons, Content, Header, LinkStyled, Subtitle, Title, Wrapper } from '../styled' +import { InfoItem } from './info-item' import { PlaceModal } from './place-modal' export type PhonebookInfo = { diff --git a/src/pages/all-staff/ui/place-modal.tsx b/src/features/all-staff/ui/place-modal.tsx similarity index 99% rename from src/pages/all-staff/ui/place-modal.tsx rename to src/features/all-staff/ui/place-modal.tsx index 3dc51a55c..5bdc1b1a3 100644 --- a/src/pages/all-staff/ui/place-modal.tsx +++ b/src/features/all-staff/ui/place-modal.tsx @@ -2,9 +2,8 @@ import React from 'react' import styled from 'styled-components' -import { SiteName } from '@pages/teachers-applications/pages/contact-details/lib/get-form' - -import { MEDIA_QUERIES } from '@shared/constants' +import { SiteName } from '@shared/lib' +import { MEDIA_QUERIES } from '@shared/ui/consts' export const PlaceModal = ({ place }: { place: SiteName }) => { return ( diff --git a/src/features/applications/lib/create-application-search.ts b/src/features/applications/lib/create-application-search.ts index 3e7651c5a..8f1b8540d 100644 --- a/src/features/applications/lib/create-application-search.ts +++ b/src/features/applications/lib/create-application-search.ts @@ -1,4 +1,4 @@ -import normalizeString from '@utils/normalize-string' +import normalizeString from '@shared/lib/normalize-string' import { Section } from '../ui/molecules/create-application-list' diff --git a/src/features/applications/lib/get-address-fields.ts b/src/features/applications/lib/get-address-fields.ts index 7e4d7d0d4..f51c6e658 100644 --- a/src/features/applications/lib/get-address-fields.ts +++ b/src/features/applications/lib/get-address-fields.ts @@ -1,4 +1,4 @@ -import { IInputAreaData } from '@ui/input-area/model' +import { IInputAreaData } from '@shared/ui/input-area/model' const getAddressFields = (): IInputAreaData[] => { return [ diff --git a/src/features/applications/lib/get-applications-columns.tsx b/src/features/applications/lib/get-applications-columns.tsx index 2c72bf4e8..335aeadd8 100644 --- a/src/features/applications/lib/get-applications-columns.tsx +++ b/src/features/applications/lib/get-applications-columns.tsx @@ -5,11 +5,10 @@ import { ApplicationStatusType, ApplicationsConstants } from '@entities/applicat import { LinkButton } from '@shared/ui/atoms' import Flex from '@shared/ui/flex' +import { Message } from '@shared/ui/message' +import { ColumnProps } from '@shared/ui/table/types' import { Tooltip } from '@shared/ui/tooltip' -import { Message } from '@ui/message' -import { ColumnProps } from '@ui/table/types' - import { ApplicationFileOutput } from '../../../shared/api/model/applications' const getApplicationsColumns = (): ColumnProps[] => { diff --git a/src/features/applications/lib/get-divisions.ts b/src/features/applications/lib/get-divisions.ts index 01a8d7288..ea78a7888 100644 --- a/src/features/applications/lib/get-divisions.ts +++ b/src/features/applications/lib/get-divisions.ts @@ -1,8 +1,4 @@ -export type divisionT = { - id: string - name: string - contact: string -} +import { divisionT } from '@shared/api/model' export const getFormattedDivisions = (divisions: divisionT[]) => { return divisions.map((division) => { diff --git a/src/features/applications/lib/get-extended-application-columns.tsx b/src/features/applications/lib/get-extended-application-columns.tsx index 9d57dfa34..4677599c8 100644 --- a/src/features/applications/lib/get-extended-application-columns.tsx +++ b/src/features/applications/lib/get-extended-application-columns.tsx @@ -1,12 +1,11 @@ import React from 'react' import { ApplicationFileOutput } from '@shared/api/model' -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' import { Button } from '@shared/ui/atoms' import Flex from '@shared/ui/flex' import Subtext from '@shared/ui/subtext' - -import { ColumnProps } from '@ui/table/types' +import { ColumnProps } from '@shared/ui/table/types' import { getCommonApplicationsColumns } from './get-applications-columns' diff --git a/src/features/applications/lib/get-formatted-subdivisions.ts b/src/features/applications/lib/get-formatted-subdivisions.ts index 1ef7d74d7..abcb2ae32 100644 --- a/src/features/applications/lib/get-formatted-subdivisions.ts +++ b/src/features/applications/lib/get-formatted-subdivisions.ts @@ -1,4 +1,4 @@ -import { Subdivision } from '@api/model' +import { Subdivision } from '@shared/api/model' export const getFormattedSubDivisions = (subdivisions: Subdivision[] = []) => { return subdivisions.map((subdivision) => { diff --git a/src/features/applications/lib/get-list-configs-certificate.ts b/src/features/applications/lib/get-list-configs-certificate.ts index 84fdd5309..453a86906 100644 --- a/src/features/applications/lib/get-list-configs-certificate.ts +++ b/src/features/applications/lib/get-list-configs-certificate.ts @@ -1,4 +1,4 @@ -import { getCertForm } from '@pages/medical-certificate/lib/cert-form' +import { getCertForm } from '@features/medical-certificate/lib/cert-form' export const listConfigCert = { kvdCert: getCertForm({ diff --git a/src/features/applications/lib/get-method-obtaining-fields.ts b/src/features/applications/lib/get-method-obtaining-fields.ts index 69880a861..f224c24fd 100644 --- a/src/features/applications/lib/get-method-obtaining-fields.ts +++ b/src/features/applications/lib/get-method-obtaining-fields.ts @@ -1,6 +1,6 @@ import { TeacherMethodObtainingOptions } from '@entities/applications/consts' -import { IInputAreaData } from '@ui/input-area/model' +import { IInputAreaData } from '@shared/ui/input-area/model' const getMethodObtainingFields = (): IInputAreaData[] => { return [ diff --git a/src/features/applications/lib/get-section-links.ts b/src/features/applications/lib/get-section-links.ts index 86b3d54c6..d6c95dede 100644 --- a/src/features/applications/lib/get-section-links.ts +++ b/src/features/applications/lib/get-section-links.ts @@ -1,4 +1,6 @@ -import { MEDICAL_CERTIFICATE } from '@app/routes/general-routes' +import { Section } from '@features/applications/ui/molecules/create-application-list' + +import { RECEPTION_COMMISSION, UNION_ORGANIZATION, isProduction } from '@shared/consts' import { ACADEMIC_LEAVE_ACCOMMODATION, ACCOMMODATION_CORRESPONDENCE_FORM, @@ -17,6 +19,7 @@ import { HOLIDAYS_AFTER_TRAINING, INCREASED_STATE_ACADEMIC_SCHOLARSHIP, INDEPENDENTLY_DEDUCTED, + MEDICAL_CERTIFICATE, MEDICAL_CERTIFICATES_086, MILITARY_COPIES, MILITARY_FORM_4, @@ -35,15 +38,11 @@ import { SOCIAL_AGENCIES, SOCIAL_SCOLLARSHIP, STATE_ACCREDITATION, - STUDENT_EMPLOYMENT_APP_ROUTE, + STUDENT_EMPLOYMENT_APPLICATION_ROUTE, STUDENT_STATUS, + TECHNICAL_MAINTENANCE, TERMINATION_OF_EMPLOYMENT_CONTRACT, -} from '@app/routes/routes' -import { TECHNICAL_MAINTENANCE } from '@app/routes/teacher-routes' - -import { Section } from '@features/applications/ui/molecules/create-application-list' - -import { RECEPTION_COMMISSION, UNION_ORGANIZATION, isProduction } from '@shared/constants' +} from '@shared/routing' const getSectionLinks = (): Section[] => { const additionalHeaderClosedService = isProduction ? ' (Сервис временно недоступен)' : '' @@ -220,7 +219,7 @@ const getSectionLinks = (): Section[] => { disabled: isProduction, links: [ { - link: STUDENT_EMPLOYMENT_APP_ROUTE, + link: STUDENT_EMPLOYMENT_APPLICATION_ROUTE, title: 'Трудоустройство студентов', }, ], diff --git a/src/features/applications/lib/get-student-method-obtaining-fields.ts b/src/features/applications/lib/get-student-method-obtaining-fields.ts index ce315583e..28a9d197d 100644 --- a/src/features/applications/lib/get-student-method-obtaining-fields.ts +++ b/src/features/applications/lib/get-student-method-obtaining-fields.ts @@ -1,6 +1,6 @@ import { MethodObtainingOptions } from '@entities/applications/consts' -import { IInputAreaData } from '@ui/input-area/model' +import { IInputAreaData } from '@shared/ui/input-area/model' export const getStudentMethodObtainingFields = (): IInputAreaData[] => { return [ diff --git a/src/features/applications/lib/get-subdivisions.ts b/src/features/applications/lib/get-subdivisions.ts index 15181b8a1..7e1bf1436 100644 --- a/src/features/applications/lib/get-subdivisions.ts +++ b/src/features/applications/lib/get-subdivisions.ts @@ -1,4 +1,4 @@ -import { Division } from '@api/model' +import { Division } from '@shared/api/model' export const getSubivisions = (subdivisions: Division[] = []) => subdivisions.map((subdivision) => ({ diff --git a/src/features/applications/lib/get-teachers-section-links.ts b/src/features/applications/lib/get-teachers-section-links.ts index b0667a926..d6d74794e 100644 --- a/src/features/applications/lib/get-teachers-section-links.ts +++ b/src/features/applications/lib/get-teachers-section-links.ts @@ -1,13 +1,9 @@ +import { User } from '@shared/api/model' +import { UNION_ORGANIZATION, isProduction } from '@shared/consts' import { ARBITRARY_REQUEST, - BUFFER_DISMISSAL, // BUFFER_EXTRA_HOLIDAY_COLL, - BUFFER_HOLIDAY_PLANNING, - BUFFER_HOLIDAY_TRANSFER, - BUFFER_HOLIDAY_WORK, - BUFFER_MEDICAL_EXAMINATION, // BUFFER_HOLIDAY_POSTPONED, - BUFFER_WORK_TRANSFER, CERTIFICATE_FROM_PLACE_OF_WORK, CERTIFICATE_OF_WORK_EXPERIENCE, CERTIFICATE_TIME_PARENTAL_LEAVE, @@ -23,7 +19,7 @@ import { EDIT_PHONEBOOK_INNER_PHONE, EDIT_PHONEBOOK_SUBDIVISION, GETTING_COMPUTER_EQUIPMENT, - GUESTS_ACCOMODATION_ON_CAMPUS, + GUESTS_ACCOMMODATION_ON_CAMPUS, GUESTS_PASSAGE_TO_CAMPUS, GUEST_PASS, INCREASE_ANTIPLAGIAT_LIMITS, @@ -32,7 +28,6 @@ import { LIVING_IN_RESIDENTIAL_PREMISES, NUMBER_OF_UNUSED_VACATION_DAYS, OTHER_IT_SERVICES, - PARTTIME_EMPLOYMENT, PAYMENT_FOR_CHILD_CARE, PAYMENT_OF_CHILD_BIRTH_ALLOWANCE, PERSONA_INCOME_TAX_REFERENCE, @@ -44,10 +39,7 @@ import { TERMINATION_OF_AGREEMENT, VISA_CERTIFICATE, WORK_ON_TERMS_OF_EXTERNAL_CONCURRENCY, -} from '@app/routes/teacher-routes' - -import { User } from '@shared/api/model' -import { UNION_ORGANIZATION, isProduction } from '@shared/constants' +} from '@shared/routing' import { Section } from '../ui/molecules/create-application-list' @@ -147,7 +139,7 @@ const getInDevelopmentStaffLinks = () => [ disabled: isProduction, links: [ { link: LIVING_IN_RESIDENTIAL_PREMISES, title: 'Предоставление права проживания в жилом помещении' }, - { link: GUESTS_ACCOMODATION_ON_CAMPUS, title: 'Временное размещение гостей в студгородке' }, + { link: GUESTS_ACCOMMODATION_ON_CAMPUS, title: 'Временное размещение гостей в студгородке' }, { link: GUESTS_PASSAGE_TO_CAMPUS, title: 'Проход гостей на территорию студенческого городка' }, { link: RELOCATION, title: 'Переселение' }, { link: TERMINATION_OF_AGREEMENT, title: 'Расторжение договора найма жилого помещения' }, @@ -211,30 +203,7 @@ const getTeachersHRSectionLinks = () => { return [ { title: '', - links: [ - //{ link: PARTTIME_EMPLOYMENT, title: 'Заявление на трудоустройство по совместительству' }, - //{ link: HOLIDAY_POSTPONED, title: 'Заявление на перенос отпуска' }, - { link: PARTTIME_EMPLOYMENT, title: 'Заявление на трудоустройство по совместительству' }, - // { link: BUFFER_HOLIDAY_POSTPONED, title: 'Заявление на перенос отпуска' }, - { link: BUFFER_DISMISSAL, title: 'Заявление на увольнение' }, - { link: BUFFER_HOLIDAY_WORK, title: 'Заявление о привлечении к работе в выходной день' }, - { link: BUFFER_HOLIDAY_PLANNING, title: 'Заявление о предоставлении отпуска' }, - { link: BUFFER_HOLIDAY_TRANSFER, title: 'Заявление о переносе отпуска' }, - { link: BUFFER_MEDICAL_EXAMINATION, title: 'Заявление о диспансеризации' }, - { link: BUFFER_WORK_TRANSFER, title: 'Заявление на перевод' }, - // { - // link: BUFFER_EXTRA_HOLIDAY_COLL, - // title: 'Заявление о предоставлении дополнительного отпуска по коллективному договору', - // }, - // { link: DISMISSAL, title: 'Заявление на увольнение' }, - //{ link: HOLIDAY_WORK, title: 'Заявление о привлечении к работе в выходной день' }, - // { link: HOLIDAY_PLANNING, title: 'Заявление о предоставлении отпуска' }, - //{ link: WORK_TRANSFER, title: 'Заявление на перевод' }, - // { - // link: EXTRA_HOLIDAY_COLL, - // title: 'Заявление о предоставлении дополнительного отпуска по коллективному договору', - // }, - ], + links: [], }, ] } diff --git a/src/features/applications/ui/lib/isEnabledForDegreeLevel.ts b/src/features/applications/ui/lib/isEnabledForDegreeLevel.ts index 388ae6b10..9c37b401d 100644 --- a/src/features/applications/ui/lib/isEnabledForDegreeLevel.ts +++ b/src/features/applications/ui/lib/isEnabledForDegreeLevel.ts @@ -1,4 +1,4 @@ -import { User } from '@api/model' +import { User } from '@shared/api/model' const isEnabledForDegreeLevel = ( currentDegreeLevel: User['degreeLevel'] | undefined, diff --git a/src/features/applications/ui/lib/isEnabledForEducationForm.ts b/src/features/applications/ui/lib/isEnabledForEducationForm.ts index 51766e29b..a56019012 100644 --- a/src/features/applications/ui/lib/isEnabledForEducationForm.ts +++ b/src/features/applications/ui/lib/isEnabledForEducationForm.ts @@ -1,4 +1,4 @@ -import { User } from '@api/model' +import { User } from '@shared/api/model' const isEnabledForEducationForm = ( currentEducationForm: User['educationForm'] | undefined, diff --git a/src/features/applications/ui/molecules/create-application-list.tsx b/src/features/applications/ui/molecules/create-application-list.tsx index f2a010af2..34f2fbfc5 100644 --- a/src/features/applications/ui/molecules/create-application-list.tsx +++ b/src/features/applications/ui/molecules/create-application-list.tsx @@ -1,23 +1,21 @@ import React, { useState } from 'react' import { Link } from 'react-router-dom' -import { User } from '@api/model' import styled from 'styled-components' -import { useModal } from 'widgets' import createApplicationSearch from '@features/applications/lib/create-application-search' import getSectionLinks from '@features/applications/lib/get-section-links' import { getTeachersSectionLinks } from '@features/applications/lib/get-teachers-section-links' import isEnabledForEducationForm from '@features/applications/ui/lib/isEnabledForEducationForm' -import { userModel } from '@entities/user' - +import { User } from '@shared/api/model' +import { userModel } from '@shared/session' +import { Error } from '@shared/ui/error' import Flex from '@shared/ui/flex' +import { useModal } from '@shared/ui/modal' +import { LocalSearch } from '@shared/ui/molecules' import Subtext from '@shared/ui/subtext' - -import { Error } from '@ui/error' -import { LocalSearch } from '@ui/molecules' -import { Title } from '@ui/title' +import { Title } from '@shared/ui/title' import isEnabledForDegreeLevel from '../lib/isEnabledForDegreeLevel' diff --git a/src/features/applications/ui/molecules/step-by-step-form.tsx b/src/features/applications/ui/molecules/step-by-step-form.tsx index e83f6acd5..d5528b98a 100644 --- a/src/features/applications/ui/molecules/step-by-step-form.tsx +++ b/src/features/applications/ui/molecules/step-by-step-form.tsx @@ -2,15 +2,14 @@ import React, { useEffect, useState } from 'react' import styled from 'styled-components' -import { Colors } from '@shared/constants' +import checkFormFields from '@features/send-form/check-form-fields' + +import { Colors } from '@shared/consts' import { Button } from '@shared/ui/atoms' import Flex from '@shared/ui/flex' - -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' -import { Line } from '@ui/timeline/ui' - -import checkFormFields from '@utils/check-form-fields' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' +import { Line } from '@shared/ui/timeline/ui' type HiddenProps = { reached?: boolean diff --git a/src/features/change-avatar/index.tsx b/src/features/change-avatar/index.tsx index 3b60dba86..fb33bfb2d 100644 --- a/src/features/change-avatar/index.tsx +++ b/src/features/change-avatar/index.tsx @@ -2,12 +2,11 @@ import React, { useEffect, useState } from 'react' import styled from 'styled-components' -import { confirmModel } from '@entities/confirm' -import { userModel } from '@entities/user' - import { changeAvatar } from '@shared/api/user-api' -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' +import { userModel } from '@shared/session' import { Message, SubmitButton } from '@shared/ui/atoms' +import { confirmModel } from '@shared/ui/confirm' import FileInput from '@shared/ui/file-input' import List from '@shared/ui/list' import useSubmitButton from '@shared/ui/submit-button/use-submit-button' diff --git a/src/features/change-password/index.tsx b/src/features/change-password/index.tsx index 6dd4adaeb..31e0b122e 100644 --- a/src/features/change-password/index.tsx +++ b/src/features/change-password/index.tsx @@ -1,13 +1,12 @@ import React, { useState } from 'react' -import { useModal } from 'widgets' - import { changePassword } from '@shared/api/user-api' import useFormValidation from '@shared/lib/hooks/use-form-validation' import { AnimatedCheck, Button, Input, SubmitButton, Title } from '@shared/ui/atoms' import Checkbox from '@shared/ui/checkbox' import List from '@shared/ui/list' import { Message } from '@shared/ui/message' +import { useModal } from '@shared/ui/modal' import ProgressBar from '@shared/ui/progress-bar' import Subtext from '@shared/ui/subtext' diff --git a/src/features/chat/lib/search-chats.ts b/src/features/chat/lib/search-chats.ts index 4a01a1d5a..6c7c288e4 100644 --- a/src/features/chat/lib/search-chats.ts +++ b/src/features/chat/lib/search-chats.ts @@ -1,6 +1,6 @@ import { Chat } from '@entities/chats' -import normalizeString from '@utils/normalize-string' +import normalizeString from '@shared/lib/normalize-string' type SearchChatsParams = { search: string diff --git a/src/features/chat/ui/atoms/chat-item-wrapper.ts b/src/features/chat/ui/atoms/chat-item-wrapper.ts index 0ba806c7b..67303e105 100644 --- a/src/features/chat/ui/atoms/chat-item-wrapper.ts +++ b/src/features/chat/ui/atoms/chat-item-wrapper.ts @@ -2,7 +2,7 @@ import { Link } from 'react-router-dom' import styled from 'styled-components' -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' const ChatItemWrapper = styled(Link)<{ isChosen: boolean; isOpen: boolean }>` text-decoration: none; diff --git a/src/features/chat/ui/atoms/chat-item.tsx b/src/features/chat/ui/atoms/chat-item.tsx index 82648d795..271ee1e02 100644 --- a/src/features/chat/ui/atoms/chat-item.tsx +++ b/src/features/chat/ui/atoms/chat-item.tsx @@ -4,13 +4,12 @@ import { useRouteMatch } from 'react-router' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { CHAT_ROUTE, TEMPLATE_CHAT_ROUTE } from '@app/routes/general-routes' - -import Avatar from '@features/home/ui/molecules/avatar' - import { chatMessagesModel } from '@entities/chat-messages' import { Chat } from '@entities/chats' +import { CHAT_ROUTE, TEMPLATE_CHAT_ROUTE } from '@shared/routing' +import Avatar from '@shared/ui/avatar' + import Badge from '../../../../shared/ui/badge' import Flex from '../../../../shared/ui/flex' import Subtext from '../../../../shared/ui/subtext' diff --git a/src/features/chat/ui/atoms/file-view.tsx b/src/features/chat/ui/atoms/file-view.tsx index 1406ebd6f..6109c6394 100644 --- a/src/features/chat/ui/atoms/file-view.tsx +++ b/src/features/chat/ui/atoms/file-view.tsx @@ -6,7 +6,7 @@ import styled from 'styled-components' import { ChatFile } from '@entities/chat-messages/type' -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' import { downloadFile } from '@shared/lib/download-file' type FileProps = { diff --git a/src/features/chat/ui/atoms/group-icon.tsx b/src/features/chat/ui/atoms/group-icon.tsx index c0b110dd2..0fefeaaa2 100644 --- a/src/features/chat/ui/atoms/group-icon.tsx +++ b/src/features/chat/ui/atoms/group-icon.tsx @@ -1,7 +1,7 @@ import React from 'react' import { FiUsers } from 'react-icons/fi' -import { Icon } from '@features/all-pages' +import { Icon } from '@shared/ui/icon' type GroupIconProps = { size?: number diff --git a/src/features/chat/ui/atoms/message-context-menu.tsx b/src/features/chat/ui/atoms/message-context-menu.tsx index f234d9580..871572877 100644 --- a/src/features/chat/ui/atoms/message-context-menu.tsx +++ b/src/features/chat/ui/atoms/message-context-menu.tsx @@ -8,11 +8,10 @@ import { RawChatMessage } from '@features/chat/type' import { chatMessagesModel } from '@entities/chat-messages' import { contextMenuModel } from '@entities/context-menu' -import { popUpMessageModel } from '@entities/pop-up-message' +import { Button } from '@shared/ui/button' import Flex from '@shared/ui/flex' - -import { Button } from '@ui/button' +import { popUpMessageModel } from '@shared/ui/pop-up-message' interface Props { message: RawChatMessage diff --git a/src/features/chat/ui/atoms/message-item.tsx b/src/features/chat/ui/atoms/message-item.tsx index 5cb3a695c..4bd9168cc 100644 --- a/src/features/chat/ui/atoms/message-item.tsx +++ b/src/features/chat/ui/atoms/message-item.tsx @@ -7,11 +7,11 @@ import styled from 'styled-components' import { RawChatMessage } from '@features/chat/type' import { contextMenuModel } from '@entities/context-menu' -import { userModel } from '@entities/user' -import { Colors } from '@shared/constants' -import useCurrentDevice from '@shared/lib/hooks/use-current-device' +import { Colors } from '@shared/consts' +import { userModel } from '@shared/session' import Flex from '@shared/ui/flex' +import useCurrentDevice from '@shared/ui/hooks/use-current-device' import Subtext from '../../../../shared/ui/subtext' import { getTimeFromDate } from '../../lib/get-time-from-date' @@ -35,7 +35,7 @@ export const MessageItem = ({ name, message, isLast }: Props) => { const { isMobile } = useCurrentDevice() - const isYourMessage = message.author_id === user.currentUser?.id.toString() + const isYourMessage = message.author_id === user?.id.toString() const openContextMenu = (e: React.MouseEvent) => { // prevent click on link and files diff --git a/src/features/chat/ui/atoms/read-status-icon.tsx b/src/features/chat/ui/atoms/read-status-icon.tsx index 29977a262..f7b0f0cba 100644 --- a/src/features/chat/ui/atoms/read-status-icon.tsx +++ b/src/features/chat/ui/atoms/read-status-icon.tsx @@ -4,9 +4,10 @@ import { IoCheckmarkDoneOutline, IoCheckmarkOutline } from 'react-icons/io5' import { useUnit } from 'effector-react' -import { userModel } from '../../../../entities/user' -import { Tooltip } from '../../../../shared/ui/tooltip' -import { RawChatMessage } from '../../type' +import { RawChatMessage } from '@features/chat/type' + +import { userModel } from '@shared/session' +import { Tooltip } from '@shared/ui/tooltip' type Props = { message: RawChatMessage @@ -24,8 +25,8 @@ export const ReadStatusIcon = ({ message }: Props) => { } if ( - (message.author_id === user?.currentUser?.id.toString() && message.readed_opponent) || - message.author_id !== user?.currentUser?.id.toString() + (message.author_id === user?.id.toString() && message.readed_opponent) || + message.author_id !== user?.id.toString() ) { return ( diff --git a/src/features/chat/ui/atoms/skeleton-loading.tsx b/src/features/chat/ui/atoms/skeleton-loading.tsx index 14b588b12..ad764f578 100644 --- a/src/features/chat/ui/atoms/skeleton-loading.tsx +++ b/src/features/chat/ui/atoms/skeleton-loading.tsx @@ -2,7 +2,7 @@ import React from 'react' import styled from 'styled-components' -import { SkeletonShape } from '@ui/atoms' +import { SkeletonShape } from '@shared/ui/atoms' const SkeletonLoadingWrapper = styled.div` display: flex; diff --git a/src/features/chat/ui/molecules/attachments.tsx b/src/features/chat/ui/molecules/attachments.tsx index e501c9d3b..85e8735cc 100644 --- a/src/features/chat/ui/molecules/attachments.tsx +++ b/src/features/chat/ui/molecules/attachments.tsx @@ -2,7 +2,7 @@ import React from 'react' import styled from 'styled-components' -import { Title } from '@ui/atoms' +import { Title } from '@shared/ui/atoms' const AttachmentsWrapper = styled.div` @media (min-width: 1001px) { diff --git a/src/features/chat/ui/molecules/chat-header.tsx b/src/features/chat/ui/molecules/chat-header.tsx index 12a66a04e..d3d3a80dd 100644 --- a/src/features/chat/ui/molecules/chat-header.tsx +++ b/src/features/chat/ui/molecules/chat-header.tsx @@ -4,13 +4,13 @@ import { useHistory } from 'react-router' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { User } from 'widgets' -import { CHAT_ROUTE } from '@app/routes/general-routes' +import User from '@features/user' import { chatModel, chatsModel } from '@entities/chats' -import { Button } from '@ui/atoms' +import { CHAT_ROUTE } from '@shared/routing' +import { Button } from '@shared/ui/atoms' import Flex from '../../../../shared/ui/flex' import Subtext from '../../../../shared/ui/subtext' diff --git a/src/features/chat/ui/molecules/chat-input.tsx b/src/features/chat/ui/molecules/chat-input.tsx index 1af7a0984..12c494bcc 100644 --- a/src/features/chat/ui/molecules/chat-input.tsx +++ b/src/features/chat/ui/molecules/chat-input.tsx @@ -9,13 +9,12 @@ import { chatsMessageModel } from '@features/chat/model' import { chatModel } from '@entities/chats' -import { MEDIA_QUERIES } from '@shared/constants' +import { Button } from '@shared/ui/atoms' +import { MEDIA_QUERIES } from '@shared/ui/consts' import ListOfFiles from '@shared/ui/file-input/ui/list-of-files' import { RichTextInput } from '@shared/ui/rich-text-input' import { UploadFileButton } from '@shared/ui/upload-file-button' -import { Button } from '@ui/atoms' - export const ChatInput = () => { const [message, selectedChat] = useUnit([chatsMessageModel.stores.currentMessage, chatModel.stores.selectedChat]) diff --git a/src/features/chat/ui/molecules/chat-items.tsx b/src/features/chat/ui/molecules/chat-items.tsx index 1d23cc31b..c2bd1d286 100644 --- a/src/features/chat/ui/molecules/chat-items.tsx +++ b/src/features/chat/ui/molecules/chat-items.tsx @@ -2,13 +2,13 @@ import React from 'react' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { TutorialComponent } from 'widgets/tutorial/lib/with-tutorial' import { chatSidebarModel } from '@features/chat/model' import { chatsModel } from '@entities/chats' -import { Title } from '@ui/atoms' +import { Title } from '@shared/ui/atoms' +import { TutorialComponent } from '@shared/ui/types' import { ChatItem, SkeletonLoading } from '../atoms' diff --git a/src/features/chat/ui/molecules/message-list.tsx b/src/features/chat/ui/molecules/message-list.tsx index 2147f539f..222a34da8 100644 --- a/src/features/chat/ui/molecules/message-list.tsx +++ b/src/features/chat/ui/molecules/message-list.tsx @@ -3,18 +3,19 @@ import React from 'react' import { useUnit } from 'effector-react' import styled from 'styled-components' +import { StaffModal } from '@features/all-staff/staff-modal' import { prepareMessages } from '@features/chat/lib/prepare-messages' import { allChatMessagesModel } from '@features/chat/model' import { RawChatMessage } from '@features/chat/type' -import Avatar from '@features/home/ui/molecules/avatar' +import { StudentModal } from '@features/user/ui' import { chatMessagesModel } from '@entities/chat-messages' import { chatModel } from '@entities/chats' -import { userModel } from '@entities/user' -import { StaffModal } from '../../../../pages/all-staff/ui/staff-modal' -import { useModal } from '../../../../widgets' -import { StudentModal } from '../../../../widgets/user/ui' +import { userModel } from '@shared/session' +import Avatar from '@shared/ui/avatar' +import { useModal } from '@shared/ui/modal' + import { MessageItem } from '../atoms' import EmptyHere from '../atoms/empty-here' import TopDate from '../atoms/top-date' @@ -29,7 +30,7 @@ export const MessageList = () => { ]) const handleOpenUserModal = (message: RawChatMessage) => { - if (!chat || message.author_id === user?.currentUser?.id.toString()) return + if (!chat || message.author_id === user?.id.toString()) return open( chat?.opponent?.status === 'сотрудник' ? ( @@ -49,7 +50,7 @@ export const MessageList = () => { prepareMessages({ chat: chat!, messages: allMessages, - currentUser: user.currentUser!, + currentUser: user!, }), ).map((messageGroup) => { return ( diff --git a/src/features/chat/ui/molecules/messages.tsx b/src/features/chat/ui/molecules/messages.tsx index be84d4767..c1f1defe1 100644 --- a/src/features/chat/ui/molecules/messages.tsx +++ b/src/features/chat/ui/molecules/messages.tsx @@ -8,7 +8,7 @@ import scrollToBottom from '@features/chat/lib/scroll-to-bottom' import { chatMessagesModel } from '@entities/chat-messages' import { chatModel } from '@entities/chats' -import { Loading } from '@ui/atoms' +import { Loading } from '@shared/ui/atoms' import { MessageList } from '.' diff --git a/src/features/chat/ui/organisms/list-of-chats.tsx b/src/features/chat/ui/organisms/list-of-chats.tsx index f9e64df2d..239147b0d 100644 --- a/src/features/chat/ui/organisms/list-of-chats.tsx +++ b/src/features/chat/ui/organisms/list-of-chats.tsx @@ -3,20 +3,17 @@ import { useRouteMatch } from 'react-router' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { ChatItemsTutorial } from 'widgets/tutorial/tutorials/chat-items-tutorial' -import { FlexTutorial } from 'widgets/tutorial/tutorials/flex-tutorial' -import { AddNewChatTutorial } from 'widgets/tutorial/tutorials/new-chat' - -import { TEMPLATE_CHAT_ROUTE } from '@app/routes/general-routes' import { chatSidebarModel } from '@features/chat/model' +import { ChatItemsTutorial } from '@features/tutorials/chat-items-tutorial' +import { FlexTutorial } from '@features/tutorials/flex-tutorial' +import { AddNewChatTutorial } from '@features/tutorials/new-chat' +import { TEMPLATE_CHAT_ROUTE } from '@shared/routing' +import { Divider, Title } from '@shared/ui/atoms' +import { MEDIA_QUERIES } from '@shared/ui/consts' import Search from '@shared/ui/search' -import { Divider, Title } from '@ui/atoms' - -import { MEDIA_QUERIES } from '../../../../shared/constants' - export const ListOfChats = () => { const params = useRouteMatch(TEMPLATE_CHAT_ROUTE)?.params as { chatId: string | undefined } diff --git a/src/widgets/context-menu/index.tsx b/src/features/context-menu/index.tsx similarity index 90% rename from src/widgets/context-menu/index.tsx rename to src/features/context-menu/index.tsx index 84ab49dd0..b72c54dfd 100644 --- a/src/widgets/context-menu/index.tsx +++ b/src/features/context-menu/index.tsx @@ -1,11 +1,11 @@ import React, { useRef } from 'react' import styled from 'styled-components' -import ModalWrapper from 'widgets/modal/ui/atoms/modal-wrapper' -import useOnClickOutside from '@utils/hooks/use-on-click-outside' +import { contextMenuModel } from '@entities/context-menu' -import { contextMenuModel } from '../../entities/context-menu' +import useOnClickOutside from '@shared/ui/hooks/use-on-click-outside' +import ModalWrapper from '@shared/ui/modal/ui/atoms/modal-wrapper' const ContextMenuWrapper = styled.div<{ isVisible: boolean diff --git a/src/features/customize-menu/index.tsx b/src/features/customize-menu/index.tsx index eb1bb3b54..226b06818 100644 --- a/src/features/customize-menu/index.tsx +++ b/src/features/customize-menu/index.tsx @@ -4,13 +4,12 @@ import { Store } from 'effector' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { IRoute, IRoutes } from '@app/routes/general-routes' - import search from '@features/all-pages/lib/search' import { CustomizeLeftsideBarItem } from '@features/customize-menu/ui/customize-leftside-bar-item' import { menuModel } from '@entities/menu' +import { IRoutes, Page } from '@shared/routing' import { LocalSearch } from '@shared/ui/molecules' const CustomizeMenuStyled = styled.div` @@ -56,7 +55,7 @@ const CustomizeMenu = ({ enabledListStore, add, remove, requiredListStore }: Pro /> {Object.values(searchResult ?? visibleRoutes) .filter((route) => !requiredList.includes(route.id)) - .map((el: IRoute, index) => { + .map((el: Page, index) => { return ( () diff --git a/src/features/employee/business-mobile-phone/ui/business-mobile-phone-modal.tsx b/src/features/employee/business-mobile-phone/ui/business-mobile-phone-modal.tsx index 2d373bb62..89789c079 100644 --- a/src/features/employee/business-mobile-phone/ui/business-mobile-phone-modal.tsx +++ b/src/features/employee/business-mobile-phone/ui/business-mobile-phone-modal.tsx @@ -2,12 +2,11 @@ import React, { useEffect, useState } from 'react' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { useModal } from 'widgets' -import { userModel } from '@entities/user' - -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' +import { userModel } from '@shared/session' import { Button, Divider, Input } from '@shared/ui/atoms' +import { useModal } from '@shared/ui/modal' import ToggleItem from '@shared/ui/toggle-item' import { changeStaffPhone, changeStaffPhoneParamsMutation } from '../model' @@ -31,10 +30,7 @@ const Buttons = styled.div` export const BusinessMobilePhoneModal = () => { const { close, isOpen } = useModal() - const { - loading, - user: { currentUser }, - } = useUnit({ + const { loading, user: currentUser } = useUnit({ loading: changeStaffPhoneParamsMutation.$pending, user: userModel.stores.user, }) diff --git a/src/features/employee/business-mobile-phone/ui/index.tsx b/src/features/employee/business-mobile-phone/ui/index.tsx index 3c7d0be99..de027b362 100644 --- a/src/features/employee/business-mobile-phone/ui/index.tsx +++ b/src/features/employee/business-mobile-phone/ui/index.tsx @@ -2,18 +2,15 @@ import React from 'react' import { FiPhone } from 'react-icons/fi' import { useUnit } from 'effector-react' -import { useModal } from 'widgets' - -import { userModel } from '@entities/user' +import { userModel } from '@shared/session' +import { useModal } from '@shared/ui/modal' import TextFieldItem from '@shared/ui/text-field/text-field-item' import { BusinessMobilePhoneModal } from './business-mobile-phone-modal' export const BusinessMobilePhone = () => { - const { - user: { currentUser }, - } = useUnit({ user: userModel.stores.user }) + const { user: currentUser } = useUnit({ user: userModel.stores.user }) const { open } = useModal() diff --git a/src/features/employee/work-place-address/model.ts b/src/features/employee/work-place-address/model.ts index e5a864e7d..04b26720b 100644 --- a/src/features/employee/work-place-address/model.ts +++ b/src/features/employee/work-place-address/model.ts @@ -1,12 +1,10 @@ import { createMutation } from '@farfetched/core' import { createEvent, sample } from 'effector' -import { LocationSettingsType } from '@pages/settings/types' - -import { popUpMessageModel } from '@entities/pop-up-message' -import { userModel } from '@entities/user' - +import { LocationSettingsType } from '@shared/api/model' import { changeStaffAddressApi } from '@shared/api/user-api' +import { userModel } from '@shared/session' +import { popUpMessageModel } from '@shared/ui/pop-up-message' export const changeStaffAddress = createEvent() @@ -22,7 +20,7 @@ sample({ sample({ clock: changeStaffAddressMutation.$succeeded, source: { user: userModel.stores.user, mutationParams: changeStaffAddressMutation.__.$latestParams }, - fn: ({ user: { currentUser }, mutationParams }) => { + fn: ({ user: currentUser, mutationParams }) => { return { subdivisions: currentUser?.subdivisions?.map((subdivision) => { if (subdivision.guid_staff === mutationParams?.guid_staff) return { ...subdivision, ...mutationParams } @@ -37,7 +35,7 @@ sample({ sample({ clock: changeStaffAddressMutation.$succeeded, source: { user: userModel.stores.user, mutationParams: changeStaffAddressMutation.__.$latestParams }, - fn: ({ user: { currentUser }, mutationParams }) => ({ + fn: ({ user: currentUser, mutationParams }) => ({ message: `Данные об адресе рабочего места (${ currentUser?.subdivisions?.find((s) => s.guid_staff === mutationParams?.guid_staff)?.post }) успешно изменены`, diff --git a/src/features/employee/work-place-address/ui/index.tsx b/src/features/employee/work-place-address/ui/index.tsx index 0dd260373..ac5385fce 100644 --- a/src/features/employee/work-place-address/ui/index.tsx +++ b/src/features/employee/work-place-address/ui/index.tsx @@ -2,10 +2,9 @@ import React from 'react' import { HiOutlineOfficeBuilding } from 'react-icons/hi' import { useUnit } from 'effector-react' -import { useModal } from 'widgets' - -import { userModel } from '@entities/user' +import { userModel } from '@shared/session' +import { useModal } from '@shared/ui/modal' import TextFieldItem from '@shared/ui/text-field/text-field-item' import { WorkPlaceAddressModal } from './work-place-address-modal' @@ -15,9 +14,7 @@ type WorkPlaceAddressProps = { } export const WorkPlaceAddress = ({ subDivisionGuidStaff }: WorkPlaceAddressProps) => { - const { - user: { currentUser }, - } = useUnit({ user: userModel.stores.user }) + const { user: currentUser } = useUnit({ user: userModel.stores.user }) const { open } = useModal() diff --git a/src/features/employee/work-place-address/ui/work-place-address-modal.tsx b/src/features/employee/work-place-address/ui/work-place-address-modal.tsx index b7bbd5fec..41be9fb16 100644 --- a/src/features/employee/work-place-address/ui/work-place-address-modal.tsx +++ b/src/features/employee/work-place-address/ui/work-place-address-modal.tsx @@ -2,19 +2,17 @@ import React, { useEffect, useState } from 'react' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { SliderPage, useModal } from 'widgets' -import { sites } from '@pages/teachers-applications/pages/contact-details/lib/get-form' -import { getCabinetMask } from '@pages/teachers-applications/pages/contact-details/lib/getCabinetMask' +import SliderPage from '@features/slider-page' -import Select, { SelectPage } from '@features/select' - -import { userModel } from '@entities/user' - -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' +import { getCabinetMask, sites } from '@shared/lib' import Masks from '@shared/lib/masks' +import { userModel } from '@shared/session' import { Button, Divider, Input, Title } from '@shared/ui/atoms' import findCurrentInSelect from '@shared/ui/input-area/lib/find-current-in-select' +import { useModal } from '@shared/ui/modal' +import Select, { SelectPage } from '@shared/ui/select' import { changeStaffAddress, changeStaffAddressMutation } from '../model' @@ -40,10 +38,7 @@ type WorkPlaceAddressModalProps = { export const WorkPlaceAddressModal = ({ subDivisionGuidStaff }: WorkPlaceAddressModalProps) => { const { close, isOpen } = useModal() - const { - loading, - user: { currentUser }, - } = useUnit({ + const { loading, user: currentUser } = useUnit({ loading: changeStaffAddressMutation.$pending, user: userModel.stores.user, }) diff --git a/src/features/feedback/lib/get-form.tsx b/src/features/feedback/lib/get-form.tsx index 73a71d285..71515717c 100644 --- a/src/features/feedback/lib/get-form.tsx +++ b/src/features/feedback/lib/get-form.tsx @@ -1,8 +1,6 @@ -import { Feedback } from '@api/model/feedback' - -import { SelectPage } from '@features/select' - -import { IInputArea } from '@ui/input-area/model' +import { Feedback } from '@shared/api/model/feedback' +import { IInputArea } from '@shared/ui/input-area/model' +import { SelectPage } from '@shared/ui/select' const SELECT_OPTIONS: SelectPage[] = [ { id: '1', title: 'Проблема с дистанционным обучением (LMS)' }, diff --git a/src/features/feedback/model/index.ts b/src/features/feedback/model/index.ts index f7b209970..7595a919b 100644 --- a/src/features/feedback/model/index.ts +++ b/src/features/feedback/model/index.ts @@ -1,6 +1,7 @@ -import { feedbackApi } from '@api' -import { Feedback, FormFeedback } from '@api/model/feedback' -import { createFormStore } from 'shared/effector/create-form-store' +import { createFormStore } from '@entities/applications/lib/create-form-store' + +import { feedbackApi } from '@shared/api' +import { Feedback, FormFeedback } from '@shared/api/model/feedback' export const { effects, events, selectors } = createFormStore({ defaultStore: { diff --git a/src/features/feedback/ui/organisms/ask-form.tsx b/src/features/feedback/ui/organisms/ask-form.tsx index 148b09c35..6255e55d4 100644 --- a/src/features/feedback/ui/organisms/ask-form.tsx +++ b/src/features/feedback/ui/organisms/ask-form.tsx @@ -1,16 +1,14 @@ import React, { useEffect, useState } from 'react' -import { FormFeedback } from '@api/model/feedback' - import { feedbackModel } from '@features/feedback' import getForm from '@features/feedback/lib/get-form' +import checkFormFields from '@features/send-form/check-form-fields' +import sendForm from '@features/send-form/send-form' -import { SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' - -import checkFormFields from '@utils/check-form-fields' -import sendForm from '@utils/send-form' +import { FormFeedback } from '@shared/api/model/feedback' +import { SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' type LoadedState = React.Dispatch> diff --git a/src/features/feedback/ui/organisms/help-links.tsx b/src/features/feedback/ui/organisms/help-links.tsx index f739bdded..8fd12d8f6 100644 --- a/src/features/feedback/ui/organisms/help-links.tsx +++ b/src/features/feedback/ui/organisms/help-links.tsx @@ -3,10 +3,8 @@ import { Link } from 'react-router-dom' import styled from 'styled-components' -import { PAYMENTS_ROUTE } from '@app/routes/general-routes' -import { ARBITRARY_REQUEST_ROUTE } from '@app/routes/routes' - -import { Message } from '@ui/message' +import { ARBITRARY_REQUEST_ROUTE, PAYMENTS_ROUTE } from '@shared/routing' +import { Message } from '@shared/ui/message' export const Ul = styled.div` display: flex; diff --git a/src/features/feedback/ui/organisms/other-contacts.tsx b/src/features/feedback/ui/organisms/other-contacts.tsx index 5a3121bd9..5b55056bc 100644 --- a/src/features/feedback/ui/organisms/other-contacts.tsx +++ b/src/features/feedback/ui/organisms/other-contacts.tsx @@ -1,6 +1,6 @@ import React from 'react' -import { Message } from '@ui/atoms' +import { Message } from '@shared/ui/atoms' export function OtherContacts() { return ( diff --git a/src/features/feedback/ui/templates/content-page.tsx b/src/features/feedback/ui/templates/content-page.tsx index d4c3d5690..548df3418 100644 --- a/src/features/feedback/ui/templates/content-page.tsx +++ b/src/features/feedback/ui/templates/content-page.tsx @@ -1,7 +1,6 @@ import React from 'react' -import { userModel } from '@entities/user' - +import { userModel } from '@shared/session' import GoBackButton from '@shared/ui/go-back-button' import PageBlock from '@shared/ui/page-block' diff --git a/src/features/global-app-search/global-app-search-modal.tsx b/src/features/global-app-search/global-app-search-modal.tsx index d02d1d7b4..f4fee2405 100644 --- a/src/features/global-app-search/global-app-search-modal.tsx +++ b/src/features/global-app-search/global-app-search-modal.tsx @@ -2,14 +2,13 @@ import React from 'react' import { FiEyeOff, FiSearch } from 'react-icons/fi' import styled from 'styled-components' -import { useModal } from 'widgets' -import Slider from 'widgets/slider' - -import PerhapsYouMeant from '@features/perhaps-you-meant' import { Error } from '@shared/ui/error' import Flex from '@shared/ui/flex' +import { useModal } from '@shared/ui/modal' +import PerhapsYouMeant from '@shared/ui/perhaps-you-meant' import Search from '@shared/ui/search' +import Slider from '@shared/ui/slider' import useGlobalAppSearch from './hooks/use-global-app-search' import getDataLength from './lib/get-data-length' diff --git a/src/features/global-app-search/hooks/use-global-app-search.tsx b/src/features/global-app-search/hooks/use-global-app-search.tsx index 8aab229ce..e5659acce 100644 --- a/src/features/global-app-search/hooks/use-global-app-search.tsx +++ b/src/features/global-app-search/hooks/use-global-app-search.tsx @@ -1,13 +1,13 @@ import { useMemo, useState } from 'react' -import { BrowserStorageKey } from '@shared/constants/browser-storage-key' +import { BrowserStorageKey } from '@shared/consts/browser-storage-key' import useDebounce from '@shared/lib/hooks/use-debounce' import englishToRussianKeyboard from '@shared/ui/search/lib/english-to-russian-keyboard' import isValidEnglishText from '@shared/ui/search/lib/is-valid-english-text' import getDataLength from '../lib/get-data-length' import getSearchHistory from '../lib/get-search-history' -import useSearchConfig from './use-search-config' +import { useSearchConfig } from './use-search-config' const useGlobalAppSearch = () => { const config = useSearchConfig() diff --git a/src/features/global-app-search/hooks/use-search-config.tsx b/src/features/global-app-search/hooks/use-search-config.tsx index c2d7e4c70..d7a2dc1c1 100644 --- a/src/features/global-app-search/hooks/use-search-config.tsx +++ b/src/features/global-app-search/hooks/use-search-config.tsx @@ -1,38 +1,36 @@ import React, { useMemo, useState } from 'react' import { useUnit } from 'effector-react' -import { User } from 'widgets' -import NotificationList from 'widgets/lk-notification-list/ui/list' - -import { IRoutes } from '@app/routes/general-routes' - -import { findEmployee } from '@pages/all-staff/lib/find-employee' -import pages from '@pages/helpful-information/config/pages-config' -import search from '@pages/helpful-information/lib/search' -import { HelpfulPage } from '@pages/helpful-information/types/helpful-pages' -import BlocksList from '@pages/helpful-information/ui/molecules/blocks-list' -import { safetyPages } from '@pages/safety-information' import { FoundPages } from '@features/all-pages' import searchFunc from '@features/all-pages/lib/search' +import { findEmployee } from '@features/all-staff/lib/find-employee' import DivisionsList from '@features/divisions-list' import GroupsList from '@features/groups-list' +import { HelpfulPage } from '@features/helpful-information' +import pages from '@features/helpful-information/config/pages-config' +import search from '@features/helpful-information/lib/search' +import { safetyPages } from '@features/helpful-information/safety-information/config' +import BlocksList from '@features/helpful-information/ui/blocks-list' +import NotificationList from '@features/lk-notification-list/ui/list' import { TNotification, lkNotificationModel } from '@entities/lk-notifications' import { menuModel } from '@entities/menu' import { phonebookModel } from '@entities/phonebook' -import { userModel } from '@entities/user' import { studentApi, teacherApi } from '@shared/api' import { TStudent, TTeacher } from '@shared/api/model' import { Employee } from '@shared/api/model/phonebook' import { getGroups } from '@shared/api/student-api' import normalizeString from '@shared/lib/normalize-string' +import { IRoutes } from '@shared/routing' +import { userModel } from '@shared/session' import { Divider } from '@shared/ui/divider' import Flex from '@shared/ui/flex' import { Title } from '@shared/ui/title' import getDataLength from '../lib/get-data-length' +import { FoundPeople } from '../ui/found-people' type SearchConfig = { title: string @@ -42,38 +40,7 @@ type SearchConfig = { search: (value: string) => Promise | void }[] -const FoundPeople = ({ - people, - type, -}: { - people: (TTeacher | TStudent | Employee)[] | null - type: 'stud' | 'staff' -}) => { - if (!people || people.length === 0) return null - - return ( - - {people.map((s) => ( - j.post === s.post)?.subdivision - : '' - } - /> - ))} - - ) -} - -const useSearchConfig = () => { +export const useSearchConfig = () => { const { allRoutes } = menuModel.selectors.useMenu() const { notifications, removeNotificationLoading } = lkNotificationModel.selectors.useLkNotifications() const { @@ -267,5 +234,3 @@ const useSearchConfig = () => { return [getAllTab(), ...preconfig] } - -export default useSearchConfig diff --git a/src/features/global-app-search/index.tsx b/src/features/global-app-search/index.tsx index 2de4cdeec..6439424d9 100644 --- a/src/features/global-app-search/index.tsx +++ b/src/features/global-app-search/index.tsx @@ -2,16 +2,17 @@ import React, { memo } from 'react' import { FiCommand, FiSearch } from 'react-icons/fi' import styled from 'styled-components' -import { useModal } from 'widgets' -import { TutorialComponent } from 'widgets/tutorial/lib/with-tutorial' -import { MEDIA_QUERIES } from '@shared/constants' -import getUsersOS from '@shared/lib/get-users-os' -import useShortCutKeys from '@shared/lib/hooks/use-short-cut-keys' +import getUsersOS from '@features/global-app-search/lib/get-users-os' + import BlockWrapper from '@shared/ui/block/styles' import { Button } from '@shared/ui/button' +import { MEDIA_QUERIES } from '@shared/ui/consts' import Flex from '@shared/ui/flex' +import useShortCutKeys from '@shared/ui/hooks/use-short-cut-keys' +import { useModal } from '@shared/ui/modal' import Subtext from '@shared/ui/subtext' +import { TutorialComponent } from '@shared/ui/types' import GlobalAppSearchModal from './global-app-search-modal' diff --git a/src/features/global-app-search/lib/get-search-history.ts b/src/features/global-app-search/lib/get-search-history.ts index db7a623d6..21061baad 100644 --- a/src/features/global-app-search/lib/get-search-history.ts +++ b/src/features/global-app-search/lib/get-search-history.ts @@ -1,4 +1,4 @@ -import { BrowserStorageKey } from '@shared/constants/browser-storage-key' +import { BrowserStorageKey } from '@shared/consts/browser-storage-key' const getSearchHistory = () => JSON.parse(localStorage.getItem(BrowserStorageKey.SearchHistory) ?? '[]') as string[] diff --git a/src/shared/lib/get-users-os.ts b/src/features/global-app-search/lib/get-users-os.ts similarity index 100% rename from src/shared/lib/get-users-os.ts rename to src/features/global-app-search/lib/get-users-os.ts diff --git a/src/features/global-app-search/ui/found-people.tsx b/src/features/global-app-search/ui/found-people.tsx new file mode 100644 index 000000000..63ed63980 --- /dev/null +++ b/src/features/global-app-search/ui/found-people.tsx @@ -0,0 +1,38 @@ +import React from 'react' + +import User from '@features/user' + +import { TStudent, TTeacher } from '@shared/api/model' +import { Employee } from '@shared/api/model/phonebook' +import Flex from '@shared/ui/flex' + +export const FoundPeople = ({ + people, + type, +}: { + people: (TTeacher | TStudent | Employee)[] | null + type: 'stud' | 'staff' +}) => { + if (!people || people.length === 0) return null + + return ( + + {people.map((s) => ( + j.post === s.post)?.subdivision + : '' + } + /> + ))} + + ) +} diff --git a/src/features/groups-list/group-item.tsx b/src/features/groups-list/group-item.tsx index a3e36c2fb..22dc57b4a 100644 --- a/src/features/groups-list/group-item.tsx +++ b/src/features/groups-list/group-item.tsx @@ -2,9 +2,9 @@ import React from 'react' import { FiChevronRight, FiUsers } from 'react-icons/fi' import styled from 'styled-components' -import { useModal } from 'widgets' import Flex from '@shared/ui/flex' +import { useModal } from '@shared/ui/modal' import Subtext from '@shared/ui/subtext' import GroupModal from './group-modal' diff --git a/src/features/groups-list/group-modal.tsx b/src/features/groups-list/group-modal.tsx index 6c643dfa9..ebe787354 100644 --- a/src/features/groups-list/group-modal.tsx +++ b/src/features/groups-list/group-modal.tsx @@ -3,17 +3,16 @@ import { FiClock, FiList, FiUsers } from 'react-icons/fi' import { Link } from 'react-router-dom' import styled from 'styled-components' -import { useModal } from 'widgets' -import { ALL_STUDENTS_ROUTE, SCHEDULE_FILTER_ROUTE } from '@app/routes/general-routes' - -import { Icon } from '@features/all-pages' import { SendMessage } from '@features/send-first-message' import { getEnrichedTemplatePath } from '@entities/menu/lib/get-enriched-template-path' +import { ALL_STUDENTS_ROUTE, SCHEDULE_FILTER_ROUTE } from '@shared/routing' import { Button } from '@shared/ui/button' import Flex from '@shared/ui/flex' +import { Icon } from '@shared/ui/icon' +import { useModal } from '@shared/ui/modal' import Subtext from '@shared/ui/subtext' const GroupModalStyled = styled.div` diff --git a/src/pages/helpful-information/config/pages-config.ts b/src/features/helpful-information/config/pages-config.ts similarity index 99% rename from src/pages/helpful-information/config/pages-config.ts rename to src/features/helpful-information/config/pages-config.ts index c28193248..65bf6d775 100644 --- a/src/pages/helpful-information/config/pages-config.ts +++ b/src/features/helpful-information/config/pages-config.ts @@ -1,8 +1,8 @@ -import instructionsTeacherData from '@pages/instructions/data/teacher-data' +import instructionsTeacherData from '@features/helpful-information/instructions/data/teacher-data' import { HelpfulInfoEnum, helpfulInfoName } from '@entities/useful-information' -import { HelpfulPages, Link } from '../types/helpful-pages' +import { HelpfulPages, Link } from '../types' const pages: HelpfulPages = [ { @@ -258,7 +258,7 @@ const pages: HelpfulPages = [ { id: HelpfulInfoEnum.instructions, title: 'Положения', - visible: 'all', + visible: 'student', content: [ { title: 'Положения', @@ -360,7 +360,7 @@ const pages: HelpfulPages = [ { id: HelpfulInfoEnum.instructions, title: 'Правила', - visible: 'all', + visible: 'student', content: [ { title: 'Правила', diff --git a/src/features/helpful-information/index.ts b/src/features/helpful-information/index.ts new file mode 100644 index 000000000..fd80c4ae7 --- /dev/null +++ b/src/features/helpful-information/index.ts @@ -0,0 +1,4 @@ +export * from './config/pages-config' +export * from './lib/search' +export * from './types' +export * from './ui/blocks-list' diff --git a/src/pages/instructions/data/student-data.ts b/src/features/helpful-information/instructions/data/student-data.ts similarity index 99% rename from src/pages/instructions/data/student-data.ts rename to src/features/helpful-information/instructions/data/student-data.ts index 133b8780d..d36e77e0f 100644 --- a/src/pages/instructions/data/student-data.ts +++ b/src/features/helpful-information/instructions/data/student-data.ts @@ -1,7 +1,7 @@ import { IconType } from 'react-icons' import { HiOutlineDocumentText } from 'react-icons/hi' -import { OLD_LK_URL } from '@shared/constants' +import { OLD_LK_URL } from '@shared/consts' type LinksType = { link: string diff --git a/src/pages/instructions/data/teacher-data.ts b/src/features/helpful-information/instructions/data/teacher-data.ts similarity index 99% rename from src/pages/instructions/data/teacher-data.ts rename to src/features/helpful-information/instructions/data/teacher-data.ts index 2e211494b..f54f8f525 100644 --- a/src/pages/instructions/data/teacher-data.ts +++ b/src/features/helpful-information/instructions/data/teacher-data.ts @@ -1,6 +1,6 @@ import { HiOutlineDocumentText } from 'react-icons/hi' -import { OLD_LK_URL } from '@shared/constants' +import { OLD_LK_URL } from '@shared/consts' import { InstructionsType } from './student-data' diff --git a/src/pages/instructions/index.tsx b/src/features/helpful-information/instructions/index.tsx similarity index 96% rename from src/pages/instructions/index.tsx rename to src/features/helpful-information/instructions/index.tsx index 870b010a9..1564a4201 100644 --- a/src/pages/instructions/index.tsx +++ b/src/features/helpful-information/instructions/index.tsx @@ -2,11 +2,10 @@ import React, { useState } from 'react' import styled from 'styled-components' -import { userModel } from '@entities/user' - -import { CenterPage, Divider, Error, Message, Title } from '@ui/atoms' -import BlockWrapper from '@ui/block/styles' -import { LocalSearch } from '@ui/molecules' +import { userModel } from '@shared/session' +import { CenterPage, Divider, Error, Message, Title } from '@shared/ui/atoms' +import BlockWrapper from '@shared/ui/block/styles' +import { LocalSearch } from '@shared/ui/molecules' import instructionsStudentData, { InstructionsType } from './data/student-data' import instructionsTeacherData from './data/teacher-data' diff --git a/src/pages/instructions/lib/search.ts b/src/features/helpful-information/instructions/lib/search.ts similarity index 89% rename from src/pages/instructions/lib/search.ts rename to src/features/helpful-information/instructions/lib/search.ts index 3f9dae03a..9dae40cb2 100644 --- a/src/pages/instructions/lib/search.ts +++ b/src/features/helpful-information/instructions/lib/search.ts @@ -1,4 +1,4 @@ -import normalizeString from '@utils/normalize-string' +import normalizeString from '@shared/lib/normalize-string' import { InstructionsType } from '../data/student-data' diff --git a/src/pages/helpful-information/lib/search.ts b/src/features/helpful-information/lib/search.ts similarity index 77% rename from src/pages/helpful-information/lib/search.ts rename to src/features/helpful-information/lib/search.ts index 13f9882fd..268ab6062 100644 --- a/src/pages/helpful-information/lib/search.ts +++ b/src/features/helpful-information/lib/search.ts @@ -1,6 +1,6 @@ -import normalizeString from '@utils/normalize-string' +import normalizeString from '@shared/lib/normalize-string' -import { HelpfulPage } from '../types/helpful-pages' +import { HelpfulPage } from '../types' const search = (value: string, pages: HelpfulPage[]) => { return pages.reduce((acc, page) => { diff --git a/src/features/helpful-information/safety-information/config.ts b/src/features/helpful-information/safety-information/config.ts new file mode 100644 index 000000000..98c218967 --- /dev/null +++ b/src/features/helpful-information/safety-information/config.ts @@ -0,0 +1,64 @@ +import { HelpfulPage } from '@features/helpful-information' + +export const safetyPages: HelpfulPage[] = [ + { + title: 'Полезные материалы', + links: [ + { + title: 'Действия работников и обучающихся при вооруженном нападении на учебный корпус (антитеррористическая защищенность)', + visible: 'all', + href: 'https://youtu.be/cH7-sC7kRwc', + }, + { + title: 'Если оказались на территории вуза в момент наступившей чрезвычайной ситуации', + visible: 'all', + href: 'https://e.mospolytech.ru/old/storage/files/notes/Metodicheskie_ukazaniya_i_pamyatki_2_Esli_okazalis_na_territorii_vuza_v_moment_nastupivshej_chrezvychajnoj_situatsii.pdf', + }, + { + title: 'Памятка «Подозрительный предмет»', + visible: 'all', + href: 'https://e.mospolytech.ru/old/storage/files/notes/Metodicheskie_ukazaniya_i_pamyatki_3_Podozritelnyj_predmet.pdf', + }, + { + title: 'Памятка студента по действиям в экстремальных ситуациях', + visible: 'all', + href: 'https://e.mospolytech.ru/old/storage/files/Metodicheskie_ukazaniya_i_pamyatki_4_Pamyatka_studenta_po_dejstviyam_v_ekstremalnyh_situatsiyah.pdf', + }, + { + title: 'Алгоритм действий при возникновении паники в толпе или в месте массового пребывания людей', + visible: 'all', + href: 'https://e.mospolytech.ru/old/storage/files/notes/Metodicheskie_ukazaniya_i_pamyatki_5_Algoritm_dejstvij_pri_vozniknovenii_paniki_v_tolpe_ili_v_meste_massovogo_prebyvaniya_ljudej.PDF', + }, + { + title: 'Безопасность в экстремальных и чрезвычайных ситуациях', + visible: 'all', + href: 'https://e.mospolytech.ru/old/storage/files/notes/Metodicheskie_ukazaniya_i_pamyatki_6_Bezopasnost_v_ekstremalnyh_i_chrezvychajnyh_situatsiyah.PDF', + }, + { + title: 'Как понять, что материал экстремистский, и что с этим делать', + visible: 'all', + href: 'https://e.mospolytech.ru/old/storage/files/notes/Metodicheskie_ukazaniya_i_pamyatki_7_Kak_ponyat__chto_material_ekstremistskij__i_chto_s_etim_delat.PDF', + }, + { + title: 'Последствия и ответственность за ложное сообщение об акте терроризма', + visible: 'all', + href: 'https://e.mospolytech.ru/old/storage/files/notes/Metodicheskie_ukazaniya_i_pamyatki_8_Posledstviya_i_otvetstvennost_za_lozhnoe_soobschenie_ob_akte_terrorizma.PDF', + }, + { + title: 'Последствия участия в несогласованных митингах и протестных акциях', + visible: 'all', + href: 'https://e.mospolytech.ru/old/storage/files/notes/Metodicheskie_ukazaniya_i_pamyatki_9_Posledstviya_uchastiya_v_nesoglasovannyh_mitingah_i_protestnyh_aktsiyah.PDF', + }, + { + title: 'Признаки вербовки в экстремистскую организацию и как с этим справиться', + visible: 'all', + href: 'https://e.mospolytech.ru/old/storage/files/notes/Metodicheskie_ukazaniya_i_pamyatki_10_Priznaki_verbovki_v_ekstremistskuju_organizatsiju_i_kak_s_etim_spravitsya.PDF', + }, + { + title: 'Что делать, если вы обнаружили бесхозный предмет', + visible: 'all', + href: 'https://e.mospolytech.ru/old/storage/files/notes/Metodicheskie_ukazaniya_i_pamyatki_11_Chto_delat__esli_vy_obnaruzhili_beshoznyj_predmet.PDF', + }, + ], + }, +] diff --git a/src/pages/helpful-information/types/helpful-pages.ts b/src/features/helpful-information/types.ts similarity index 100% rename from src/pages/helpful-information/types/helpful-pages.ts rename to src/features/helpful-information/types.ts index ba4c34495..e03257d31 100644 --- a/src/pages/helpful-information/types/helpful-pages.ts +++ b/src/features/helpful-information/types.ts @@ -1,4 +1,8 @@ -type Visibility = 'all' | 'student' | 'staff' +export type HelpfulPage = { + title: string + links: Link[] + visible?: Visibility +} export type Link = { title: string @@ -6,11 +10,7 @@ export type Link = { visible: Visibility } -export type HelpfulPage = { - title: string - links: Link[] - visible?: Visibility -} +type Visibility = 'all' | 'student' | 'staff' export type HelpfulPages = { id: string diff --git a/src/pages/helpful-information/ui/molecules/blocks-list.tsx b/src/features/helpful-information/ui/blocks-list.tsx similarity index 95% rename from src/pages/helpful-information/ui/molecules/blocks-list.tsx rename to src/features/helpful-information/ui/blocks-list.tsx index 7d9cdd645..0b12dc843 100644 --- a/src/pages/helpful-information/ui/molecules/blocks-list.tsx +++ b/src/features/helpful-information/ui/blocks-list.tsx @@ -2,7 +2,7 @@ import React from 'react' import styled from 'styled-components' -import { HelpfulPage } from '@pages/helpful-information/types/helpful-pages' +import { HelpfulPage } from '@features/helpful-information' import List from '@shared/ui/list' import { Title } from '@shared/ui/title' diff --git a/src/features/home/ui/links/index.tsx b/src/features/home/ui/links/index.tsx index 1f3f441c9..1f77b70b1 100644 --- a/src/features/home/ui/links/index.tsx +++ b/src/features/home/ui/links/index.tsx @@ -1,13 +1,12 @@ import React, { useEffect, useState } from 'react' import styled from 'styled-components' -import { TutorialComponent } from 'widgets/tutorial/lib/with-tutorial' - -import { IRoutes } from '@app/routes/general-routes' import { menuModel } from '@entities/menu' +import { IRoutes } from '@shared/routing' import { Divider } from '@shared/ui/divider' +import { TutorialComponent } from '@shared/ui/types' import LinkItem from './link-item' @@ -50,8 +49,10 @@ const Links = ({ links, forwardedRef }: Props) => { if (!allRoutes) return null useEffect(() => { - const longestTitle = linksKeysArray.reduce((a, b) => (links[a].title.length > links[b].title.length ? a : b)) - setLongestTitleLength(links[longestTitle].title.length) + const longestTitle = linksKeysArray.reduce((a, b) => + (links[a].title?.length ?? 0) > (links[b].title?.length ?? 0) ? a : b, + ) + setLongestTitleLength(links[longestTitle].title?.length ?? 0) }, [linksKeysArray]) const linksAmount = Object.keys(links).length diff --git a/src/features/home/ui/links/link-item.tsx b/src/features/home/ui/links/link-item.tsx index eac535d33..351a54ac4 100644 --- a/src/features/home/ui/links/link-item.tsx +++ b/src/features/home/ui/links/link-item.tsx @@ -3,11 +3,10 @@ import { Link } from 'react-router-dom' import styled from 'styled-components' -import { IRoute } from '@app/routes/general-routes' - -import { Icon } from '@features/all-pages' - -import { Colors, MEDIA_QUERIES } from '@shared/constants' +import { Colors } from '@shared/consts' +import { Page } from '@shared/routing' +import { MEDIA_QUERIES } from '@shared/ui/consts' +import { Icon } from '@shared/ui/icon' import Subtext from '@shared/ui/subtext' const LinkItemStyled = styled(Link)<{ color: string; amount: number }>` @@ -77,16 +76,16 @@ const LinkItemStyled = styled(Link)<{ color: string; amount: number }>` ` type Props = { - item: IRoute + item: Page amount: number } const LinkItem = ({ item, amount }: Props) => { - const { icon, color, path, title, notifications, menuPath } = item + const { icon: LinkIcon, color, path, title, notifications, menuPath } = item return ( - - - {icon} + + + {LinkIcon && } {title} diff --git a/src/features/home/ui/molecules/all-info.tsx b/src/features/home/ui/molecules/all-info.tsx index b15c2c1c1..8684584e1 100644 --- a/src/features/home/ui/molecules/all-info.tsx +++ b/src/features/home/ui/molecules/all-info.tsx @@ -1,12 +1,11 @@ import React, { memo } from 'react' -import { User } from '@api/model' import styled from 'styled-components' -import KeyValue from '@ui/atoms/key-value' -import { Divider } from '@ui/divider' - -import transformSex from '@utils/transform-sex' +import { User } from '@shared/api/model' +import transformSex from '@shared/lib/transform-sex' +import KeyValue from '@shared/ui/atoms/key-value' +import { Divider } from '@shared/ui/divider' export default memo(AllInfo) diff --git a/src/features/home/ui/molecules/payments-widget.tsx b/src/features/home/ui/molecules/payments-widget.tsx index 9d8c1dbda..77d3b0b1b 100644 --- a/src/features/home/ui/molecules/payments-widget.tsx +++ b/src/features/home/ui/molecules/payments-widget.tsx @@ -2,25 +2,23 @@ import React from 'react' import { FiCheck, FiInfo } from 'react-icons/fi' import { Link } from 'react-router-dom' -import { Payments, PaymentsContract } from '@api/model' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { TutorialComponent } from 'widgets/tutorial/lib/with-tutorial' - -import { PAYMENTS_ROUTE } from '@app/routes/general-routes' import PaymentButton from '@features/payment-button' import Debt from '@features/payments/debt' import { paymentsModel } from '@entities/payments' -import { MEDIA_QUERIES } from '@shared/constants' +import { Payments, PaymentsContract } from '@shared/api/model' +import { PAYMENTS_ROUTE } from '@shared/routing' +import { Button } from '@shared/ui/button' +import { MEDIA_QUERIES } from '@shared/ui/consts' +import { Error } from '@shared/ui/error' +import { Message } from '@shared/ui/message' +import { SkeletonShape } from '@shared/ui/skeleton-shape' import Subtext from '@shared/ui/subtext' - -import { Button } from '@ui/button' -import { Error } from '@ui/error' -import { Message } from '@ui/message' -import { SkeletonShape } from '@ui/skeleton-shape' +import { TutorialComponent } from '@shared/ui/types' const PaymentsWidgetWrapper = styled.div<{ fullWidth?: boolean }>` max-width: ${({ fullWidth }) => (fullWidth ? '100%' : '400px')}; diff --git a/src/features/home/ui/organisms/links-list.tsx b/src/features/home/ui/organisms/links-list.tsx index ff1abe0bb..5de26e3bc 100644 --- a/src/features/home/ui/organisms/links-list.tsx +++ b/src/features/home/ui/organisms/links-list.tsx @@ -1,13 +1,11 @@ import React from 'react' -import { IRoutes } from '@app/routes/general-routes' - import AllPagesLink from '@features/all-pages/ui/molecules/all-pages-link' +import { IRoutes } from '@shared/routing' import Flex from '@shared/ui/flex' import { Title } from '@shared/ui/title' - -import { Align } from '@ui/types' +import { Align } from '@shared/ui/types' import PageLink, { PageLinkProps } from '../../../all-pages/ui/molecules/page-link' @@ -36,7 +34,7 @@ const LinksList = ({ title, links, doNotShow, orientation, background, shadow = mode={mode} shadow={shadow} {...el} - color={el.color.length ? el.color : 'blue'} + color={el.color?.length ? el.color : 'blue'} /> ) })} diff --git a/src/features/home/ui/organisms/schedule-and-notification.tsx b/src/features/home/ui/organisms/schedule-and-notification.tsx index d9aa73c81..17f882a85 100644 --- a/src/features/home/ui/organisms/schedule-and-notification.tsx +++ b/src/features/home/ui/organisms/schedule-and-notification.tsx @@ -1,7 +1,8 @@ import React from 'react' import { useUnit } from 'effector-react' -import { ListTutorial } from 'widgets/tutorial/tutorials/list-tutorial' + +import { ListTutorial } from '@features/tutorials/list-tutorial' import { userSettingsModel } from '@entities/settings' diff --git a/src/features/home/ui/schedule-widget/hooks/use-schedule-widget.ts b/src/features/home/ui/schedule-widget/hooks/use-schedule-widget.ts index 7e4238ef1..00a9afb2a 100644 --- a/src/features/home/ui/schedule-widget/hooks/use-schedule-widget.ts +++ b/src/features/home/ui/schedule-widget/hooks/use-schedule-widget.ts @@ -1,13 +1,13 @@ import isDayEnded from '@features/schedule/lib/is-day-ended' import { isNextEvent } from '@features/schedule/lib/is-next-event' +import { checkIfEventIsCurrent } from '@features/schedule/ui/calendar/ui/event/lib/check-if-event-is-current' import { useScheduleSubjectModal } from '@features/use-schedule-subject-modal' -import { popUpMessageModel } from '@entities/pop-up-message' import { scheduleModel } from '@entities/schedule' -import { TIME_IN_MS } from '@shared/constants' +import { TIME_IN_MS } from '@shared/consts' import { useScrollTo } from '@shared/lib/hooks/use-scroll-to' -import { checkIfEventIsCurrent } from '@shared/ui/calendar/ui/event/lib/check-if-event-is-current' +import { popUpMessageModel } from '@shared/ui/pop-up-message' export const useScheduleWidget = () => { const { diff --git a/src/features/home/ui/schedule-widget/index.tsx b/src/features/home/ui/schedule-widget/index.tsx index 347447241..73a178acb 100644 --- a/src/features/home/ui/schedule-widget/index.tsx +++ b/src/features/home/ui/schedule-widget/index.tsx @@ -2,9 +2,9 @@ import React from 'react' import { isNextEvent } from '@features/schedule/lib/is-next-event' import { DayEnded, HolidayPlate, SkeletonLoading } from '@features/schedule/ui' +import EventItem from '@features/schedule/ui/calendar/ui/event/event-item' +import { checkIfEventIsCurrent } from '@features/schedule/ui/calendar/ui/event/lib/check-if-event-is-current' -import EventItem from '@shared/ui/calendar/ui/event/event-item' -import { checkIfEventIsCurrent } from '@shared/ui/calendar/ui/event/lib/check-if-event-is-current' import { ErrorIconIndicator } from '@shared/ui/error-icon-indicator' import { useScheduleWidget } from './hooks/use-schedule-widget' diff --git a/src/features/home/ui/schedule-widget/styles.ts b/src/features/home/ui/schedule-widget/styles.ts index 451fcc98c..0e561ac90 100644 --- a/src/features/home/ui/schedule-widget/styles.ts +++ b/src/features/home/ui/schedule-widget/styles.ts @@ -1,6 +1,7 @@ import styled from 'styled-components' -import { Colors, MEDIA_QUERIES } from '@shared/constants' +import { Colors } from '@shared/consts' +import { MEDIA_QUERIES } from '@shared/ui/consts' export const ScheduleWidgetStyled = styled.div<{ noSchedule: boolean }>` --time-width: 30px; diff --git a/src/features/link-more-button/context-content.tsx b/src/features/link-more-button/context-content.tsx index 54ae22a8b..6185b613b 100644 --- a/src/features/link-more-button/context-content.tsx +++ b/src/features/link-more-button/context-content.tsx @@ -4,8 +4,6 @@ import { FiPlus, FiXCircle } from 'react-icons/fi' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { IRoute } from '@app/routes/general-routes' - import { $homePages, $requiredSidebarItems, @@ -18,15 +16,15 @@ import { import { contextMenuModel } from '@entities/context-menu' -import { REQUIRED_HOME_PAGES_CONFIG } from '@shared/constants' - -import { Button } from '@ui/button' -import { Divider } from '@ui/divider' +import { REQUIRED_HOME_PAGES_CONFIG } from '@shared/consts' +import { Page } from '@shared/routing' +import { Button } from '@shared/ui/button' +import { Divider } from '@shared/ui/divider' -import Icon from '../all-pages/ui/atoms/icon' +import Icon from '../../shared/ui/icon/icon' -const ContextContent = (props: IRoute) => { - const { id, icon, title, color } = props +const ContextContent = (props: Page) => { + const { id, icon: LinkIcon, title, color } = props const [home, sidebar, requiredSidebar] = useUnit([$homePages, $sidebarItems, $requiredSidebarItems]) const isAddedToHome = home.includes(id) @@ -48,8 +46,8 @@ const ContextContent = (props: IRoute) => { return (
- - {icon} + + {LinkIcon && } {title}
diff --git a/src/features/link-more-button/index.tsx b/src/features/link-more-button/index.tsx index 97430177a..c64b3405c 100644 --- a/src/features/link-more-button/index.tsx +++ b/src/features/link-more-button/index.tsx @@ -1,17 +1,16 @@ import React from 'react' import { FiMoreVertical } from 'react-icons/fi' -import { IRoute } from '@app/routes/general-routes' - import { contextMenuModel } from '@entities/context-menu' -import { Colors, IColors } from '@shared/constants' +import { Colors, IColors } from '@shared/consts' +import { Page } from '@shared/routing' import { Button } from '@shared/ui/button' import ContextContent from './context-content' type Props = { - route: IRoute + route: Page } const LinkMoreButton = ({ route }: Props) => { diff --git a/src/widgets/list-of-people/index.tsx b/src/features/list-of-people/index.tsx similarity index 97% rename from src/widgets/list-of-people/index.tsx rename to src/features/list-of-people/index.tsx index f56ef1e35..9578c76d7 100644 --- a/src/widgets/list-of-people/index.tsx +++ b/src/features/list-of-people/index.tsx @@ -4,11 +4,10 @@ import { AxiosResponse } from 'axios' import { EventCallable, Store } from 'effector' import styled from 'styled-components' -import SearchWithHints from '@features/search-with-hints' -import { SelectPage } from '@features/select' - import GlobalSearch from '@shared/ui/global-search' import { Hint } from '@shared/ui/search' +import SearchWithHints from '@shared/ui/search-with-hints' +import { SelectPage } from '@shared/ui/select' import Subtext from '@shared/ui/subtext' import { Title } from '@shared/ui/title' diff --git a/src/widgets/list-of-people/people-pagination-list.tsx b/src/features/list-of-people/people-pagination-list.tsx similarity index 96% rename from src/widgets/list-of-people/people-pagination-list.tsx rename to src/features/list-of-people/people-pagination-list.tsx index efeda2ba5..eaea30ec0 100644 --- a/src/widgets/list-of-people/people-pagination-list.tsx +++ b/src/features/list-of-people/people-pagination-list.tsx @@ -2,12 +2,12 @@ import React from 'react' import { EventCallable, Store } from 'effector' import { useStore } from 'effector-react' -import User from 'widgets/user' -import { SelectPage } from '@features/select' +import User from '@features/user' import PagintaionList from '@shared/ui/pagination-list' import { Hint } from '@shared/ui/search' +import { SelectPage } from '@shared/ui/select' type TUser = { id: string diff --git a/src/widgets/lk-notification-list/index.tsx b/src/features/lk-notification-list/index.tsx similarity index 97% rename from src/widgets/lk-notification-list/index.tsx rename to src/features/lk-notification-list/index.tsx index 8eec0085b..b923594ad 100644 --- a/src/widgets/lk-notification-list/index.tsx +++ b/src/features/lk-notification-list/index.tsx @@ -4,11 +4,11 @@ import { FiBellOff, FiXCircle } from 'react-icons/fi' import styled from 'styled-components' import { lkNotificationModel } from '@entities/lk-notifications' -import { popUpMessageModel } from '@entities/pop-up-message' import { CenterPage, Error, Message } from '@shared/ui/atoms' import Flex from '@shared/ui/flex' import PlaneSkeletonList from '@shared/ui/plane-skeleton-list' +import { popUpMessageModel } from '@shared/ui/pop-up-message' import NotificationList from './ui/list' diff --git a/src/widgets/lk-notification-list/ui/list.tsx b/src/features/lk-notification-list/ui/list.tsx similarity index 94% rename from src/widgets/lk-notification-list/ui/list.tsx rename to src/features/lk-notification-list/ui/list.tsx index f0d36f022..59df80033 100644 --- a/src/widgets/lk-notification-list/ui/list.tsx +++ b/src/features/lk-notification-list/ui/list.tsx @@ -1,11 +1,11 @@ import React from 'react' +import NotificationItem from '@features/notifications/notification-item' + import { TNotification, lkNotificationModel } from '@entities/lk-notifications' import Flex from '@shared/ui/flex' -import NotificationItem from './notification-item' - type Props = { notifications: TNotification[] | null loadingRemove: boolean diff --git a/src/pages/medical-certificate/lib/cert-form.ts b/src/features/medical-certificate/lib/cert-form.ts similarity index 93% rename from src/pages/medical-certificate/lib/cert-form.ts rename to src/features/medical-certificate/lib/cert-form.ts index 283055687..db64f82cf 100644 --- a/src/pages/medical-certificate/lib/cert-form.ts +++ b/src/features/medical-certificate/lib/cert-form.ts @@ -1,4 +1,4 @@ -import getDelayInDays from '@pages/hr-applications/lib/get-delay-in-days' +import getDelayInDays from '@features/medical-certificate/lib/get-delay-in-days' import { IInputArea } from '@shared/ui/input-area/model' diff --git a/src/pages/hr-applications/lib/get-delay-in-days.ts b/src/features/medical-certificate/lib/get-delay-in-days.ts similarity index 100% rename from src/pages/hr-applications/lib/get-delay-in-days.ts rename to src/features/medical-certificate/lib/get-delay-in-days.ts diff --git a/src/features/notifications/icon-wrapper.tsx b/src/features/notifications/icon-wrapper.tsx new file mode 100644 index 000000000..33a992c5e --- /dev/null +++ b/src/features/notifications/icon-wrapper.tsx @@ -0,0 +1,8 @@ +import React from 'react' + +import { IColors } from '@shared/consts' +import { Icon } from '@shared/ui/icon' + +export const IconWrapper = ({ color, children }: { color: keyof IColors; children: JSX.Element }) => { + return {children} +} diff --git a/src/widgets/lk-notification-list/ui/notification-icon.tsx b/src/features/notifications/notification-icon.tsx similarity index 82% rename from src/widgets/lk-notification-list/ui/notification-icon.tsx rename to src/features/notifications/notification-icon.tsx index 82b53f206..a787a60a4 100644 --- a/src/widgets/lk-notification-list/ui/notification-icon.tsx +++ b/src/features/notifications/notification-icon.tsx @@ -3,16 +3,11 @@ import { BiNews, BiRuble } from 'react-icons/bi' import { FiClock, FiFileText, FiInfo, FiMessageCircle, FiStar } from 'react-icons/fi' import { HiOutlineClipboardCheck } from 'react-icons/hi' -import { Icon } from '@features/all-pages' - import { NotificationType } from '@entities/lk-notifications' -import { IColors } from '@shared/constants' import NewVersionMessage from '@shared/ui/new-version-message' -const IconWrapper = ({ color, children }: { color: keyof IColors; children: JSX.Element }) => { - return {children} -} +import { IconWrapper } from './icon-wrapper' export const iconObject = (): Record => ({ info: ( @@ -50,11 +45,6 @@ export const iconObject = (): Record => ({ ), - 'hr-applications': ( - - - - ), 'kpi-pps': ( diff --git a/src/widgets/lk-notification-list/ui/notification-item.tsx b/src/features/notifications/notification-item.tsx similarity index 98% rename from src/widgets/lk-notification-list/ui/notification-item.tsx rename to src/features/notifications/notification-item.tsx index de788231a..f08aeff77 100644 --- a/src/widgets/lk-notification-list/ui/notification-item.tsx +++ b/src/features/notifications/notification-item.tsx @@ -3,7 +3,6 @@ import { FiX } from 'react-icons/fi' import { Link } from 'react-router-dom' import styled from 'styled-components' -import { useModal } from 'widgets/modal/lib' import { TNotification, lkNotificationModel } from '@entities/lk-notifications' @@ -13,6 +12,7 @@ import AutoAccordion from '@shared/ui/auto-accordion' import { Button } from '@shared/ui/button' import DotSeparatedWords from '@shared/ui/dot-separated-words' import Flex from '@shared/ui/flex' +import { useModal } from '@shared/ui/modal' import Subtext from '@shared/ui/subtext' import { ExtSize, Size } from '@shared/ui/types' diff --git a/src/features/payment-button/index.tsx b/src/features/payment-button/index.tsx index 40e875498..4725aa1bd 100644 --- a/src/features/payment-button/index.tsx +++ b/src/features/payment-button/index.tsx @@ -1,12 +1,10 @@ import React from 'react' import { HiOutlineQrcode } from 'react-icons/hi' -import { useModal } from 'widgets' -import { TutorialComponent } from 'widgets/tutorial/lib/with-tutorial' - -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' import { Button } from '@shared/ui/button' -import { Direction } from '@shared/ui/types' +import { useModal } from '@shared/ui/modal' +import { Direction, TutorialComponent } from '@shared/ui/types' import PayQRModal from './pay-qr-modal' diff --git a/src/features/payment-button/pay-qr-modal.tsx b/src/features/payment-button/pay-qr-modal.tsx index a92181cf7..2ef444608 100644 --- a/src/features/payment-button/pay-qr-modal.tsx +++ b/src/features/payment-button/pay-qr-modal.tsx @@ -1,9 +1,9 @@ import React from 'react' import styled from 'styled-components' -import { SliderPage } from 'widgets' import QrCode from '@features/payments/ui/atoms/qr-code' +import SliderPage from '@features/slider-page' const PayQRModalStyled = styled.div` @media (min-width: 1001px) { diff --git a/src/features/payments/debt.tsx b/src/features/payments/debt.tsx index b7a02cf21..cc5dc3044 100644 --- a/src/features/payments/debt.tsx +++ b/src/features/payments/debt.tsx @@ -1,10 +1,8 @@ import React from 'react' -import { TutorialComponent } from 'widgets/tutorial/lib/with-tutorial' - -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' import RubleNumber from '@shared/ui/ruble-number' -import { Size } from '@shared/ui/types' +import { Size, TutorialComponent } from '@shared/ui/types' type Props = { debt: number diff --git a/src/features/payments/ui/atoms/payment-item.tsx b/src/features/payments/ui/atoms/payment-item.tsx index 165cea926..920cab3d6 100644 --- a/src/features/payments/ui/atoms/payment-item.tsx +++ b/src/features/payments/ui/atoms/payment-item.tsx @@ -1,14 +1,13 @@ import React from 'react' import { BiRuble } from 'react-icons/bi' -import { IPaymentItem } from '@api/model' import styled from 'styled-components' -import { Icon } from '@features/all-pages' - -import { Colors } from '@shared/constants' +import { IPaymentItem } from '@shared/api/model' +import { Colors } from '@shared/consts' import localizeDate from '@shared/lib/dates/localize-date' import Flex from '@shared/ui/flex' +import { Icon } from '@shared/ui/icon' import Subtext from '@shared/ui/subtext' const PaymentItemWrapper = styled.div` diff --git a/src/features/payments/ui/atoms/qr-code.tsx b/src/features/payments/ui/atoms/qr-code.tsx index e0b27af64..2a99b6b8f 100644 --- a/src/features/payments/ui/atoms/qr-code.tsx +++ b/src/features/payments/ui/atoms/qr-code.tsx @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react' import styled from 'styled-components' -import { Image } from '@ui/atoms' +import { Image } from '@shared/ui/atoms' const QrCodeWrapper = styled.div` display: flex; diff --git a/src/features/payments/ui/molecules/contract.tsx b/src/features/payments/ui/molecules/contract.tsx index 076c32bc6..af787fcd4 100644 --- a/src/features/payments/ui/molecules/contract.tsx +++ b/src/features/payments/ui/molecules/contract.tsx @@ -1,21 +1,20 @@ import React, { useState } from 'react' import { FiDownload } from 'react-icons/fi' -import { PaymentsContract } from '@api/model' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { useModal } from 'widgets' import { paymentsModel } from '@entities/payments' -import { userModel } from '@entities/user' -import { Colors } from '@shared/constants' +import { PaymentsContract } from '@shared/api/model' +import { Colors } from '@shared/consts' import localizeDate from '@shared/lib/dates/localize-date' import { formatNumber } from '@shared/lib/get-number-with-spaces-format' +import { userModel } from '@shared/session' +import { Button, LinkButton, SubmitButton } from '@shared/ui/atoms' import KeyValue from '@shared/ui/atoms/key-value' import Flex from '@shared/ui/flex' - -import { Button, LinkButton, SubmitButton } from '@ui/atoms' +import { useModal } from '@shared/ui/modal' import TechicalErrorMessage from './technical-error-message' @@ -62,7 +61,7 @@ const Contract = ({ contract }: Props) => { const [loading, setLoading] = useState(false) const [completed, setCompleted] = useState(false) const error = useUnit(paymentsModel.stores.$error) - const isStudent = useUnit(userModel.stores.user).currentUser?.user_status === 'stud' + const isStudent = useUnit(userModel.stores.userRole) === 'stud' const contractInfo = [ { @@ -99,7 +98,7 @@ const Contract = ({ contract }: Props) => { }, { text: 'Статус', - info: sign_text, + info: sign_text ?? '', }, // { // text: 'Ежемесячная плата: ', diff --git a/src/features/payments/ui/molecules/electronic-agreement-list-item.tsx b/src/features/payments/ui/molecules/electronic-agreement-list-item.tsx index 94bac1e79..d3bba3470 100644 --- a/src/features/payments/ui/molecules/electronic-agreement-list-item.tsx +++ b/src/features/payments/ui/molecules/electronic-agreement-list-item.tsx @@ -2,24 +2,22 @@ import React, { useEffect } from 'react' import { FiCheck, FiDownload } from 'react-icons/fi' import { useHistory } from 'react-router' -import { Agreement } from '@api/model' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { useModal } from 'widgets' - -import { THIRD_PARTY_ELECTRONIC_INTERACTION } from '@app/routes/general-routes' import { paymentsModel, thirdPartyAgreementModel, thirdPartyInteractionModel } from '@entities/payments' -import { popUpMessageModel } from '@entities/pop-up-message' +import { Agreement } from '@shared/api/model' import localizeDate from '@shared/lib/dates/localize-date' -import useCurrentDevice from '@shared/lib/hooks/use-current-device' +import { THIRD_PARTY_ELECTRONIC_INTERACTION } from '@shared/routing' +import Accordion from '@shared/ui/accordion/accordion' +import { LinkButton, Message, SubmitButton, Title } from '@shared/ui/atoms' import Flex from '@shared/ui/flex' +import useCurrentDevice from '@shared/ui/hooks/use-current-device' +import { useModal } from '@shared/ui/modal' +import { popUpMessageModel } from '@shared/ui/pop-up-message' import Subtext from '@shared/ui/subtext' -import Accordion from '@ui/accordion/accordion' -import { LinkButton, Message, SubmitButton, Title } from '@ui/atoms' - import { ThirdPartyModal } from './third-party' interface Props { diff --git a/src/features/payments/ui/molecules/payment-list.tsx b/src/features/payments/ui/molecules/payment-list.tsx index 94d7cfa0a..981b65955 100644 --- a/src/features/payments/ui/molecules/payment-list.tsx +++ b/src/features/payments/ui/molecules/payment-list.tsx @@ -1,19 +1,17 @@ import React from 'react' import { FiArrowDownCircle, FiBox } from 'react-icons/fi' -import { IPaymentItem } from '@api/model' import styled from 'styled-components' import { PaymentItem } from '@features/payments' +import { IPaymentItem } from '@shared/api/model' +import getCorrectNumberFormat from '@shared/lib/get-correct-number-format' +import { Error, Title } from '@shared/ui/atoms' import Flex from '@shared/ui/flex' import RubleNumber from '@shared/ui/ruble-number' import Subtext from '@shared/ui/subtext' -import { Error, Title } from '@ui/atoms' - -import getCorrectNumberFormat from '@utils/get-correct-number-format' - const PaymentListWrapper = styled.div` width: 100%; display: flex; diff --git a/src/features/payments/ui/molecules/third-party/check-emails.tsx b/src/features/payments/ui/molecules/third-party/check-emails.tsx index 2651da25f..bb7d4b4dd 100644 --- a/src/features/payments/ui/molecules/third-party/check-emails.tsx +++ b/src/features/payments/ui/molecules/third-party/check-emails.tsx @@ -1,17 +1,16 @@ import React, { useState } from 'react' import { useUnit } from 'effector-react' -import { useModal } from 'widgets' import { thirdPartyAgreementModel } from '@entities/payments' import { Agreement } from '@shared/api/model' -import { Colors } from '@shared/constants' -import useCurrentDevice from '@shared/lib/hooks/use-current-device' -import { Button, Message, Title } from '@shared/ui/atoms' +import { Colors } from '@shared/consts' +import { Button, Input, Message, Title } from '@shared/ui/atoms' import Flex from '@shared/ui/flex' import { Grid } from '@shared/ui/grid' -import Input from '@shared/ui/input' +import useCurrentDevice from '@shared/ui/hooks/use-current-device' +import { useModal } from '@shared/ui/modal' export const CheckEmails = ({ agreement }: { agreement: Agreement }) => { const { isMobile } = useCurrentDevice() diff --git a/src/features/payments/ui/molecules/third-party/enter-passwords.tsx b/src/features/payments/ui/molecules/third-party/enter-passwords.tsx index b45a76490..e10e729ca 100644 --- a/src/features/payments/ui/molecules/third-party/enter-passwords.tsx +++ b/src/features/payments/ui/molecules/third-party/enter-passwords.tsx @@ -5,9 +5,9 @@ import { useUnit } from 'effector-react' import { thirdPartyAgreementModel } from '@entities/payments' import { Agreement } from '@shared/api/model' -import useCurrentDevice from '@shared/lib/hooks/use-current-device' import { Button, Title } from '@shared/ui/atoms' import { Grid } from '@shared/ui/grid' +import useCurrentDevice from '@shared/ui/hooks/use-current-device' import Input from '@shared/ui/input' export const EnterPasswords = ({ agreement }: { agreement: Agreement }) => { diff --git a/src/features/payments/ui/molecules/third-party/get-passwords.tsx b/src/features/payments/ui/molecules/third-party/get-passwords.tsx index 517cfca8d..74e3f1539 100644 --- a/src/features/payments/ui/molecules/third-party/get-passwords.tsx +++ b/src/features/payments/ui/molecules/third-party/get-passwords.tsx @@ -5,12 +5,11 @@ import { useUnit } from 'effector-react' import { thirdPartyAgreementModel } from '@entities/payments' import { Agreement } from '@shared/api/model' -import { Colors } from '@shared/constants' -import useCurrentDevice from '@shared/lib/hooks/use-current-device' -import { Button } from '@shared/ui/atoms' +import { Colors } from '@shared/consts' +import { Button, Title } from '@shared/ui/atoms' import Flex from '@shared/ui/flex' import { Grid } from '@shared/ui/grid' -import { Title } from '@shared/ui/title' +import useCurrentDevice from '@shared/ui/hooks/use-current-device' export const GetPasswords = ({ agreement }: { agreement: Agreement }) => { const { isMobile } = useCurrentDevice() diff --git a/src/features/payments/ui/molecules/third-party/index.tsx b/src/features/payments/ui/molecules/third-party/index.tsx index 064f53518..7a356687c 100644 --- a/src/features/payments/ui/molecules/third-party/index.tsx +++ b/src/features/payments/ui/molecules/third-party/index.tsx @@ -7,9 +7,9 @@ import styled from 'styled-components' import { thirdPartyAgreementModel } from '@entities/payments' import { Agreement } from '@shared/api/model' -import useCurrentDevice from '@shared/lib/hooks/use-current-device' import { Button } from '@shared/ui/atoms' import Flex from '@shared/ui/flex' +import useCurrentDevice from '@shared/ui/hooks/use-current-device' import { Title } from '@shared/ui/title' import { CheckEmails } from './check-emails' diff --git a/src/features/payments/ui/organisms/electronic-agreement-list.tsx b/src/features/payments/ui/organisms/electronic-agreement-list.tsx index 3ab6f43ac..84c968afe 100644 --- a/src/features/payments/ui/organisms/electronic-agreement-list.tsx +++ b/src/features/payments/ui/organisms/electronic-agreement-list.tsx @@ -1,10 +1,9 @@ import React from 'react' import { FiFolderPlus } from 'react-icons/fi' +import List from '@shared/ui/list' import { Title } from '@shared/ui/title' -import List from '@ui/list' - import ElectronicAgreementListItem from '../molecules/electronic-agreement-list-item' interface Props { diff --git a/src/features/pe-students-filter/filters.ts b/src/features/pe-students-filter/filters.ts new file mode 100644 index 000000000..df5c6e0ab --- /dev/null +++ b/src/features/pe-students-filter/filters.ts @@ -0,0 +1,67 @@ +import { attach, combine, createEvent, createStore, sample } from 'effector' +import { debounce, reset } from 'patronum' + +import { pEStudentModel, pEStudentSearchModel } from '@entities/pe-student/model' + +import { peApi } from '@shared/api' + +const addFilter = createEvent<{ name: string; value: string | number; strict?: boolean }>() +const resetFilters = createEvent() + +const $filters = createStore>({}) + .on(pEStudentSearchModel.stores.$search, (state, search) => { + return { ...state, fullName: { value: search } } + }) + .on(addFilter, (state, { name, value, strict }) => { + const data = { ...state } + if (!value) { + delete data[name] + return data + } + return { ...data, [name]: { value, strict } } + }) + +sample({ clock: resetFilters, target: $filters.reinit! }) +sample({ clock: resetFilters, fn: () => '', target: pEStudentSearchModel.events.update }) + +const loadPageFx = attach({ + source: { page: pEStudentModel.stores.$pEStudentsPage, filters: $filters }, + effect: async ({ filters, page }) => { + const { data } = await peApi.getStudents(page, filters) + + return data.data + }, +}) + +debounce({ + source: combine(pEStudentModel.stores.$pEStudentsPage, $filters), + timeout: 200, + target: pEStudentModel.events.load, +}) + +sample({ clock: pEStudentModel.events.load, target: loadPageFx }) + +reset({ + clock: $filters, + target: pEStudentModel.stores.$pEStudentsPage, +}) + +sample({ + clock: loadPageFx.doneData, + fn: ({ students }) => students, + target: pEStudentModel.stores.$pEStudents, +}) +sample({ + clock: loadPageFx.doneData, + fn: ({ totalCount }) => totalCount, + target: pEStudentModel.stores.$pEStudentsTotalCount, +}) + +const $loading = combine(loadPageFx.pending, Boolean) + +export const stores = { $loading, $filters } + +export const events = { + addFilter, + resetFilters, +} diff --git a/src/features/pe-students-filter/index.ts b/src/features/pe-students-filter/index.ts index ed584959d..ac32c0d11 100644 --- a/src/features/pe-students-filter/index.ts +++ b/src/features/pe-students-filter/index.ts @@ -1 +1,3 @@ export * from './ui' +export * as pEStudentIsExamModel from './isExam' +export * as pEStudentFilterModel from './filters' diff --git a/src/pages/teacher-physical-education/model/isExam.ts b/src/features/pe-students-filter/isExam.ts similarity index 100% rename from src/pages/teacher-physical-education/model/isExam.ts rename to src/features/pe-students-filter/isExam.ts diff --git a/src/features/pe-students-filter/types.ts b/src/features/pe-students-filter/types.ts new file mode 100644 index 000000000..8a7fd1f94 --- /dev/null +++ b/src/features/pe-students-filter/types.ts @@ -0,0 +1,4 @@ +export enum FiltersSelect { + Group = 'group.groupName', + Course = 'course', +} diff --git a/src/features/pe-students-filter/ui/index.tsx b/src/features/pe-students-filter/ui/index.tsx index 395d5afca..321cf6249 100644 --- a/src/features/pe-students-filter/ui/index.tsx +++ b/src/features/pe-students-filter/ui/index.tsx @@ -3,22 +3,16 @@ import { FiUsers } from 'react-icons/fi' import { useUnit } from 'effector-react' -import { pEStudentFilterModel, pEStudentIsExamModel } from '@pages/teacher-physical-education/model' - -import SearchWithHints from '@features/search-with-hints' -import Select, { SelectPage } from '@features/select' - import { studentApi } from '@shared/api' import Masks from '@shared/lib/masks' +import SearchWithHints from '@shared/ui/search-with-hints' +import Select, { SelectPage } from '@shared/ui/select' import ToggleItem from '@shared/ui/toggle-item' +import { pEStudentFilterModel, pEStudentIsExamModel } from '..' +import { FiltersSelect } from '../types' import { Wrapper } from './styled' -export enum FiltersSelect { - Group = 'group.groupName', - Course = 'course', -} - const courses = [ { id: 0, title: 'Не выбрано' }, { id: 1, title: '1 курс' }, diff --git a/src/features/physical-education/admin-panel/add-competition/model.ts b/src/features/physical-education/admin-panel/add-competition/model.ts index b59cdd8f8..b0b2726f0 100644 --- a/src/features/physical-education/admin-panel/add-competition/model.ts +++ b/src/features/physical-education/admin-panel/add-competition/model.ts @@ -1,11 +1,11 @@ import { createEffect, createEvent, sample } from 'effector' -import { modalModel } from 'widgets/modal/model' import { peStudentCompetitionModel } from '@entities/pe-student/model' -import { popUpMessageModel } from '@entities/pop-up-message' import { peApi } from '@shared/api' import { getPeErrorMsg } from '@shared/api/config/pe-config' +import { modalModel } from '@shared/ui/modal/model' +import { popUpMessageModel } from '@shared/ui/pop-up-message' import { AddCompetition } from './types' diff --git a/src/features/physical-education/end-semester/constants.tsx b/src/features/physical-education/end-semester/constants.tsx index e38c68bb6..74c8aadd1 100644 --- a/src/features/physical-education/end-semester/constants.tsx +++ b/src/features/physical-education/end-semester/constants.tsx @@ -1,7 +1,7 @@ import React from 'react' import { FiAlertOctagon, FiCheck } from 'react-icons/fi' -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' import { Loading } from '@shared/ui/loading' import { Status } from '../student/pe-student-end-semester/model' diff --git a/src/features/physical-education/end-semester/index.tsx b/src/features/physical-education/end-semester/index.tsx index 5029f6c12..6ab543a74 100644 --- a/src/features/physical-education/end-semester/index.tsx +++ b/src/features/physical-education/end-semester/index.tsx @@ -2,7 +2,7 @@ import React from 'react' import { useUnit } from 'effector-react' -import { peExamStudentModel } from '@pages/teacher-physical-education/students-exam/pe-exam-student-model' +import { peExamStudentModel } from '@features/physical-education/end-semester/pe-exam-student-model' import Flex from '@shared/ui/flex' import Subtext from '@shared/ui/subtext' diff --git a/src/pages/teacher-physical-education/students-exam/pe-exam-student-model.ts b/src/features/physical-education/end-semester/pe-exam-student-model.ts similarity index 96% rename from src/pages/teacher-physical-education/students-exam/pe-exam-student-model.ts rename to src/features/physical-education/end-semester/pe-exam-student-model.ts index 14352d232..9d71183e6 100644 --- a/src/pages/teacher-physical-education/students-exam/pe-exam-student-model.ts +++ b/src/features/physical-education/end-semester/pe-exam-student-model.ts @@ -3,9 +3,8 @@ import { attach, combine, createEvent, createStore, sample } from 'effector' import { peStudentEndSemesterModel } from '@features/physical-education/student/pe-student-end-semester' import { Status } from '@features/physical-education/student/pe-student-end-semester/model' -import { PEStudent } from '@entities/pe-student/types' - import { peApi } from '@shared/api' +import { PEStudent } from '@shared/api/physical-education' const selectedGroupChanged = createEvent() diff --git a/src/features/physical-education/student/pe-student-additional-points/constants.ts b/src/features/physical-education/student/pe-student-additional-points/constants.ts index a4c90400a..bef51c4b7 100644 --- a/src/features/physical-education/student/pe-student-additional-points/constants.ts +++ b/src/features/physical-education/student/pe-student-additional-points/constants.ts @@ -1,4 +1,4 @@ -import { WorkType } from '@entities/pe-student-additional-points/types' +import { WorkType } from '@shared/api/physical-education' export const SelectorData: { id: WorkType; title: string }[] = [ { id: WorkType.Activist, title: 'Активист' }, diff --git a/src/features/physical-education/student/pe-student-additional-points/features/add-pe-student-additional-points/index.tsx b/src/features/physical-education/student/pe-student-additional-points/features/add-pe-student-additional-points/index.tsx index 503fb1f44..528b12887 100644 --- a/src/features/physical-education/student/pe-student-additional-points/features/add-pe-student-additional-points/index.tsx +++ b/src/features/physical-education/student/pe-student-additional-points/features/add-pe-student-additional-points/index.tsx @@ -2,16 +2,15 @@ import React, { useEffect, useState } from 'react' import { useUnit } from 'effector-react' -import Select, { SelectPage } from '@features/select' - import { peStudentAdditionalPointsModel } from '@entities/pe-student-additional-points/model' -import { AddStudentAdditionalPoints, WorkType } from '@entities/pe-student-additional-points/types' import { peStudentCompetitionModel, selectedPEStudentModel } from '@entities/pe-student/model' -import { Colors } from '@shared/constants' +import { AddStudentAdditionalPoints, WorkType } from '@shared/api/physical-education' +import { Colors } from '@shared/consts' import localizeDate from '@shared/lib/dates/localize-date' import { Button } from '@shared/ui/button' import Input from '@shared/ui/input' +import Select, { SelectPage } from '@shared/ui/select' import { TextArea } from '@shared/ui/textarea' import { SelectorData } from '../../constants' diff --git a/src/features/physical-education/student/pe-student-additional-points/index.tsx b/src/features/physical-education/student/pe-student-additional-points/index.tsx index 8a4c3c8cf..b048c055e 100644 --- a/src/features/physical-education/student/pe-student-additional-points/index.tsx +++ b/src/features/physical-education/student/pe-student-additional-points/index.tsx @@ -1,13 +1,13 @@ import React from 'react' import { useUnit } from 'effector-react' -import { useModal } from 'widgets' import { selectedPEStudentModel } from '@entities/pe-student/model' import { peTeacherModel } from '@entities/pe-teacher' -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' import { Button } from '@shared/ui/button' +import { useModal } from '@shared/ui/modal' import { AddPEStudentAdditionalPoints } from './features/add-pe-student-additional-points' import { $additionalPointsColumns } from './model' diff --git a/src/features/physical-education/student/pe-student-additional-points/model.tsx b/src/features/physical-education/student/pe-student-additional-points/model.tsx index 87485cb04..bd9084834 100644 --- a/src/features/physical-education/student/pe-student-additional-points/model.tsx +++ b/src/features/physical-education/student/pe-student-additional-points/model.tsx @@ -4,11 +4,9 @@ import { differenceInDays } from 'date-fns' import { combine } from 'effector' import { peStudentAdditionalPointsModel } from '@entities/pe-student-additional-points/model' -import { WorkType } from '@entities/pe-student-additional-points/types' -import { PEStudentProfile } from '@entities/pe-student/types' import { peTeacherModel } from '@entities/pe-teacher' -import { PeTeacherPermission } from '@entities/pe-teacher/types' +import { PEStudentProfile, PeTeacherPermission, WorkType } from '@shared/api/physical-education' import { Button } from '@shared/ui/button' import { ColumnProps } from '@shared/ui/table/types' diff --git a/src/features/physical-education/student/pe-student-health-group/ui.tsx b/src/features/physical-education/student/pe-student-health-group/ui.tsx index c2e9e5206..5c6a7ed3b 100644 --- a/src/features/physical-education/student/pe-student-health-group/ui.tsx +++ b/src/features/physical-education/student/pe-student-health-group/ui.tsx @@ -3,14 +3,13 @@ import React, { useState } from 'react' import { useUnit } from 'effector-react' import styled from 'styled-components' -import Select, { SelectPage } from '@features/select' - import { peStudentHealthGroupModel } from '@entities/pe-student/model' -import { HealthGroup } from '@entities/pe-student/types' -import { Colors } from '@shared/constants' +import { HealthGroup } from '@shared/api/physical-education' +import { Colors } from '@shared/consts' import { Button } from '@shared/ui/button' import Flex from '@shared/ui/flex' +import Select, { SelectPage } from '@shared/ui/select' interface Props { studentGuid: string diff --git a/src/features/physical-education/student/pe-student-modal/ui/modal.tsx b/src/features/physical-education/student/pe-student-modal/ui/modal.tsx index 8e9f195a3..3ffc158fb 100644 --- a/src/features/physical-education/student/pe-student-modal/ui/modal.tsx +++ b/src/features/physical-education/student/pe-student-modal/ui/modal.tsx @@ -1,17 +1,16 @@ import React from 'react' import { useHistory } from 'react-router' -import { useModal } from 'widgets' - -import { PHYSICAL_EDUCATION_STUDENT } from '@app/routes/teacher-routes' - -import { PEStudent, healthGroupToTitle, specializationToTitle } from '@entities/pe-student/types' +import { healthGroupToTitle, specializationToTitle } from '@entities/pe-student/types' +import { PEStudent } from '@shared/api/physical-education' import { buildRealLink } from '@shared/lib/buildRealLink' +import { PHYSICAL_EDUCATION_STUDENT_ID } from '@shared/routing' import KeyValue from '@shared/ui/atoms/key-value' import { Button } from '@shared/ui/button' import { Divider } from '@shared/ui/divider' import Flex from '@shared/ui/flex' +import { useModal } from '@shared/ui/modal' import { Title } from '@shared/ui/title' import { AddPeStudentVisits } from '../../pe-student-visits/features/add-pe-student-visits/ui' @@ -27,7 +26,7 @@ export const PEStudentModal = ({ student }: Props) => { const { close } = useModal() const handleClick = () => { - history.push(buildRealLink(PHYSICAL_EDUCATION_STUDENT, { studentId: student.studentGuid })) + history.push(buildRealLink(PHYSICAL_EDUCATION_STUDENT_ID, { studentId: student.studentGuid })) close() } diff --git a/src/features/physical-education/student/pe-student-modal/ui/styled.ts b/src/features/physical-education/student/pe-student-modal/ui/styled.ts index 9526f71df..d5c7df792 100644 --- a/src/features/physical-education/student/pe-student-modal/ui/styled.ts +++ b/src/features/physical-education/student/pe-student-modal/ui/styled.ts @@ -1,6 +1,6 @@ import styled from 'styled-components' -import { MEDIA_QUERIES } from '@shared/constants' +import { MEDIA_QUERIES } from '@shared/ui/consts' export const Visits = styled.div` min-height: 50px; diff --git a/src/features/physical-education/student/pe-student-regulation-points/constants.ts b/src/features/physical-education/student/pe-student-regulation-points/constants.ts index fbeec0b5b..262d10716 100644 --- a/src/features/physical-education/student/pe-student-regulation-points/constants.ts +++ b/src/features/physical-education/student/pe-student-regulation-points/constants.ts @@ -1,4 +1,4 @@ -import { RegulationType } from '@entities/pe-student-regulation-points/types' +import { RegulationType } from '@shared/api/physical-education' export const SelectorData: { id: RegulationType; title: string }[] = [ { id: RegulationType.FlexionAndExtensionOfArms, title: 'Сгибание и разгибание рук' }, diff --git a/src/features/physical-education/student/pe-student-regulation-points/features/add-pe-student-regulation-points/index.tsx b/src/features/physical-education/student/pe-student-regulation-points/features/add-pe-student-regulation-points/index.tsx index 6837a5551..e827c82e8 100644 --- a/src/features/physical-education/student/pe-student-regulation-points/features/add-pe-student-regulation-points/index.tsx +++ b/src/features/physical-education/student/pe-student-regulation-points/features/add-pe-student-regulation-points/index.tsx @@ -2,16 +2,15 @@ import React, { useState } from 'react' import { useUnit } from 'effector-react' -import Select, { SelectPage } from '@features/select' - import { peStudentRegulationPointsModel } from '@entities/pe-student-regulation-points/model' -import { AddStudentRegulationPoints, RegulationType } from '@entities/pe-student-regulation-points/types' import { selectedPEStudentModel } from '@entities/pe-student/model' -import { Colors } from '@shared/constants' +import { AddStudentRegulationPoints, RegulationType } from '@shared/api/physical-education' +import { Colors } from '@shared/consts' import localizeDate from '@shared/lib/dates/localize-date' import { Button } from '@shared/ui/button' import Input from '@shared/ui/input' +import Select, { SelectPage } from '@shared/ui/select' import { SelectorData } from '../../constants' import { Wrapper } from './styled' diff --git a/src/features/physical-education/student/pe-student-regulation-points/index.tsx b/src/features/physical-education/student/pe-student-regulation-points/index.tsx index cc2ed5c0b..8b22aa8a8 100644 --- a/src/features/physical-education/student/pe-student-regulation-points/index.tsx +++ b/src/features/physical-education/student/pe-student-regulation-points/index.tsx @@ -1,14 +1,14 @@ import React from 'react' import { useUnit } from 'effector-react' -import { useModal } from 'widgets' import { selectedPEStudentModel } from '@entities/pe-student/model' import { peTeacherModel } from '@entities/pe-teacher' -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' import { Button } from '@shared/ui/button' import { Message } from '@shared/ui/message' +import { useModal } from '@shared/ui/modal' import { AddPEStudentRegulationPoints } from './features/add-pe-student-regulation-points' import { $regularPointsColumns } from './model' diff --git a/src/features/physical-education/student/pe-student-regulation-points/model.tsx b/src/features/physical-education/student/pe-student-regulation-points/model.tsx index bef93f72b..7d61ce3b1 100644 --- a/src/features/physical-education/student/pe-student-regulation-points/model.tsx +++ b/src/features/physical-education/student/pe-student-regulation-points/model.tsx @@ -4,11 +4,9 @@ import { differenceInDays } from 'date-fns' import { combine } from 'effector' import { peStudentRegulationPointsModel } from '@entities/pe-student-regulation-points/model' -import { RegulationType } from '@entities/pe-student-regulation-points/types' -import { PEStudentProfile } from '@entities/pe-student/types' import { peTeacherModel } from '@entities/pe-teacher' -import { PeTeacherPermission } from '@entities/pe-teacher/types' +import { PEStudentProfile, PeTeacherPermission, RegulationType } from '@shared/api/physical-education' import { Button } from '@shared/ui/button' import { ColumnProps } from '@shared/ui/table/types' diff --git a/src/features/physical-education/student/pe-student-specialization/ui.tsx b/src/features/physical-education/student/pe-student-specialization/ui.tsx index c18bb0598..f1f844d3b 100644 --- a/src/features/physical-education/student/pe-student-specialization/ui.tsx +++ b/src/features/physical-education/student/pe-student-specialization/ui.tsx @@ -3,14 +3,13 @@ import React, { useState } from 'react' import { useUnit } from 'effector-react' import styled from 'styled-components' -import Select, { SelectPage } from '@features/select' - import { peStudentSpecializationModel } from '@entities/pe-student/model' -import { Specialization } from '@entities/pe-student/types' -import { Colors } from '@shared/constants' +import { Specialization } from '@shared/api/physical-education' +import { Colors } from '@shared/consts' import { Button } from '@shared/ui/button' import Flex from '@shared/ui/flex' +import Select, { SelectPage } from '@shared/ui/select' interface Props { studentGuid: string diff --git a/src/features/physical-education/student/pe-student-visits/features/add-pe-student-visits/ui.tsx b/src/features/physical-education/student/pe-student-visits/features/add-pe-student-visits/ui.tsx index 511a25db1..97e1c0550 100644 --- a/src/features/physical-education/student/pe-student-visits/features/add-pe-student-visits/ui.tsx +++ b/src/features/physical-education/student/pe-student-visits/features/add-pe-student-visits/ui.tsx @@ -5,9 +5,9 @@ import { useUnit } from 'effector-react' import { pEStudentVisitModel } from '@entities/pe-student/model' import { peTeacherModel } from '@entities/pe-teacher' -import { PeTeacherPermission } from '@entities/pe-teacher/types' -import { Colors } from '@shared/constants' +import { PeTeacherPermission } from '@shared/api/physical-education' +import { Colors } from '@shared/consts' import localizeDate from '@shared/lib/dates/localize-date' import { Button } from '@shared/ui/button' import Flex from '@shared/ui/flex' diff --git a/src/features/physical-education/student/pe-student-visits/model.tsx b/src/features/physical-education/student/pe-student-visits/model.tsx index ec4fc11b2..4d12214fc 100644 --- a/src/features/physical-education/student/pe-student-visits/model.tsx +++ b/src/features/physical-education/student/pe-student-visits/model.tsx @@ -4,10 +4,9 @@ import { differenceInDays } from 'date-fns' import { combine } from 'effector' import { pEStudentVisitModel } from '@entities/pe-student/model' -import { PEStudentProfile } from '@entities/pe-student/types' import { peTeacherModel } from '@entities/pe-teacher' -import { PeTeacherPermission } from '@entities/pe-teacher/types' +import { PEStudentProfile, PeTeacherPermission } from '@shared/api/physical-education' import { Button } from '@shared/ui/button' import { ColumnProps } from '@shared/ui/table/types' diff --git a/src/features/profile/ui/molecules/user-info.tsx b/src/features/profile/ui/molecules/user-info.tsx index 1712d22d9..037738095 100644 --- a/src/features/profile/ui/molecules/user-info.tsx +++ b/src/features/profile/ui/molecules/user-info.tsx @@ -1,7 +1,6 @@ import React from 'react' -import { userModel } from '@entities/user' - +import { userModel } from '@shared/session' import { CenterPage } from '@shared/ui/atoms' import Block from '@shared/ui/block' diff --git a/src/features/schedule/config/retake-routes.tsx b/src/features/schedule/config/retake-routes.tsx index 7a0cfa0cf..036973775 100644 --- a/src/features/schedule/config/retake-routes.tsx +++ b/src/features/schedule/config/retake-routes.tsx @@ -1,4 +1,4 @@ -import React from 'react' +import { FC } from 'react' import { BiBookBookmark } from 'react-icons/bi' import { FaRegCalendar, FaRegLightbulb } from 'react-icons/fa' import { FiTruck } from 'react-icons/fi' @@ -13,114 +13,116 @@ import { MdCarRepair, MdEvStation } from 'react-icons/md' import { RiBarChartFill, RiFlaskLine } from 'react-icons/ri' import { TiBrush } from 'react-icons/ti' -import { IRoute, IRoutes } from '@app/routes/general-routes' +import { Page } from '@shared/routing' import RetakeModal from '../ui/molecules/retake-modal' import RETAKE_LINKS from './retake-links' -type RetakeRouteRaw = Pick +type RetakeRouteRaw = Pick const retakeRoutesRaw: RetakeRouteRaw[] = [ { id: 'feiu', title: 'ФЭИУ', fullTitle: 'Факультет экономики и управления', - icon: , + icon: RiBarChartFill, color: 'lightGreen', }, { id: 'fuigh', title: 'ФУИГХ', fullTitle: 'Факультет урбанистики и городского хозяйства', - icon: , + icon: HiOutlineOfficeBuilding, color: 'purple', }, { id: 'fbk', title: 'ФБК', fullTitle: 'Факультет базовых компетенций', - icon: , + icon: HiOutlinePencilAlt, color: 'red', }, { id: 'fhtib', title: 'ФХТИБ', fullTitle: 'Факультет химической технологии и биотехнологии', - icon: , + icon: RiFlaskLine, color: 'orange', }, { id: 'tf', title: 'ТФ', fullTitle: 'Транспортный факультет', - icon: , + icon: FiTruck, color: 'green', }, { id: 'fm', title: 'ФМ', fullTitle: 'Факультет машиностроения', - icon: , + icon: MdCarRepair, color: 'green', }, { id: 'fit', title: 'ФИТ', fullTitle: 'Факультет информационных технологий', - icon: , + icon: HiOutlineDesktopComputer, color: 'blue', }, { id: 'pi', title: 'ПИ', fullTitle: 'Полиграфический институт', - icon: , + icon: HiOutlinePrinter, color: 'pink', }, { id: 'iidizh', title: 'ИИДИЖ', fullTitle: 'Институт издательского дела и журналистики', - icon: , + icon: BiBookBookmark, color: 'purple', }, { id: 'igrik', title: 'ИГРИК', fullTitle: 'Институт графики и искусства книги имени В.А.Фаворского', - icon: , + icon: TiBrush, color: 'orange', }, { id: 'pishe', title: 'ПИШЭ', fullTitle: 'Передовая инженерная школа электротранспорта', - icon: , + icon: MdEvStation, color: 'lightGreen', }, { id: 'cpd', title: 'ЦПД', fullTitle: 'Центр проектной деятельности', - icon: , + icon: FaRegLightbulb, color: 'purple', }, { id: 'nid', title: 'НИД (Аспиранты)', fullTitle: 'Научно-исследовательская деятельность', - icon: , + icon: FaRegCalendar, color: 'orange', }, { id: 'nivk', title: 'НИВК (Аспиранты)', - icon: , + icon: HiOutlineDocumentSearch, color: 'lightBlue', }, ] - -const retakeRoutes: IRoutes = retakeRoutesRaw.reduce((routes: IRoutes, { id, ...rest }: RetakeRouteRaw) => { +type RetakeLinks = { + [id: string]: Page & { Component: FC } +} +const retakeRoutes: RetakeLinks = retakeRoutesRaw.reduce((routes: RetakeLinks, { id, ...rest }: RetakeRouteRaw) => { if (!RETAKE_LINKS[id]) { return { ...routes } } @@ -130,8 +132,7 @@ const retakeRoutes: IRoutes = retakeRoutesRaw.reduce((routes: IRoutes, { id, ... const path = href && !links.length ? href : '' const Component = links.length && !href ? () => RetakeModal({ links, fullTitle }) : () => null - return { ...routes, [id]: { id, path, Component, isTemplate: false, ...rest } } -}, {} as IRoutes) +}, {} as RetakeLinks) export default retakeRoutes diff --git a/src/features/schedule/lib/calc-next-subject-time.ts b/src/features/schedule/lib/calc-next-subject-time.ts index ff36d90d6..1ef469181 100644 --- a/src/features/schedule/lib/calc-next-subject-time.ts +++ b/src/features/schedule/lib/calc-next-subject-time.ts @@ -1,5 +1,5 @@ +import { DayCalendarEvent } from '@shared/api/model' import calcTimeLeft from '@shared/lib/dates/calc-time-left' -import { type DayCalendarEvent } from '@shared/ui/calendar' const calcNextSubjectTime = (lessons: DayCalendarEvent[] | null | undefined) => { if (!lessons) return Infinity diff --git a/src/features/schedule/lib/is-day-ended.ts b/src/features/schedule/lib/is-day-ended.ts index f7cf67877..67a1c1484 100644 --- a/src/features/schedule/lib/is-day-ended.ts +++ b/src/features/schedule/lib/is-day-ended.ts @@ -1,6 +1,6 @@ +import { DayCalendarEvent } from '@shared/api/model' import { TimeType, getMinutesFromStringTime } from '@shared/lib/dates/get-minutes-from-string-time' import { getMinutesFromDate } from '@shared/lib/dates/get-time-from-date' -import { DayCalendarEvent } from '@shared/ui/calendar' const isDayEnded = (events: DayCalendarEvent[] | undefined) => { if (events && events[events.length - 1]) { diff --git a/src/features/schedule/lib/is-next-event.ts b/src/features/schedule/lib/is-next-event.ts index fe42e4f0c..b25d6b0c5 100644 --- a/src/features/schedule/lib/is-next-event.ts +++ b/src/features/schedule/lib/is-next-event.ts @@ -1,5 +1,5 @@ +import { DayCalendarEvent } from '@shared/api/model' import calcTimeLeft from '@shared/lib/dates/calc-time-left' -import { DayCalendarEvent } from '@shared/ui/calendar' import calcNextSubjectTime from './calc-next-subject-time' diff --git a/src/features/schedule/ui/atoms/day-ended.tsx b/src/features/schedule/ui/atoms/day-ended.tsx index dc0defe6f..1ec1c58a9 100644 --- a/src/features/schedule/ui/atoms/day-ended.tsx +++ b/src/features/schedule/ui/atoms/day-ended.tsx @@ -2,7 +2,7 @@ import React from 'react' import styled from 'styled-components' -import { AnimatedCheck, Title } from '@ui/atoms' +import { AnimatedCheck, Title } from '@shared/ui/atoms' import { ShowNextDayEventsButton } from '../show-next-day-events-button' diff --git a/src/features/schedule/ui/atoms/holiday-plate.tsx b/src/features/schedule/ui/atoms/holiday-plate.tsx index 05a609a2b..24d22f0b7 100644 --- a/src/features/schedule/ui/atoms/holiday-plate.tsx +++ b/src/features/schedule/ui/atoms/holiday-plate.tsx @@ -2,7 +2,8 @@ import React from 'react' import styled from 'styled-components' -import Sleep from '../../../../shared/images/sleep.gif' +import { Sleep } from '@shared/ui/images' + import { ShowNextDayEventsButton } from '../show-next-day-events-button' const HolidayPlateWrapper = styled.div` diff --git a/src/features/schedule/ui/atoms/link-image-block.tsx b/src/features/schedule/ui/atoms/link-image-block.tsx index 18b57a51e..97f58584f 100644 --- a/src/features/schedule/ui/atoms/link-image-block.tsx +++ b/src/features/schedule/ui/atoms/link-image-block.tsx @@ -2,9 +2,8 @@ import React from 'react' import styled from 'styled-components' -import { Colors } from '@shared/constants' - -import { Title } from '@ui/atoms' +import { Colors } from '@shared/consts' +import { Title } from '@shared/ui/atoms' const LinkImageBlockWrapper = styled.a` position: relative; diff --git a/src/features/schedule/ui/atoms/list-of-groups.tsx b/src/features/schedule/ui/atoms/list-of-groups.tsx index 6259c0aeb..3bb33a7a2 100644 --- a/src/features/schedule/ui/atoms/list-of-groups.tsx +++ b/src/features/schedule/ui/atoms/list-of-groups.tsx @@ -4,12 +4,12 @@ import { FiChevronRight } from 'react-icons/fi' import { Link } from 'react-router-dom' import styled from 'styled-components' -import { useModal } from 'widgets' - -import { SCHEDULE_FILTER_ROUTE } from '@app/routes/general-routes' import { getEnrichedTemplatePath } from '@entities/menu/lib/get-enriched-template-path' +import { SCHEDULE_FILTER_ROUTE } from '@shared/routing' +import { useModal } from '@shared/ui/modal' + const ListOfGroupsStyled = styled.div` display: flex; flex-direction: column; diff --git a/src/features/schedule/ui/atoms/next-subject.tsx b/src/features/schedule/ui/atoms/next-subject.tsx index bd9d25baf..08f2733a0 100644 --- a/src/features/schedule/ui/atoms/next-subject.tsx +++ b/src/features/schedule/ui/atoms/next-subject.tsx @@ -5,7 +5,7 @@ import styled from 'styled-components' import { userSettingsModel } from '@entities/settings' -import { IColorPalette, ThemeVariant } from '@shared/constants' +import { IColorPalette, ThemeVariant } from '@shared/consts' const NextSubjectWrapper = styled.div<{ background: string }>` border-radius: var(--brSemi); diff --git a/src/features/schedule/ui/atoms/skeleton-loading.tsx b/src/features/schedule/ui/atoms/skeleton-loading.tsx index abfc6e5c4..0df0b5497 100644 --- a/src/features/schedule/ui/atoms/skeleton-loading.tsx +++ b/src/features/schedule/ui/atoms/skeleton-loading.tsx @@ -2,7 +2,7 @@ import React from 'react' import styled from 'styled-components' -import { SkeletonShape } from '@ui/atoms' +import { SkeletonShape } from '@shared/ui/atoms' const SkeletonLoadingWrapper = styled.div` width: 100%; diff --git a/src/features/schedule/ui/atoms/subject-place-block.tsx b/src/features/schedule/ui/atoms/subject-place-block.tsx index b844acfc0..d3162327b 100644 --- a/src/features/schedule/ui/atoms/subject-place-block.tsx +++ b/src/features/schedule/ui/atoms/subject-place-block.tsx @@ -2,11 +2,10 @@ import React, { useEffect, useState } from 'react' import styled from 'styled-components' -import { MEDIA_QUERIES } from '@shared/constants' +import { Loading } from '@shared/ui/atoms' +import { MEDIA_QUERIES } from '@shared/ui/consts' import Flex from '@shared/ui/flex' -import { Loading } from '@ui/atoms' - import LinkImageBlock from './link-image-block' const SubjectPlaceBlockWrapper = styled.div` diff --git a/src/features/schedule/ui/atoms/time.tsx b/src/features/schedule/ui/atoms/time.tsx index 85f06e562..b0a4327d5 100644 --- a/src/features/schedule/ui/atoms/time.tsx +++ b/src/features/schedule/ui/atoms/time.tsx @@ -1,8 +1,9 @@ import React from 'react' -import { ITimeIntervalColor, TimeIntervalColor, TimeIntervals } from '@api/model' import styled from 'styled-components' +import { ITimeIntervalColor, TimeIntervalColor, TimeIntervals } from '@shared/api/model' + const TimeWrapper = styled.span<{ isCurrent: boolean color2: string diff --git a/src/shared/ui/calendar/calendars/day/hooks/use-calendar-day.ts b/src/features/schedule/ui/calendar/calendars/day/hooks/use-calendar-day.ts similarity index 85% rename from src/shared/ui/calendar/calendars/day/hooks/use-calendar-day.ts rename to src/features/schedule/ui/calendar/calendars/day/hooks/use-calendar-day.ts index bc42e1280..57b89648b 100644 --- a/src/shared/ui/calendar/calendars/day/hooks/use-calendar-day.ts +++ b/src/features/schedule/ui/calendar/calendars/day/hooks/use-calendar-day.ts @@ -1,11 +1,11 @@ import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react' -import { TimeIntervals } from '@shared/api/model' -import { IWeekDayNames } from '@shared/constants' -import useCurrentDevice from '@shared/lib/hooks/use-current-device' -import { DayCalendarEvent } from '@shared/ui/calendar' -import { useCalendarGeneral } from '@shared/ui/calendar/hooks/use-calendar-general' -import { checkIfEventIsCurrent } from '@shared/ui/calendar/ui/event/lib/check-if-event-is-current' +import { useCalendarGeneral } from '@features/schedule/ui/calendar/hooks/use-calendar-general' +import { checkIfEventIsCurrent } from '@features/schedule/ui/calendar/ui/event/lib/check-if-event-is-current' + +import { DayCalendarEvent, TimeIntervals } from '@shared/api/model' +import { IWeekDayNames } from '@shared/consts' +import useCurrentDevice from '@shared/ui/hooks/use-current-device' import { getCurrentDay } from '../lib/get-current-day' import { getEndTime } from '../lib/get-end-time' diff --git a/src/shared/ui/calendar/calendars/day/index.tsx b/src/features/schedule/ui/calendar/calendars/day/index.tsx similarity index 96% rename from src/shared/ui/calendar/calendars/day/index.tsx rename to src/features/schedule/ui/calendar/calendars/day/index.tsx index a4f2d261f..a9f82446a 100644 --- a/src/shared/ui/calendar/calendars/day/index.tsx +++ b/src/features/schedule/ui/calendar/calendars/day/index.tsx @@ -4,8 +4,8 @@ import { FiInbox } from 'react-icons/fi' import { isNextEvent } from '@features/schedule/lib/is-next-event' import { SubjectModal } from '@features/schedule/ui' -import { Error } from '../../../error' -import Flex from '../../../flex' +import { Error } from '../../../../../../shared/ui/error' +import Flex from '../../../../../../shared/ui/flex' import { checkIfEventIsCurrent } from '../../ui/event/lib/check-if-event-is-current' import { WeekDays } from '../../ui/week-days' import { useCalendarDay } from './hooks/use-calendar-day' diff --git a/src/shared/ui/calendar/calendars/day/lib/get-current-day.ts b/src/features/schedule/ui/calendar/calendars/day/lib/get-current-day.ts similarity index 100% rename from src/shared/ui/calendar/calendars/day/lib/get-current-day.ts rename to src/features/schedule/ui/calendar/calendars/day/lib/get-current-day.ts diff --git a/src/shared/ui/calendar/calendars/day/lib/get-end-time.ts b/src/features/schedule/ui/calendar/calendars/day/lib/get-end-time.ts similarity index 100% rename from src/shared/ui/calendar/calendars/day/lib/get-end-time.ts rename to src/features/schedule/ui/calendar/calendars/day/lib/get-end-time.ts diff --git a/src/shared/ui/calendar/calendars/day/lib/get-time-in-minutes.ts b/src/features/schedule/ui/calendar/calendars/day/lib/get-time-in-minutes.ts similarity index 100% rename from src/shared/ui/calendar/calendars/day/lib/get-time-in-minutes.ts rename to src/features/schedule/ui/calendar/calendars/day/lib/get-time-in-minutes.ts diff --git a/src/shared/ui/calendar/calendars/day/styles.ts b/src/features/schedule/ui/calendar/calendars/day/styles.ts similarity index 88% rename from src/shared/ui/calendar/calendars/day/styles.ts rename to src/features/schedule/ui/calendar/calendars/day/styles.ts index 896c74180..e8f43ee30 100644 --- a/src/shared/ui/calendar/calendars/day/styles.ts +++ b/src/features/schedule/ui/calendar/calendars/day/styles.ts @@ -1,9 +1,8 @@ import styled from 'styled-components' -import { CALENDAR_HEIGHT_DESKTOP, CALENDAR_HEIGHT_MOBILE, CALENDAR_HEIGHT_TABLET } from '@pages/schedule/consts' - -import { MEDIA_QUERIES } from '@shared/constants' +import { MEDIA_QUERIES } from '@shared/ui/consts' +import { CALENDAR_HEIGHT_DESKTOP, CALENDAR_HEIGHT_MOBILE, CALENDAR_HEIGHT_TABLET } from '../../consts' import { Wrapper } from '../../ui/wrapper' export const DayCalendarWrapper = styled(Wrapper)` @@ -29,7 +28,7 @@ export const EventInfo = styled.div` overflow: hidden; box-shadow: var(--block-shadow); - ${MEDIA_QUERIES.isSmallTesktop} { + ${MEDIA_QUERIES.isSmallDesktop} { display: none; } ` diff --git a/src/shared/ui/calendar/calendars/day/types.ts b/src/features/schedule/ui/calendar/calendars/day/types.ts similarity index 100% rename from src/shared/ui/calendar/calendars/day/types.ts rename to src/features/schedule/ui/calendar/calendars/day/types.ts diff --git a/src/shared/ui/calendar/calendars/day/ui/current-time-line.tsx b/src/features/schedule/ui/calendar/calendars/day/ui/current-time-line.tsx similarity index 100% rename from src/shared/ui/calendar/calendars/day/ui/current-time-line.tsx rename to src/features/schedule/ui/calendar/calendars/day/ui/current-time-line.tsx diff --git a/src/shared/ui/calendar/calendars/day/ui/event-background.tsx b/src/features/schedule/ui/calendar/calendars/day/ui/event-background.tsx similarity index 100% rename from src/shared/ui/calendar/calendars/day/ui/event-background.tsx rename to src/features/schedule/ui/calendar/calendars/day/ui/event-background.tsx diff --git a/src/shared/ui/calendar/calendars/day/ui/icon-text.tsx b/src/features/schedule/ui/calendar/calendars/day/ui/icon-text.tsx similarity index 100% rename from src/shared/ui/calendar/calendars/day/ui/icon-text.tsx rename to src/features/schedule/ui/calendar/calendars/day/ui/icon-text.tsx diff --git a/src/shared/ui/calendar/calendars/day/ui/styles.ts b/src/features/schedule/ui/calendar/calendars/day/ui/styles.ts similarity index 97% rename from src/shared/ui/calendar/calendars/day/ui/styles.ts rename to src/features/schedule/ui/calendar/calendars/day/ui/styles.ts index 48e967132..5d922a5ea 100644 --- a/src/shared/ui/calendar/calendars/day/ui/styles.ts +++ b/src/features/schedule/ui/calendar/calendars/day/ui/styles.ts @@ -1,6 +1,7 @@ import styled from 'styled-components' -import { Colors, MEDIA_QUERIES } from '@shared/constants' +import { Colors } from '@shared/consts' +import { MEDIA_QUERIES } from '@shared/ui/consts' import Flex from '@shared/ui/flex' import Subtext from '@shared/ui/subtext' diff --git a/src/shared/ui/calendar/calendars/day/ui/times-events.tsx b/src/features/schedule/ui/calendar/calendars/day/ui/times-events.tsx similarity index 76% rename from src/shared/ui/calendar/calendars/day/ui/times-events.tsx rename to src/features/schedule/ui/calendar/calendars/day/ui/times-events.tsx index a3fed92f1..b4ef906a1 100644 --- a/src/shared/ui/calendar/calendars/day/ui/times-events.tsx +++ b/src/features/schedule/ui/calendar/calendars/day/ui/times-events.tsx @@ -1,11 +1,12 @@ import React from 'react' +import { CalendarWrapper } from '@features/schedule/ui/calendar/ui/calendar-wrapper' +import Events from '@features/schedule/ui/calendar/ui/event/events' +import { getEventTopPosition } from '@features/schedule/ui/calendar/ui/event/lib/get-event-top-position' +import Times from '@features/schedule/ui/calendar/ui/times' + +import { DayCalendarEvent } from '@shared/api/model' import { useScrollTo } from '@shared/lib/hooks/use-scroll-to' -import { DayCalendarEvent } from '@shared/ui/calendar/types' -import { CalendarWrapper } from '@shared/ui/calendar/ui/calendar-wrapper' -import Events from '@shared/ui/calendar/ui/event/events' -import { getEventTopPosition } from '@shared/ui/calendar/ui/event/lib/get-event-top-position' -import Times from '@shared/ui/calendar/ui/times' type Props = { scale: number diff --git a/src/shared/ui/calendar/calendars/index.ts b/src/features/schedule/ui/calendar/calendars/index.ts similarity index 100% rename from src/shared/ui/calendar/calendars/index.ts rename to src/features/schedule/ui/calendar/calendars/index.ts diff --git a/src/shared/ui/calendar/calendars/month/consts.ts b/src/features/schedule/ui/calendar/calendars/month/consts.ts similarity index 100% rename from src/shared/ui/calendar/calendars/month/consts.ts rename to src/features/schedule/ui/calendar/calendars/month/consts.ts diff --git a/src/shared/ui/calendar/calendars/month/index.tsx b/src/features/schedule/ui/calendar/calendars/month/index.tsx similarity index 96% rename from src/shared/ui/calendar/calendars/month/index.tsx rename to src/features/schedule/ui/calendar/calendars/month/index.tsx index 2f249a008..1ba807e19 100644 --- a/src/shared/ui/calendar/calendars/month/index.tsx +++ b/src/features/schedule/ui/calendar/calendars/month/index.tsx @@ -1,8 +1,8 @@ import React from 'react' +import { getMonday } from '../../../../../../entities/schedule/lib/get-monday' import { WeekEvents } from '../../types' import { WeekDays } from '../../ui/week-days' -import { getMonday } from '../../ui/week-days/lib/get-monday' import { getSunday } from '../../ui/week-days/lib/get-sunday' import { getDaysBetweenDates } from './lib/get-days-between-dates' import { Cells, MonthCalendarWrapper } from './styles' diff --git a/src/shared/ui/calendar/calendars/month/lib/get-day-events.ts b/src/features/schedule/ui/calendar/calendars/month/lib/get-day-events.ts similarity index 88% rename from src/shared/ui/calendar/calendars/month/lib/get-day-events.ts rename to src/features/schedule/ui/calendar/calendars/month/lib/get-day-events.ts index 8ee34b93d..9f34f42e2 100644 --- a/src/shared/ui/calendar/calendars/month/lib/get-day-events.ts +++ b/src/features/schedule/ui/calendar/calendars/month/lib/get-day-events.ts @@ -1,6 +1,7 @@ +import { WeekEvents } from '@features/schedule/ui/calendar/types' + import { areDatesEqual } from '@shared/lib/dates/are-dates-equal' import { getWeekDayFromDate } from '@shared/lib/dates/get-weekday-from-date' -import { WeekEvents } from '@shared/ui/calendar/types' export const getDayEvents = (events: WeekEvents, date: Date) => { const weekday = getWeekDayFromDate(date) diff --git a/src/shared/ui/calendar/calendars/month/lib/get-days-between-dates.ts b/src/features/schedule/ui/calendar/calendars/month/lib/get-days-between-dates.ts similarity index 100% rename from src/shared/ui/calendar/calendars/month/lib/get-days-between-dates.ts rename to src/features/schedule/ui/calendar/calendars/month/lib/get-days-between-dates.ts diff --git a/src/shared/ui/calendar/calendars/month/styles.ts b/src/features/schedule/ui/calendar/calendars/month/styles.ts similarity index 95% rename from src/shared/ui/calendar/calendars/month/styles.ts rename to src/features/schedule/ui/calendar/calendars/month/styles.ts index 27df90bbd..8af68d903 100644 --- a/src/shared/ui/calendar/calendars/month/styles.ts +++ b/src/features/schedule/ui/calendar/calendars/month/styles.ts @@ -1,9 +1,8 @@ import styled from 'styled-components' -import { CALENDAR_HEIGHT_DESKTOP, CALENDAR_HEIGHT_MOBILE } from '@pages/schedule/consts' - -import { MEDIA_QUERIES } from '@shared/constants' +import { MEDIA_QUERIES } from '@shared/ui/consts' +import { CALENDAR_HEIGHT_DESKTOP, CALENDAR_HEIGHT_MOBILE } from '../../consts' import { DateWrapperProps, getBackground, getColor } from '../../ui/week-days/styles' export const MonthCalendarWrapper = styled.div` @@ -29,7 +28,7 @@ export const Cells = styled.div` scroll-snap-type: y mandatory; scroll-padding-top: 100px; - ${MEDIA_QUERIES.isMiddleTesktop} { + ${MEDIA_QUERIES.isMiddleDesktop} { &::-webkit-scrollbar { display: none; } diff --git a/src/shared/ui/calendar/calendars/month/ui/calendar-cells.tsx b/src/features/schedule/ui/calendar/calendars/month/ui/calendar-cells.tsx similarity index 92% rename from src/shared/ui/calendar/calendars/month/ui/calendar-cells.tsx rename to src/features/schedule/ui/calendar/calendars/month/ui/calendar-cells.tsx index b72db5886..a19ad336c 100644 --- a/src/shared/ui/calendar/calendars/month/ui/calendar-cells.tsx +++ b/src/features/schedule/ui/calendar/calendars/month/ui/calendar-cells.tsx @@ -1,20 +1,20 @@ import React from 'react' -import { useModal } from 'widgets' - +import { WeekEvents } from '@features/schedule/ui/calendar/types' +import { MonthEventItem } from '@features/schedule/ui/calendar/ui/event/month-event-item' +import { SubjectsIndicator } from '@features/schedule/ui/calendar/ui/subjects-indicator' +import { getSunday } from '@features/schedule/ui/calendar/ui/week-days/lib/get-sunday' import { EventsModal } from '@features/schedule/ui/show-next-day-events-button/events-modal' +import { DayCalendarEvent } from '@shared/api/model' import capitalizeFirstLetter from '@shared/lib/capitalize-first-letter' import { areDatesEqual } from '@shared/lib/dates/are-dates-equal' import localizeDate from '@shared/lib/dates/localize-date' import get2DigitDumber from '@shared/lib/get-2-digit-number' -import useCurrentDevice from '@shared/lib/hooks/use-current-device' -import { DayCalendarEvent, WeekEvents } from '@shared/ui/calendar/types' -import { MonthEventItem } from '@shared/ui/calendar/ui/event/month-event-item' -import { SubjectsIndicator } from '@shared/ui/calendar/ui/subjects-indicator' -import { getSunday } from '@shared/ui/calendar/ui/week-days/lib/get-sunday' import { Error } from '@shared/ui/error' import Flex from '@shared/ui/flex' +import useCurrentDevice from '@shared/ui/hooks/use-current-device' +import { useModal } from '@shared/ui/modal' import Subtext from '@shared/ui/subtext' import { MAX_EVENTS_VISIBLE_PER_DAY } from '../consts' diff --git a/src/shared/ui/calendar/calendars/week/index.tsx b/src/features/schedule/ui/calendar/calendars/week/index.tsx similarity index 96% rename from src/shared/ui/calendar/calendars/week/index.tsx rename to src/features/schedule/ui/calendar/calendars/week/index.tsx index 475ac7b1b..a4356b59e 100644 --- a/src/shared/ui/calendar/calendars/week/index.tsx +++ b/src/features/schedule/ui/calendar/calendars/week/index.tsx @@ -1,6 +1,6 @@ import React from 'react' -import { IWeekDayNames, WEEK_DAYS } from '@shared/constants' +import { IWeekDayNames, WEEK_DAYS } from '@shared/consts' import { useCalendarGeneral } from '../../hooks/use-calendar-general' import { CalendarWrapper } from '../../ui/calendar-wrapper' diff --git a/src/shared/ui/calendar/calendars/week/styles.ts b/src/features/schedule/ui/calendar/calendars/week/styles.ts similarity index 81% rename from src/shared/ui/calendar/calendars/week/styles.ts rename to src/features/schedule/ui/calendar/calendars/week/styles.ts index dc934c812..520743ec6 100644 --- a/src/shared/ui/calendar/calendars/week/styles.ts +++ b/src/features/schedule/ui/calendar/calendars/week/styles.ts @@ -1,9 +1,8 @@ import styled from 'styled-components' -import { CALENDAR_HEIGHT_DESKTOP, CALENDAR_HEIGHT_MOBILE, CALENDAR_HEIGHT_TABLET } from '@pages/schedule/consts' - -import { MEDIA_QUERIES } from '@shared/constants' +import { MEDIA_QUERIES } from '@shared/ui/consts' +import { CALENDAR_HEIGHT_DESKTOP, CALENDAR_HEIGHT_MOBILE, CALENDAR_HEIGHT_TABLET } from '../../consts' import { Wrapper } from '../../ui/wrapper' export const WeekCalendarWrapper = styled(Wrapper)` diff --git a/src/shared/ui/calendar/calendars/week/types.ts b/src/features/schedule/ui/calendar/calendars/week/types.ts similarity index 100% rename from src/shared/ui/calendar/calendars/week/types.ts rename to src/features/schedule/ui/calendar/calendars/week/types.ts diff --git a/src/pages/schedule/consts.ts b/src/features/schedule/ui/calendar/consts.ts similarity index 66% rename from src/pages/schedule/consts.ts rename to src/features/schedule/ui/calendar/consts.ts index b747fc63d..ed8de2bba 100644 --- a/src/pages/schedule/consts.ts +++ b/src/features/schedule/ui/calendar/consts.ts @@ -1,3 +1,10 @@ +export const SCALE_VALUES = { + isMiddleDesktop: 1.35, + isSmallDesktop: 1.35, + isTablet: 1.5, + isMobile: 1.2, +} + export const CALENDAR_HEIGHT_DESKTOP = 'calc(100vh - var(--header-height) - 110px)' export const CALENDAR_HEIGHT_MOBILE = 'calc(100vh - var(--header-height) - 185px)' export const CALENDAR_HEIGHT_TABLET = 'calc(100vh - var(--header-height) - 170px);' diff --git a/src/shared/ui/calendar/hooks/use-calendar-general.tsx b/src/features/schedule/ui/calendar/hooks/use-calendar-general.tsx similarity index 84% rename from src/shared/ui/calendar/hooks/use-calendar-general.tsx rename to src/features/schedule/ui/calendar/hooks/use-calendar-general.tsx index 3b0e28094..0311b5173 100644 --- a/src/shared/ui/calendar/hooks/use-calendar-general.tsx +++ b/src/features/schedule/ui/calendar/hooks/use-calendar-general.tsx @@ -1,7 +1,6 @@ +import { useCalendarScale } from '@features/schedule/ui/calendar/hooks/use-calendar-scale' import { useScheduleSubjectModal } from '@features/use-schedule-subject-modal' -import { useCalendarScale } from '@shared/ui/calendar/hooks/use-calendar-scale' - import { CalendarWeekProps } from '../calendars/week/types' type Props = CalendarWeekProps diff --git a/src/shared/ui/calendar/hooks/use-calendar-scale.ts b/src/features/schedule/ui/calendar/hooks/use-calendar-scale.ts similarity index 85% rename from src/shared/ui/calendar/hooks/use-calendar-scale.ts rename to src/features/schedule/ui/calendar/hooks/use-calendar-scale.ts index 5aff66090..900287ab5 100644 --- a/src/shared/ui/calendar/hooks/use-calendar-scale.ts +++ b/src/features/schedule/ui/calendar/hooks/use-calendar-scale.ts @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react' -import useCurrentDevice from '@shared/lib/hooks/use-current-device' +import useCurrentDevice from '@shared/ui/hooks/use-current-device' import { SCALE_VALUES } from '../consts' diff --git a/src/shared/ui/calendar/index.ts b/src/features/schedule/ui/calendar/index.ts similarity index 100% rename from src/shared/ui/calendar/index.ts rename to src/features/schedule/ui/calendar/index.ts diff --git a/src/shared/ui/calendar/lib/get-time-interval.ts b/src/features/schedule/ui/calendar/lib/get-time-interval.ts similarity index 77% rename from src/shared/ui/calendar/lib/get-time-interval.ts rename to src/features/schedule/ui/calendar/lib/get-time-interval.ts index fc8cb67d2..956710c39 100644 --- a/src/shared/ui/calendar/lib/get-time-interval.ts +++ b/src/features/schedule/ui/calendar/lib/get-time-interval.ts @@ -1,7 +1,6 @@ -import { TimeIntervals } from '@shared/api/model' +import { DayCalendarEvent, TimeIntervals } from '@shared/api/model' import { getEndTime } from '../calendars/day/lib/get-end-time' -import { DayCalendarEvent } from '../types' export const getTimeInterval = (startTime: DayCalendarEvent['startTime'], duration: DayCalendarEvent['duration']) => { return startTime diff --git a/src/features/schedule/ui/calendar/types.ts b/src/features/schedule/ui/calendar/types.ts new file mode 100644 index 000000000..b5ae20949 --- /dev/null +++ b/src/features/schedule/ui/calendar/types.ts @@ -0,0 +1,10 @@ +import { DayCalendarEvent } from '@shared/api/model' + +export type WeekEvents = { + monday: DayCalendarEvent[] + tuesday: DayCalendarEvent[] + wednesday: DayCalendarEvent[] + thursday: DayCalendarEvent[] + friday: DayCalendarEvent[] + saturday: DayCalendarEvent[] +} | null diff --git a/src/shared/ui/calendar/ui/calendar-wrapper.ts b/src/features/schedule/ui/calendar/ui/calendar-wrapper.ts similarity index 100% rename from src/shared/ui/calendar/ui/calendar-wrapper.ts rename to src/features/schedule/ui/calendar/ui/calendar-wrapper.ts diff --git a/src/shared/ui/calendar/ui/event/event-item.tsx b/src/features/schedule/ui/calendar/ui/event/event-item.tsx similarity index 95% rename from src/shared/ui/calendar/ui/event/event-item.tsx rename to src/features/schedule/ui/calendar/ui/event/event-item.tsx index da00decbc..15c234563 100644 --- a/src/shared/ui/calendar/ui/event/event-item.tsx +++ b/src/features/schedule/ui/calendar/ui/event/event-item.tsx @@ -11,20 +11,20 @@ import { useUnit } from 'effector-react' import { getSubjectName } from '@features/schedule/lib/get-subject-name' import { NextSubject } from '@features/schedule/ui' +import IconText from '@features/schedule/ui/calendar/calendars/day/ui/icon-text' +import { getTimeInterval } from '@features/schedule/ui/calendar/lib/get-time-interval' import { TimeIndicator } from '@features/schedule/ui/subject/time-indicator' import { userSettingsModel } from '@entities/settings' -import { ThemeVariant } from '@shared/constants' +import { DayCalendarEvent } from '@shared/api/model' +import { ThemeVariant } from '@shared/consts' import calcTimeLeft from '@shared/lib/dates/calc-time-left' import getShortString from '@shared/lib/get-short-string' import { useCalcTimeLeft } from '@shared/lib/hooks/use-calc-time-left' -import useCurrentDevice from '@shared/lib/hooks/use-current-device' -import { type DayCalendarEvent } from '@shared/ui/calendar' -import IconText from '@shared/ui/calendar/calendars/day/ui/icon-text' -import { getTimeInterval } from '@shared/ui/calendar/lib/get-time-interval' import DotSeparatedWords from '@shared/ui/dot-separated-words' import Flex from '@shared/ui/flex' +import useCurrentDevice from '@shared/ui/hooks/use-current-device' import { getEventTopPosition } from './lib/get-event-top-position' import { EventFront, EventItemStyled, EventTitle, MobileIcon } from './styles' diff --git a/src/shared/ui/calendar/ui/event/events.tsx b/src/features/schedule/ui/calendar/ui/event/events.tsx similarity index 97% rename from src/shared/ui/calendar/ui/event/events.tsx rename to src/features/schedule/ui/calendar/ui/event/events.tsx index e84044f57..e14742f59 100644 --- a/src/shared/ui/calendar/ui/event/events.tsx +++ b/src/features/schedule/ui/calendar/ui/event/events.tsx @@ -2,8 +2,9 @@ import React from 'react' import { isNextEvent } from '@features/schedule/lib/is-next-event' +import { DayCalendarEvent } from '@shared/api/model' + import { CurrentTimeLine } from '../../calendars/day/ui/current-time-line' -import { DayCalendarEvent } from '../../types' import EventItem from './event-item' import { checkIfEventIsCurrent } from './lib/check-if-event-is-current' import { prepareEvents } from './lib/prepare-events' diff --git a/src/shared/ui/calendar/ui/event/lib/check-if-event-is-current.ts b/src/features/schedule/ui/calendar/ui/event/lib/check-if-event-is-current.ts similarity index 89% rename from src/shared/ui/calendar/ui/event/lib/check-if-event-is-current.ts rename to src/features/schedule/ui/calendar/ui/event/lib/check-if-event-is-current.ts index ae77eca4a..b5750aaef 100644 --- a/src/shared/ui/calendar/ui/event/lib/check-if-event-is-current.ts +++ b/src/features/schedule/ui/calendar/ui/event/lib/check-if-event-is-current.ts @@ -1,6 +1,6 @@ +import { DayCalendarEvent } from '@shared/api/model' import { TimeType, getMinutesFromStringTime } from '@shared/lib/dates/get-minutes-from-string-time' import { getMinutesFromDate } from '@shared/lib/dates/get-time-from-date' -import { DayCalendarEvent } from '@shared/ui/calendar/types' export const checkIfEventIsCurrent = (event: DayCalendarEvent, isCurrentDay: boolean) => { return ( diff --git a/src/shared/ui/calendar/ui/event/lib/get-event-top-position.ts b/src/features/schedule/ui/calendar/ui/event/lib/get-event-top-position.ts similarity index 100% rename from src/shared/ui/calendar/ui/event/lib/get-event-top-position.ts rename to src/features/schedule/ui/calendar/ui/event/lib/get-event-top-position.ts diff --git a/src/shared/ui/calendar/ui/event/lib/get-start-time-shift-in-minutes.ts b/src/features/schedule/ui/calendar/ui/event/lib/get-start-time-shift-in-minutes.ts similarity index 100% rename from src/shared/ui/calendar/ui/event/lib/get-start-time-shift-in-minutes.ts rename to src/features/schedule/ui/calendar/ui/event/lib/get-start-time-shift-in-minutes.ts diff --git a/src/shared/ui/calendar/ui/event/lib/prepare-events.ts b/src/features/schedule/ui/calendar/ui/event/lib/prepare-events.ts similarity index 94% rename from src/shared/ui/calendar/ui/event/lib/prepare-events.ts rename to src/features/schedule/ui/calendar/ui/event/lib/prepare-events.ts index 462275922..092578bee 100644 --- a/src/shared/ui/calendar/ui/event/lib/prepare-events.ts +++ b/src/features/schedule/ui/calendar/ui/event/lib/prepare-events.ts @@ -1,4 +1,4 @@ -import { DayCalendarEvent } from '@shared/ui/calendar/types' +import { DayCalendarEvent } from '@shared/api/model' export const prepareEvents = (events: DayCalendarEvent[] | null | undefined): Record => { const result: Record = {} diff --git a/src/shared/ui/calendar/ui/event/month-event-item.tsx b/src/features/schedule/ui/calendar/ui/event/month-event-item.tsx similarity index 94% rename from src/shared/ui/calendar/ui/event/month-event-item.tsx rename to src/features/schedule/ui/calendar/ui/event/month-event-item.tsx index 3c54e9517..c6ad2d5ea 100644 --- a/src/shared/ui/calendar/ui/event/month-event-item.tsx +++ b/src/features/schedule/ui/calendar/ui/event/month-event-item.tsx @@ -7,12 +7,11 @@ import { TimeIndicator } from '@features/schedule/ui/subject/time-indicator' import { userSettingsModel } from '@entities/settings' -import { ThemeVariant } from '@shared/constants' +import { DayCalendarEvent } from '@shared/api/model' +import { ThemeVariant } from '@shared/consts' import Flex from '@shared/ui/flex' import Subtext from '@shared/ui/subtext' -import { DayCalendarEvent } from '../../types' - const MonthEventItemStyled = styled(Flex)<{ textColor: string; background: string }>` padding: 4px; border-radius: 4px; diff --git a/src/shared/ui/calendar/ui/event/styles.ts b/src/features/schedule/ui/calendar/ui/event/styles.ts similarity index 98% rename from src/shared/ui/calendar/ui/event/styles.ts rename to src/features/schedule/ui/calendar/ui/event/styles.ts index 8c55c30ce..28e60c817 100644 --- a/src/shared/ui/calendar/ui/event/styles.ts +++ b/src/features/schedule/ui/calendar/ui/event/styles.ts @@ -1,6 +1,6 @@ import styled from 'styled-components' -import { MEDIA_QUERIES } from '@shared/constants' +import { MEDIA_QUERIES } from '@shared/ui/consts' import Flex from '@shared/ui/flex' import { StyledProps } from './types' diff --git a/src/shared/ui/calendar/ui/event/types.ts b/src/features/schedule/ui/calendar/ui/event/types.ts similarity index 87% rename from src/shared/ui/calendar/ui/event/types.ts rename to src/features/schedule/ui/calendar/ui/event/types.ts index 49bcb72d5..44570f62d 100644 --- a/src/shared/ui/calendar/ui/event/types.ts +++ b/src/features/schedule/ui/calendar/ui/event/types.ts @@ -1,4 +1,4 @@ -import { DayCalendarEvent } from '../../types' +import { DayCalendarEvent } from '@shared/api/model' export type UIProps = { shift: number diff --git a/src/shared/ui/calendar/ui/subjects-indicator/index.tsx b/src/features/schedule/ui/calendar/ui/subjects-indicator/index.tsx similarity index 94% rename from src/shared/ui/calendar/ui/subjects-indicator/index.tsx rename to src/features/schedule/ui/calendar/ui/subjects-indicator/index.tsx index 735b76ff1..ed35c1545 100644 --- a/src/shared/ui/calendar/ui/subjects-indicator/index.tsx +++ b/src/features/schedule/ui/calendar/ui/subjects-indicator/index.tsx @@ -2,7 +2,7 @@ import React from 'react' import styled from 'styled-components' -import { DayCalendarEvent } from '../../types' +import { DayCalendarEvent } from '@shared/api/model' const SubjectsIndicatorStyled = styled.div` display: flex; diff --git a/src/shared/ui/calendar/ui/times/index.tsx b/src/features/schedule/ui/calendar/ui/times/index.tsx similarity index 97% rename from src/shared/ui/calendar/ui/times/index.tsx rename to src/features/schedule/ui/calendar/ui/times/index.tsx index e696ad859..8138f190e 100644 --- a/src/shared/ui/calendar/ui/times/index.tsx +++ b/src/features/schedule/ui/calendar/ui/times/index.tsx @@ -2,8 +2,8 @@ import React from 'react' import styled from 'styled-components' -import { MEDIA_QUERIES } from '@shared/constants' import get2DigitDumber from '@shared/lib/get-2-digit-number' +import { MEDIA_QUERIES } from '@shared/ui/consts' import Flex from '@shared/ui/flex' import Subtext from '@shared/ui/subtext' diff --git a/src/shared/ui/calendar/ui/week-days/index.tsx b/src/features/schedule/ui/calendar/ui/week-days/index.tsx similarity index 98% rename from src/shared/ui/calendar/ui/week-days/index.tsx rename to src/features/schedule/ui/calendar/ui/week-days/index.tsx index ef9d7a663..49a78cacc 100644 --- a/src/shared/ui/calendar/ui/week-days/index.tsx +++ b/src/features/schedule/ui/calendar/ui/week-days/index.tsx @@ -1,6 +1,6 @@ import React from 'react' -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' import Flex from '@shared/ui/flex' import { WeekEvents } from '../../types' diff --git a/src/shared/ui/calendar/ui/week-days/lib/get-sunday.ts b/src/features/schedule/ui/calendar/ui/week-days/lib/get-sunday.ts similarity index 100% rename from src/shared/ui/calendar/ui/week-days/lib/get-sunday.ts rename to src/features/schedule/ui/calendar/ui/week-days/lib/get-sunday.ts diff --git a/src/shared/ui/calendar/ui/week-days/lib/get-week-names.ts b/src/features/schedule/ui/calendar/ui/week-days/lib/get-week-names.ts similarity index 83% rename from src/shared/ui/calendar/ui/week-days/lib/get-week-names.ts rename to src/features/schedule/ui/calendar/ui/week-days/lib/get-week-names.ts index be68beff2..76f040308 100644 --- a/src/shared/ui/calendar/ui/week-days/lib/get-week-names.ts +++ b/src/features/schedule/ui/calendar/ui/week-days/lib/get-week-names.ts @@ -1,7 +1,7 @@ -import { IWeekDays, WEEK_DAYS } from '@shared/constants' +import { IWeekDays, WEEK_DAYS } from '@shared/consts' import { getDateInSomeDays } from '@shared/lib/dates/get-date-in-some-days' -import { getMonday } from './get-monday' +import { getMonday } from '../../../../../../../entities/schedule/lib/get-monday' export const getWeekNames = () => { const today = new Date() diff --git a/src/shared/ui/calendar/ui/week-days/styles.ts b/src/features/schedule/ui/calendar/ui/week-days/styles.ts similarity index 98% rename from src/shared/ui/calendar/ui/week-days/styles.ts rename to src/features/schedule/ui/calendar/ui/week-days/styles.ts index 810c9c652..de8295f74 100644 --- a/src/shared/ui/calendar/ui/week-days/styles.ts +++ b/src/features/schedule/ui/calendar/ui/week-days/styles.ts @@ -1,6 +1,6 @@ import styled from 'styled-components' -import { MEDIA_QUERIES } from '@shared/constants' +import { MEDIA_QUERIES } from '@shared/ui/consts' import Flex from '@shared/ui/flex' export type DateWrapperProps = { isCurrent?: boolean; isCurrentChosenDay?: boolean } diff --git a/src/shared/ui/calendar/ui/wrapper.ts b/src/features/schedule/ui/calendar/ui/wrapper.ts similarity index 80% rename from src/shared/ui/calendar/ui/wrapper.ts rename to src/features/schedule/ui/calendar/ui/wrapper.ts index 8d87353c4..c6c59cabe 100644 --- a/src/shared/ui/calendar/ui/wrapper.ts +++ b/src/features/schedule/ui/calendar/ui/wrapper.ts @@ -1,6 +1,6 @@ import styled from 'styled-components' -import { MEDIA_QUERIES } from '@shared/constants' +import { MEDIA_QUERIES } from '@shared/ui/consts' import Flex from '@shared/ui/flex' export const Wrapper = styled(Flex)` diff --git a/src/features/schedule/ui/molecules/retake-link-content.tsx b/src/features/schedule/ui/molecules/retake-link-content.tsx index 5e3105779..82f6613fd 100644 --- a/src/features/schedule/ui/molecules/retake-link-content.tsx +++ b/src/features/schedule/ui/molecules/retake-link-content.tsx @@ -1,11 +1,12 @@ import React from 'react' -import { Icon } from '@features/all-pages' import { PageLinkWrapper as ContentWrapper } from '@features/all-pages/ui/molecules/page-link-content' +import { Icon } from '@shared/ui/icon' + import { RetakeLinkProps } from './retake-link' -const RetakeLinkContent = ({ title, icon, color }: RetakeLinkProps) => { +const RetakeLinkContent = ({ title, icon: LinkIcon, color }: RetakeLinkProps) => { return ( { maxWidth={'100%'} height={'135px'} justifyContent="center" - color={color.length ? color : 'blue'} + color={color ?? 'blue'} isVertical={true} hasNotifications={false} >
- {icon} + {LinkIcon && } {title}
diff --git a/src/features/schedule/ui/molecules/retake-link.tsx b/src/features/schedule/ui/molecules/retake-link.tsx index 863cc1954..293f44d8e 100644 --- a/src/features/schedule/ui/molecules/retake-link.tsx +++ b/src/features/schedule/ui/molecules/retake-link.tsx @@ -1,10 +1,11 @@ -import React from 'react' +import React, { FC } from 'react' import styled from 'styled-components' -import { useModal } from 'widgets' import { PageLinkProps } from '@features/all-pages/ui/molecules/page-link' +import { useModal } from '@shared/ui/modal' + import RetakeLinkContent from './retake-link-content' const LinkWrapper = styled.a<{ width: number | string }>` @@ -17,7 +18,7 @@ const LinkWrapper = styled.a<{ width: number | string }>` } ` -export type RetakeLinkProps = Omit +export type RetakeLinkProps = Omit & { Component: FC } const RetakeLink = (props: RetakeLinkProps) => { const { path, Component: RetakeModal, fullTitle } = props diff --git a/src/features/schedule/ui/molecules/retake-modal.tsx b/src/features/schedule/ui/molecules/retake-modal.tsx index 638bc80a0..218f0b5b0 100644 --- a/src/features/schedule/ui/molecules/retake-modal.tsx +++ b/src/features/schedule/ui/molecules/retake-modal.tsx @@ -4,7 +4,7 @@ import styled from 'styled-components' import { RetakeLink } from '@features/schedule/types/retake-types' -import { Title } from '@ui/title' +import { Title } from '@shared/ui/title' const Container = styled.div` width: 600px; diff --git a/src/features/schedule/ui/molecules/schedule-view-buttons-list.tsx b/src/features/schedule/ui/molecules/schedule-view-buttons-list.tsx index 9fcbe0ddd..7dedc98f8 100644 --- a/src/features/schedule/ui/molecules/schedule-view-buttons-list.tsx +++ b/src/features/schedule/ui/molecules/schedule-view-buttons-list.tsx @@ -1,10 +1,10 @@ import React from 'react' import { FiColumns, FiSidebar } from 'react-icons/fi' -import { ViewType } from '@api/model' import styled from 'styled-components' -import { Button } from '@ui/atoms' +import { ViewType } from '@shared/api/model' +import { Button } from '@shared/ui/atoms' const ScheduleViewButtonsListWrapper = styled.div` display: flex; diff --git a/src/features/schedule/ui/show-next-day-events-button/events-modal.tsx b/src/features/schedule/ui/show-next-day-events-button/events-modal.tsx index 6dbd983f6..62013ddbc 100644 --- a/src/features/schedule/ui/show-next-day-events-button/events-modal.tsx +++ b/src/features/schedule/ui/show-next-day-events-button/events-modal.tsx @@ -1,12 +1,12 @@ import React from 'react' +import { TimesEvents } from '@features/schedule/ui/calendar/calendars/day/ui/times-events' +import { useCalendarScale } from '@features/schedule/ui/calendar/hooks/use-calendar-scale' import { useScheduleSubjectModal } from '@features/use-schedule-subject-modal' -import { Sleep } from '@shared/images' -import { DayCalendarEvent } from '@shared/ui/calendar' -import { TimesEvents } from '@shared/ui/calendar/calendars/day/ui/times-events' -import { useCalendarScale } from '@shared/ui/calendar/hooks/use-calendar-scale' +import { DayCalendarEvent } from '@shared/api/model' import { Error } from '@shared/ui/error' +import { Sleep } from '@shared/ui/images' import { NextDayScheduleStyled } from './styles' diff --git a/src/features/schedule/ui/show-next-day-events-button/index.tsx b/src/features/schedule/ui/show-next-day-events-button/index.tsx index 2d5583878..d7ef9ac1d 100644 --- a/src/features/schedule/ui/show-next-day-events-button/index.tsx +++ b/src/features/schedule/ui/show-next-day-events-button/index.tsx @@ -1,13 +1,12 @@ import React from 'react' -import { useModal } from 'widgets' - import { scheduleModel } from '@entities/schedule' import capitalizeFirstLetter from '@shared/lib/capitalize-first-letter' import { getDateInSomeDays } from '@shared/lib/dates/get-date-in-some-days' import { getWeekDayFromDate } from '@shared/lib/dates/get-weekday-from-date' import { Button } from '@shared/ui/button' +import { useModal } from '@shared/ui/modal' import { EventsModal } from './events-modal' diff --git a/src/features/schedule/ui/show-next-day-events-button/styles.ts b/src/features/schedule/ui/show-next-day-events-button/styles.ts index cb6df82cf..bf6ba097c 100644 --- a/src/features/schedule/ui/show-next-day-events-button/styles.ts +++ b/src/features/schedule/ui/show-next-day-events-button/styles.ts @@ -1,6 +1,6 @@ import styled from 'styled-components' -import { MEDIA_QUERIES } from '@shared/constants' +import { MEDIA_QUERIES } from '@shared/ui/consts' export const NextDayScheduleStyled = styled.div` --time-width: 55px; diff --git a/src/features/schedule/ui/subject/modal/index.tsx b/src/features/schedule/ui/subject/modal/index.tsx index 13f359aca..5f7287eac 100644 --- a/src/features/schedule/ui/subject/modal/index.tsx +++ b/src/features/schedule/ui/subject/modal/index.tsx @@ -8,21 +8,21 @@ import { HiOutlineUserGroup, } from 'react-icons/hi' -import { ISubject } from '@api/model' import styled from 'styled-components' -import { User, useModal } from 'widgets' import GroupModal from '@features/groups-list/group-modal' import { getSubjectName } from '@features/schedule/lib/get-subject-name' +import IconText from '@features/schedule/ui/calendar/calendars/day/ui/icon-text' +import User from '@features/user' -import { IColorPalette } from '@shared/constants' +import { ISubject } from '@shared/api/model' +import { IColorPalette } from '@shared/consts' import calcTimeLeft from '@shared/lib/dates/calc-time-left' import { useCalcTimeLeft } from '@shared/lib/hooks/use-calc-time-left' -import IconText from '@shared/ui/calendar/calendars/day/ui/icon-text' +import { Button, Divider, Title } from '@shared/ui/atoms' import DotSeparatedWords from '@shared/ui/dot-separated-words' import Flex from '@shared/ui/flex' - -import { Button, Divider, Title } from '@ui/atoms' +import { useModal } from '@shared/ui/modal' import { NextSubject, SubjectPlaceBlock } from '../../atoms' import ListOfGroups from '../../atoms/list-of-groups' diff --git a/src/features/schedule/ui/subject/subject-icon-and-background.tsx b/src/features/schedule/ui/subject/subject-icon-and-background.tsx index 02758bde9..eece1893b 100644 --- a/src/features/schedule/ui/subject/subject-icon-and-background.tsx +++ b/src/features/schedule/ui/subject/subject-icon-and-background.tsx @@ -3,13 +3,13 @@ import React from 'react' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { getSubjectIcon } from '@features/acad-performance/lib/get-subject-icon' -import { Icon } from '@features/all-pages' +import EventBackground from '@features/schedule/ui/calendar/calendars/day/ui/event-background' import { userSettingsModel } from '@entities/settings' -import { IColorPalette, ThemeVariant } from '@shared/constants' -import EventBackground from '@shared/ui/calendar/calendars/day/ui/event-background' +import { IColorPalette, ThemeVariant } from '@shared/consts' +import { getSubjectIcon } from '@shared/lib/get-subject-icon' +import { Icon } from '@shared/ui/icon' type Props = { subjectName: string diff --git a/src/features/schedule/ui/subject/time-indicator.tsx b/src/features/schedule/ui/subject/time-indicator.tsx index 96275748b..9db88b795 100644 --- a/src/features/schedule/ui/subject/time-indicator.tsx +++ b/src/features/schedule/ui/subject/time-indicator.tsx @@ -1,12 +1,13 @@ import React from 'react' import { useUnit } from 'effector-react' -import { pulse } from 'global-styles' import styled from 'styled-components' import { userSettingsModel } from '@entities/settings' -import { IColorPalette, MEDIA_QUERIES, ThemeVariant } from '@shared/constants' +import { IColorPalette, ThemeVariant } from '@shared/consts' +import { pulse } from '@shared/global-styles' +import { MEDIA_QUERIES } from '@shared/ui/consts' type Props = { timeInterval?: string diff --git a/src/features/send-first-message/index.tsx b/src/features/send-first-message/index.tsx index ea4ed3f4c..6d8b36677 100644 --- a/src/features/send-first-message/index.tsx +++ b/src/features/send-first-message/index.tsx @@ -3,13 +3,12 @@ import { FiMessageCircle } from 'react-icons/fi' import { Link } from 'react-router-dom' import { useUnit } from 'effector-react' -import { useModal } from 'widgets' - -import { CHAT_ROUTE } from '@app/routes/general-routes' import { chatsModel } from '@entities/chats' +import { CHAT_ROUTE } from '@shared/routing' import { Button } from '@shared/ui/atoms' +import { useModal } from '@shared/ui/modal' import { SendFirstMessageProps } from './type' import { SendMessageModal } from './ui/send-first-message-modal' diff --git a/src/features/send-first-message/ui/send-first-message-modal.tsx b/src/features/send-first-message/ui/send-first-message-modal.tsx index 95573390d..3fce025e5 100644 --- a/src/features/send-first-message/ui/send-first-message-modal.tsx +++ b/src/features/send-first-message/ui/send-first-message-modal.tsx @@ -6,13 +6,13 @@ import { Link } from 'react-router-dom' import { useUnit } from 'effector-react' import sanitize from 'sanitize-html' import styled from 'styled-components' -import { useModal } from 'widgets' -import { CHAT_ROUTE } from '@app/routes/general-routes' - -import { Colors, MEDIA_QUERIES } from '@shared/constants' +import { Colors } from '@shared/consts' +import { CHAT_ROUTE } from '@shared/routing' import { Button, Divider, Title } from '@shared/ui/atoms' +import { MEDIA_QUERIES } from '@shared/ui/consts' import ListOfFiles from '@shared/ui/file-input/ui/list-of-files' +import { useModal } from '@shared/ui/modal' import { RichTextInput } from '@shared/ui/rich-text-input' import { UploadFileButton } from '@shared/ui/upload-file-button' import UserHeader from '@shared/ui/user-header' diff --git a/src/shared/lib/check-form-fields.ts b/src/features/send-form/check-form-fields.ts similarity index 94% rename from src/shared/lib/check-form-fields.ts rename to src/features/send-form/check-form-fields.ts index 66301aca3..5066d4003 100644 --- a/src/shared/lib/check-form-fields.ts +++ b/src/features/send-form/check-form-fields.ts @@ -1,6 +1,5 @@ -import { SpecialFieldsNameConfig } from '@entities/applications/consts' - -import { CheckboxDocs, IComplexInputAreaData, IInputArea, IInputAreaData } from '@ui/input-area/model' +import { CheckboxDocs, IComplexInputAreaData, IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsNameConfig } from '@shared/ui/input-area/types' const checkFormFields = (form: IInputArea, specialFieldsNameConfig?: SpecialFieldsNameConfig) => { const isCheckDocument = !form.documents?.required || !!form.documents.files.length diff --git a/src/shared/lib/prepare-form-data.ts b/src/features/send-form/prepare-form-data.ts similarity index 89% rename from src/shared/lib/prepare-form-data.ts rename to src/features/send-form/prepare-form-data.ts index a6488c2c6..c8c4f66ca 100644 --- a/src/shared/lib/prepare-form-data.ts +++ b/src/features/send-form/prepare-form-data.ts @@ -1,8 +1,6 @@ -import { SelectPage } from '@features/select' - -import { IndexedProperties } from '@shared/models/indexed-properties' - -import { CheckboxDocs, IInputArea, IInputAreaData } from '@ui/input-area/model' +import { IndexedProperties } from '@shared/consts/models/indexed-properties' +import { CheckboxDocs, IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { SelectPage } from '@shared/ui/select' const prepareFormData = (form: IInputArea) => { const inputs = (form.data as IInputAreaData[]).reduce( diff --git a/src/shared/lib/send-form.ts b/src/features/send-form/send-form.ts similarity index 81% rename from src/shared/lib/send-form.ts rename to src/features/send-form/send-form.ts index 6e0436f93..575c26651 100644 --- a/src/shared/lib/send-form.ts +++ b/src/features/send-form/send-form.ts @@ -1,10 +1,9 @@ import { Effect, EventCallable } from 'effector' -import { popUpMessageModel } from '@entities/pop-up-message' +import prepareFormData from '@features/send-form/prepare-form-data' -import { IInputArea } from '@ui/input-area/model' - -import prepareFormData from '@utils/prepare-form-data' +import { IInputArea } from '@shared/ui/input-area/model' +import { popUpMessageModel } from '@shared/ui/pop-up-message' const sendForm = async ( form: IInputArea, diff --git a/src/widgets/slider-page/index.tsx b/src/features/slider-page/index.tsx similarity index 92% rename from src/widgets/slider-page/index.tsx rename to src/features/slider-page/index.tsx index 9b01b4797..e202b67c4 100644 --- a/src/widgets/slider-page/index.tsx +++ b/src/features/slider-page/index.tsx @@ -2,15 +2,14 @@ import React, { useEffect, useRef, useState } from 'react' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { SliderTutorial } from 'widgets/tutorial/tutorials/slider-tutorial' -import { tutorialModel } from '@entities/tutorial' +import { SliderTutorial } from '@features/tutorials' -import { Error } from '@ui/atoms' -import convertHorizontalAlign from '@ui/list/lib/convert-horizontal-align' -import { Align } from '@ui/types' - -import useResize from '@utils/hooks/use-resize' +import useResize from '@shared/lib/hooks/use-resize' +import { tutorialModel } from '@shared/tutorial' +import { Error } from '@shared/ui/atoms' +import convertHorizontalAlign from '@shared/ui/list/lib/convert-horizontal-align' +import { Align } from '@shared/ui/types' const SliderPageWrapper = styled.div<{ width?: string; align: Align; maxWidth?: string }>` display: flex; diff --git a/src/features/teacher-group-search/index.tsx b/src/features/teacher-group-search/index.tsx index 30a9a3046..31ab3aa6f 100644 --- a/src/features/teacher-group-search/index.tsx +++ b/src/features/teacher-group-search/index.tsx @@ -4,13 +4,11 @@ import { HiOutlineUserCircle } from 'react-icons/hi' import { AxiosResponse } from 'axios' -import SearchWithHints from '@features/search-with-hints' - -import { userModel } from '@entities/user' - import { studentApi, teacherApi } from '@shared/api' import Masks from '@shared/lib/masks' +import { userModel } from '@shared/session' import { Hint } from '@shared/ui/search' +import SearchWithHints from '@shared/ui/search-with-hints' type Props = { value: string diff --git a/src/features/teacher-select/model.ts b/src/features/teacher-select/model.ts deleted file mode 100644 index c32cd5582..000000000 --- a/src/features/teacher-select/model.ts +++ /dev/null @@ -1,28 +0,0 @@ -import axios from 'axios' -import { createEffect, createEvent, createStore, sample } from 'effector' -import { debounce } from 'patronum' - -const onSearch = createEvent() -const resetTeachers = createEvent() - -const searchFx = createEffect(async (search: string) => { - const { employees } = (await axios.get(`https://api.mospolytech.ru/physedjournal/staff?filter=${search}`)).data - - return employees -}) - -const $search = createStore(null).on(onSearch, (_, search) => search) - -debounce({ - source: sample({ source: $search, filter: (value): value is string => value !== null }), - timeout: 200, - target: searchFx, -}) - -sample({ source: $search, filter: (value): value is string => value !== null }) - -const $teachers = createStore<{ guid: string; fullName: string }[]>([]).on(searchFx.doneData, (_, data) => data) - -sample({ clock: resetTeachers, target: $search.reinit! }) - -export { $teachers, onSearch, $search, resetTeachers } diff --git a/src/features/teacher-select/ui.tsx b/src/features/teacher-select/ui.tsx deleted file mode 100644 index 0fec93bde..000000000 --- a/src/features/teacher-select/ui.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import React, { useEffect } from 'react' - -import { useUnit } from 'effector-react' - -import Search, { Hint } from '@shared/ui/search' -import { Title } from '@shared/ui/title' - -import { $search, $teachers, onSearch, resetTeachers } from './model' - -type TeacherSelectProps = { - onChange: (value: string) => void - onSearchChange?: (value: string) => void -} - -export const TeacherSelect = ({ onChange, onSearchChange }: TeacherSelectProps) => { - const [teachers, search] = useUnit([$teachers, $search]) - - const handleHintClick = (hint: Hint | undefined) => { - if (hint?.id) { - onChange(hint.id) - } - } - - useEffect(() => { - onSearch('') - - return resetTeachers - }, []) - - useEffect(() => { - search && onSearchChange?.(search) - }, [search]) - - return ( - <> - - Преподаватель - - ({ id: t.guid, title: t.fullName, value: t.guid }))} - onHintClick={handleHintClick} - /> - - ) -} diff --git a/src/widgets/template-form/index.tsx b/src/features/template-form/index.tsx similarity index 84% rename from src/widgets/template-form/index.tsx rename to src/features/template-form/index.tsx index 9d3f195e5..9df8ff9ce 100644 --- a/src/widgets/template-form/index.tsx +++ b/src/features/template-form/index.tsx @@ -1,21 +1,18 @@ import React, { useEffect, useState } from 'react' import { FiInfo } from 'react-icons/fi' -import { TemplateFormStoreOutput } from 'shared/effector/create-form-store' +import checkFormFields from '@features/send-form/check-form-fields' +import sendForm from '@features/send-form/send-form' -import getMethodObtaining from '@features/applications/lib/get-method-obstaing' - -import { SpecialFieldsNameConfig } from '@entities/applications/consts' +import { TemplateFormStoreOutput } from '@entities/applications/lib/create-form-store' +import getMethodObtaining from '@entities/applications/lib/get-method-obstaing' import localizeDate from '@shared/lib/dates/localize-date' - -import { Loading, SubmitButton, Title } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea, IInputAreaData } from '@ui/input-area/model' -import { Message } from '@ui/message' - -import checkFormFields from '@utils/check-form-fields' -import sendForm from '@utils/send-form' +import { Message, SubmitButton, Title } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { LoadedState, SpecialFieldsNameConfig } from '@shared/ui/input-area/types' +import { Loading } from '@shared/ui/loading' export type TemplateFormProps = { model: TemplateFormStoreOutput @@ -27,8 +24,6 @@ export type TemplateFormProps = { isSpecialField?: boolean } -export type LoadedState = React.Dispatch> - const TemplateForm = ({ model, getForm, diff --git a/src/pages/allowances/ui/dev-mode-message.tsx b/src/features/test-database-message/test-database-message.tsx similarity index 83% rename from src/pages/allowances/ui/dev-mode-message.tsx rename to src/features/test-database-message/test-database-message.tsx index aea1524f0..6f4d28e1f 100644 --- a/src/pages/allowances/ui/dev-mode-message.tsx +++ b/src/features/test-database-message/test-database-message.tsx @@ -1,6 +1,6 @@ import React from 'react' -import { isProduction } from '@shared/constants' +import { isProduction } from '@shared/consts' import { Message } from '@shared/ui/atoms' export const DevModeMessage = () => { diff --git a/src/features/theme-toggle/index.tsx b/src/features/theme-toggle/index.tsx index c50b2ee6f..2582bfb64 100644 --- a/src/features/theme-toggle/index.tsx +++ b/src/features/theme-toggle/index.tsx @@ -3,15 +3,14 @@ import { FiMoon, FiSun } from 'react-icons/fi' import { useUnit } from 'effector-react' -import { IconWrapper } from '@pages/profile/ui/top/styles' - import { userSettingsModel } from '@entities/settings' -import { Colors, ThemeVariant } from '@shared/constants' +import { Colors, ThemeVariant } from '@shared/consts' import { Button } from '@shared/ui/button' import ToggleItem from '@shared/ui/toggle-item' import { switchTheme } from './model' +import { IconWrapper } from './styles' type Props = { type: 'toggle' | 'h-button' | 'v-button' diff --git a/src/features/theme-toggle/model.ts b/src/features/theme-toggle/model.ts index 79941c6ed..985ecae40 100644 --- a/src/features/theme-toggle/model.ts +++ b/src/features/theme-toggle/model.ts @@ -2,7 +2,7 @@ import { createEvent, sample } from 'effector' import { userSettingsModel } from '@entities/settings' -import { ThemeVariant } from '@shared/constants' +import { ThemeVariant } from '@shared/consts' export const switchTheme = createEvent<{ isDark: boolean }>() diff --git a/src/features/theme-toggle/styles.ts b/src/features/theme-toggle/styles.ts new file mode 100644 index 000000000..8d67a335d --- /dev/null +++ b/src/features/theme-toggle/styles.ts @@ -0,0 +1,18 @@ +import styled from 'styled-components' + +export const IconWrapper = styled.div<{ background: string; width?: string }>` + min-width: ${({ width }) => width ?? '35px'}; + height: ${({ width }) => width ?? '35px'}; + display: flex; + align-items: center; + justify-content: center; + border-radius: 100%; + color: #fff; + background: ${({ background }) => background ?? 'var(--almostTransparent)'}; + + @media (max-width: 1000px) { + background: none; + color: var(--text); + /* color: ${({ background }) => background ?? 'var(--almostTransparent)'}; */ + } +` diff --git a/src/features/tutorials/button-tutorial.ts b/src/features/tutorials/button-tutorial.ts new file mode 100644 index 000000000..cc6bd5853 --- /dev/null +++ b/src/features/tutorials/button-tutorial.ts @@ -0,0 +1,5 @@ +import { withTutorial } from '@shared/tutorial/lib/with-tutorial' + +import { Button } from '../../shared/ui/button/index' + +export const ButtonTutorial = withTutorial(Button) diff --git a/src/widgets/tutorial/tutorials/chat-items-tutorial.ts b/src/features/tutorials/chat-items-tutorial.ts similarity index 61% rename from src/widgets/tutorial/tutorials/chat-items-tutorial.ts rename to src/features/tutorials/chat-items-tutorial.ts index 86b42bf5e..d5cf6d0b0 100644 --- a/src/widgets/tutorial/tutorials/chat-items-tutorial.ts +++ b/src/features/tutorials/chat-items-tutorial.ts @@ -1,5 +1,5 @@ import { ChatItems } from '@features/chat/ui/molecules' -import { withTutorial } from '../lib/with-tutorial' +import { withTutorial } from '../../shared/tutorial/lib/with-tutorial' export const ChatItemsTutorial = withTutorial(ChatItems) diff --git a/src/features/tutorials/debt-tutorial.ts b/src/features/tutorials/debt-tutorial.ts new file mode 100644 index 000000000..697232c10 --- /dev/null +++ b/src/features/tutorials/debt-tutorial.ts @@ -0,0 +1,5 @@ +import { withTutorial } from '@shared/tutorial/lib/with-tutorial' + +import Debt from '../payments/debt' + +export const DebtTutorial = withTutorial(Debt) diff --git a/src/widgets/tutorial/tutorials/div-tutorial.tsx b/src/features/tutorials/div-tutorial.tsx similarity index 64% rename from src/widgets/tutorial/tutorials/div-tutorial.tsx rename to src/features/tutorials/div-tutorial.tsx index c06a9e15b..92fc0a3ba 100644 --- a/src/widgets/tutorial/tutorials/div-tutorial.tsx +++ b/src/features/tutorials/div-tutorial.tsx @@ -1,6 +1,7 @@ import React from 'react' -import { TutorialComponent, withTutorial } from '../lib/with-tutorial' +import { withTutorial } from '@shared/tutorial/lib/with-tutorial' +import { TutorialComponent } from '@shared/ui/types' export const DivTutorial = withTutorial( ({ forwardedRef, children }: TutorialComponent & { children?: React.ReactNode }) => ( diff --git a/src/widgets/tutorial/tutorials/flex-tutorial.tsx b/src/features/tutorials/flex-tutorial.tsx similarity index 86% rename from src/widgets/tutorial/tutorials/flex-tutorial.tsx rename to src/features/tutorials/flex-tutorial.tsx index 6699a108f..fa5f6e576 100644 --- a/src/widgets/tutorial/tutorials/flex-tutorial.tsx +++ b/src/features/tutorials/flex-tutorial.tsx @@ -1,8 +1,9 @@ import React from 'react' import Flex from '@shared/ui/flex' +import { TutorialComponent } from '@shared/ui/types' -import { TutorialComponent, withTutorial } from '../lib/with-tutorial' +import { withTutorial } from '../../shared/tutorial/lib/with-tutorial' type JC = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' type AI = 'flex-start' | 'center' | 'flex-end' diff --git a/src/features/tutorials/global-app-search-tutorial.ts b/src/features/tutorials/global-app-search-tutorial.ts new file mode 100644 index 000000000..607c0f4a8 --- /dev/null +++ b/src/features/tutorials/global-app-search-tutorial.ts @@ -0,0 +1,5 @@ +import { withTutorial } from '@shared/tutorial/lib/with-tutorial' + +import GlobalAppSearch from '../global-app-search/index' + +export const GlobalAppSearchTutorial = withTutorial(GlobalAppSearch) diff --git a/src/features/tutorials/index.ts b/src/features/tutorials/index.ts new file mode 100644 index 000000000..bce26f18e --- /dev/null +++ b/src/features/tutorials/index.ts @@ -0,0 +1,5 @@ +import slider from '@shared/ui/slider' + +import { withTutorial } from '../../shared/tutorial/lib/with-tutorial' + +export const SliderTutorial = withTutorial(slider) diff --git a/src/widgets/tutorial/tutorials/link-tutorial.tsx b/src/features/tutorials/link-tutorial.tsx similarity index 74% rename from src/widgets/tutorial/tutorials/link-tutorial.tsx rename to src/features/tutorials/link-tutorial.tsx index 2a42e6ca9..86e952e3f 100644 --- a/src/widgets/tutorial/tutorials/link-tutorial.tsx +++ b/src/features/tutorials/link-tutorial.tsx @@ -1,7 +1,8 @@ import React from 'react' import { Link } from 'react-router-dom' -import { TutorialComponent, withTutorial } from 'widgets/tutorial/lib/with-tutorial' +import { withTutorial } from '@shared/tutorial/lib/with-tutorial' +import { TutorialComponent } from '@shared/ui/types' export const LinkTutoiral = withTutorial( ({ forwardedRef, to, children }: TutorialComponent & { to: string; children?: React.ReactNode }) => { diff --git a/src/features/tutorials/links-tutorial.ts b/src/features/tutorials/links-tutorial.ts new file mode 100644 index 000000000..7b82988d8 --- /dev/null +++ b/src/features/tutorials/links-tutorial.ts @@ -0,0 +1,5 @@ +import { withTutorial } from '@shared/tutorial/lib/with-tutorial' + +import Links from '../home/ui/links' + +export const LinksTutorial = withTutorial(Links) diff --git a/src/widgets/tutorial/tutorials/list-tutorial.ts b/src/features/tutorials/list-tutorial.ts similarity index 54% rename from src/widgets/tutorial/tutorials/list-tutorial.ts rename to src/features/tutorials/list-tutorial.ts index 786c60d0e..a7fef4f65 100644 --- a/src/widgets/tutorial/tutorials/list-tutorial.ts +++ b/src/features/tutorials/list-tutorial.ts @@ -1,5 +1,5 @@ import List from '@shared/ui/list' -import { withTutorial } from '../lib/with-tutorial' +import { withTutorial } from '../../shared/tutorial/lib/with-tutorial' export const ListTutorial = withTutorial(List) diff --git a/src/widgets/tutorial/tutorials/new-chat.ts b/src/features/tutorials/new-chat.ts similarity index 64% rename from src/widgets/tutorial/tutorials/new-chat.ts rename to src/features/tutorials/new-chat.ts index 09dd9ff0e..98f4c7727 100644 --- a/src/widgets/tutorial/tutorials/new-chat.ts +++ b/src/features/tutorials/new-chat.ts @@ -1,5 +1,5 @@ -import { withTutorial } from 'widgets/tutorial/lib/with-tutorial' - import { AddNewChat } from '@features/add-new-chat' +import { withTutorial } from '@shared/tutorial/lib/with-tutorial' + export const AddNewChatTutorial = withTutorial(AddNewChat) diff --git a/src/widgets/tutorial/tutorials/page-link-tutorial.ts b/src/features/tutorials/page-link-tutorial.ts similarity index 59% rename from src/widgets/tutorial/tutorials/page-link-tutorial.ts rename to src/features/tutorials/page-link-tutorial.ts index 9ba66d3a4..5b2a53be4 100644 --- a/src/widgets/tutorial/tutorials/page-link-tutorial.ts +++ b/src/features/tutorials/page-link-tutorial.ts @@ -1,5 +1,5 @@ import { PageLink } from '@features/all-pages' -import { withTutorial } from '../lib/with-tutorial' +import { withTutorial } from '../../shared/tutorial/lib/with-tutorial' export const PageLinkTutorial = withTutorial(PageLink) diff --git a/src/widgets/tutorial/tutorials/page-wrapper-tutorial.tsx b/src/features/tutorials/page-wrapper-tutorial.tsx similarity index 71% rename from src/widgets/tutorial/tutorials/page-wrapper-tutorial.tsx rename to src/features/tutorials/page-wrapper-tutorial.tsx index f76567c1f..909f9ecef 100644 --- a/src/widgets/tutorial/tutorials/page-wrapper-tutorial.tsx +++ b/src/features/tutorials/page-wrapper-tutorial.tsx @@ -1,9 +1,10 @@ import React from 'react' -import { TutorialComponent, withTutorial } from 'widgets/tutorial/lib/with-tutorial' - import { PageWrapper } from '@features/payments' +import { withTutorial } from '@shared/tutorial/lib/with-tutorial' +import { TutorialComponent } from '@shared/ui/types' + export const PageWrapperTutorial = withTutorial( ({ forwardedRef, children }: TutorialComponent & { children?: React.ReactNode }) => { return {children} diff --git a/src/features/tutorials/table-tutorial.ts b/src/features/tutorials/table-tutorial.ts new file mode 100644 index 000000000..10b187325 --- /dev/null +++ b/src/features/tutorials/table-tutorial.ts @@ -0,0 +1,5 @@ +import { withTutorial } from '@shared/tutorial/lib/with-tutorial' + +import Table from '../../shared/ui/table/index' + +export const TableTutorial = withTutorial(Table) diff --git a/src/features/use-schedule-subject-modal/index.tsx b/src/features/use-schedule-subject-modal/index.tsx index 8ebd32081..4984d833c 100644 --- a/src/features/use-schedule-subject-modal/index.tsx +++ b/src/features/use-schedule-subject-modal/index.tsx @@ -1,12 +1,11 @@ import React from 'react' -import { useModal } from 'widgets' - import { SubjectModal } from '@features/schedule/ui' +import { getTimeInterval } from '@features/schedule/ui/calendar/lib/get-time-interval' +import { checkIfEventIsCurrent } from '@features/schedule/ui/calendar/ui/event/lib/check-if-event-is-current' -import { DayCalendarEvent } from '@shared/ui/calendar' -import { getTimeInterval } from '@shared/ui/calendar/lib/get-time-interval' -import { checkIfEventIsCurrent } from '@shared/ui/calendar/ui/event/lib/check-if-event-is-current' +import { DayCalendarEvent } from '@shared/api/model' +import { useModal } from '@shared/ui/modal' export const useScheduleSubjectModal = () => { const { open } = useModal() diff --git a/src/widgets/user/index.tsx b/src/features/user/index.tsx similarity index 91% rename from src/widgets/user/index.tsx rename to src/features/user/index.tsx index fffce6c4f..c0f3e1c0c 100644 --- a/src/widgets/user/index.tsx +++ b/src/features/user/index.tsx @@ -1,24 +1,22 @@ import React from 'react' import styled from 'styled-components' -import { useModal } from 'widgets' -import { StaffModal } from '@pages/all-staff/ui/staff-modal' - -import Avatar from '@features/home/ui/molecules/avatar' +import { StaffModal } from '@features/all-staff/staff-modal' import { contextMenuModel } from '@entities/context-menu' -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' +import Avatar from '@shared/ui/avatar' import DotSeparatedWords from '@shared/ui/dot-separated-words' +import { useModal } from '@shared/ui/modal' +import { Direction, Size } from '@shared/ui/types' -import { Direction, Size } from '@ui/types' - +import getStatus from '../../shared/ui/user-header/get-status' +import { UserProps } from '../../shared/ui/user-header/types' import getFontSize from './lib/get-font-size' import getImageSize from './lib/get-image-size' -import getStatus from './lib/get-status' import getWidth from './lib/get-width' -import { UserProps } from './types' import { SkeletonLoading, StudentModal } from './ui' const UserWrapper = styled.div<{ orientation: Direction; size: Size }>` diff --git a/src/widgets/user/lib/get-font-size.ts b/src/features/user/lib/get-font-size.ts similarity index 85% rename from src/widgets/user/lib/get-font-size.ts rename to src/features/user/lib/get-font-size.ts index 1548cb9b6..9e4453fa4 100644 --- a/src/widgets/user/lib/get-font-size.ts +++ b/src/features/user/lib/get-font-size.ts @@ -1,4 +1,4 @@ -import { Size } from '@ui/types' +import { Size } from '@shared/ui/types' const getFontSize = (size: Size) => { switch (size) { diff --git a/src/widgets/user/lib/get-image-size.ts b/src/features/user/lib/get-image-size.ts similarity index 85% rename from src/widgets/user/lib/get-image-size.ts rename to src/features/user/lib/get-image-size.ts index d38b44e7f..53ed91adb 100644 --- a/src/widgets/user/lib/get-image-size.ts +++ b/src/features/user/lib/get-image-size.ts @@ -1,4 +1,4 @@ -import { Direction, Size } from '@ui/types' +import { Direction, Size } from '@shared/ui/types' const getImageSize = (orientation: Direction, size: Size) => { if (orientation === 'horizontal') { diff --git a/src/widgets/user/lib/get-width.ts b/src/features/user/lib/get-width.ts similarity index 85% rename from src/widgets/user/lib/get-width.ts rename to src/features/user/lib/get-width.ts index 1c07ef46b..8505a2c9f 100644 --- a/src/widgets/user/lib/get-width.ts +++ b/src/features/user/lib/get-width.ts @@ -1,4 +1,4 @@ -import { Size } from '@ui/types' +import { Size } from '@shared/ui/types' const getWidth = (size: Size) => { switch (size) { diff --git a/src/widgets/user/lib/handle-change-account.ts b/src/features/user/lib/handle-change-account.ts similarity index 79% rename from src/widgets/user/lib/handle-change-account.ts rename to src/features/user/lib/handle-change-account.ts index f8d9955e4..79ef70492 100644 --- a/src/widgets/user/lib/handle-change-account.ts +++ b/src/features/user/lib/handle-change-account.ts @@ -1,6 +1,5 @@ -import { confirmModel } from '@entities/confirm' - -import { BrowserStorageKey } from '@shared/constants/browser-storage-key' +import { BrowserStorageKey } from '@shared/consts/browser-storage-key' +import { confirmModel } from '@shared/ui/confirm' const handleChangeAccount = (token: string) => { if (token) { diff --git a/src/widgets/user/ui/atoms/index.ts b/src/features/user/ui/atoms/index.ts similarity index 100% rename from src/widgets/user/ui/atoms/index.ts rename to src/features/user/ui/atoms/index.ts diff --git a/src/widgets/user/ui/atoms/skeleton-loading.tsx b/src/features/user/ui/atoms/skeleton-loading.tsx similarity index 96% rename from src/widgets/user/ui/atoms/skeleton-loading.tsx rename to src/features/user/ui/atoms/skeleton-loading.tsx index 16c092057..295e693cb 100644 --- a/src/widgets/user/ui/atoms/skeleton-loading.tsx +++ b/src/features/user/ui/atoms/skeleton-loading.tsx @@ -2,7 +2,7 @@ import React from 'react' import styled from 'styled-components' -import { SkeletonShape } from '@ui/atoms' +import { SkeletonShape } from '@shared/ui/atoms' const SkeletonLoadingWrapper = styled.div` display: flex; diff --git a/src/widgets/user/ui/atoms/user-modal.tsx b/src/features/user/ui/atoms/user-modal.tsx similarity index 92% rename from src/widgets/user/ui/atoms/user-modal.tsx rename to src/features/user/ui/atoms/user-modal.tsx index c8bd57b09..f413445a5 100644 --- a/src/widgets/user/ui/atoms/user-modal.tsx +++ b/src/features/user/ui/atoms/user-modal.tsx @@ -1,10 +1,10 @@ import React from 'react' import styled from 'styled-components' -import { UserProps } from 'widgets/user/types' -import { MEDIA_QUERIES } from '@shared/constants' +import { MEDIA_QUERIES } from '@shared/ui/consts' import UserHeader from '@shared/ui/user-header' +import { UserProps } from '@shared/ui/user-header/types' const UserModalWrapper = styled.div` @media (min-width: 1001px) { diff --git a/src/widgets/user/ui/index.ts b/src/features/user/ui/index.ts similarity index 100% rename from src/widgets/user/ui/index.ts rename to src/features/user/ui/index.ts diff --git a/src/widgets/user/ui/molecules/index.ts b/src/features/user/ui/molecules/index.ts similarity index 100% rename from src/widgets/user/ui/molecules/index.ts rename to src/features/user/ui/molecules/index.ts diff --git a/src/widgets/user/ui/molecules/student-modal.tsx b/src/features/user/ui/molecules/student-modal.tsx similarity index 91% rename from src/widgets/user/ui/molecules/student-modal.tsx rename to src/features/user/ui/molecules/student-modal.tsx index c14d5f618..e7c8731cf 100644 --- a/src/widgets/user/ui/molecules/student-modal.tsx +++ b/src/features/user/ui/molecules/student-modal.tsx @@ -2,18 +2,15 @@ import React from 'react' import { FiClock } from 'react-icons/fi' import { Link } from 'react-router-dom' -import useModal from 'widgets/modal' -import { UserProps } from 'widgets/user/types' - -import { SCHEDULE_FILTER_ROUTE } from '@app/routes/general-routes' - import { SendMessage } from '@features/send-first-message' import { getEnrichedTemplatePath } from '@entities/menu/lib/get-enriched-template-path' import getLettersColors from '@shared/lib/get-letters-colors' - -import { Button } from '@ui/button' +import { SCHEDULE_FILTER_ROUTE } from '@shared/routing' +import { Button } from '@shared/ui/button' +import { useModal } from '@shared/ui/modal' +import { UserProps } from '@shared/ui/user-header/types' import handleChangeAccount from '../../lib/handle-change-account' import { UserModal } from '../atoms' diff --git a/src/widgets/user/ui/molecules/teacher-modal.tsx b/src/features/user/ui/molecules/teacher-modal.tsx similarity index 87% rename from src/widgets/user/ui/molecules/teacher-modal.tsx rename to src/features/user/ui/molecules/teacher-modal.tsx index 54f42d64a..488d31579 100644 --- a/src/widgets/user/ui/molecules/teacher-modal.tsx +++ b/src/features/user/ui/molecules/teacher-modal.tsx @@ -2,19 +2,16 @@ import React from 'react' import { FiClock } from 'react-icons/fi' import { Link } from 'react-router-dom' -import useModal from 'widgets/modal' -import handleChangeAccount from 'widgets/user/lib/handle-change-account' -import { UserProps } from 'widgets/user/types' - -import { SCHEDULE_FILTER_ROUTE } from '@app/routes/general-routes' - import { SendMessage } from '@features/send-first-message' +import handleChangeAccount from '@features/user/lib/handle-change-account' import { getEnrichedTemplatePath } from '@entities/menu/lib/get-enriched-template-path' import getLettersColors from '@shared/lib/get-letters-colors' - -import { Button } from '@ui/button' +import { SCHEDULE_FILTER_ROUTE } from '@shared/routing' +import { Button } from '@shared/ui/button' +import { useModal } from '@shared/ui/modal' +import { UserProps } from '@shared/ui/user-header/types' import { UserModal } from '../atoms' diff --git a/src/features/vacation-schedule/ui/organism/vacation.tsx b/src/features/vacation-schedule/ui/organism/vacation.tsx index 0ba11d385..4f6839707 100644 --- a/src/features/vacation-schedule/ui/organism/vacation.tsx +++ b/src/features/vacation-schedule/ui/organism/vacation.tsx @@ -1,16 +1,13 @@ import React from 'react' -import { VacationSchedule, Vacation as VacationType } from '@api/model/vacation-schedule' -import { IndexedProperties } from '@utility-types/indexed-properties' - +import { VacationSchedule, Vacation as VacationType } from '@shared/api/model/vacation-schedule' +import { IndexedProperties } from '@shared/consts/models/indexed-properties' import localizeDate from '@shared/lib/dates/localize-date' - -import KeyValue from '@ui/atoms/key-value' -import List from '@ui/list' -import Table from '@ui/table' -import { ColumnProps } from '@ui/table/types' - -import getCorrectWordForm, { Rules } from '@utils/get-correct-word-form' +import getCorrectWordForm, { Rules } from '@shared/lib/get-correct-word-form' +import KeyValue from '@shared/ui/atoms/key-value' +import List from '@shared/ui/list' +import Table from '@shared/ui/table' +import { ColumnProps } from '@shared/ui/table/types' const RULES: Rules = { fiveToNine: 'дней', diff --git a/src/features/vacation-schedule/ui/templates/page.tsx b/src/features/vacation-schedule/ui/templates/page.tsx index fa7faa9cc..7cbc75f7a 100644 --- a/src/features/vacation-schedule/ui/templates/page.tsx +++ b/src/features/vacation-schedule/ui/templates/page.tsx @@ -1,17 +1,15 @@ import React, { useEffect, useMemo, useState } from 'react' import { FiPlus } from 'react-icons/fi' -import Select, { SelectPage } from '@features/select' - -import { userModel } from '@entities/user' import { vacationScheduleModel } from '@entities/vacation-schedule' +import { userModel } from '@shared/session' +import { Button, CenterPage, Divider, LinkButton, Title, Wrapper } from '@shared/ui/atoms' +import Card from '@shared/ui/card' +import List from '@shared/ui/list' import PageBlock from '@shared/ui/page-block' - -import { Button, CenterPage, Divider, LinkButton, Title, Wrapper } from '@ui/atoms' -import Card from '@ui/card' -import List from '@ui/list' -import Subtext from '@ui/subtext' +import Select, { SelectPage } from '@shared/ui/select' +import Subtext from '@shared/ui/subtext' import { Vacation } from '../organism' diff --git a/src/index.tsx b/src/index.tsx index cdf23b393..f3113a0b0 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2,7 +2,7 @@ import React from 'react' import ReactDOM from 'react-dom' import App from './app' -import GlobalStyles from './global-styles' +import GlobalStyles from './shared/global-styles' ReactDOM.render( diff --git a/src/pages/acad-performance/index.tsx b/src/pages/acad-performance/index.tsx index 602429106..8620cc6f5 100644 --- a/src/pages/acad-performance/index.tsx +++ b/src/pages/acad-performance/index.tsx @@ -1,24 +1,21 @@ import React, { useEffect, useMemo, useState } from 'react' import { HiOutlineEmojiSad } from 'react-icons/hi' -import { AcadPerformance as IAcadPerformance } from '@api/model/acad-performance' - import createSelectItems from '@features/acad-performance/lib/create-select-items' import search from '@features/acad-performance/lib/search' import { SubjectList } from '@features/acad-performance/ui/organisms' -import Select, { SelectPage } from '@features/select' import { acadPerformanceModel } from '@entities/acad-performance' import { PreparedAcadPerformanceData, getCurrentData, prepareData } from '@entities/acad-performance/lib/prepare' -import { userModel } from '@entities/user' +import { AcadPerformance as IAcadPerformance } from '@shared/api/model/acad-performance' +import findSemestr from '@shared/lib/find-semestr' +import { userModel } from '@shared/session' +import { Error, Wrapper } from '@shared/ui/atoms' import Flex from '@shared/ui/flex' +import { LocalSearch } from '@shared/ui/molecules' import PageBlock from '@shared/ui/page-block' - -import { Error, Wrapper } from '@ui/atoms' -import { LocalSearch } from '@ui/molecules' - -import findSemestr from '@utils/find-semestr' +import Select, { SelectPage } from '@shared/ui/select' import GradeGraph from './ui/grade-graph' import PerformanceMessage from './ui/performance-message' diff --git a/src/pages/acad-performance/ui/grade-graph.tsx b/src/pages/acad-performance/ui/grade-graph.tsx index 676c791bc..f0d8d67e5 100644 --- a/src/pages/acad-performance/ui/grade-graph.tsx +++ b/src/pages/acad-performance/ui/grade-graph.tsx @@ -5,7 +5,7 @@ import styled from 'styled-components' import findPercentage from '@features/acad-performance/lib/find-percentage' import { AcadPerformance } from '@shared/api/model/acad-performance' -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' import Flex from '@shared/ui/flex' import { SkeletonShape } from '@shared/ui/skeleton-shape' import Subtext from '@shared/ui/subtext' diff --git a/src/pages/alerts/ui/alert-modal.tsx b/src/pages/alerts/ui/alert-modal.tsx deleted file mode 100644 index 00b735cb9..000000000 --- a/src/pages/alerts/ui/alert-modal.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import React from 'react' - -import styled from 'styled-components' - -import { Alert } from '@shared/api/model/alert' -import localizeDate from '@shared/lib/dates/localize-date' -import { Divider } from '@shared/ui/divider' -import DotSeparatedWords from '@shared/ui/dot-separated-words' -import Subtext from '@shared/ui/subtext' - -interface Props { - alert: Alert -} - -const AlertModal: React.FC = ({ alert }) => { - const { content, time, date } = alert - return ( - - - - - -
- - ) -} - -const Wrapper = styled.div` - display: flex; - flex-direction: column; - gap: 5px; - max-width: 600px; - - & > div { - width: 100%; - - p { - margin-top: 10px; - width: 100%; - opacity: 0.9; - line-height: 1.7rem; - } - - a { - text-decoration: underline; - } - - strong { - font-weight: 600; - } - - p:nth-child(1) { - margin: 0; - opacity: 1; - text-align: left !important; - } - - span { - font-size: 1rem !important; - } - - img { - width: 100% !important; - height: auto !important; - object-fit: cover; - border-radius: var(--brLight); - margin-bottom: 20px; - box-shadow: var(--block-content-shadow); - } - } -` - -export default AlertModal diff --git a/src/pages/alerts/ui/alerts/index.tsx b/src/pages/alerts/ui/alerts/index.tsx index 264f0bd21..8fd8d15c2 100644 --- a/src/pages/alerts/ui/alerts/index.tsx +++ b/src/pages/alerts/ui/alerts/index.tsx @@ -1,11 +1,12 @@ import React, { useState } from 'react' import styled from 'styled-components' -import AlertItem from 'widgets/alerts-widget/alert-item' + +import AlertItem from '@widgets/alerts-widget/alert-item' import { PreparedAlerts } from '@entities/alert/lib/prepare-data' -import { userModel } from '@entities/user' +import { userModel } from '@shared/session' import Flex from '@shared/ui/flex' import { LocalSearch } from '@shared/ui/molecules' diff --git a/src/pages/all-pages/index.tsx b/src/pages/all-pages/index.tsx index 8f67f6017..68e45d9ca 100644 --- a/src/pages/all-pages/index.tsx +++ b/src/pages/all-pages/index.tsx @@ -2,8 +2,6 @@ import React, { useMemo, useState } from 'react' import { useUnit } from 'effector-react' -import { Groups, IRoutes } from '@app/routes/general-routes' - import { FoundPages } from '@features/all-pages' import getGroupPages, { routesOrder } from '@features/all-pages/lib/get-group-pages' import search from '@features/all-pages/lib/search' @@ -11,14 +9,14 @@ import LinksList from '@features/home/ui/organisms/links-list' import { menuModel } from '@entities/menu' import { peTeacherModel } from '@entities/pe-teacher' -import { userModel } from '@entities/user' +import { Groups, IRoutes } from '@shared/routing' +import { userModel } from '@shared/session' import { CenterPage } from '@shared/ui/atoms' import Flex from '@shared/ui/flex' +import { LocalSearch } from '@shared/ui/molecules' import PageBlock from '@shared/ui/page-block' -import { LocalSearch } from '@ui/molecules' - const AllPages = () => { const { visibleRoutes, allRoutes } = menuModel.selectors.useMenu() const [foundPages, setFoundPages] = useState(null) diff --git a/src/pages/all-staff/index.tsx b/src/pages/all-staff/index.tsx index bb2c77107..087608106 100644 --- a/src/pages/all-staff/index.tsx +++ b/src/pages/all-staff/index.tsx @@ -3,22 +3,20 @@ import { useHistory } from 'react-router' import { useUnit } from 'effector-react' -import { ALL_TEACHERS_ROUTE } from '@app/routes/general-routes' - import { Wrapper } from '@pages/pe-student/styled' -import SearchWithHints from '@features/search-with-hints' - import { phonebookModel } from '@entities/phonebook' import { getDivisions } from '@shared/api/teacher-api' -import useCurrentDevice from '@shared/lib/hooks/use-current-device' import useDebounce from '@shared/lib/hooks/use-debounce' import useQueryParams from '@shared/lib/hooks/use-query-params' +import { ALL_TEACHERS_ROUTE } from '@shared/routing' import { Loader } from '@shared/ui/atoms/loader' import Flex from '@shared/ui/flex' +import useCurrentDevice from '@shared/ui/hooks/use-current-device' import PageBlock from '@shared/ui/page-block' import Search, { Hint } from '@shared/ui/search' +import SearchWithHints from '@shared/ui/search-with-hints' import { Grid } from '../../shared/ui/grid' import { setSubdivisionPath } from './lib/set-subdivision-path' diff --git a/src/pages/all-staff/lib/set-subdivision-path.ts b/src/pages/all-staff/lib/set-subdivision-path.ts index fc8f7ad17..566a9b623 100644 --- a/src/pages/all-staff/lib/set-subdivision-path.ts +++ b/src/pages/all-staff/lib/set-subdivision-path.ts @@ -2,7 +2,7 @@ import { phonebookModel } from '@entities/phonebook' import { Subdivision } from '@shared/api/model/phonebook' -import { getSubdivisionPath } from './get-subdivision-path' +import { getSubdivisionPath } from '../../../features/all-staff/lib/get-subdivision-path' export const setSubdivisionPath = (subdivisions: Subdivision[], value: string) => { const searched = getSubdivisionPath(subdivisions, value) || null diff --git a/src/pages/all-staff/staff.tsx b/src/pages/all-staff/staff.tsx index f7ebfdb7e..06e267405 100644 --- a/src/pages/all-staff/staff.tsx +++ b/src/pages/all-staff/staff.tsx @@ -1,18 +1,18 @@ import React, { useMemo } from 'react' import { useUnit } from 'effector-react' -import { useModal } from 'widgets' import { phonebookModel } from '@entities/phonebook' import useQueryParams from '@shared/lib/hooks/use-query-params' +import { useModal } from '@shared/ui/modal' -import { findEmployeeByFio } from './lib/find-employee-by-fio' -import { getEmployeeInfo } from './lib/get-employee-info' -import { getSubdivisionInfo } from './lib/get-subdivision-info' -import { ScrollWrapper } from './styled' +import { findEmployeeByFio } from '../../features/all-staff/lib/find-employee-by-fio' +import { getEmployeeInfo } from '../../features/all-staff/lib/get-employee-info' +import { getSubdivisionInfo } from '../../features/all-staff/lib/get-subdivision-info' +import { ScrollWrapper } from '../../features/all-staff/styled' +import { PhonebookModal } from '../../features/all-staff/ui/phonebook-modal' import { SubdivisionItem } from './subdivision-item' -import { PhonebookModal } from './ui/phonebook-modal' export const Staff = () => { const query = useQueryParams() diff --git a/src/pages/all-staff/subdivision-item.tsx b/src/pages/all-staff/subdivision-item.tsx index a56314612..ba75fa6f6 100644 --- a/src/pages/all-staff/subdivision-item.tsx +++ b/src/pages/all-staff/subdivision-item.tsx @@ -2,11 +2,11 @@ import React from 'react' import { FiEyeOff } from 'react-icons/fi' import styled from 'styled-components' -import getImageSize from 'widgets/user/lib/get-image-size' -import Avatar from '@features/home/ui/molecules/avatar' +import getImageSize from '@features/user/lib/get-image-size' import { Employee, Subdivision } from '@shared/api/model/phonebook' +import Avatar from '@shared/ui/avatar' import { Error } from '@shared/ui/error' import Flex from '@shared/ui/flex' import Subtext from '@shared/ui/subtext' diff --git a/src/pages/all-staff/subdivisions.tsx b/src/pages/all-staff/subdivisions.tsx index f3046196d..21844ab69 100644 --- a/src/pages/all-staff/subdivisions.tsx +++ b/src/pages/all-staff/subdivisions.tsx @@ -4,8 +4,8 @@ import { useUnit } from 'effector-react' import { phonebookModel } from '@entities/phonebook' +import { ScrollWrapper } from '../../features/all-staff/styled' import { ExpandableItem } from './expandable-item' -import { ScrollWrapper } from './styled' export const Subdivisions = () => { const { subdivisions } = useUnit({ diff --git a/src/pages/all-students/index.tsx b/src/pages/all-students/index.tsx index 543443067..73d904ce0 100644 --- a/src/pages/all-students/index.tsx +++ b/src/pages/all-students/index.tsx @@ -3,18 +3,17 @@ import { useRouteMatch } from 'react-router' import { useStore } from 'effector-react' import styled from 'styled-components' -import ListOfPeople from 'widgets/list-of-people' -import { SelectPage } from '@features/select' +import ListOfPeople from '@features/list-of-people' import { paginationList } from '@entities/all-students' -import { userModel } from '@entities/user' import { getGroups } from '@shared/api/student-api' import Masks from '@shared/lib/masks' +import { userModel } from '@shared/session' +import { Wrapper } from '@shared/ui/atoms' import PageBlock from '@shared/ui/page-block' - -import { Wrapper } from '@ui/atoms' +import { SelectPage } from '@shared/ui/select' const PageWrapper = styled.div` width: 100%; diff --git a/src/pages/all-teachers/index.tsx b/src/pages/all-teachers/index.tsx index dc566249c..100bce640 100644 --- a/src/pages/all-teachers/index.tsx +++ b/src/pages/all-teachers/index.tsx @@ -3,20 +3,18 @@ import { useHistory, useRouteMatch } from 'react-router' import { useStore } from 'effector-react' import styled from 'styled-components' -import ListOfPeople from 'widgets/list-of-people' -import { ALL_STAFF_ROUTE } from '@app/routes/teacher-routes' - -import { SelectPage } from '@features/select' +import ListOfPeople from '@features/list-of-people' import { paginationList } from '@entities/all-teachers' -import { userModel } from '@entities/user' import { getDivisions } from '@shared/api/teacher-api' -import useCurrentDevice from '@shared/lib/hooks/use-current-device' +import { ALL_STAFF_ROUTE } from '@shared/routing' +import { userModel } from '@shared/session' +import { Wrapper } from '@shared/ui/atoms' +import useCurrentDevice from '@shared/ui/hooks/use-current-device' import PageBlock from '@shared/ui/page-block' - -import { Wrapper } from '@ui/atoms' +import { SelectPage } from '@shared/ui/select' const PageWrapper = styled.div` width: 100%; diff --git a/src/pages/allowances/lib/get-allowances-columns.tsx b/src/pages/allowances/lib/get-allowances-columns.tsx index aa6410864..d0340aae6 100644 --- a/src/pages/allowances/lib/get-allowances-columns.tsx +++ b/src/pages/allowances/lib/get-allowances-columns.tsx @@ -1,8 +1,7 @@ import React from 'react' -import { allowanceStatus } from '@entities/allowances/consts' -import { AllowanceFiles, AllowanceStatus } from '@entities/allowances/types' - +import { allowanceStatus } from '@shared/api/allowances/consts' +import { AllowanceFiles, AllowanceStatus } from '@shared/api/allowances/types' import { Message } from '@shared/ui/atoms' import { ColumnProps } from '@shared/ui/table/types' diff --git a/src/pages/allowances/pages/allowances.tsx b/src/pages/allowances/pages/allowances.tsx index 91214009b..71963fa1f 100644 --- a/src/pages/allowances/pages/allowances.tsx +++ b/src/pages/allowances/pages/allowances.tsx @@ -3,18 +3,19 @@ import { FiPlus } from 'react-icons/fi' import { useHistory, useParams } from 'react-router' import { useUnit } from 'effector-react' -import { SliderPage } from 'widgets' -import { ALLOWANCES, CREATE_ALLOWANCE } from '@app/routes/teacher-routes' +import SliderPage from '@features/slider-page' import { allowancesModel } from '@entities/allowances' +import { ALLOWANCES, CREATE_ALLOWANCE } from '@shared/routing' +import { userModel } from '@shared/session' import { Button, Loading, Message } from '@shared/ui/atoms' import Flex from '@shared/ui/flex' import PageBlock from '@shared/ui/page-block' +import { DevModeMessage } from '../../../features/test-database-message/test-database-message' import { Approver } from '../ui/approver' -import { DevModeMessage } from '../ui/dev-mode-message' import { AllowancesForbidden } from '../ui/forbidden' import { Initiator } from '../ui/initiator' @@ -26,9 +27,9 @@ const Allowances = () => { } const [pageMounted, loading, roles, jobRoles] = useUnit([ allowancesModel.events.pageMounted, - allowancesModel.stores.rolesPending, - allowancesModel.stores.roles, - allowancesModel.stores.jobRoles, + userModel.stores.rolesPending, + userModel.stores.roles, + userModel.stores.jobRoles, ]) const handleCreateApplication = () => { diff --git a/src/pages/allowances/pages/create-allowance.tsx b/src/pages/allowances/pages/create-allowance.tsx index f4aca76af..2f62ece56 100644 --- a/src/pages/allowances/pages/create-allowance.tsx +++ b/src/pages/allowances/pages/create-allowance.tsx @@ -4,22 +4,22 @@ import { useUnit } from 'effector-react' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import Select from '@features/select' - import { allowancesModel } from '@entities/allowances' -import { popUpMessageModel } from '@entities/pop-up-message' import getCorrectWordForm, { Rules } from '@shared/lib/get-correct-word-form' +import { userModel } from '@shared/session' import { Input, Loading, SubmitButton, TextArea } from '@shared/ui/atoms' import FormBlockWrapper from '@shared/ui/atoms/form-block' import Checkbox from '@shared/ui/checkbox' import FileInput from '@shared/ui/file-input' import Flex from '@shared/ui/flex' import { AreaTitle, InputAreaWrapper } from '@shared/ui/input-area/ui' +import { popUpMessageModel } from '@shared/ui/pop-up-message' import Search from '@shared/ui/search' +import Select from '@shared/ui/select' import Subtext from '@shared/ui/subtext' -import { DevModeMessage } from '../ui/dev-mode-message' +import { DevModeMessage } from '../../../features/test-database-message/test-database-message' import { EmployeeInput } from '../ui/employee-input' import { AllowancesForbidden } from '../ui/forbidden' @@ -36,15 +36,15 @@ const CreateAllowance = () => { jobRoles, errorMessage, ] = useUnit([ - allowancesModel.stores.rolesPending, + userModel.stores.rolesPending, allowancesModel.events.createSupplement, allowancesModel.stores.supplementCreating, allowancesModel.events.pageMounted, - allowancesModel.stores.roles, + userModel.stores.roles, allowancesModel.stores.completed, allowancesModel.events.setCompleted, allowancesModel.stores.isActive, - allowancesModel.stores.jobRoles, + userModel.stores.jobRoles, allowancesModel.stores.errorMessage, ]) @@ -98,7 +98,7 @@ const CreateAllowance = () => { function Job() { const { value, setValue } = useUnit(allowancesModel.fields.job) - const jobRoles = useUnit(allowancesModel.stores.jobRoles) + const jobRoles = useUnit(userModel.stores.jobRoles) if (!jobRoles) return null diff --git a/src/pages/allowances/pages/info.tsx b/src/pages/allowances/pages/info.tsx index 7a2e4bc36..212f9c486 100644 --- a/src/pages/allowances/pages/info.tsx +++ b/src/pages/allowances/pages/info.tsx @@ -2,11 +2,13 @@ import React, { useEffect } from 'react' import { useParams } from 'react-router' import { useUnit } from 'effector-react' -import { SliderPage } from 'widgets' + +import SliderPage from '@features/slider-page' import { allowancesModel } from '@entities/allowances' -import { AllowanceEmployee, AllowanceFiles, Role } from '@entities/allowances/types' +import { AllowanceEmployee, AllowanceFiles, Role } from '@shared/api/allowances/types' +import { userModel } from '@shared/session' import { Loader } from '@shared/ui/atoms/loader' import { Divider } from '@shared/ui/divider' import Flex from '@shared/ui/flex' @@ -15,7 +17,7 @@ import { Loading } from '@shared/ui/loading' import PageBlock from '@shared/ui/page-block' import { Title } from '@shared/ui/title' -import { DevModeMessage } from '../ui/dev-mode-message' +import { DevModeMessage } from '../../../features/test-database-message/test-database-message' import { Employee } from '../ui/employee' import { File } from '../ui/file' import { AllowancesForbidden } from '../ui/forbidden' @@ -28,8 +30,8 @@ const Info = () => { allowancesModel.stores.allowance.data, allowancesModel.stores.allowance.loading, allowancesModel.stores.allowance.error, - allowancesModel.stores.roles, - allowancesModel.stores.jobRoles, + userModel.stores.roles, + userModel.stores.jobRoles, allowancesModel.stores.allowance.role, allowancesModel.events.setCurrentRole, allowancesModel.stores.allowance.jobId, diff --git a/src/pages/allowances/ui/approver.tsx b/src/pages/allowances/ui/approver.tsx index f32e21ac6..7c7fe9dc6 100644 --- a/src/pages/allowances/ui/approver.tsx +++ b/src/pages/allowances/ui/approver.tsx @@ -3,13 +3,12 @@ import { useHistory } from 'react-router' import { useUnit } from 'effector-react' -import { ALLOWANCE_INFO_CUT } from '@app/routes/teacher-routes' - -import Select, { SelectPage } from '@features/select' - import { allowancesModel } from '@entities/allowances' +import { ALLOWANCE_INFO_CUT } from '@shared/routing' +import { userModel } from '@shared/session' import Flex from '@shared/ui/flex' +import Select, { SelectPage } from '@shared/ui/select' import Table from '@shared/ui/table' import { getAllowancesColumns } from '../lib/get-allowances-columns' @@ -18,7 +17,7 @@ export const Approver = () => { const history = useHistory() const [allowances, jobs, setRole, setJobId] = useUnit([ allowancesModel.stores.allowances, - allowancesModel.stores.jobRoles, + userModel.stores.jobRoles, allowancesModel.events.setCurrentRole, allowancesModel.events.setCurrentJobId, ]) diff --git a/src/pages/allowances/ui/employee-input.tsx b/src/pages/allowances/ui/employee-input.tsx index 9a496aae8..6e156ea1e 100644 --- a/src/pages/allowances/ui/employee-input.tsx +++ b/src/pages/allowances/ui/employee-input.tsx @@ -3,8 +3,8 @@ import React from 'react' import { useUnit } from 'effector-react' import { allowancesModel } from '@entities/allowances' -import { Subordnate } from '@entities/allowances/types' +import { Subordnate } from '@shared/api/allowances/types' import Checkbox from '@shared/ui/checkbox' import Flex from '@shared/ui/flex' import Input from '@shared/ui/input' diff --git a/src/pages/allowances/ui/employee.tsx b/src/pages/allowances/ui/employee.tsx index 2acfa95a6..6bd1388e2 100644 --- a/src/pages/allowances/ui/employee.tsx +++ b/src/pages/allowances/ui/employee.tsx @@ -4,10 +4,10 @@ import { useUnit } from 'effector-react' import styled from 'styled-components' import { allowancesModel } from '@entities/allowances' -import { approvalStatus, orderStatus } from '@entities/allowances/consts' import { getStatusType } from '@entities/allowances/lib/get-status' -import { AllowanceEmployee, Role } from '@entities/allowances/types' +import { approvalStatus, orderStatus } from '@shared/api/allowances/consts' +import { AllowanceEmployee, Role } from '@shared/api/allowances/types' import localizeDate from '@shared/lib/dates/localize-date' import { Button, Message } from '@shared/ui/atoms' import Flex from '@shared/ui/flex' diff --git a/src/pages/allowances/ui/file.tsx b/src/pages/allowances/ui/file.tsx index 713ca095f..d61b0ae9d 100644 --- a/src/pages/allowances/ui/file.tsx +++ b/src/pages/allowances/ui/file.tsx @@ -1,14 +1,13 @@ import React, { useState } from 'react' import { FcFile, FcLandscape } from 'react-icons/fc' -import { AttachedFile } from '@entities/allowances/types' -import { popUpMessageModel } from '@entities/pop-up-message' -import { getJwtToken } from '@entities/user/lib/jwt-token' - +import { AttachedFile } from '@shared/api/allowances/types' import { ALLOWANCES_URL } from '@shared/api/config/allowances-config' +import { getJwtToken } from '@shared/api/session/jwt-token' import getFileSize from '@shared/lib/get-file-size' import FileWrapper from '@shared/ui/file-input/ui/list-of-files/ui/file/style' import { Loading } from '@shared/ui/loading' +import { popUpMessageModel } from '@shared/ui/pop-up-message' import Subtext from '@shared/ui/subtext' export const File = ({ file }: { file: AttachedFile }) => { diff --git a/src/pages/allowances/ui/forbidden.tsx b/src/pages/allowances/ui/forbidden.tsx index e53aff5d5..781c422c4 100644 --- a/src/pages/allowances/ui/forbidden.tsx +++ b/src/pages/allowances/ui/forbidden.tsx @@ -2,7 +2,7 @@ import React from 'react' import { getAllowancesErrorCode } from '@entities/allowances/lib/get-error-code' -import { JobRoles } from '@shared/api/allowances-api' +import { JobRoles } from '@shared/api/allowances/allowances-api' import { Forbidden } from '@shared/ui/forbidden' export const AllowancesForbidden = ({ jobRoles }: { jobRoles: JobRoles | null }) => { diff --git a/src/pages/allowances/ui/initiator.tsx b/src/pages/allowances/ui/initiator.tsx index f52543ee1..fe91335f7 100644 --- a/src/pages/allowances/ui/initiator.tsx +++ b/src/pages/allowances/ui/initiator.tsx @@ -3,13 +3,12 @@ import { useHistory } from 'react-router' import { useUnit } from 'effector-react' -import { ALLOWANCE_INFO_CUT } from '@app/routes/teacher-routes' - -import Select, { SelectPage } from '@features/select' - import { allowancesModel } from '@entities/allowances' +import { ALLOWANCE_INFO_CUT } from '@shared/routing' +import { userModel } from '@shared/session' import Flex from '@shared/ui/flex' +import Select, { SelectPage } from '@shared/ui/select' import Table from '@shared/ui/table' import { getAllowancesColumns } from '../lib/get-allowances-columns' @@ -18,7 +17,7 @@ export const Initiator = () => { const history = useHistory() const [allowances, jobs, setRole, setJobId] = useUnit([ allowancesModel.stores.allowances, - allowancesModel.stores.jobRoles, + userModel.stores.jobRoles, allowancesModel.events.setCurrentRole, allowancesModel.events.setCurrentJobId, ]) diff --git a/src/pages/application-for-superior-room/index.tsx b/src/pages/application-for-superior-room/index.tsx index ba66b697c..854a3de63 100644 --- a/src/pages/application-for-superior-room/index.tsx +++ b/src/pages/application-for-superior-room/index.tsx @@ -3,18 +3,16 @@ import { FiInfo } from 'react-icons/fi' import styled from 'styled-components' -import { SelectPage } from '@features/select' +import checkFormFields from '@features/send-form/check-form-fields' import { superiorRoomModel } from '@entities/superior-room' -import { userModel } from '@entities/user' -import { isProduction } from '@shared/constants' - -import { Error, FormBlock, Message, SubmitButton, Wrapper } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea, IInputAreaData } from '@ui/input-area/model' - -import checkFormFields from '@utils/check-form-fields' +import { isProduction } from '@shared/consts' +import { userModel } from '@shared/session' +import { Error, FormBlock, Message, SubmitButton, Wrapper } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { SelectPage } from '@shared/ui/select' import getForm from './lib/get-form' import { getStatusFormSuperiorRoom } from './lib/get-status' diff --git a/src/pages/application-for-superior-room/lib/get-form.tsx b/src/pages/application-for-superior-room/lib/get-form.tsx index ef27389e5..464e3815a 100644 --- a/src/pages/application-for-superior-room/lib/get-form.tsx +++ b/src/pages/application-for-superior-room/lib/get-form.tsx @@ -1,10 +1,8 @@ import React from 'react' -import { SuperiorRoom } from '@api/model' - -import { SelectPage } from '@features/select' - -import { CheckboxDocs, IInputArea, IInputAreaData } from '@ui/input-area/model' +import { SuperiorRoom } from '@shared/api/model' +import { CheckboxDocs, IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { SelectPage } from '@shared/ui/select' import { superiorRoomAlert } from './get-status' diff --git a/src/pages/application-for-superior-room/lib/get-status.ts b/src/pages/application-for-superior-room/lib/get-status.ts index a578e56a9..baf5f6a31 100644 --- a/src/pages/application-for-superior-room/lib/get-status.ts +++ b/src/pages/application-for-superior-room/lib/get-status.ts @@ -1,7 +1,5 @@ -import { User } from '@api/model' - -export const StartDateSuperiorRoom = 'Jun 26 2024 12:00:00 GMT+0300' -export const EndDateSuperiorRoom = 'Jun 28 2024 12:00:00 GMT+0300' +import { User } from '@shared/api/model' +import { EndDateSuperiorRoom, StartDateSuperiorRoom } from '@shared/routing/routes/student' export const superiorRoomAlert = 'Подача заявок открыта с 12:00 26 июня до 12:00 28 июня!' diff --git a/src/pages/application-for-superior-room/lib/send-form.ts b/src/pages/application-for-superior-room/lib/send-form.ts index d5ae80310..335c09936 100644 --- a/src/pages/application-for-superior-room/lib/send-form.ts +++ b/src/pages/application-for-superior-room/lib/send-form.ts @@ -1,11 +1,9 @@ -import { superiorRoomApi } from '@api' -import { IndexedProperties } from '@utility-types/indexed-properties' +import prepareFormData from '@features/send-form/prepare-form-data' -import { popUpMessageModel } from '@entities/pop-up-message' - -import { IInputArea } from '@ui/input-area/model' - -import prepareFormData from '@utils/prepare-form-data' +import { superiorRoomApi } from '@shared/api' +import { IndexedProperties } from '@shared/consts/models/indexed-properties' +import { IInputArea } from '@shared/ui/input-area/model' +import { popUpMessageModel } from '@shared/ui/pop-up-message' const sendForm = ( form: IInputArea, diff --git a/src/pages/applications/index.tsx b/src/pages/applications/index.tsx index 1c662c5e1..de527449a 100644 --- a/src/pages/applications/index.tsx +++ b/src/pages/applications/index.tsx @@ -1,6 +1,6 @@ import React from 'react' -import { TemplateApplications } from 'widgets' +import TemplateApplications from '@widgets/template-applications' const ApplicationsPage = () => { return diff --git a/src/pages/applications/lib/get-additionally.ts b/src/pages/applications/lib/get-additionally.ts index f9e5af14c..b5395adbd 100644 --- a/src/pages/applications/lib/get-additionally.ts +++ b/src/pages/applications/lib/get-additionally.ts @@ -1,4 +1,4 @@ -import { IInputArea } from '@ui/input-area/model' +import { IInputArea } from '@shared/ui/input-area/model' const getAdditionally = (): IInputArea => { return { diff --git a/src/pages/applications/lib/get-disability.ts b/src/pages/applications/lib/get-disability.ts index c967ece34..bf2ce105c 100644 --- a/src/pages/applications/lib/get-disability.ts +++ b/src/pages/applications/lib/get-disability.ts @@ -1,4 +1,4 @@ -import { IInputArea } from '@ui/input-area/model' +import { IInputArea } from '@shared/ui/input-area/model' const getDisability = (): IInputArea => { return { diff --git a/src/pages/applications/lib/get-registration.ts b/src/pages/applications/lib/get-registration.ts index 653b073f8..f69363b5d 100644 --- a/src/pages/applications/lib/get-registration.ts +++ b/src/pages/applications/lib/get-registration.ts @@ -1,4 +1,4 @@ -import { IInputArea } from '@ui/input-area/model' +import { IInputArea } from '@shared/ui/input-area/model' const getRegistration = (): IInputArea => { return { diff --git a/src/pages/applications/lib/get-student-subdivisions.ts b/src/pages/applications/lib/get-student-subdivisions.ts index 921d63f6d..ac31b7d47 100644 --- a/src/pages/applications/lib/get-student-subdivisions.ts +++ b/src/pages/applications/lib/get-student-subdivisions.ts @@ -1,8 +1,7 @@ -import { UserApplication } from '@api/model' - import { getFormattedDivisions } from '@features/applications/lib/get-divisions' -import { IInputAreaData } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputAreaData } from '@shared/ui/input-area/model' const getStudentSubdivisions = ({ divisions_crs }: UserApplication): IInputAreaData[] => { return [ diff --git a/src/pages/applications/lib/global-app-send-form.ts b/src/pages/applications/lib/global-app-send-form.ts index 9e6c9eb9e..1dcd31a48 100644 --- a/src/pages/applications/lib/global-app-send-form.ts +++ b/src/pages/applications/lib/global-app-send-form.ts @@ -1,8 +1,7 @@ -import { ApplicationFormCodes, ApplicationTeachersFormCodes } from '@utility-types/application-form-codes' - import { applicationsModel } from '@entities/applications' -import { IInputArea } from '@ui/input-area/model' +import { ApplicationFormCodes, ApplicationTeachersFormCodes } from '@shared/consts/models/application-form-codes' +import { IInputArea } from '@shared/ui/input-area/model' import { globalPrepareFormData } from './prepare-form-data' diff --git a/src/pages/applications/lib/prepare-form-data.ts b/src/pages/applications/lib/prepare-form-data.ts index 65efa1af6..bfc94c5dd 100644 --- a/src/pages/applications/lib/prepare-form-data.ts +++ b/src/pages/applications/lib/prepare-form-data.ts @@ -1,9 +1,9 @@ -import { SelectPage } from '@features/select' +import prepareFormData from '@features/send-form/prepare-form-data' -import prepareFormData from '@shared/lib/prepare-form-data' -import { ApplicationFormCodes, ApplicationTeachersFormCodes } from '@shared/models/application-form-codes' -import { IndexedProperties } from '@shared/models/indexed-properties' +import { ApplicationFormCodes, ApplicationTeachersFormCodes } from '@shared/consts/models/application-form-codes' +import { IndexedProperties } from '@shared/consts/models/indexed-properties' import { CheckboxDocs, IComplexInputAreaData, IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { SelectPage } from '@shared/ui/select' export const globalPrepareFormData = ( formId: ApplicationFormCodes | ApplicationTeachersFormCodes, diff --git a/src/pages/applications/pages/campus-management/academic-leave-accommodation/index.tsx b/src/pages/applications/pages/campus-management/academic-leave-accommodation/index.tsx index 09cfaf60e..a1203a545 100644 --- a/src/pages/applications/pages/campus-management/academic-leave-accommodation/index.tsx +++ b/src/pages/applications/pages/campus-management/academic-leave-accommodation/index.tsx @@ -1,19 +1,17 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' import { listConfigCert } from '@features/applications/lib/get-list-configs-certificate' import StepByStepForm, { StagesConfigsT } from '@features/applications/ui/molecules/step-by-step-form' +import checkFormFields from '@features/send-form/check-form-fields' import { applicationsModel } from '@entities/applications' -import { FormBlock, SubmitButton, Title } from '@ui/atoms' -import { IInputArea } from '@ui/input-area/model' - -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton, Title } from '@shared/ui/atoms' +import { IInputArea } from '@shared/ui/input-area/model' import { CampusError } from '../ui/error' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/campus-management/academic-leave-accommodation/lib/get-form.tsx b/src/pages/applications/pages/campus-management/academic-leave-accommodation/lib/get-form.tsx index f15b2d58b..cab2843c5 100644 --- a/src/pages/applications/pages/campus-management/academic-leave-accommodation/lib/get-form.tsx +++ b/src/pages/applications/pages/campus-management/academic-leave-accommodation/lib/get-form.tsx @@ -1,8 +1,7 @@ import React from 'react' -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const getForm = (dataUserApplication: UserApplication): IInputArea => { const { surname, name, patronymic, group, email, phone } = dataUserApplication diff --git a/src/pages/applications/pages/campus-management/accommodation-correspondence-form/index.tsx b/src/pages/applications/pages/campus-management/accommodation-correspondence-form/index.tsx index 1e099e712..29d372794 100644 --- a/src/pages/applications/pages/campus-management/accommodation-correspondence-form/index.tsx +++ b/src/pages/applications/pages/campus-management/accommodation-correspondence-form/index.tsx @@ -1,20 +1,18 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { getAdditionally, getDisability, getRegistration, globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' import { listConfigCert } from '@features/applications/lib/get-list-configs-certificate' import StepByStepForm, { StagesConfigsT } from '@features/applications/ui/molecules/step-by-step-form' +import checkFormFields from '@features/send-form/check-form-fields' import { applicationsModel } from '@entities/applications' -import { userModel } from '@entities/user' - -import { Error, FormBlock, SubmitButton, Title } from '@ui/atoms' -import { IInputArea } from '@ui/input-area/model' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { userModel } from '@shared/session' +import { Error, FormBlock, SubmitButton, Title } from '@shared/ui/atoms' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/campus-management/accommodation-correspondence-form/lib/get-form.ts b/src/pages/applications/pages/campus-management/accommodation-correspondence-form/lib/get-form.ts index abe78b1f8..3128ceb90 100644 --- a/src/pages/applications/pages/campus-management/accommodation-correspondence-form/lib/get-form.ts +++ b/src/pages/applications/pages/campus-management/accommodation-correspondence-form/lib/get-form.ts @@ -1,6 +1,5 @@ -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const reasonItems = [ { diff --git a/src/pages/applications/pages/campus-management/accommodation-for-graduates/index.tsx b/src/pages/applications/pages/campus-management/accommodation-for-graduates/index.tsx index a3654ece4..cab383fd8 100644 --- a/src/pages/applications/pages/campus-management/accommodation-for-graduates/index.tsx +++ b/src/pages/applications/pages/campus-management/accommodation-for-graduates/index.tsx @@ -1,25 +1,28 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' +import { useUnit } from 'effector-react' import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' +import PageIsNotReady from '@pages/page-is-not-ready' -import { applicationsModel } from '@entities/applications' - -import { isProduction } from '@shared/constants' +import checkFormFields from '@features/send-form/check-form-fields' -import { Error, FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { isProduction } from '@shared/consts' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { userModel } from '@shared/session' +import { Error, FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' type LoadedState = React.Dispatch> const AccommodationForGraduatesPage = () => { + const user = useUnit(userModel.stores.user) const [form, setForm] = useState(null) const { data: { dataUserApplication }, @@ -34,6 +37,18 @@ const AccommodationForGraduatesPage = () => { } }, [dataUserApplication]) + if ( + !['4', '5', '6'].includes(user?.course ?? '') && + !user?.status?.toLocaleLowerCase()?.includes('окончил') && + !(user?.degreeLevel?.toLocaleLowerCase() === 'магистратура' && user?.course === '2') + ) + return ( + + ) + if (isProduction && new Date() > new Date('2024 Aug 08')) return return ( diff --git a/src/pages/applications/pages/campus-management/accommodation-for-graduates/lib/get-form.tsx b/src/pages/applications/pages/campus-management/accommodation-for-graduates/lib/get-form.tsx index 1f734a203..03b1eedb6 100644 --- a/src/pages/applications/pages/campus-management/accommodation-for-graduates/lib/get-form.tsx +++ b/src/pages/applications/pages/campus-management/accommodation-for-graduates/lib/get-form.tsx @@ -1,10 +1,9 @@ import React from 'react' -import { UserApplication } from '@api/model' - import listHostelsOptions from '@features/applications/lib/get-list-hostels' -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const statusesStudentForHostelOptions = [ { diff --git a/src/pages/applications/pages/campus-management/family-room/index.tsx b/src/pages/applications/pages/campus-management/family-room/index.tsx index abfaf3916..7b43f643b 100644 --- a/src/pages/applications/pages/campus-management/family-room/index.tsx +++ b/src/pages/applications/pages/campus-management/family-room/index.tsx @@ -1,7 +1,5 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { getAdditionally, globalAppSendForm } from '@pages/applications/lib' import getBirthCertificate from '@pages/applications/pages/campus-management/family-room/lib/get-birth-certificate' import getConsentToProcessingPersonalData from '@pages/applications/pages/campus-management/family-room/lib/get-consent-to-processing-personal-data' @@ -12,13 +10,13 @@ import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrap import { listConfigCert } from '@features/applications/lib/get-list-configs-certificate' import StepByStepForm, { StagesConfigsT } from '@features/applications/ui/molecules/step-by-step-form' +import checkFormFields from '@features/send-form/check-form-fields' import { applicationsModel } from '@entities/applications' -import { FormBlock, SubmitButton, Title } from '@ui/atoms' -import { IInputArea } from '@ui/input-area/model' - -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton, Title } from '@shared/ui/atoms' +import { IInputArea } from '@shared/ui/input-area/model' import { CampusError } from '../ui/error' import getFamily from './lib/get-family' diff --git a/src/pages/applications/pages/campus-management/family-room/lib/get-birth-certificate.ts b/src/pages/applications/pages/campus-management/family-room/lib/get-birth-certificate.ts index e8d7f58c8..459e0b42c 100644 --- a/src/pages/applications/pages/campus-management/family-room/lib/get-birth-certificate.ts +++ b/src/pages/applications/pages/campus-management/family-room/lib/get-birth-certificate.ts @@ -1,4 +1,4 @@ -import { IInputArea } from '@ui/input-area/model' +import { IInputArea } from '@shared/ui/input-area/model' const getBirthCertificate = (): IInputArea => { return { diff --git a/src/pages/applications/pages/campus-management/family-room/lib/get-consent-to-processing-personal-data.ts b/src/pages/applications/pages/campus-management/family-room/lib/get-consent-to-processing-personal-data.ts index 1eac5a096..e3a674d95 100644 --- a/src/pages/applications/pages/campus-management/family-room/lib/get-consent-to-processing-personal-data.ts +++ b/src/pages/applications/pages/campus-management/family-room/lib/get-consent-to-processing-personal-data.ts @@ -1,4 +1,4 @@ -import { IInputArea } from '@ui/input-area/model' +import { IInputArea } from '@shared/ui/input-area/model' const getConsentToProcessingPersonalData = (): IInputArea => { return { diff --git a/src/pages/applications/pages/campus-management/family-room/lib/get-family.ts b/src/pages/applications/pages/campus-management/family-room/lib/get-family.ts index d2a04c014..abbf534f6 100644 --- a/src/pages/applications/pages/campus-management/family-room/lib/get-family.ts +++ b/src/pages/applications/pages/campus-management/family-room/lib/get-family.ts @@ -1,4 +1,4 @@ -import { IInputArea } from '@ui/input-area/model' +import { IInputArea } from '@shared/ui/input-area/model' const familyType = [ { id: 'wife', title: 'Жена' }, diff --git a/src/pages/applications/pages/campus-management/family-room/lib/get-form.ts b/src/pages/applications/pages/campus-management/family-room/lib/get-form.ts index 2d480831a..3d716fe99 100644 --- a/src/pages/applications/pages/campus-management/family-room/lib/get-form.ts +++ b/src/pages/applications/pages/campus-management/family-room/lib/get-form.ts @@ -1,6 +1,5 @@ -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const getForm = (dataUserApplication: UserApplication): IInputArea => { const { surname, name, patronymic, group, email, phone } = dataUserApplication diff --git a/src/pages/applications/pages/campus-management/family-room/lib/get-marriage-registration-certificate.ts b/src/pages/applications/pages/campus-management/family-room/lib/get-marriage-registration-certificate.ts index 928ff576f..9e23fdd30 100644 --- a/src/pages/applications/pages/campus-management/family-room/lib/get-marriage-registration-certificate.ts +++ b/src/pages/applications/pages/campus-management/family-room/lib/get-marriage-registration-certificate.ts @@ -1,4 +1,4 @@ -import { IInputArea } from '@ui/input-area/model' +import { IInputArea } from '@shared/ui/input-area/model' const getMarriageRegistrationCertificate = (): IInputArea => { return { diff --git a/src/pages/applications/pages/campus-management/family-room/lib/get-registration-doc.ts b/src/pages/applications/pages/campus-management/family-room/lib/get-registration-doc.ts index 7763f8a84..f5a567f4a 100644 --- a/src/pages/applications/pages/campus-management/family-room/lib/get-registration-doc.ts +++ b/src/pages/applications/pages/campus-management/family-room/lib/get-registration-doc.ts @@ -1,4 +1,4 @@ -import { IInputArea } from '@ui/input-area/model' +import { IInputArea } from '@shared/ui/input-area/model' const getRegistrationDoc = (): IInputArea => { return { diff --git a/src/pages/applications/pages/campus-management/family-room/lib/get-registration-family-members.ts b/src/pages/applications/pages/campus-management/family-room/lib/get-registration-family-members.ts index 14c4a3da4..dda389ca9 100644 --- a/src/pages/applications/pages/campus-management/family-room/lib/get-registration-family-members.ts +++ b/src/pages/applications/pages/campus-management/family-room/lib/get-registration-family-members.ts @@ -1,4 +1,4 @@ -import { IInputArea } from '@ui/input-area/model' +import { IInputArea } from '@shared/ui/input-area/model' const getRegistrationFamilyMembers = (): IInputArea => { return { diff --git a/src/pages/applications/pages/campus-management/full-time-part-time-form/index.tsx b/src/pages/applications/pages/campus-management/full-time-part-time-form/index.tsx index d94d2e797..772aa24de 100644 --- a/src/pages/applications/pages/campus-management/full-time-part-time-form/index.tsx +++ b/src/pages/applications/pages/campus-management/full-time-part-time-form/index.tsx @@ -1,20 +1,18 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { getAdditionally, getDisability, getRegistration, globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' import { listConfigCert } from '@features/applications/lib/get-list-configs-certificate' import StepByStepForm, { StagesConfigsT } from '@features/applications/ui/molecules/step-by-step-form' +import checkFormFields from '@features/send-form/check-form-fields' import { applicationsModel } from '@entities/applications' -import { userModel } from '@entities/user' - -import { Error, FormBlock, SubmitButton, Title } from '@ui/atoms' -import { IInputArea } from '@ui/input-area/model' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { userModel } from '@shared/session' +import { Error, FormBlock, SubmitButton, Title } from '@shared/ui/atoms' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/campus-management/full-time-part-time-form/lib/get-form.ts b/src/pages/applications/pages/campus-management/full-time-part-time-form/lib/get-form.ts index 710566749..3715f7f86 100644 --- a/src/pages/applications/pages/campus-management/full-time-part-time-form/lib/get-form.ts +++ b/src/pages/applications/pages/campus-management/full-time-part-time-form/lib/get-form.ts @@ -1,8 +1,7 @@ -import { UserApplication } from '@api/model' - import listHostelsOptions from '@features/applications/lib/get-list-hostels' -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const reasonItems = [ { diff --git a/src/pages/applications/pages/campus-management/preferential-accommodation/index.tsx b/src/pages/applications/pages/campus-management/preferential-accommodation/index.tsx index 60517d07b..08888e41d 100644 --- a/src/pages/applications/pages/campus-management/preferential-accommodation/index.tsx +++ b/src/pages/applications/pages/campus-management/preferential-accommodation/index.tsx @@ -1,19 +1,17 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { getDisability, getRegistration, globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' import { listConfigCert } from '@features/applications/lib/get-list-configs-certificate' import StepByStepForm from '@features/applications/ui/molecules/step-by-step-form' +import checkFormFields from '@features/send-form/check-form-fields' import { applicationsModel } from '@entities/applications' -import { FormBlock, SubmitButton, Title } from '@ui/atoms' -import { IInputArea } from '@ui/input-area/model' - -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton, Title } from '@shared/ui/atoms' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/campus-management/preferential-accommodation/lib/get-form.ts b/src/pages/applications/pages/campus-management/preferential-accommodation/lib/get-form.ts index ead82966d..4babaa495 100644 --- a/src/pages/applications/pages/campus-management/preferential-accommodation/lib/get-form.ts +++ b/src/pages/applications/pages/campus-management/preferential-accommodation/lib/get-form.ts @@ -1,6 +1,5 @@ -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const itemsCategory = [ { diff --git a/src/pages/applications/pages/campus-management/regular-accommodation/index.tsx b/src/pages/applications/pages/campus-management/regular-accommodation/index.tsx index 220544d4b..069a422e9 100644 --- a/src/pages/applications/pages/campus-management/regular-accommodation/index.tsx +++ b/src/pages/applications/pages/campus-management/regular-accommodation/index.tsx @@ -1,20 +1,18 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { getAdditionally, getDisability, getRegistration, globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' import { listConfigCert } from '@features/applications/lib/get-list-configs-certificate' import StepByStepForm, { StagesConfigsT } from '@features/applications/ui/molecules/step-by-step-form' +import checkFormFields from '@features/send-form/check-form-fields' import { applicationsModel } from '@entities/applications' -import { userModel } from '@entities/user' - -import { Error, FormBlock, SubmitButton, Title } from '@ui/atoms' -import { IInputArea } from '@ui/input-area/model' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { userModel } from '@shared/session' +import { Error, FormBlock, SubmitButton, Title } from '@shared/ui/atoms' +import { IInputArea } from '@shared/ui/input-area/model' import { CampusError } from '../ui/error' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/campus-management/regular-accommodation/lib/get-form.ts b/src/pages/applications/pages/campus-management/regular-accommodation/lib/get-form.ts index d8ee8f6c3..fe4792ec5 100644 --- a/src/pages/applications/pages/campus-management/regular-accommodation/lib/get-form.ts +++ b/src/pages/applications/pages/campus-management/regular-accommodation/lib/get-form.ts @@ -1,8 +1,7 @@ -import { UserApplication } from '@api/model' - import listHostelsOptions from '@features/applications/lib/get-list-hostels' -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const reasonItems = [ { diff --git a/src/pages/applications/pages/campus-management/relocation-inside-hostel/index.tsx b/src/pages/applications/pages/campus-management/relocation-inside-hostel/index.tsx index c25ba1eab..b42296361 100644 --- a/src/pages/applications/pages/campus-management/relocation-inside-hostel/index.tsx +++ b/src/pages/applications/pages/campus-management/relocation-inside-hostel/index.tsx @@ -1,17 +1,16 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' import { CampusError } from '../ui/error' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/campus-management/relocation-inside-hostel/lib/get-form.ts b/src/pages/applications/pages/campus-management/relocation-inside-hostel/lib/get-form.ts index 5ac32fc65..db89a9748 100644 --- a/src/pages/applications/pages/campus-management/relocation-inside-hostel/lib/get-form.ts +++ b/src/pages/applications/pages/campus-management/relocation-inside-hostel/lib/get-form.ts @@ -1,6 +1,5 @@ -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const getForm = (dataUserApplication: UserApplication): IInputArea => { const { surname, name, patronymic, group, email, phone } = dataUserApplication diff --git a/src/pages/applications/pages/campus-management/relocation-to-another-hostel/index.tsx b/src/pages/applications/pages/campus-management/relocation-to-another-hostel/index.tsx index 1bd654af0..e0660188f 100644 --- a/src/pages/applications/pages/campus-management/relocation-to-another-hostel/index.tsx +++ b/src/pages/applications/pages/campus-management/relocation-to-another-hostel/index.tsx @@ -1,17 +1,16 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' import { CampusError } from '../ui/error' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/campus-management/relocation-to-another-hostel/lib/get-form.ts b/src/pages/applications/pages/campus-management/relocation-to-another-hostel/lib/get-form.ts index 98f8847a9..ab0511efd 100644 --- a/src/pages/applications/pages/campus-management/relocation-to-another-hostel/lib/get-form.ts +++ b/src/pages/applications/pages/campus-management/relocation-to-another-hostel/lib/get-form.ts @@ -1,8 +1,7 @@ -import { UserApplication } from '@api/model' - import listHostelsOptions from '@features/applications/lib/get-list-hostels' -import { CheckboxDocs, IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { CheckboxDocs, IInputArea } from '@shared/ui/input-area/model' const extracurricularActivities: CheckboxDocs[] = [ { diff --git a/src/pages/applications/pages/campus-management/termination-of-employment-contract/index.tsx b/src/pages/applications/pages/campus-management/termination-of-employment-contract/index.tsx index bbbaab854..f9ffbb913 100644 --- a/src/pages/applications/pages/campus-management/termination-of-employment-contract/index.tsx +++ b/src/pages/applications/pages/campus-management/termination-of-employment-contract/index.tsx @@ -1,17 +1,16 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/campus-management/termination-of-employment-contract/lib/get-form.ts b/src/pages/applications/pages/campus-management/termination-of-employment-contract/lib/get-form.ts index bd3aaf122..8cfa57dcf 100644 --- a/src/pages/applications/pages/campus-management/termination-of-employment-contract/lib/get-form.ts +++ b/src/pages/applications/pages/campus-management/termination-of-employment-contract/lib/get-form.ts @@ -1,6 +1,5 @@ -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const getForm = (dataUserApplication: UserApplication): IInputArea => { const { surname, name, patronymic, group, email, phone } = dataUserApplication diff --git a/src/pages/applications/pages/department-of-paid-services/paymnet-recipient/index.tsx b/src/pages/applications/pages/department-of-paid-services/paymnet-recipient/index.tsx index 936493ff0..a67b83a2d 100644 --- a/src/pages/applications/pages/department-of-paid-services/paymnet-recipient/index.tsx +++ b/src/pages/applications/pages/department-of-paid-services/paymnet-recipient/index.tsx @@ -2,12 +2,12 @@ import React, { useEffect, useState } from 'react' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, Message, SubmitButton } from '@ui/atoms' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { FormBlock, Message, SubmitButton } from '@shared/ui/atoms' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/department-of-paid-services/paymnet-recipient/lib/get-form.ts b/src/pages/applications/pages/department-of-paid-services/paymnet-recipient/lib/get-form.ts index ae8554935..70198ca02 100644 --- a/src/pages/applications/pages/department-of-paid-services/paymnet-recipient/lib/get-form.ts +++ b/src/pages/applications/pages/department-of-paid-services/paymnet-recipient/lib/get-form.ts @@ -1,4 +1,4 @@ -import { IInputArea } from '@ui/input-area/model' +import { IInputArea } from '@shared/ui/input-area/model' const getForm = (): IInputArea => { return { diff --git a/src/pages/applications/pages/mobilization-department/military-copies/index.tsx b/src/pages/applications/pages/mobilization-department/military-copies/index.tsx index 42659aba3..7f20d7f78 100644 --- a/src/pages/applications/pages/mobilization-department/military-copies/index.tsx +++ b/src/pages/applications/pages/mobilization-department/military-copies/index.tsx @@ -1,17 +1,17 @@ import React, { useEffect, useState } from 'react' -import { LoadedState } from 'widgets/template-form' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' +import checkFormFields from '@features/send-form/check-form-fields' + import { applicationsModel } from '@entities/applications' -import checkFormFields from '@shared/lib/check-form-fields' -import { ApplicationFormCodes } from '@shared/models/application-form-codes' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' import { FormBlock, SubmitButton } from '@shared/ui/atoms' import InputArea from '@shared/ui/input-area' import { IInputArea } from '@shared/ui/input-area/model' +import { LoadedState } from '@shared/ui/input-area/types' import { getForm } from './lib/form' diff --git a/src/pages/applications/pages/mobilization-department/military-form-4/index.tsx b/src/pages/applications/pages/mobilization-department/military-form-4/index.tsx index d8d89842f..4cd5a294f 100644 --- a/src/pages/applications/pages/mobilization-department/military-form-4/index.tsx +++ b/src/pages/applications/pages/mobilization-department/military-form-4/index.tsx @@ -1,20 +1,19 @@ import React, { useEffect, useState } from 'react' -import { LoadedState } from 'widgets/template-form' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import getMethodObtaining from '@features/applications/lib/get-method-obstaing' +import checkFormFields from '@features/send-form/check-form-fields' import { applicationsModel } from '@entities/applications' -import { SpecialFieldsNameConfig } from '@entities/applications/consts' +import getMethodObtaining from '@entities/applications/lib/get-method-obstaing' -import checkFormFields from '@shared/lib/check-form-fields' -import { ApplicationFormCodes } from '@shared/models/application-form-codes' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' import { FormBlock, SubmitButton } from '@shared/ui/atoms' import InputArea from '@shared/ui/input-area' import { IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsNameConfig } from '@shared/ui/input-area/types' +import { LoadedState } from '@shared/ui/input-area/types' import getReasonForReceiving from '../../multifunctional-center/certificate-of-attendance/lib/get-reason-for-receiving' import { getForm } from './lib/form' diff --git a/src/pages/applications/pages/mobilization-department/military-form-5/index.tsx b/src/pages/applications/pages/mobilization-department/military-form-5/index.tsx index 06979f7bb..2d956c780 100644 --- a/src/pages/applications/pages/mobilization-department/military-form-5/index.tsx +++ b/src/pages/applications/pages/mobilization-department/military-form-5/index.tsx @@ -1,20 +1,19 @@ import React, { useEffect, useState } from 'react' -import { LoadedState } from 'widgets/template-form' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import getMethodObtaining from '@features/applications/lib/get-method-obstaing' +import checkFormFields from '@features/send-form/check-form-fields' import { applicationsModel } from '@entities/applications' -import { SpecialFieldsNameConfig } from '@entities/applications/consts' +import getMethodObtaining from '@entities/applications/lib/get-method-obstaing' -import checkFormFields from '@shared/lib/check-form-fields' -import { ApplicationFormCodes } from '@shared/models/application-form-codes' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' import { FormBlock, SubmitButton } from '@shared/ui/atoms' import InputArea from '@shared/ui/input-area' import { IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsNameConfig } from '@shared/ui/input-area/types' +import { LoadedState } from '@shared/ui/input-area/types' import getReasonForReceiving from '../../multifunctional-center/certificate-of-attendance/lib/get-reason-for-receiving' import { getForm } from './lib/form' diff --git a/src/pages/applications/pages/mobilization-department/military-registration-documents/index.tsx b/src/pages/applications/pages/mobilization-department/military-registration-documents/index.tsx index 24b741a8b..5e8481319 100644 --- a/src/pages/applications/pages/mobilization-department/military-registration-documents/index.tsx +++ b/src/pages/applications/pages/mobilization-department/military-registration-documents/index.tsx @@ -1,17 +1,16 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/mobilization-department/military-registration-documents/lib/get-form.tsx b/src/pages/applications/pages/mobilization-department/military-registration-documents/lib/get-form.tsx index 9b0f0a6c4..eefb559e5 100644 --- a/src/pages/applications/pages/mobilization-department/military-registration-documents/lib/get-form.tsx +++ b/src/pages/applications/pages/mobilization-department/military-registration-documents/lib/get-form.tsx @@ -1,9 +1,9 @@ import React from 'react' -import { UserApplication } from '@api/model' import styled from 'styled-components' -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const getForm = (dataUserApplication: UserApplication): IInputArea => { return { diff --git a/src/pages/applications/pages/mobilization-department/military-registration/index.tsx b/src/pages/applications/pages/mobilization-department/military-registration/index.tsx index 5d5ffeb9a..df1239ed3 100644 --- a/src/pages/applications/pages/mobilization-department/military-registration/index.tsx +++ b/src/pages/applications/pages/mobilization-department/military-registration/index.tsx @@ -1,19 +1,18 @@ import React, { useEffect, useMemo, useState } from 'react' -import { LoadedState } from 'widgets/template-form' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' import StepByStepForm, { StagesConfigsT } from '@features/applications/ui/molecules/step-by-step-form' -import { SelectPage } from '@features/select' +import checkFormFields from '@features/send-form/check-form-fields' import { applicationsModel } from '@entities/applications' -import checkFormFields from '@shared/lib/check-form-fields' -import { ApplicationFormCodes } from '@shared/models/application-form-codes' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' import { FormBlock, Message, SubmitButton, Title } from '@shared/ui/atoms' import { IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { LoadedState } from '@shared/ui/input-area/types' +import { SelectPage } from '@shared/ui/select' import { getContacts, diff --git a/src/pages/applications/pages/multifunctional-center/certificate-of-attendance/index.tsx b/src/pages/applications/pages/multifunctional-center/certificate-of-attendance/index.tsx index 9ada70d55..6c4861c0e 100644 --- a/src/pages/applications/pages/multifunctional-center/certificate-of-attendance/index.tsx +++ b/src/pages/applications/pages/multifunctional-center/certificate-of-attendance/index.tsx @@ -1,21 +1,19 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import getReasonForReceiving from '@pages/applications/pages/multifunctional-center/certificate-of-attendance/lib/get-reason-for-receiving' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import getMethodObtaining from '@features/applications/lib/get-method-obstaing' +import checkFormFields from '@features/send-form/check-form-fields' import { applicationsModel } from '@entities/applications' -import { SpecialFieldsNameConfig } from '@entities/applications/consts' - -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea, IInputAreaData } from '@ui/input-area/model' +import getMethodObtaining from '@entities/applications/lib/get-method-obstaing' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsNameConfig } from '@shared/ui/input-area/types' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/multifunctional-center/certificate-of-attendance/lib/get-form.ts b/src/pages/applications/pages/multifunctional-center/certificate-of-attendance/lib/get-form.ts index bce84242c..c5e121604 100644 --- a/src/pages/applications/pages/multifunctional-center/certificate-of-attendance/lib/get-form.ts +++ b/src/pages/applications/pages/multifunctional-center/certificate-of-attendance/lib/get-form.ts @@ -1,12 +1,11 @@ -import { UserApplication } from '@api/model' - import getStudentSubdivisions from '@pages/applications/lib/get-student-subdivisions' import getAddressFields from '@features/applications/lib/get-address-fields' import { getStudentMethodObtainingFields } from '@features/applications/lib/get-student-method-obtaining-fields' -import findCurrentInSelect from '@ui/input-area/lib/find-current-in-select' -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import findCurrentInSelect from '@shared/ui/input-area/lib/find-current-in-select' +import { IInputArea } from '@shared/ui/input-area/model' const academic_form = [ { id: 0, title: 'Очная' }, diff --git a/src/pages/applications/pages/multifunctional-center/certificate-of-attendance/lib/get-reason-for-receiving.ts b/src/pages/applications/pages/multifunctional-center/certificate-of-attendance/lib/get-reason-for-receiving.ts index 9012e3094..b3fbd8a9e 100644 --- a/src/pages/applications/pages/multifunctional-center/certificate-of-attendance/lib/get-reason-for-receiving.ts +++ b/src/pages/applications/pages/multifunctional-center/certificate-of-attendance/lib/get-reason-for-receiving.ts @@ -1,6 +1,5 @@ -import { SpecialFieldsName, SpecialFieldsNameConfig } from '@entities/applications/consts' - -import { IInputAreaData } from '@ui/input-area/model' +import { IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsName, SpecialFieldsNameConfig } from '@shared/ui/input-area/types' type radioType = { id: number; title: string } diff --git a/src/pages/applications/pages/multifunctional-center/changing-personal-data/index.tsx b/src/pages/applications/pages/multifunctional-center/changing-personal-data/index.tsx index 566af9afa..3587121bd 100644 --- a/src/pages/applications/pages/multifunctional-center/changing-personal-data/index.tsx +++ b/src/pages/applications/pages/multifunctional-center/changing-personal-data/index.tsx @@ -1,17 +1,16 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/multifunctional-center/changing-personal-data/lib/get-form.ts b/src/pages/applications/pages/multifunctional-center/changing-personal-data/lib/get-form.ts index cf82572e4..2759191a5 100644 --- a/src/pages/applications/pages/multifunctional-center/changing-personal-data/lib/get-form.ts +++ b/src/pages/applications/pages/multifunctional-center/changing-personal-data/lib/get-form.ts @@ -1,6 +1,5 @@ -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const getForm = (dataUserApplication: UserApplication): IInputArea => { return { diff --git a/src/pages/applications/pages/multifunctional-center/clarification-of-passport-data/index.tsx b/src/pages/applications/pages/multifunctional-center/clarification-of-passport-data/index.tsx index 9ba510a01..04212ab30 100644 --- a/src/pages/applications/pages/multifunctional-center/clarification-of-passport-data/index.tsx +++ b/src/pages/applications/pages/multifunctional-center/clarification-of-passport-data/index.tsx @@ -1,17 +1,16 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/multifunctional-center/clarification-of-passport-data/lib/get-form.ts b/src/pages/applications/pages/multifunctional-center/clarification-of-passport-data/lib/get-form.ts index d1cbd3497..452743aff 100644 --- a/src/pages/applications/pages/multifunctional-center/clarification-of-passport-data/lib/get-form.ts +++ b/src/pages/applications/pages/multifunctional-center/clarification-of-passport-data/lib/get-form.ts @@ -1,6 +1,5 @@ -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const getForm = (dataUserApplication: UserApplication): IInputArea => { return { diff --git a/src/pages/applications/pages/multifunctional-center/exit-academic-leave/index.tsx b/src/pages/applications/pages/multifunctional-center/exit-academic-leave/index.tsx index abc9497f1..d7b8cc7c1 100644 --- a/src/pages/applications/pages/multifunctional-center/exit-academic-leave/index.tsx +++ b/src/pages/applications/pages/multifunctional-center/exit-academic-leave/index.tsx @@ -1,18 +1,17 @@ import React, { useEffect, useState } from 'react' -import { LoadedState } from 'widgets/template-form' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' +import checkFormFields from '@features/send-form/check-form-fields' + import { applicationsModel } from '@entities/applications' -import { SpecialFieldsNameConfig } from '@entities/applications/consts' -import checkFormFields from '@shared/lib/check-form-fields' -import { ApplicationFormCodes } from '@shared/models/application-form-codes' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' import { FormBlock, SubmitButton } from '@shared/ui/atoms' import InputArea from '@shared/ui/input-area' import { IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { LoadedState, SpecialFieldsNameConfig } from '@shared/ui/input-area/types' import { getForm } from './lib/get-form' import { getAttachmentExitAcademic } from './lib/get-reason-exit-academic' diff --git a/src/pages/applications/pages/multifunctional-center/exit-academic-leave/lib/get-reason-exit-academic.ts b/src/pages/applications/pages/multifunctional-center/exit-academic-leave/lib/get-reason-exit-academic.ts index 394f7e9da..93c944c19 100644 --- a/src/pages/applications/pages/multifunctional-center/exit-academic-leave/lib/get-reason-exit-academic.ts +++ b/src/pages/applications/pages/multifunctional-center/exit-academic-leave/lib/get-reason-exit-academic.ts @@ -1,6 +1,5 @@ -import { SpecialFieldsName, SpecialFieldsNameConfig } from '@entities/applications/consts' - -import { IInputAreaData } from '@ui/input-area/model' +import { IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsName, SpecialFieldsNameConfig } from '@shared/ui/input-area/types' type radioType = { id: number; title: string } diff --git a/src/pages/applications/pages/multifunctional-center/extension-attestation/index.tsx b/src/pages/applications/pages/multifunctional-center/extension-attestation/index.tsx index 05b8ecd83..d501c0c24 100644 --- a/src/pages/applications/pages/multifunctional-center/extension-attestation/index.tsx +++ b/src/pages/applications/pages/multifunctional-center/extension-attestation/index.tsx @@ -1,17 +1,16 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/multifunctional-center/extension-attestation/lib/get-form.ts b/src/pages/applications/pages/multifunctional-center/extension-attestation/lib/get-form.ts index 1b3222184..43290e417 100644 --- a/src/pages/applications/pages/multifunctional-center/extension-attestation/lib/get-form.ts +++ b/src/pages/applications/pages/multifunctional-center/extension-attestation/lib/get-form.ts @@ -1,6 +1,5 @@ -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const TypesApplicationByDeadlineOptions = [ { id: 0, title: 'изменение сроков' }, diff --git a/src/pages/applications/pages/multifunctional-center/holidays-after-training/index.tsx b/src/pages/applications/pages/multifunctional-center/holidays-after-training/index.tsx index d45572248..4b93d4b0e 100644 --- a/src/pages/applications/pages/multifunctional-center/holidays-after-training/index.tsx +++ b/src/pages/applications/pages/multifunctional-center/holidays-after-training/index.tsx @@ -1,18 +1,17 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' -import { userModel } from '@entities/user' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { userModel } from '@shared/session' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/multifunctional-center/holidays-after-training/lib/get-form.ts b/src/pages/applications/pages/multifunctional-center/holidays-after-training/lib/get-form.ts index fd37a2316..495818eaa 100644 --- a/src/pages/applications/pages/multifunctional-center/holidays-after-training/lib/get-form.ts +++ b/src/pages/applications/pages/multifunctional-center/holidays-after-training/lib/get-form.ts @@ -1,6 +1,5 @@ -import { User, UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { User, UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const getForm = (dataUserApplication: UserApplication, user: User): IInputArea => { return { diff --git a/src/pages/applications/pages/multifunctional-center/independently-deducted/index.tsx b/src/pages/applications/pages/multifunctional-center/independently-deducted/index.tsx index 5a3bcb731..1acae7b9a 100644 --- a/src/pages/applications/pages/multifunctional-center/independently-deducted/index.tsx +++ b/src/pages/applications/pages/multifunctional-center/independently-deducted/index.tsx @@ -1,18 +1,17 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' -import { SpecialFieldsNameConfig } from '@entities/applications/consts' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea, IInputAreaData } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsNameConfig } from '@shared/ui/input-area/types' import getForm from './lib/get-form' import { getReasonIndepedentlyDeducted } from './lib/get-reason-independently-deducted' diff --git a/src/pages/applications/pages/multifunctional-center/independently-deducted/lib/get-form.ts b/src/pages/applications/pages/multifunctional-center/independently-deducted/lib/get-form.ts index a22b4dabd..3bec6f6f8 100644 --- a/src/pages/applications/pages/multifunctional-center/independently-deducted/lib/get-form.ts +++ b/src/pages/applications/pages/multifunctional-center/independently-deducted/lib/get-form.ts @@ -1,8 +1,7 @@ -import { UserApplication } from '@api/model' +import getDelayInDays from '@features/medical-certificate/lib/get-delay-in-days' -import getDelayInDays from '@pages/hr-applications/lib/get-delay-in-days' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const ReasonDeductionOptions = [ { id: 0, title: 'по собственному желанию' }, diff --git a/src/pages/applications/pages/multifunctional-center/independently-deducted/lib/get-reason-independently-deducted.ts b/src/pages/applications/pages/multifunctional-center/independently-deducted/lib/get-reason-independently-deducted.ts index ca40113cc..b1e4452e2 100644 --- a/src/pages/applications/pages/multifunctional-center/independently-deducted/lib/get-reason-independently-deducted.ts +++ b/src/pages/applications/pages/multifunctional-center/independently-deducted/lib/get-reason-independently-deducted.ts @@ -1,8 +1,6 @@ -import { SelectPage } from '@features/select' - -import { SpecialFieldsName, SpecialFieldsNameConfig } from '@entities/applications/consts' - -import { IInputAreaData } from '@ui/input-area/model' +import { IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsName, SpecialFieldsNameConfig } from '@shared/ui/input-area/types' +import { SelectPage } from '@shared/ui/select' export const getReasonIndepedentlyDeducted = (data: IInputAreaData[]): SpecialFieldsNameConfig => { const reasonField = data.find((item: IInputAreaData) => item.fieldName === 'reason') diff --git a/src/pages/applications/pages/multifunctional-center/paper-call/index.tsx b/src/pages/applications/pages/multifunctional-center/paper-call/index.tsx index a0f0836f3..5a5bfc003 100644 --- a/src/pages/applications/pages/multifunctional-center/paper-call/index.tsx +++ b/src/pages/applications/pages/multifunctional-center/paper-call/index.tsx @@ -1,20 +1,18 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import getMethodObtaining from '@features/applications/lib/get-method-obstaing' +import checkFormFields from '@features/send-form/check-form-fields' import { applicationsModel } from '@entities/applications' -import { SpecialFieldsNameConfig } from '@entities/applications/consts' - -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea, IInputAreaData } from '@ui/input-area/model' +import getMethodObtaining from '@entities/applications/lib/get-method-obstaing' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsNameConfig } from '@shared/ui/input-area/types' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/multifunctional-center/paper-call/lib/get-form.ts b/src/pages/applications/pages/multifunctional-center/paper-call/lib/get-form.ts index a01e51387..413965f95 100644 --- a/src/pages/applications/pages/multifunctional-center/paper-call/lib/get-form.ts +++ b/src/pages/applications/pages/multifunctional-center/paper-call/lib/get-form.ts @@ -1,5 +1,3 @@ -import { UserApplication } from '@api/model' - import getStudentSubdivisions from '@pages/applications/lib/get-student-subdivisions' import getAddressFields from '@features/applications/lib/get-address-fields' @@ -7,7 +5,8 @@ import { getStudentMethodObtainingFields } from '@features/applications/lib/get- import { NumberOfCopiesOptions } from '@entities/applications/consts' -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const getForm = (dataUserApplication: UserApplication): IInputArea => { return { diff --git a/src/pages/applications/pages/multifunctional-center/provision-academic-leave/index.tsx b/src/pages/applications/pages/multifunctional-center/provision-academic-leave/index.tsx index c39ece4bd..c171c8929 100644 --- a/src/pages/applications/pages/multifunctional-center/provision-academic-leave/index.tsx +++ b/src/pages/applications/pages/multifunctional-center/provision-academic-leave/index.tsx @@ -1,19 +1,18 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import getReasonAcademic from '@pages/applications/pages/multifunctional-center/provision-academic-leave/lib/get-reason-academic' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' -import { SpecialFieldsNameConfig } from '@entities/applications/consts' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea, IInputAreaData } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsNameConfig } from '@shared/ui/input-area/types' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/multifunctional-center/provision-academic-leave/lib/get-form.tsx b/src/pages/applications/pages/multifunctional-center/provision-academic-leave/lib/get-form.tsx index 43bc7a0ac..48334e368 100644 --- a/src/pages/applications/pages/multifunctional-center/provision-academic-leave/lib/get-form.tsx +++ b/src/pages/applications/pages/multifunctional-center/provision-academic-leave/lib/get-form.tsx @@ -1,8 +1,7 @@ import React from 'react' -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const ReasonProvidingOptions = [ { id: 0, title: 'медицинские показания' }, diff --git a/src/pages/applications/pages/multifunctional-center/provision-academic-leave/lib/get-reason-academic.ts b/src/pages/applications/pages/multifunctional-center/provision-academic-leave/lib/get-reason-academic.ts index 4ad4e8c6c..c6908f10d 100644 --- a/src/pages/applications/pages/multifunctional-center/provision-academic-leave/lib/get-reason-academic.ts +++ b/src/pages/applications/pages/multifunctional-center/provision-academic-leave/lib/get-reason-academic.ts @@ -1,6 +1,5 @@ -import { SpecialFieldsName, SpecialFieldsNameConfig } from '@entities/applications/consts' - -import { IInputAreaData } from '@ui/input-area/model' +import { IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsName, SpecialFieldsNameConfig } from '@shared/ui/input-area/types' type radioType = { id: number; title: string } diff --git a/src/pages/applications/pages/multifunctional-center/restoring-the-magnetic-pass/index.tsx b/src/pages/applications/pages/multifunctional-center/restoring-the-magnetic-pass/index.tsx index 85209d7ac..a401d62c9 100644 --- a/src/pages/applications/pages/multifunctional-center/restoring-the-magnetic-pass/index.tsx +++ b/src/pages/applications/pages/multifunctional-center/restoring-the-magnetic-pass/index.tsx @@ -1,17 +1,16 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/multifunctional-center/restoring-the-magnetic-pass/lib/get-form.tsx b/src/pages/applications/pages/multifunctional-center/restoring-the-magnetic-pass/lib/get-form.tsx index e91207f31..f16e996ff 100644 --- a/src/pages/applications/pages/multifunctional-center/restoring-the-magnetic-pass/lib/get-form.tsx +++ b/src/pages/applications/pages/multifunctional-center/restoring-the-magnetic-pass/lib/get-form.tsx @@ -1,8 +1,7 @@ import React from 'react' -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const getForm = (dataUserApplication: UserApplication): IInputArea => { return { diff --git a/src/pages/applications/pages/multifunctional-center/retake-for-diploma/index.tsx b/src/pages/applications/pages/multifunctional-center/retake-for-diploma/index.tsx index e062860cb..7e2ddda12 100644 --- a/src/pages/applications/pages/multifunctional-center/retake-for-diploma/index.tsx +++ b/src/pages/applications/pages/multifunctional-center/retake-for-diploma/index.tsx @@ -1,17 +1,16 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/multifunctional-center/retake-for-diploma/lib/get-form.tsx b/src/pages/applications/pages/multifunctional-center/retake-for-diploma/lib/get-form.tsx index 7ec15a21f..13eb9320f 100644 --- a/src/pages/applications/pages/multifunctional-center/retake-for-diploma/lib/get-form.tsx +++ b/src/pages/applications/pages/multifunctional-center/retake-for-diploma/lib/get-form.tsx @@ -1,8 +1,7 @@ import React from 'react' -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const typeExamOptions = [ { id: 0, title: 'Экзамен' }, diff --git a/src/pages/applications/pages/multifunctional-center/social-agencies/index.tsx b/src/pages/applications/pages/multifunctional-center/social-agencies/index.tsx index c25763d34..9f7555ae3 100644 --- a/src/pages/applications/pages/multifunctional-center/social-agencies/index.tsx +++ b/src/pages/applications/pages/multifunctional-center/social-agencies/index.tsx @@ -1,20 +1,18 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import getMethodObtaining from '@features/applications/lib/get-method-obstaing' +import checkFormFields from '@features/send-form/check-form-fields' import { applicationsModel } from '@entities/applications' -import { SpecialFieldsNameConfig } from '@entities/applications/consts' - -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea, IInputAreaData } from '@ui/input-area/model' +import getMethodObtaining from '@entities/applications/lib/get-method-obstaing' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsNameConfig } from '@shared/ui/input-area/types' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/multifunctional-center/social-agencies/lib/get-form.ts b/src/pages/applications/pages/multifunctional-center/social-agencies/lib/get-form.ts index 22733d5ec..3bd81c8ea 100644 --- a/src/pages/applications/pages/multifunctional-center/social-agencies/lib/get-form.ts +++ b/src/pages/applications/pages/multifunctional-center/social-agencies/lib/get-form.ts @@ -1,5 +1,3 @@ -import { UserApplication } from '@api/model' - import getStudentSubdivisions from '@pages/applications/lib/get-student-subdivisions' import getAddressFields from '@features/applications/lib/get-address-fields' @@ -7,7 +5,8 @@ import { getStudentMethodObtainingFields } from '@features/applications/lib/get- import { NumberOfCopiesOptions } from '@entities/applications/consts' -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const SocialPlaceOfReferenceOptions = [ { id: 0, title: 'в Фонд пенсионного и социального страхования Российской Федерации (СФР)' }, diff --git a/src/pages/applications/pages/multifunctional-center/state-accreditation/index.tsx b/src/pages/applications/pages/multifunctional-center/state-accreditation/index.tsx index 9b7b66f9e..04f89c4d3 100644 --- a/src/pages/applications/pages/multifunctional-center/state-accreditation/index.tsx +++ b/src/pages/applications/pages/multifunctional-center/state-accreditation/index.tsx @@ -1,20 +1,18 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import getMethodObtaining from '@features/applications/lib/get-method-obstaing' +import checkFormFields from '@features/send-form/check-form-fields' import { applicationsModel } from '@entities/applications' -import { SpecialFieldsNameConfig } from '@entities/applications/consts' - -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea, IInputAreaData } from '@ui/input-area/model' +import getMethodObtaining from '@entities/applications/lib/get-method-obstaing' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsNameConfig } from '@shared/ui/input-area/types' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/multifunctional-center/state-accreditation/lib/get-form.ts b/src/pages/applications/pages/multifunctional-center/state-accreditation/lib/get-form.ts index ae960127f..9fb5b3101 100644 --- a/src/pages/applications/pages/multifunctional-center/state-accreditation/lib/get-form.ts +++ b/src/pages/applications/pages/multifunctional-center/state-accreditation/lib/get-form.ts @@ -1,11 +1,10 @@ -import { UserApplication } from '@api/model' - import getStudentSubdivisions from '@pages/applications/lib/get-student-subdivisions' import getAddressFields from '@features/applications/lib/get-address-fields' import { getStudentMethodObtainingFields } from '@features/applications/lib/get-student-method-obtaining-fields' -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const documentOptions = [ { id: 0, title: 'Лицензия на право ведения образовательной деятельности' }, diff --git a/src/pages/applications/pages/multifunctional-center/student-status/index.tsx b/src/pages/applications/pages/multifunctional-center/student-status/index.tsx index 79a2004ba..5acd5730d 100644 --- a/src/pages/applications/pages/multifunctional-center/student-status/index.tsx +++ b/src/pages/applications/pages/multifunctional-center/student-status/index.tsx @@ -1,20 +1,18 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import getMethodObtaining from '@features/applications/lib/get-method-obstaing' +import checkFormFields from '@features/send-form/check-form-fields' import { applicationsModel } from '@entities/applications' -import { SpecialFieldsNameConfig } from '@entities/applications/consts' - -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea, IInputAreaData } from '@ui/input-area/model' +import getMethodObtaining from '@entities/applications/lib/get-method-obstaing' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsNameConfig } from '@shared/ui/input-area/types' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/multifunctional-center/student-status/lib/get-form.ts b/src/pages/applications/pages/multifunctional-center/student-status/lib/get-form.ts index 013952085..0bfc14d5b 100644 --- a/src/pages/applications/pages/multifunctional-center/student-status/lib/get-form.ts +++ b/src/pages/applications/pages/multifunctional-center/student-status/lib/get-form.ts @@ -1,11 +1,10 @@ -import { UserApplication } from '@api/model' - import getStudentSubdivisions from '@pages/applications/lib/get-student-subdivisions' import getAddressFields from '@features/applications/lib/get-address-fields' import { getStudentMethodObtainingFields } from '@features/applications/lib/get-student-method-obtaining-fields' -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const PlaceOfReferenceOptions = [ { id: 0, title: 'по месту требования' }, diff --git a/src/pages/applications/pages/other/arbitrary-request/index.tsx b/src/pages/applications/pages/other/arbitrary-request/index.tsx index 262800113..2278afe6e 100644 --- a/src/pages/applications/pages/other/arbitrary-request/index.tsx +++ b/src/pages/applications/pages/other/arbitrary-request/index.tsx @@ -1,17 +1,16 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/other/arbitrary-request/lib/get-form.ts b/src/pages/applications/pages/other/arbitrary-request/lib/get-form.ts index 01780b725..10e085ace 100644 --- a/src/pages/applications/pages/other/arbitrary-request/lib/get-form.ts +++ b/src/pages/applications/pages/other/arbitrary-request/lib/get-form.ts @@ -1,8 +1,7 @@ -import { UserApplication } from '@api/model' - import { getFormattedDivisions } from '@features/applications/lib/get-divisions' -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const getForm = (dataUserApplication: UserApplication): IInputArea => { return { diff --git a/src/pages/applications/pages/other/family-contacts/index.tsx b/src/pages/applications/pages/other/family-contacts/index.tsx index f63d65b2e..51b87ed54 100644 --- a/src/pages/applications/pages/other/family-contacts/index.tsx +++ b/src/pages/applications/pages/other/family-contacts/index.tsx @@ -1,19 +1,20 @@ import React, { useEffect, useState } from 'react' import { useUnit } from 'effector-react' -import { LoadedState } from 'widgets/template-form' import { globalPrepareFormData } from '@pages/applications/lib/prepare-form-data' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' +import checkFormFields from '@features/send-form/check-form-fields' + import { applicationsModel } from '@entities/applications' import { familyContactsModel } from '@entities/family-contacts' -import checkFormFields from '@shared/lib/check-form-fields' -import { ApplicationFormCodes } from '@shared/models/application-form-codes' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' import { FormBlock, SubmitButton } from '@shared/ui/atoms' import InputArea from '@shared/ui/input-area' import { IInputArea } from '@shared/ui/input-area/model' +import { LoadedState } from '@shared/ui/input-area/types' import { checkForAtLeastOneField } from './lib/check-for-at-least-one-field' import { getAbstractRelativeForm, getForm, getRelativeForm } from './lib/get-form' diff --git a/src/pages/applications/pages/other/family-contacts/lib/get-form.ts b/src/pages/applications/pages/other/family-contacts/lib/get-form.ts index 6b305825d..e1320f373 100644 --- a/src/pages/applications/pages/other/family-contacts/lib/get-form.ts +++ b/src/pages/applications/pages/other/family-contacts/lib/get-form.ts @@ -1,9 +1,7 @@ -import { UserApplication } from '@api/model' - import { FamilyContacts } from '@shared/api/family-contacts-api' +import { UserApplication } from '@shared/api/model' import findCurrentInSelect from '@shared/ui/input-area/lib/find-current-in-select' - -import { IInputArea } from '@ui/input-area/model' +import { IInputArea } from '@shared/ui/input-area/model' const relatives = [ { id: 0, title: 'Брат' }, diff --git a/src/pages/applications/pages/other/medical-certifitcates-086/index.tsx b/src/pages/applications/pages/other/medical-certifitcates-086/index.tsx index 4e0ec36f2..a4d29c045 100644 --- a/src/pages/applications/pages/other/medical-certifitcates-086/index.tsx +++ b/src/pages/applications/pages/other/medical-certifitcates-086/index.tsx @@ -1,18 +1,18 @@ import React, { useEffect, useState } from 'react' -import { LoadedState } from 'widgets/template-form' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { getCertForm } from '@pages/medical-certificate/lib/cert-form' + +import { getCertForm } from '@features/medical-certificate/lib/cert-form' +import checkFormFields from '@features/send-form/check-form-fields' import { applicationsModel } from '@entities/applications' -import checkFormFields from '@shared/lib/check-form-fields' -import { ApplicationFormCodes } from '@shared/models/application-form-codes' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' import { FormBlock, SubmitButton } from '@shared/ui/atoms' import InputArea from '@shared/ui/input-area' import { IInputArea } from '@shared/ui/input-area/model' +import { LoadedState } from '@shared/ui/input-area/types' import { getForm } from './lib/get-form' diff --git a/src/pages/applications/pages/other/medical-certifitcates-086/lib/get-form.ts b/src/pages/applications/pages/other/medical-certifitcates-086/lib/get-form.ts index 487c6c4c3..318d42cbf 100644 --- a/src/pages/applications/pages/other/medical-certifitcates-086/lib/get-form.ts +++ b/src/pages/applications/pages/other/medical-certifitcates-086/lib/get-form.ts @@ -1,6 +1,5 @@ -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' export const getForm = (dataUserApplication: UserApplication): IInputArea => { const { phone, email } = dataUserApplication diff --git a/src/pages/applications/pages/other/student-employment/index.tsx b/src/pages/applications/pages/other/student-employment/index.tsx index 9922c020e..d3a33aa72 100644 --- a/src/pages/applications/pages/other/student-employment/index.tsx +++ b/src/pages/applications/pages/other/student-employment/index.tsx @@ -1,18 +1,18 @@ import React, { useEffect, useState } from 'react' -import { LoadedState } from 'widgets/template-form' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' +import checkFormFields from '@features/send-form/check-form-fields' + import { applicationsModel } from '@entities/applications' -import { SpecialFieldsNameConfig } from '@entities/applications/consts' -import checkFormFields from '@shared/lib/check-form-fields' -import { ApplicationFormCodes } from '@shared/models/application-form-codes' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' import { FormBlock, SubmitButton } from '@shared/ui/atoms' import InputArea from '@shared/ui/input-area' import { IInputArea, IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsNameConfig } from '@shared/ui/input-area/types' +import { LoadedState } from '@shared/ui/input-area/types' import getEmployment from './lib/get-employment' import { getForm } from './lib/get-form' diff --git a/src/pages/applications/pages/other/student-employment/lib/get-employment.ts b/src/pages/applications/pages/other/student-employment/lib/get-employment.ts index 580351ac4..33f65ba03 100644 --- a/src/pages/applications/pages/other/student-employment/lib/get-employment.ts +++ b/src/pages/applications/pages/other/student-employment/lib/get-employment.ts @@ -1,6 +1,5 @@ -import { SpecialFieldsName, SpecialFieldsNameConfig } from '@entities/applications/consts' - -import { IInputAreaData } from '@ui/input-area/model' +import { IInputAreaData } from '@shared/ui/input-area/model' +import { SpecialFieldsName, SpecialFieldsNameConfig } from '@shared/ui/input-area/types' type radioType = { id: number; title: string } diff --git a/src/pages/applications/pages/other/student-employment/lib/get-form.ts b/src/pages/applications/pages/other/student-employment/lib/get-form.ts index e5d329b99..708b70d0d 100644 --- a/src/pages/applications/pages/other/student-employment/lib/get-form.ts +++ b/src/pages/applications/pages/other/student-employment/lib/get-form.ts @@ -1,7 +1,6 @@ -import { SelectPage } from '@features/select' - import { UserApplication } from '@shared/api/model' import { IInputArea } from '@shared/ui/input-area/model' +import { SelectPage } from '@shared/ui/select' const SELECT_FIELD_OF_ACTIVITY: SelectPage[] = [ { id: '1', title: 'Банковская сфера' }, diff --git a/src/pages/applications/pages/trade-union-organization/financial-assistance/index.tsx b/src/pages/applications/pages/trade-union-organization/financial-assistance/index.tsx index bf7194841..51be00ac6 100644 --- a/src/pages/applications/pages/trade-union-organization/financial-assistance/index.tsx +++ b/src/pages/applications/pages/trade-union-organization/financial-assistance/index.tsx @@ -1,17 +1,16 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/trade-union-organization/financial-assistance/lib/get-form.ts b/src/pages/applications/pages/trade-union-organization/financial-assistance/lib/get-form.ts index d96c03640..306a04a18 100644 --- a/src/pages/applications/pages/trade-union-organization/financial-assistance/lib/get-form.ts +++ b/src/pages/applications/pages/trade-union-organization/financial-assistance/lib/get-form.ts @@ -1,6 +1,5 @@ -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const justificationGrantOptions = [ { diff --git a/src/pages/applications/pages/trade-union-organization/financial-support/index.tsx b/src/pages/applications/pages/trade-union-organization/financial-support/index.tsx index f7b265a08..e0255bc7b 100644 --- a/src/pages/applications/pages/trade-union-organization/financial-support/index.tsx +++ b/src/pages/applications/pages/trade-union-organization/financial-support/index.tsx @@ -1,17 +1,16 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/trade-union-organization/financial-support/lib/get-form.ts b/src/pages/applications/pages/trade-union-organization/financial-support/lib/get-form.ts index 8027b6ef7..3369561c0 100644 --- a/src/pages/applications/pages/trade-union-organization/financial-support/lib/get-form.ts +++ b/src/pages/applications/pages/trade-union-organization/financial-support/lib/get-form.ts @@ -1,6 +1,5 @@ -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const justificationGrantOptions = [ { id: 0, title: 'Сироты или оставшиеся без попечения родителей' }, diff --git a/src/pages/applications/pages/trade-union-organization/increased-state-academic-scholarship/index.tsx b/src/pages/applications/pages/trade-union-organization/increased-state-academic-scholarship/index.tsx index 673a0b4e7..6a92019ad 100644 --- a/src/pages/applications/pages/trade-union-organization/increased-state-academic-scholarship/index.tsx +++ b/src/pages/applications/pages/trade-union-organization/increased-state-academic-scholarship/index.tsx @@ -6,17 +6,15 @@ import styled from 'styled-components' import { parseFilesToFormData } from '@pages/applications/lib/prepare-form-data' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import Select from '@features/select' - import { increasedScholarshipModel } from '@entities/increased-scholarship' -import { ApplicationFormCodes } from '@shared/models/application-form-codes' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { Divider, FileLink, FormBlock, Input, Message, SubmitButton, TextArea } from '@shared/ui/atoms' import Checkbox from '@shared/ui/checkbox' import FileInput from '@shared/ui/file-input' import Flex from '@shared/ui/flex' import TextHeader from '@shared/ui/molecules/text-header' - -import { Divider, FileLink, FormBlock, Input, Message, SubmitButton, TextArea } from '@ui/atoms' +import Select from '@shared/ui/select' const typesOfActivity = [ { id: 0, title: 'Учебная деятельность' }, diff --git a/src/pages/applications/pages/trade-union-organization/social-scollarship/index.tsx b/src/pages/applications/pages/trade-union-organization/social-scollarship/index.tsx index 37a8eb2c2..916ab086a 100644 --- a/src/pages/applications/pages/trade-union-organization/social-scollarship/index.tsx +++ b/src/pages/applications/pages/trade-union-organization/social-scollarship/index.tsx @@ -1,17 +1,16 @@ import React, { useEffect, useState } from 'react' -import { ApplicationFormCodes } from '@utility-types/application-form-codes' - import { globalAppSendForm } from '@pages/applications/lib' import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrapper' -import { applicationsModel } from '@entities/applications' +import checkFormFields from '@features/send-form/check-form-fields' -import { FormBlock, SubmitButton } from '@ui/atoms' -import InputArea from '@ui/input-area' -import { IInputArea } from '@ui/input-area/model' +import { applicationsModel } from '@entities/applications' -import checkFormFields from '@utils/check-form-fields' +import { ApplicationFormCodes } from '@shared/consts/models/application-form-codes' +import { FormBlock, SubmitButton } from '@shared/ui/atoms' +import InputArea from '@shared/ui/input-area' +import { IInputArea } from '@shared/ui/input-area/model' import getForm from './lib/get-form' diff --git a/src/pages/applications/pages/trade-union-organization/social-scollarship/lib/get-form.ts b/src/pages/applications/pages/trade-union-organization/social-scollarship/lib/get-form.ts index 8084e0a51..f9af584c2 100644 --- a/src/pages/applications/pages/trade-union-organization/social-scollarship/lib/get-form.ts +++ b/src/pages/applications/pages/trade-union-organization/social-scollarship/lib/get-form.ts @@ -1,6 +1,5 @@ -import { UserApplication } from '@api/model' - -import { IInputArea } from '@ui/input-area/model' +import { UserApplication } from '@shared/api/model' +import { IInputArea } from '@shared/ui/input-area/model' const ReasonsSocialScholarshipOptions = [ { diff --git a/src/pages/cant-access/index.tsx b/src/pages/cant-access/index.tsx index 521c76dff..4636da312 100644 --- a/src/pages/cant-access/index.tsx +++ b/src/pages/cant-access/index.tsx @@ -1,11 +1,11 @@ import React from 'react' import { FiInfo } from 'react-icons/fi' -import { CenterPage, Message, Title } from '@ui/atoms' -import KeyValue from '@ui/atoms/key-value' -import Block from '@ui/block' -import GoBackButton from '@ui/go-back-button' -import List from '@ui/list' +import { CenterPage, Message, Title } from '@shared/ui/atoms' +import KeyValue from '@shared/ui/atoms/key-value' +import Block from '@shared/ui/block' +import GoBackButton from '@shared/ui/go-back-button' +import List from '@shared/ui/list' const CantAccessPage = () => { return ( diff --git a/src/pages/chat/index.tsx b/src/pages/chat/index.tsx index f11e81304..5a8d104c0 100644 --- a/src/pages/chat/index.tsx +++ b/src/pages/chat/index.tsx @@ -4,14 +4,13 @@ import { Route, Switch, useRouteMatch } from 'react-router' import { useUnit } from 'effector-react' import styled from 'styled-components' -import { TEMPLATE_CHAT_ROUTE } from '@app/routes/general-routes' - import { ChatWindow, ListOfChats } from '@features/chat' import EmptyHere from '@features/chat/ui/atoms/empty-here' import { chatModel, chatsModel } from '@entities/chats' -import { MEDIA_QUERIES } from '../../shared/constants' +import { TEMPLATE_CHAT_ROUTE } from '@shared/routing' +import { MEDIA_QUERIES } from '@shared/ui/consts' const ChatPage = () => { const params = useRouteMatch<{ chatId: string | undefined }>(TEMPLATE_CHAT_ROUTE)?.params @@ -57,7 +56,7 @@ const ChatPageWrapper = styled.div` border-radius: 12px; overflow: hidden; - ${MEDIA_QUERIES.isSmallTesktop} { + ${MEDIA_QUERIES.isSmallDesktop} { margin: 0; height: 100%; border-radius: 0; diff --git a/src/pages/children/index.tsx b/src/pages/children/index.tsx index 6765a94d4..ce23c36e6 100644 --- a/src/pages/children/index.tsx +++ b/src/pages/children/index.tsx @@ -8,7 +8,7 @@ import BaseApplicationWrapper from '@pages/applications/ui/base-application-wrap import { childrensModel } from '@entities/children' -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' import { isNumber } from '@shared/lib/is-number' import { Button, Input, Loading, Message, Title } from '@shared/ui/atoms' import FormBlockWrapper from '@shared/ui/atoms/form-block' diff --git a/src/pages/decreis-directives/index.tsx b/src/pages/decreis-directives/index.tsx index 2a7a01791..bb0e13139 100644 --- a/src/pages/decreis-directives/index.tsx +++ b/src/pages/decreis-directives/index.tsx @@ -1,6 +1,6 @@ import React from 'react' -import NotificationsPage from 'widgets/notifications' +import NotificationsPage from '@widgets/notifications' const DecreisDirectivesPage = () => { return diff --git a/src/pages/dormitory/index.tsx b/src/pages/dormitory/index.tsx index e052da41b..50c2fac24 100644 --- a/src/pages/dormitory/index.tsx +++ b/src/pages/dormitory/index.tsx @@ -1,9 +1,8 @@ import React from 'react' +import { CenterPage, FileLink, Message } from '@shared/ui/atoms' import PageBlock from '@shared/ui/page-block' -import { CenterPage, FileLink, Message } from '@ui/atoms' - const DormitoryPage = () => { return ( diff --git a/src/pages/download-admin-files/index.tsx b/src/pages/download-admin-files/index.tsx index 8257e5404..f680b3995 100644 --- a/src/pages/download-admin-files/index.tsx +++ b/src/pages/download-admin-files/index.tsx @@ -1,13 +1,12 @@ import React from 'react' -import { SliderPage } from 'widgets' - -import { STUDENTS_LOGINS_ROUTE } from '@app/routes/teacher-routes' - import PageIsNotReady from '@pages/page-is-not-ready' +import SliderPage from '@features/slider-page' + import { adminLinksModel } from '@entities/admin-links' +import { STUDENTS_LOGINS_ROUTE } from '@shared/routing' import { CenterPage } from '@shared/ui/atoms' import PageBlock from '@shared/ui/page-block' diff --git a/src/pages/download-admin-files/pages/accepts/index.tsx b/src/pages/download-admin-files/pages/accepts/index.tsx index 13e39b24d..11e8e4b81 100644 --- a/src/pages/download-admin-files/pages/accepts/index.tsx +++ b/src/pages/download-admin-files/pages/accepts/index.tsx @@ -1,6 +1,6 @@ import React from 'react' -import AdminLinksTemplate from 'widgets/admin-links-template' +import AdminLinksTemplate from '@widgets/admin-links-template' import { adminLinksModel } from '@entities/admin-links' diff --git a/src/pages/download-admin-files/pages/additional-agreements/index.tsx b/src/pages/download-admin-files/pages/additional-agreements/index.tsx index 171e4de08..9d3f96eee 100644 --- a/src/pages/download-admin-files/pages/additional-agreements/index.tsx +++ b/src/pages/download-admin-files/pages/additional-agreements/index.tsx @@ -1,6 +1,6 @@ import React from 'react' -import AdminLinksTemplate from 'widgets/admin-links-template' +import AdminLinksTemplate from '@widgets/admin-links-template' import { adminLinksModel } from '@entities/admin-links' diff --git a/src/pages/download-admin-files/pages/checkdata/index.tsx b/src/pages/download-admin-files/pages/checkdata/index.tsx index 043b9c74f..0863ced96 100644 --- a/src/pages/download-admin-files/pages/checkdata/index.tsx +++ b/src/pages/download-admin-files/pages/checkdata/index.tsx @@ -1,6 +1,6 @@ import React from 'react' -import AdminLinksTemplate from 'widgets/admin-links-template' +import AdminLinksTemplate from '@widgets/admin-links-template' import { adminLinksModel } from '@entities/admin-links' diff --git a/src/pages/download-admin-files/pages/phonebook/index.tsx b/src/pages/download-admin-files/pages/phonebook/index.tsx index dbed22169..ad9c9880c 100644 --- a/src/pages/download-admin-files/pages/phonebook/index.tsx +++ b/src/pages/download-admin-files/pages/phonebook/index.tsx @@ -1,6 +1,6 @@ import React from 'react' -import AdminLinksTemplate from 'widgets/admin-links-template' +import AdminLinksTemplate from '@widgets/admin-links-template' import { adminLinksModel } from '@entities/admin-links' diff --git a/src/pages/electronic-interaction-agreement/index.tsx b/src/pages/electronic-interaction-agreement/index.tsx index f81583e59..135cd50dd 100644 --- a/src/pages/electronic-interaction-agreement/index.tsx +++ b/src/pages/electronic-interaction-agreement/index.tsx @@ -2,19 +2,20 @@ import React from 'react' import { useHistory, useParams } from 'react-router' import { useUnit } from 'effector-react' -import { SliderPage, useModal } from 'widgets' -import { ElectornicAgreement } from 'widgets/electonic-agreement' -import { ELECTRONIC_INTERACTION_AGREEMENT_ROUTE } from '@app/routes/general-routes' +import { ElectornicAgreement } from '@widgets/electonic-agreement' + +import SliderPage from '@features/slider-page' import { electronicInteractionModel } from '@entities/electronic-interaction' import { thirdPartyInteractionModel } from '@entities/payments' import localizeDate from '@shared/lib/dates/localize-date' +import { ELECTRONIC_INTERACTION_AGREEMENT_ROUTE } from '@shared/routing' +import { Wrapper } from '@shared/ui/atoms' +import { useModal } from '@shared/ui/modal' import PageBlock from '@shared/ui/page-block' -import { Wrapper } from '@ui/atoms' - import { Modal } from './modal' const ElectronicInteractionAgreementPage = () => { diff --git a/src/pages/electronic-interaction-agreement/modal.tsx b/src/pages/electronic-interaction-agreement/modal.tsx index 88d8d30d5..8f70f089b 100644 --- a/src/pages/electronic-interaction-agreement/modal.tsx +++ b/src/pages/electronic-interaction-agreement/modal.tsx @@ -1,9 +1,8 @@ import React, { useState } from 'react' -import { useModal } from 'widgets' - -import useCurrentDevice from '@shared/lib/hooks/use-current-device' import Flex from '@shared/ui/flex' +import useCurrentDevice from '@shared/ui/hooks/use-current-device' +import { useModal } from '@shared/ui/modal' import { Title } from '@shared/ui/title' import { Code } from './steps/code' diff --git a/src/pages/electronic-interaction-agreement/steps/code.tsx b/src/pages/electronic-interaction-agreement/steps/code.tsx index 5e1b1974c..08c02723f 100644 --- a/src/pages/electronic-interaction-agreement/steps/code.tsx +++ b/src/pages/electronic-interaction-agreement/steps/code.tsx @@ -1,14 +1,14 @@ import React, { useState } from 'react' import { useUnit } from 'effector-react' -import { useModal } from 'widgets' import { thirdPartyInteractionModel } from '@entities/payments' -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' import { Button } from '@shared/ui/atoms' import Flex from '@shared/ui/flex' import Input from '@shared/ui/input' +import { useModal } from '@shared/ui/modal' export const Code = ({ next, guid }: { guid: string; next: () => void }) => { const { close } = useModal() diff --git a/src/pages/electronic-interaction-agreement/steps/email.tsx b/src/pages/electronic-interaction-agreement/steps/email.tsx index 5c9aeba69..04d912c7e 100644 --- a/src/pages/electronic-interaction-agreement/steps/email.tsx +++ b/src/pages/electronic-interaction-agreement/steps/email.tsx @@ -1,14 +1,14 @@ import React, { useState } from 'react' import { useUnit } from 'effector-react' -import { useModal } from 'widgets' import { thirdPartyInteractionModel } from '@entities/payments' -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' import { Button } from '@shared/ui/atoms' import Flex from '@shared/ui/flex' import Input from '@shared/ui/input' +import { useModal } from '@shared/ui/modal' export const Email = ({ next, guid, defaultEmail }: { defaultEmail: string; guid: string; next: () => void }) => { const { close } = useModal() diff --git a/src/pages/feedback/index.tsx b/src/pages/feedback/index.tsx index 993314a0a..ed17e7ba9 100644 --- a/src/pages/feedback/index.tsx +++ b/src/pages/feedback/index.tsx @@ -2,7 +2,7 @@ import React from 'react' import { ContentPage } from '@features/feedback/ui' -import { Wrapper } from '@ui/atoms' +import { Wrapper } from '@shared/ui/atoms' const FeedbackPage = () => { return ( diff --git a/src/pages/forgot-password/index.tsx b/src/pages/forgot-password/index.tsx index fb01096a5..7c7feb75d 100644 --- a/src/pages/forgot-password/index.tsx +++ b/src/pages/forgot-password/index.tsx @@ -1,8 +1,8 @@ import React, { useState } from 'react' -import { CenterPage, Input, Message, SubmitButton, Title } from '@ui/atoms' -import Block from '@ui/block' -import GoBackButton from '@ui/go-back-button' +import { CenterPage, Input, Message, SubmitButton, Title } from '@shared/ui/atoms' +import Block from '@shared/ui/block' +import GoBackButton from '@shared/ui/go-back-button' const ForgotPasswordPage = () => { const [email, setEmail] = useState('') diff --git a/src/pages/get-your-login/index.tsx b/src/pages/get-your-login/index.tsx index a414b7253..ae3b180ff 100644 --- a/src/pages/get-your-login/index.tsx +++ b/src/pages/get-your-login/index.tsx @@ -3,11 +3,10 @@ import React, { useState } from 'react' import { useStore } from 'effector-react' import styled from 'styled-components' -import { userModel } from '@entities/user' - -import { CenterPage, Input, Message, SubmitButton, Title } from '@ui/atoms' -import Block from '@ui/block' -import GoBackButton from '@ui/go-back-button' +import { userModel } from '@shared/session' +import { CenterPage, Input, Message, SubmitButton, Title } from '@shared/ui/atoms' +import Block from '@shared/ui/block' +import GoBackButton from '@shared/ui/go-back-button' import { USER_NOT_FOUND } from './config/ad-result-status' diff --git a/src/pages/helpful-information/index.tsx b/src/pages/helpful-information/index.tsx index 950d749bc..3d6a0b175 100644 --- a/src/pages/helpful-information/index.tsx +++ b/src/pages/helpful-information/index.tsx @@ -1,17 +1,16 @@ import React, { useCallback, useMemo } from 'react' import { useHistory, useRouteMatch } from 'react-router' -import { SliderPage } from 'widgets' - -import { TEMPLATE_USEFUL_INFO_ROUTE, USEFUL_INFO_ROUTE } from '@app/routes/general-routes' +import SliderPage from '@features/slider-page' import { menuModel } from '@entities/menu' -import { userModel } from '@entities/user' +import { TEMPLATE_USEFUL_INFO_ROUTE, USEFUL_INFO_ROUTE } from '@shared/routing' +import { userModel } from '@shared/session' import { CenterPage } from '@shared/ui/atoms' import PageBlock from '@shared/ui/page-block' -import pages from './config/pages-config' +import pages from '../../features/helpful-information/config/pages-config' import getPages from './lib/get-pages' const HelpfulInformation = () => { diff --git a/src/pages/helpful-information/lib/get-pages.tsx b/src/pages/helpful-information/lib/get-pages.tsx index 966e4002d..6de42024d 100644 --- a/src/pages/helpful-information/lib/get-pages.tsx +++ b/src/pages/helpful-information/lib/get-pages.tsx @@ -1,6 +1,7 @@ import React from 'react' -import { HelpfulPages } from '../types/helpful-pages' +import { HelpfulPages } from '@features/helpful-information' + import LinksList from '../ui/molecules/links-list' const getPages = (config: HelpfulPages, isStaff: boolean) => { diff --git a/src/pages/helpful-information/ui/molecules/links-list.tsx b/src/pages/helpful-information/ui/molecules/links-list.tsx index ec792ba13..f6d921ec0 100644 --- a/src/pages/helpful-information/ui/molecules/links-list.tsx +++ b/src/pages/helpful-information/ui/molecules/links-list.tsx @@ -1,13 +1,13 @@ import React, { useState } from 'react' -import search from '@pages/helpful-information/lib/search' -import { HelpfulPage } from '@pages/helpful-information/types/helpful-pages' +import { HelpfulPage } from '@features/helpful-information' +import search from '@features/helpful-information/lib/search' -import { Error } from '@ui/error' -import List from '@ui/list' -import { LocalSearch } from '@ui/molecules' +import { Error } from '@shared/ui/error' +import List from '@shared/ui/list' +import { LocalSearch } from '@shared/ui/molecules' -import BlocksList from './blocks-list' +import BlocksList from '../../../../features/helpful-information/ui/blocks-list' const LinksList = ({ title, blocks, isStaff }: { title: string; blocks: HelpfulPage[]; isStaff: boolean }) => { const [searchBlocks, setSearchBlocks] = useState(null) diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx index a71542e76..8f4022164 100644 --- a/src/pages/home/index.tsx +++ b/src/pages/home/index.tsx @@ -1,11 +1,9 @@ import React from 'react' -import { HomePageTutorial } from 'widgets/tutorial/tutorials/home-page-tutorial' - -import { userModel } from '@entities/user' - -import { Wrapper } from '@ui/atoms' +import { userModel } from '@shared/session' +import { Wrapper } from '@shared/ui/atoms' +import { HomePageTutorial } from './ui/home-page' import HomeTopPlate from './ui/home-top-plate' const Home = () => { diff --git a/src/pages/home/ui/home-page.tsx b/src/pages/home/ui/home-page.tsx index c90d5ae20..125356fc6 100644 --- a/src/pages/home/ui/home-page.tsx +++ b/src/pages/home/ui/home-page.tsx @@ -2,25 +2,26 @@ import React, { useEffect } from 'react' import { useUnit } from 'effector-react' import styled from 'styled-components' -import AlertsWidget from 'widgets/alerts-widget' -import { TutorialComponent } from 'widgets/tutorial/lib/with-tutorial' -import { GlobalAppSearchTutorial } from 'widgets/tutorial/tutorials/global-app-search-tutorial' -import { LinksTutorial } from 'widgets/tutorial/tutorials/links-tutorial' -import { TutorialActionPlate } from 'widgets/tutorial/ui/tutorial-action-plate' + +import AlertsWidget from '@widgets/alerts-widget' +import UserInfo from '@widgets/user-info' import ScheduleAndNotification from '@features/home/ui/organisms/schedule-and-notification' -import UserInfo from '@features/user-info' +import { GlobalAppSearchTutorial } from '@features/tutorials/global-app-search-tutorial' +import { LinksTutorial } from '@features/tutorials/links-tutorial' import { menuModel } from '@entities/menu' import { paymentsModel } from '@entities/payments' import { scheduleModel } from '@entities/schedule' import { userSettingsModel } from '@entities/settings' -import { userModel } from '@entities/user' +import { userModel } from '@shared/session' +import { withTutorial } from '@shared/tutorial/lib/with-tutorial' +import { TutorialActionPlate } from '@shared/tutorial/ui/tutorial-action-plate' +import { CenterPage, Title } from '@shared/ui/atoms' import Block from '@shared/ui/block' import Flex from '@shared/ui/flex' - -import { CenterPage, Title } from '@ui/atoms' +import { TutorialComponent } from '@shared/ui/types' const HomePageStyled = styled.div` width: 100%; @@ -93,3 +94,5 @@ export const HomePage = ({ forwardedRef }: TutorialComponent) => { ) } + +export const HomePageTutorial = withTutorial(HomePage) diff --git a/src/pages/home/ui/home-top-plate.tsx b/src/pages/home/ui/home-top-plate.tsx index eb7734995..061922f2a 100644 --- a/src/pages/home/ui/home-top-plate.tsx +++ b/src/pages/home/ui/home-top-plate.tsx @@ -2,10 +2,9 @@ import React from 'react' import styled from 'styled-components' -import { userModel } from '@entities/user' - -import { Colors } from '@shared/constants' +import { Colors } from '@shared/consts' import getLettersColors from '@shared/lib/get-letters-colors' +import { userModel } from '@shared/session' const HomeTopPlateStyled = styled.div<{ dark: string; main: string; light: string }>` width: 100%; diff --git a/src/pages/hr-applications/index.tsx b/src/pages/hr-applications/index.tsx deleted file mode 100644 index 91770a5f9..000000000 --- a/src/pages/hr-applications/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import React from 'react' - -import { TemplateHrApplications } from 'widgets' - -const HrApplicationsPage = () => { - return -} - -export default HrApplicationsPage diff --git a/src/pages/hr-applications/lib/get-file-dismissal.ts b/src/pages/hr-applications/lib/get-file-dismissal.ts deleted file mode 100644 index 0adc3757f..000000000 --- a/src/pages/hr-applications/lib/get-file-dismissal.ts +++ /dev/null @@ -1,26 +0,0 @@ -import axios from 'axios' - -import { getJwtToken } from '@entities/user/lib/jwt-token' - -const downloadFile = async (guid: string) => { - const url = `https://api.mospolytech.ru/serviceforfrontpersonnelorders/Dismissal.DownloadFile?guid=${guid}` - - const headers = { - Authorization: `Bearer ${getJwtToken()}`, - } - - const response = await axios({ - url: url, - method: 'GET', - responseType: 'blob', - headers: headers, - }) - const downloadUrl = window.URL.createObjectURL(new Blob([response.data])) - const link = document.createElement('a') - link.href = downloadUrl - link.setAttribute('download', 'order.pdf') // or any other extension - document.body.appendChild(link) - link.click() -} - -export default downloadFile diff --git a/src/pages/hr-applications/lib/get-file.ts b/src/pages/hr-applications/lib/get-file.ts deleted file mode 100644 index 65b00f10e..000000000 --- a/src/pages/hr-applications/lib/get-file.ts +++ /dev/null @@ -1,26 +0,0 @@ -import axios from 'axios' - -import { getJwtToken } from '@entities/user/lib/jwt-token' - -const downloadFile = async (guid: string, type: string) => { - const url = `https://api.mospolytech.ru/serviceforfrontpersonnelorders/Vacation.DownloadFile?DocumentGuid=${guid}&Type=${type}` - - const headers = { - Authorization: `Bearer ${getJwtToken()}`, - } - - const response = await axios({ - url: url, - method: 'GET', - responseType: 'blob', - headers: headers, - }) - const downloadUrl = window.URL.createObjectURL(new Blob([response.data])) - const link = document.createElement('a') - link.href = downloadUrl - link.setAttribute('download', 'order.pdf') // or any other extension - document.body.appendChild(link) - link.click() -} - -export default downloadFile diff --git a/src/pages/hr-applications/lib/send-hr-form-dismissal.ts b/src/pages/hr-applications/lib/send-hr-form-dismissal.ts deleted file mode 100644 index ab235796e..000000000 --- a/src/pages/hr-applications/lib/send-hr-form-dismissal.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { applicationsModel } from '@entities/hr-applications' -import { getJwtToken, parseJwt } from '@entities/user/lib/jwt-token' - -import { IInputArea } from '@ui/input-area/model' - -const sendHrFormDismissal = async ( - employeeId: string, - inputAreas: IInputArea[], - setCompleted: (loading: boolean) => void, -) => { - setCompleted(false) - const form = inputAreas - .map((itemForm) => { - if (!Array.isArray(itemForm.data[0])) { - return itemForm.data.map((l) => { - const obj = {} - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (!!l?.fieldName) obj[l?.fieldName ?? ''] = typeof l.value !== 'object' ? l?.value : l.value.title - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (l.type === 'multiselect') { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - obj[l?.fieldName ?? ''] = JSON.stringify(l?.value.map((itemSelect) => itemSelect.title)) - } - - return obj - }) - } else { - const r = itemForm.data.map((c) => { - return Object.assign( - {}, - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - ...c?.map((r) => { - const obj = {} - if (!!r?.fieldName) - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - obj[r?.fieldName] = !!r?.value?.title ? r?.value?.title : r?.value - return obj - }), - ) - }) - const obj = {} as any - - obj[employeeId] = JSON.stringify(r) - - return obj - } - }) - .flat() - - const result = Object.assign({}, ...form) - - const response = await applicationsModel.effects.postApplicationFx({ - guid: parseJwt(getJwtToken() || '{}')['IndividualGuid'], - jobGuid: result.jobGuid, - signingDate: new Date(new Date().getTime() - new Date().getTimezoneOffset() * 60000).toISOString(), - dateOfDismissal: result.last_day, - isSendMail: result.get_tk === 'По почте', - isRetirement: !!result.isRetirement, - address: result.get_tk_address, - reason: result.reason.charAt(0).toLowerCase() + result.reason.slice(1), - }) - - !response?.data?.dismissalResponse?.isError && setCompleted(true) -} - -export default sendHrFormDismissal diff --git a/src/pages/hr-applications/lib/send-hr-form-holiday-planning.ts b/src/pages/hr-applications/lib/send-hr-form-holiday-planning.ts deleted file mode 100644 index 46f267e92..000000000 --- a/src/pages/hr-applications/lib/send-hr-form-holiday-planning.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { IInputArea } from '@ui/input-area/model' - -import { bufferHolidayPlanningModel } from '../pages/buffer-holiday-planning/model' - -const sendHrFormHolidayPlanning = async ( - employeeId: string, - inputAreas: IInputArea[], - setCompleted: (loading: boolean) => void, -) => { - setCompleted(false) - const form = inputAreas - .map((itemForm) => { - if (!Array.isArray(itemForm.data[0])) { - return itemForm.data.map((l) => { - const obj = {} - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (!!l?.fieldName) obj[l?.fieldName ?? ''] = typeof l.value !== 'object' ? l?.value : l.value.title - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (l.type === 'multiselect') { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - obj[l?.fieldName ?? ''] = JSON.stringify(l?.value.map((itemSelect) => itemSelect.title)) - } - - return obj - }) - } else { - const r = itemForm.data.map((c) => { - return Object.assign( - {}, - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - ...c?.map((r) => { - const obj = {} - if (!!r?.fieldName) - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - obj[r?.fieldName] = !!r?.value?.title ? r?.value?.title : r?.value - return obj - }), - ) - }) - const obj = {} as any - - obj[employeeId] = JSON.stringify(r) - - return obj - } - }) - .flat() - - const result = Object.assign({}, ...form) - - if (result.holiday_type == 'Ежегодный (основной) оплачиваемый отпуск') result.holiday_type = 1 - else if (result.holiday_type == 'Ежегодный дополнительный оплачиваемый отпуск (в т.ч. учебный)') - result.holiday_type = 2 - else if (result.holiday_type == 'Отпуск без сохранения заработной платы') result.holiday_type = 3 - else if (result.holiday_type == 'Отпуск по коллективному договору') result.holiday_type = 4 - - const response = await bufferHolidayPlanningModel.effects.sendBufferHolidayPlanningFx({ - employeeGuid: result.jobGuid, - type: result.holiday_type, - start: result.holiday_start, - end: result.holiday_end, - }) - - !response.isError && setCompleted(true) -} - -export default sendHrFormHolidayPlanning diff --git a/src/pages/hr-applications/lib/send-hr-form-holiday-transfer.ts b/src/pages/hr-applications/lib/send-hr-form-holiday-transfer.ts deleted file mode 100644 index 4834eb807..000000000 --- a/src/pages/hr-applications/lib/send-hr-form-holiday-transfer.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { IInputArea } from '@ui/input-area/model' - -import { bufferHolidayTransferModel } from '../pages/buffer-holiday-transfer/model' - -const sendHrFormHolidayTransfer = async ( - employeeId: string, - inputAreas: IInputArea[], - setCompleted: (loading: boolean) => void, -) => { - setCompleted(false) - const form = inputAreas - .map((itemForm) => { - if (!Array.isArray(itemForm.data[0])) { - return itemForm.data.map((l) => { - const obj = {} - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (!!l?.fieldName) obj[l?.fieldName ?? ''] = typeof l.value !== 'object' ? l?.value : l.value.title - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (l.type === 'multiselect') { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - obj[l?.fieldName ?? ''] = JSON.stringify(l?.value.map((itemSelect) => itemSelect.title)) - } - - return obj - }) - } else { - const r = itemForm.data.map((c) => { - return Object.assign( - {}, - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - ...c?.map((r) => { - const obj = {} - if (!!r?.fieldName) - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - obj[r?.fieldName] = !!r?.value?.title ? r?.value?.title : r?.value - return obj - }), - ) - }) - const obj = {} as any - - obj[employeeId] = JSON.stringify(r) - - return obj - } - }) - .flat() - - const result = Object.assign({}, ...form) - - const response = await bufferHolidayTransferModel.effects.sendBufferHolidayTransferFx({ - employeeGuid: result.jobGuid, - reason: result.reason, - period: { - from: { - startDate: result.holiday_old_start, - endDate: result.holiday_old_end, - }, - to: { - startDate: result.holiday_new_start, - endDate: result.holiday_new_end, - }, - }, - }) - - !response.isError && setCompleted(true) -} - -export default sendHrFormHolidayTransfer diff --git a/src/pages/hr-applications/lib/send-hr-form-holiday-work.ts b/src/pages/hr-applications/lib/send-hr-form-holiday-work.ts deleted file mode 100644 index fa6422a49..000000000 --- a/src/pages/hr-applications/lib/send-hr-form-holiday-work.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { IInputArea } from '@ui/input-area/model' - -import { bufferHolidayWorkModel } from '../pages/buffer-holiday-work/model' - -const SendHrFormHolidayWork = async ( - employeeId: string, - inputAreas: IInputArea[], - setCompleted: (loading: boolean) => void, -) => { - setCompleted(false) - - const form = inputAreas - .map((itemForm) => { - if (!Array.isArray(itemForm.data[0])) { - return itemForm.data.map((l) => { - const obj = {} - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (!!l?.fieldName) obj[l?.fieldName ?? ''] = typeof l.value !== 'object' ? l?.value : l.value.title - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (l.type === 'multiselect') { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - obj[l?.fieldName ?? ''] = JSON.stringify(l?.value.map((itemSelect) => itemSelect.title)) - } - - return obj - }) - } else { - const r = itemForm.data.map((c) => { - return Object.assign( - {}, - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - ...c?.map((r) => { - const obj = {} - if (!!r?.fieldName) - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - obj[r?.fieldName] = !!r?.value?.title ? r?.value?.title : r?.value - return obj - }), - ) - }) - const obj = {} as any - obj[employeeId] = JSON.stringify(r) - return obj - } - }) - .flat() - - const result = Object.assign({}, ...form) - - const response = await bufferHolidayWorkModel.effects.sendBufferHolidayWorkFx({ - employeeGuid: result.jobGuid, - dates: [ - { - date: result.holiday_work_date, - dayOff: result.extra_holiday_date ? result.extra_holiday_date : null, - hours: +result.holiday_work_hours, - }, - ], - }) - - !response.isError && setCompleted(true) -} - -export default SendHrFormHolidayWork diff --git a/src/pages/hr-applications/lib/send-hr-form-medical-examination.ts b/src/pages/hr-applications/lib/send-hr-form-medical-examination.ts deleted file mode 100644 index a0d732e14..000000000 --- a/src/pages/hr-applications/lib/send-hr-form-medical-examination.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { IInputArea } from '@ui/input-area/model' - -import { bufferMedicalExaminationModel } from '../pages/buffer-medical-examination/model' - -const SendHrFormMedicalExamination = async ( - employeeId: string, - inputAreas: IInputArea[], - setCompleted: (loading: boolean) => void, -) => { - setCompleted(false) - const form = inputAreas - .map((itemForm) => { - if (!Array.isArray(itemForm.data[0])) { - return itemForm.data.map((l) => { - const obj = {} - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (!!l?.fieldName) obj[l?.fieldName ?? ''] = typeof l.value !== 'object' ? l?.value : l.value.title - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (l.type === 'multiselect') { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - obj[l?.fieldName ?? ''] = JSON.stringify(l?.value.map((itemSelect) => itemSelect.title)) - } - - return obj - }) - } else { - const r = itemForm.data.map((c) => { - return Object.assign( - {}, - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - ...c?.map((r) => { - const obj = {} - if (!!r?.fieldName) - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - obj[r?.fieldName] = !!r?.value?.title ? r?.value?.title : r?.value - return obj - }), - ) - }) - const obj = {} as any - obj[employeeId] = JSON.stringify(r) - return obj - } - }) - .flat() - - const result = Object.assign({}, ...form) - - const response = await bufferMedicalExaminationModel.effects.sendBufferMedicalExaminationFx({ - employeeGuid: result.jobGuid, - start: result.extra_examination_date, - end: result.isRetirement ? result.extra_examination_date_2 : result.extra_examination_date, - }) - - !response?.isError && setCompleted(true) -} - -export default SendHrFormMedicalExamination diff --git a/src/pages/hr-applications/lib/send-hr-form-part-time.ts b/src/pages/hr-applications/lib/send-hr-form-part-time.ts deleted file mode 100644 index 3c0acb226..000000000 --- a/src/pages/hr-applications/lib/send-hr-form-part-time.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { IInputArea } from '@ui/input-area/model' - -import { bufferHolidayWorkModel } from '../pages/buffer-holiday-work/model' - -export const SendHrFormPartTimeEmployment = async ( - employeeId: string, - inputAreas: IInputArea[], - setCompleted: (loading: boolean) => void, -) => { - setCompleted(false) - - const form = inputAreas - .map((itemForm) => { - if (!Array.isArray(itemForm.data[0])) { - return itemForm.data.map((l) => { - const obj = {} - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (!!l?.fieldName) obj[l?.fieldName ?? ''] = typeof l.value !== 'object' ? l?.value : l.value.title - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (l.type === 'multiselect') { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - obj[l?.fieldName ?? ''] = JSON.stringify(l?.value.map((itemSelect) => itemSelect.title)) - } - - return obj - }) - } else { - const r = itemForm.data.map((c) => { - return Object.assign( - {}, - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - ...c?.map((r) => { - const obj = {} - if (!!r?.fieldName) - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - obj[r?.fieldName] = !!r?.value?.title ? r?.value?.title : r?.value - return obj - }), - ) - }) - const obj = {} as any - obj[employeeId] = JSON.stringify(r) - return obj - } - }) - .flat() - - const result = Object.assign({}, ...form) - - const response = await bufferHolidayWorkModel.effects.sendBufferHolidayWorkFx({ - employeeGuid: result.jobGuid, - dates: [ - { - date: result.holiday_work_date, - dayOff: result.extra_holiday_date ? result.extra_holiday_date : null, - hours: +result.holiday_work_hours, - }, - ], - }) - - !response.isError && setCompleted(true) -} diff --git a/src/pages/hr-applications/lib/send-hr-form-work-transfer.ts b/src/pages/hr-applications/lib/send-hr-form-work-transfer.ts deleted file mode 100644 index 6cd792259..000000000 --- a/src/pages/hr-applications/lib/send-hr-form-work-transfer.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { IInputArea } from '@ui/input-area/model' - -import { bufferWorkTransferModel } from '../pages/buffer-work-transfer/model' - -const sendHrFormWorkTransfer = async ( - employeeId: string, - inputAreas: IInputArea[], - setCompleted: (loading: boolean) => void, - divisions: any, -) => { - setCompleted(false) - - const form = inputAreas - .map((itemForm) => { - if (!Array.isArray(itemForm.data[0])) { - return itemForm.data.map((l) => { - const obj = {} - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (!!l?.fieldName) obj[l?.fieldName ?? ''] = typeof l.value !== 'object' ? l?.value : l.value.title - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (l.type === 'multiselect') { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - obj[l?.fieldName ?? ''] = JSON.stringify(l?.value.map((itemSelect) => itemSelect.title)) - } - - return obj - }) - } else { - const r = itemForm.data.map((c) => { - return Object.assign( - {}, - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - ...c?.map((r) => { - const obj = {} - if (!!r?.fieldName) - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - obj[r?.fieldName] = !!r?.value?.title ? r?.value?.title : r?.value - return obj - }), - ) - }) - const obj = {} as any - obj[employeeId] = JSON.stringify(r) - return obj - } - }) - .flat() - - const result = Object.assign({}, ...form) - const response = await bufferWorkTransferModel.effects.sendBufferWorkTransferFx({ - employeeGuid: result.jobGuid, - transferDate: result.transferDate, - divisionGuid: divisions.find((item: any) => item.divisionName === result.newPlaceOfWork)?.divisionGuid ?? '', - desiredJob: result.newPost, - desiredRate: result.newRate, - }) - - !response.isError && setCompleted(true) -} - -export default sendHrFormWorkTransfer diff --git a/src/pages/hr-applications/model/divisions.ts b/src/pages/hr-applications/model/divisions.ts deleted file mode 100644 index 671db6429..000000000 --- a/src/pages/hr-applications/model/divisions.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { combine, createEffect, createEvent, createStore, sample } from 'effector' - -import { getDivisions } from '@shared/api/application-api' - -export const loadDivisions = createEvent() - -const loadDivisionsFx = createEffect(getDivisions) - -sample({ clock: loadDivisions, target: loadDivisionsFx }) - -export const $hrDivisions = createStore<{ divisionGuid: string; divisionName: string }[]>([]) -export const $hrDivisionsSuggestions = combine($hrDivisions, (divisions) => { - return divisions.map((d) => d.divisionName) -}) -sample({ clock: loadDivisionsFx.doneData, target: $hrDivisions }) diff --git a/src/pages/hr-applications/pages/buffer-dismissal/index.tsx b/src/pages/hr-applications/pages/buffer-dismissal/index.tsx deleted file mode 100644 index 182b6a600..000000000 --- a/src/pages/hr-applications/pages/buffer-dismissal/index.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import React from 'react' - -import styled from 'styled-components' - -import { HrBlockWrapper } from '@pages/hr-applications/ui' -import { HRInfoMessage } from '@pages/hr-applications/ui/atoms/hr-info-message' - -import { applicationsModel } from '@entities/applications' - -import { Title, Wrapper } from '@ui/atoms' - -import Content from './ui/content' - -const DismissalBufferPage = () => { - const { - data: { listApplication }, - error, - } = applicationsModel.selectors.useApplications() - - return ( - applicationsModel.effects.getApplicationsFx()} - loading={!listApplication} - error={error} - data={listApplication} - > - - - - - Заявление на увольнение - - - - - - - - ) -} - -export default DismissalBufferPage - -const ApplicationPageWrapper = styled.div` - display: flex; - align-items: center; - color: var(--text); - justify-content: center; - - @media (max-width: 1000px) { - align-items: flex-start; - overflow-y: auto; - height: 100%; - } -` - -const HrHeader = styled.div` - // block - border-radius: var(--brSemi); - background: var(--block); - box-shadow: var(--block-shadow); - height: fit-content; - padding: 20px; - display: flex; - flex-direction: column; - row-gap: 20px; - margin-bottom: 30px; - - padding-bottom: 40px; - margin-bottom: 10px; -` diff --git a/src/pages/hr-applications/pages/buffer-dismissal/lib/get-ex-hr-applications-columns.tsx b/src/pages/hr-applications/pages/buffer-dismissal/lib/get-ex-hr-applications-columns.tsx deleted file mode 100644 index 526c066d8..000000000 --- a/src/pages/hr-applications/pages/buffer-dismissal/lib/get-ex-hr-applications-columns.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import React from 'react' - -import { hrApplicationsConstants, hrOrderConstants } from '@entities/applications/consts' - -//import localizeDate from '@shared/lib/dates/localize-date' -import { Message } from '@ui/message' -import { ColumnProps } from '@ui/table/types' - -const getExHrApplicationsColumns = (): ColumnProps[] => { - return [ - //{ title: 'Название', field: 'title', priority: 'one', search: true, }, - - { - title: 'Должность, Подразделение', - field: 'jobDivision', - priority: 'one', - width: '200px', - }, - { - title: 'Статус заявления', - field: 'status', - priority: 'one', - width: '200px', - catalogs: [ - ...(Object.values(hrApplicationsConstants).map((val, i) => ({ id: i.toString(), title: val })) ?? []), - ], - render: (value) => ( - - ), - }, - { - title: 'Дата заявления', - field: 'creationDate', - type: 'date', - priority: 'one', - align: 'center', - }, - { - title: 'Номер приказа', - field: 'dismissalOrder', - priority: 'one', - align: 'center', - render: (value) => value.orderNumber, - }, - { - title: 'Дата приказа', - field: 'dismissalOrder', - priority: 'one', - align: 'center', - // render: (value) => localizeDate(value.orderDate, 'numeric'), - render: (value) => value.formatedOrderDate, - }, - { - title: 'Статус приказа', - field: 'dismissalOrder', - priority: 'one', - width: '220px', - catalogs: [...(Object.values(hrOrderConstants).map((val, i) => ({ id: i.toString(), title: val })) ?? [])], - render: (value, data) => { - if (!value.orderStatus) return null - const title = value.orderStatus + data.dismissalOrder.registrationStatus - return ( - - ) - }, - }, - { title: 'Файл заявления', priority: 'one', field: 'file', type: 'file' }, - // { - // title: 'Статус регистрации приказа', - // field: 'dismissalOrder', - // priority: 'one', - - // catalogs: [ - // ...(Object.values(hrOrderRegisterConstants).map((val, i) => ({ id: i.toString(), title: val })) ?? []), - // ], - // render: (value, elements) => - // elements.dismissalOrder.orderStatus == 'Подписан' && ( - // - // ), - // }, - ] -} - -export default getExHrApplicationsColumns diff --git a/src/pages/hr-applications/pages/buffer-dismissal/lib/get-hr-applications-columns.tsx b/src/pages/hr-applications/pages/buffer-dismissal/lib/get-hr-applications-columns.tsx deleted file mode 100644 index 8766d1864..000000000 --- a/src/pages/hr-applications/pages/buffer-dismissal/lib/get-hr-applications-columns.tsx +++ /dev/null @@ -1,146 +0,0 @@ -import React from 'react' - -import downloadFile from '@pages/hr-applications/lib/get-file-dismissal' - -import { hrApplicationsConstants, hrOrderConstants } from '@entities/applications/consts' - -import localizeDate from '@shared/lib/dates/localize-date' -import { Button } from '@shared/ui/button' - -import { Message } from '@ui/message' -import { ColumnProps } from '@ui/table/types' - -const getHrApplicationsColumns = (): ColumnProps[] => { - return [ - //{ title: 'Название', field: 'title', priority: 'one', search: true, }, - - { - title: 'Статус заявления', - field: 'status', - priority: 'one', - width: '200px', - catalogs: [ - ...(Object.values(hrApplicationsConstants).map((val, i) => ({ id: i.toString(), title: val })) ?? []), - ], - render: (value) => ( - - ), - }, - { - title: 'Дата заявления', - field: 'creationDate', - type: 'date', - priority: 'one', - align: 'center', - }, - { - title: 'Номер приказа', - field: 'dismissalOrder', - priority: 'one', - align: 'center', - render: (value) => value.orderNumber, - }, - { - title: 'Дата приказа', - field: 'dismissalOrder', - type: 'date', - priority: 'one', - align: 'center', - render: (value) => localizeDate(value.orderDate, 'numeric'), - }, - { - title: 'Статус приказа', - field: 'dismissalOrder', - priority: 'one', - width: '200px', - catalogs: [...(Object.values(hrOrderConstants).map((val, i) => ({ id: i.toString(), title: val })) ?? [])], - render: (value, data) => { - if (!value.orderStatus) return null - const title = value.orderStatus + data.dismissalOrder.registrationStatus - return ( - - ) - }, - }, - { - title: 'Файл заявления', - priority: 'one', - field: 'downloadable', - type: 'file', - width: '200px', - align: 'center', - render: (value, data) => { - if (value) - return ( -