Merge branch 'main' into tracker-connect-back

# Conflicts:
#	src/assets/images/accept.png
#	src/assets/images/mainTaskCommentImg.png
#	src/components/Modal/TrackerModal/TrackerModal.jsx
#	src/components/UI/ModalTicket/ModalTicket.jsx
#	src/components/UI/TicketFullScreen/TicketFullScreen.jsx
#	src/pages/ProjectTracker/ProjectTracker.js
#	src/redux/projectsTrackerSlice.js
This commit is contained in:
Николай Полтщук 2023-06-12 22:22:51 +03:00
commit 5c742411d5
549 changed files with 8228 additions and 8502 deletions

21
.eslintrc.json Normal file
View File

@ -0,0 +1,21 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"overrides": [],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["react"],
"rules": {
"no-console": "warn",
"react/prop-types": 0,
"no-undef": "warn",
"react/no-unescaped-entities": 0,
"no-extra-boolean-cast": "warn",
"react/react-in-jsx-scope": 0
}
}

5
.husky/pre-commit Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm run format
npm run lint

7
.prettierignore Normal file
View File

@ -0,0 +1,7 @@
node_modules
config
public
*-lock.json
App.js

View File

@ -1,4 +1,19 @@
{ {
"tabWidth": 2, "tabWidth": 2,
"useTabs": false "semi": true,
"printWidth": 80,
"useTabs": false,
"importOrder": [
"^@react/(.*)$",
"^@redux/(.*)$",
"^@utils/(.*)$",
"^@api/(.*)$",
"^@hooks/(.*)$",
"^@pages/(.*)$",
"^@components/(.*)$",
"^assets/(.*)$",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
} }

View File

@ -1,7 +1,7 @@
const path = require('path'); const path = require("path");
module.exports = { module.exports = {
public: path.resolve(__dirname, '../public'), public: path.resolve(__dirname, "../public"),
src: path.resolve(__dirname, '../src'), src: path.resolve(__dirname, "../src"),
build: path.resolve(__dirname, '../build'), build: path.resolve(__dirname, "../build"),
'@node_modules': path.resolve(__dirname, '../node_modules'), "@node_modules": path.resolve(__dirname, "../node_modules"),
}; };

View File

@ -1,10 +1,10 @@
const { merge } = require('webpack-merge'); const { merge } = require("webpack-merge");
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer') const BundleAnalyzerPlugin =
.BundleAnalyzerPlugin; require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const prod = require('./prod'); const prod = require("./prod");
module.exports = merge(prod, { module.exports = merge(prod, {
plugins: [new BundleAnalyzerPlugin()] plugins: [new BundleAnalyzerPlugin()],
}); });

View File

@ -1,45 +1,44 @@
const paths = require('../paths'); const paths = require("../paths");
const webpack = require('webpack'); const webpack = require("webpack");
const CopyWebpackPlugin = require('copy-webpack-plugin'); const CopyWebpackPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require("html-webpack-plugin");
const Dotenv = require('dotenv-webpack');
const Dotenv = require("dotenv-webpack");
const plugins = [ const plugins = [
'@babel/plugin-proposal-class-properties', "@babel/plugin-proposal-class-properties",
'@babel/plugin-syntax-dynamic-import', "@babel/plugin-syntax-dynamic-import",
'@babel/plugin-transform-runtime' "@babel/plugin-transform-runtime",
]; ];
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === "development") {
plugins.push('react-refresh/babel'); plugins.push("react-refresh/babel");
} }
const babelLoader = { const babelLoader = {
loader: 'babel-loader', loader: "babel-loader",
options: { options: {
presets: [ presets: [
// "react-app", // "react-app",
'@babel/preset-env', "@babel/preset-env",
'@babel/preset-react', "@babel/preset-react",
], ],
plugins: plugins plugins: plugins,
} },
}; };
module.exports = { module.exports = {
entry: `${paths.src}/index.js`, entry: `${paths.src}/index.js`,
output: { output: {
path: paths.build, path: paths.build,
filename: '[name].bundle.js', filename: "[name].bundle.js",
publicPath: '/', publicPath: "/",
// publicPath: 'https://itguild.info', // publicPath: 'https://itguild.info',
asyncChunks: true, asyncChunks: true,
clean: true, clean: true,
crossOriginLoading: 'anonymous', crossOriginLoading: "anonymous",
module: true, module: true,
environment: { environment: {
arrowFunction: true, arrowFunction: true,
@ -47,57 +46,65 @@ module.exports = {
const: true, const: true,
destructuring: true, destructuring: true,
dynamicImport: false, dynamicImport: false,
forOf: true forOf: true,
} },
}, },
resolve: { resolve: {
alias: { alias: {
'@': `${paths.src}/modules` "@": `${paths.src}/modules`,
assets: `${paths.src}/assets`,
"@components": `${paths.src}/components`,
"@utils": `${paths.src}/utils`,
"@pages": `${paths.src}/pages`,
"@redux": `${paths.src}/redux`,
"@store": `${paths.src}/store`,
"@api": `${paths.src}/api`,
"@hooks": `${paths.src}/hooks`,
}, },
extensions: ['.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'] // extensions: [".mjs", ".js", ".jsx", ".ts", ".tsx", ".json"],
extensions: [".jsx", "..."],
}, },
experiments: { experiments: {
topLevelAwait: true, topLevelAwait: true,
outputModule: true outputModule: true,
}, },
module: { module: {
rules: [ rules: [
// JavaScript, React // JavaScript, React
{ {
test: /\.m?jsx?$/i, test: /\.m?jsx?$/i,
exclude: /node_modules/, exclude: /node_modules/,
use: babelLoader use: babelLoader,
}, },
// TypeScript // TypeScript
{ {
test: /.tsx?$/i, test: /.tsx?$/i,
exclude: /node_modules/, exclude: /node_modules/,
use: [babelLoader, 'ts-loader'] use: [babelLoader, "ts-loader"],
}, },
// CSS, SASS // CSS, SASS
{ {
test: /\.(c|sa|sc)ss$/i, test: /\.(c|sa|sc)ss$/i,
use: [ use: [
'style-loader', "style-loader",
{ {
loader: 'css-loader', loader: "css-loader",
options: {importLoaders: 1} options: { importLoaders: 1 },
}, },
'sass-loader' "sass-loader",
] ],
}, },
// MD // MD
{ {
test: /\.md$/i, test: /\.md$/i,
use: ['html-loader', 'markdown-loader'] use: ["html-loader", "markdown-loader"],
}, },
// static files // static files
{ {
test: /\.(jpe?g|png|gif|svg|eot|ttf|woff2|woff?)$/i, test: /\.(jpe?g|png|gif|webp|svg|eot|ttf|woff2|woff?)$/i,
type: 'asset/resource' type: "asset/resource",
} },
] ],
}, },
plugins: [ plugins: [
new webpack.ProgressPlugin(), new webpack.ProgressPlugin(),
@ -107,10 +114,10 @@ module.exports = {
{ {
from: `${paths.public}`, from: `${paths.public}`,
globOptions: { globOptions: {
ignore: ["**/index.html"] ignore: ["**/index.html"],
} },
} },
] ],
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
@ -119,11 +126,11 @@ module.exports = {
}), }),
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
React: 'react' React: "react",
}), }),
new Dotenv({ new Dotenv({
path: '.env' path: ".env",
}) }),
] ],
}; };

