Merge pull request #96 from apuc/fix-img-and-components

Fix img, components and project structures
This commit is contained in:
MaxOvs19 authored and GitHub committed 2023-05-30 12:14:44 +03:00
commit fe656c0360
521 files changed
+7588 -8530

No files matched your search

+2
View File
@@ -1,4 +1,6 @@
{ {
"tabWidth": 2, "tabWidth": 2,
"semi": true,
"printWidth": 80,
"useTabs": false "useTabs": false
} }
+5 -5
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"),
}; };
+5 -5
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()],
}); });
+52 -45
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",
}) }),
] ],
}; };
+8 -9
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()],
}); });
+53 -56
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
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/*"]
}
}
}
+185 -270
View File
File diff suppressed because it is too large. Load diff
-9
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",
+4 -4
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 = () => {
+36 -31
View File
@@ -1,7 +1,5 @@
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 +8,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;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 521 files, more files were not shown because too many files have changed in this diff. Show more