View File

@ -1,14 +1,14 @@
const paths = require('../paths'); const paths = require("../paths");
const webpack = require('webpack'); const webpack = require("webpack");
const {merge} = require('webpack-merge'); const { merge } = require("webpack-merge");
const common = require('./common'); const common = require("./common");
module.exports = merge(common, { module.exports = merge(common, {
target : 'web', target: "web",
mode: 'development', mode: "development",
devtool: 'eval-cheap-source-map', devtool: "eval-cheap-source-map",
devServer: { devServer: {
compress: true, compress: true,
@ -17,7 +17,6 @@ module.exports = merge(common, {
historyApiFallback: true, historyApiFallback: true,
// open: true, // open: true,
port: 3000, port: 3000,
}, },
plugins: [new webpack.HotModuleReplacementPlugin()] plugins: [new webpack.HotModuleReplacementPlugin()],
}); });

View File

@ -1,62 +1,59 @@
const paths = require('../paths'); const paths = require("../paths");
const {merge} = require('webpack-merge'); const { merge } = require("webpack-merge");
const common = require('./common'); const common = require("./common");
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = merge(common, { module.exports = merge(common, {
mode: 'production', mode: "production",
target :'browserslist', target: "browserslist",
entry: { entry: {
index: { index: {
import: `${paths.src}/index.js`, import: `${paths.src}/index.js`,
dependOn: ['react', 'helpers'] dependOn: ["react", "helpers"],
},
react: ['react', 'react-dom', 'prop-types'],
helpers: ['immer', 'nanoid']
}, },
devtool: false, react: ["react", "react-dom", "prop-types"],
output: { helpers: ["immer", "nanoid"],
filename: 'js/[name].[hash:8].bundle.js', },
publicPath: '/', devtool: false,
assetModuleFilename: '[hash][ext][query]' output: {
}, filename: "js/[name].[hash:8].bundle.js",
module: { publicPath: "/",
rules: [ assetModuleFilename: "[hash][ext][query]",
{ },
test: /\.(c|sa|sc)ss$/i, module: {
use: [ rules: [
MiniCssExtractPlugin.loader, {
{ test: /\.(c|sa|sc)ss$/i,
loader: 'css-loader', use: [
options: {importLoaders: 1} MiniCssExtractPlugin.loader,
}, {
'postcss-loader', loader: "css-loader",
'sass-loader' options: { importLoaders: 1 },
] },
}, "postcss-loader",
{ "sass-loader",
test: /\.(jpe?g|png|gif|svg)$/i, ],
type: 'asset/resource' },
// type: 'asset' {
}, test: /\.(jpe?g|png|gif|svg|webp)$/i,
type: "asset/resource",
] // type: 'asset'
}, },
plugins: [
new MiniCssExtractPlugin({
filename: '[name].[contenthash].css',
chunkFilename: '[id].css'
}),
], ],
optimization: { },
runtimeChunk: 'single' plugins: [
}, new MiniCssExtractPlugin({
performance: { filename: "[name].[contenthash].css",
hints: 'warning', chunkFilename: "[id].css",
maxEntrypointSize: 512000, }),
maxAssetSize: 512000 ],
} optimization: {
runtimeChunk: "single",
},
performance: {
hints: "warning",
maxEntrypointSize: 512000,
maxAssetSize: 512000,
},
}); });

15
jsconfig.json Normal file
View File

@ -0,0 +1,15 @@
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"assets/*": ["./assets/*"],
"@components/*": ["./components/*"],
"@utils/*": ["./utils/*"],
"@pages/*": ["./pages/*"],
"@redux/*": ["./redux/*"],
"@store/*": ["./store/*"],
"@api/*": ["./api/*"],
"@hooks/*": ["./hooks/*"]
}
}
}

1016
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -14,15 +14,6 @@
"bfj": "^7.0.2", "bfj": "^7.0.2",
"bootstrap": "^4.6.0", "bootstrap": "^4.6.0",
"camelcase": "^6.1.0", "camelcase": "^6.1.0",
"eslint": "^7.11.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-testing-library": "^3.9.2",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"fs-extra": "^9.0.1", "fs-extra": "^9.0.1",
"identity-obj-proxy": "3.0.0", "identity-obj-proxy": "3.0.0",
@ -58,11 +49,14 @@
"@babel/core": "^7.20.12", "@babel/core": "^7.20.12",
"@babel/preset-env": "^7.20.2", "@babel/preset-env": "^7.20.2",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"babel-loader": "^9.1.2", "babel-loader": "^9.1.2",
"copy-webpack-plugin": "^10.2.0", "copy-webpack-plugin": "^10.2.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"css-loader": "6.7.3", "css-loader": "6.7.3",
"dotenv-webpack": "^7.0.3", "dotenv-webpack": "^7.0.3",
"eslint": "^8.41.0",
"eslint-plugin-react": "^7.32.2",
"html-webpack-plugin": "5.5.0", "html-webpack-plugin": "5.5.0",
"mini-css-extract-plugin": "^2.7.2", "mini-css-extract-plugin": "^2.7.2",
"node-sass": "8.0.0", "node-sass": "8.0.0",
@ -80,12 +74,16 @@
"webpack-bundle-analyzer": "4.7.0", "webpack-bundle-analyzer": "4.7.0",
"webpack-cli": "^5.0.1", "webpack-cli": "^5.0.1",
"webpack-dev-server": "4.11.1", "webpack-dev-server": "4.11.1",
"webpack-merge": "5.8.0" "webpack-merge": "5.8.0",
"husky": "^8.0.0"
}, },
"scripts": { "scripts": {
"build": "cross-env SERVE=true webpack -c config/webpack/prod.js", "build": "cross-env SERVE=true webpack -c config/webpack/prod.js",
"start": "webpack serve -c config/webpack/dev.js", "start": "webpack serve -c config/webpack/dev.js",
"analyze": "webpack --analyze -c config/webpack/analyze.js" "analyze": "webpack --analyze -c config/webpack/analyze.js",
"format": "prettier --write \"./**/*.{js,jsx}\"",
"lint": "npx eslint 'src/**/*.{js,jsx,ts,tsx}'",
"prepare": "husky install"
}, },
"eslintConfig": { "eslintConfig": {
"extends": [ "extends": [

View File

@ -1,6 +1,5 @@
module.exports = { module.exports = {
'postcss-preset-env': { "postcss-preset-env": {
browsers: 'last 2 versions', browsers: "last 2 versions",
}, },
}; };

View File

@ -12,11 +12,11 @@ import Home from "./pages/Home/Home";
import Candidate from "./components/Candidate/Candidate"; import Candidate from "./components/Candidate/Candidate";
import Calendar from "./components/Calendar/Calendar"; import Calendar from "./components/Calendar/Calendar";
import ReportForm from "./components/ReportForm/ReportForm"; import ReportForm from "./components/ReportForm/ReportForm";
import FreeDevelopers from "./components/UI/FreeDevelopers/FreeDevelopers"; import FreeDevelopers from "./components/FreeDevelopers/FreeDevelopers";
import { TicketFullScreen } from "./components/UI/TicketFullScreen/TicketFullScreen"; import { TicketFullScreen } from "./components/Modal/Tracker/TicketFullScreen/TicketFullScreen";
import { ProfileCalendar } from "./components/ProfileCalendar/ProfileCalendar"; import { ProfileCalendar } from "./components/ProfileCalendar/ProfileCalendar";
import Article from "./pages/Article/Article"; import Article from "./pages/Article/Article";
import FormPage from "./pages/FormPage/FormPage.js"; import FormPage from "./pages/FormPage/FormPage";
import SingleReportPage from "./pages/SingleReportPage/SingleReportPage"; import SingleReportPage from "./pages/SingleReportPage/SingleReportPage";
import { QuizPage } from "./pages/quiz/QuizPage"; import { QuizPage } from "./pages/quiz/QuizPage";
import { QuizReportPage } from "./pages/quiz/QuizReportPage"; import { QuizReportPage } from "./pages/quiz/QuizReportPage";
@ -42,7 +42,7 @@ import { FrequentlyAskedQuestions } from "./pages/FrequentlyAskedQuestions/Frequ
import { FrequentlyAskedQuestion } from "./pages/FrequentlyAskedQuestion/FrequentlyAskedQuestion"; import { FrequentlyAskedQuestion } from "./pages/FrequentlyAskedQuestion/FrequentlyAskedQuestion";
import "./assets/global.scss"; import "./assets/global.scss";
import "./fonts/stylesheet.css"; import "./assets/fonts/stylesheet.css";
import "bootstrap/dist/css/bootstrap.min.css"; import "bootstrap/dist/css/bootstrap.min.css";
const App = () => { const App = () => {

View File

@ -1,5 +1,5 @@
import axios from 'axios'; import axios from "axios";
export default axios.create({ export default axios.create({
baseURL: process.env.REACT_APP_API_URL baseURL: process.env.REACT_APP_API_URL,
}); });

View File

@ -1,7 +1,6 @@
import axios from 'axios'; import axios from "axios";
import {getToken, urlHasParams} from "../helper";
import { getToken, urlHasParams } from "@utils/helper";
const instance = axios.create({ const instance = axios.create({
baseURL: process.env.REACT_APP_API_URL, baseURL: process.env.REACT_APP_API_URL,
@ -10,40 +9,47 @@ const instance = axios.create({
}, },
}); });
export const apiRequest = (url, { export const apiRequest = (
method = 'get', params, data, url,
headers = { {
'Access-Control-Allow-Origin': '*', method = "get",
'Content-Type': 'application/json' params,
}, data,
} = {}) => { headers = {
const fullHeaders = {...headers, ...getToken()}; "Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
},
} = {}
) => {
const fullHeaders = { ...headers, ...getToken() };
let urWithParams = urlHasParams(url); let urWithParams = urlHasParams(url);
return instance return instance
.request({ .request({
url: urWithParams, url: urWithParams,
method, method,
params, params,
data, data,
headers: {...fullHeaders}, headers: { ...fullHeaders },
}) })
.then(response => new Promise(resolve => { .then(
if (response.data.redirect || response.status === 401) { (response) =>
window.location.replace('/auth'); new Promise((resolve) => {
localStorage.clear(); if (response.data.redirect || response.status === 401) {
// dispatch(auth(false)); window.location.replace("/auth");
} localStorage.clear();
return resolve(response) // dispatch(auth(false));
})) }
.then(response => new Promise(resolve => resolve(response.data))) return resolve(response);
})
)
.then((response) => new Promise((resolve) => resolve(response.data)));
}; };
const RequestError = (code, msg, data) => { const RequestError = (code, msg, data) => {
const description = msg ? `- ${msg}` : ''; const description = msg ? `- ${msg}` : "";
this.name = 'RequestError'; this.name = "RequestError";
this.message = `API returned: ${code}${description}.`; this.message = `API returned: ${code}${description}.`;
this.code = code; this.code = code;
this.description = msg; this.description = msg;

Some files were not shown because too many files have changed in this diff Show More