بهط 27/6

master
amir hosein gorji 3 years ago
parent 450e09e09e
commit fe5f0c818c
  1. 236
      config/webpack.config.js
  2. 48201
      package-lock.json
  3. 3
      package.json
  4. BIN
      public/8.pdf
  5. 2
      public/serviceworker.js
  6. 9
      src/AppRouter.js
  7. BIN
      src/Redux.rar
  8. 2
      src/Redux/actions/public.js
  9. 5
      src/Redux/actions/userFactor.js
  10. 2
      src/Redux/reducers/public.js
  11. 4
      src/Redux/reducers/user.js
  12. 3
      src/Redux/reducers/userFactor.js
  13. 3
      src/views/Home/HomeSlider/Simple/index.js
  14. 8
      src/views/Home/HomeStatic/index.js
  15. 5
      src/views/Home/Navbar/Laptop/index.js
  16. 3
      src/views/Home/index.js
  17. 23
      src/views/PDF/index.js
  18. 5
      src/views/PDF/index.scss
  19. 11
      src/views/Product/AddToCart/index.js
  20. 7
      src/views/Product/index.js
  21. 39
      src/views/QR/PDF/index.js
  22. 1
      src/views/QR/PDF/index.scss
  23. 38
      src/views/Sample/index.js
  24. 4133
      yarn.lock

@ -1,55 +1,55 @@
'use strict'; "use strict";
const fs = require('fs'); const fs = require("fs");
const path = require('path'); const path = require("path");
const webpack = require('webpack'); const webpack = require("webpack");
const resolve = require('resolve'); const resolve = require("resolve");
const PnpWebpackPlugin = require('pnp-webpack-plugin'); const PnpWebpackPlugin = require("pnp-webpack-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require("html-webpack-plugin");
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); const CaseSensitivePathsPlugin = require("case-sensitive-paths-webpack-plugin");
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin'); const InlineChunkHtmlPlugin = require("react-dev-utils/InlineChunkHtmlPlugin");
const TerserPlugin = require('terser-webpack-plugin'); const TerserPlugin = require("terser-webpack-plugin");
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const safePostCssParser = require('postcss-safe-parser'); const safePostCssParser = require("postcss-safe-parser");
const ManifestPlugin = require('webpack-manifest-plugin'); const ManifestPlugin = require("webpack-manifest-plugin");
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); const InterpolateHtmlPlugin = require("react-dev-utils/InterpolateHtmlPlugin");
const WorkboxWebpackPlugin = require('workbox-webpack-plugin'); const WorkboxWebpackPlugin = require("workbox-webpack-plugin");
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); const WatchMissingNodeModulesPlugin = require("react-dev-utils/WatchMissingNodeModulesPlugin");
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); const ModuleScopePlugin = require("react-dev-utils/ModuleScopePlugin");
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent'); const getCSSModuleLocalIdent = require("react-dev-utils/getCSSModuleLocalIdent");
const ESLintPlugin = require('eslint-webpack-plugin'); const ESLintPlugin = require("eslint-webpack-plugin");
const paths = require('./paths'); const paths = require("./paths");
const modules = require('./modules'); const modules = require("./modules");
const getClientEnvironment = require('./env'); const getClientEnvironment = require("./env");
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin'); const ModuleNotFoundPlugin = require("react-dev-utils/ModuleNotFoundPlugin");
const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin'); const ForkTsCheckerWebpackPlugin = require("react-dev-utils/ForkTsCheckerWebpackPlugin");
const typescriptFormatter = require('react-dev-utils/typescriptFormatter'); const typescriptFormatter = require("react-dev-utils/typescriptFormatter");
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin'); const ReactRefreshWebpackPlugin = require("@pmmmwh/react-refresh-webpack-plugin");
const postcssNormalize = require('postcss-normalize'); const postcssNormalize = require("postcss-normalize");
const appPackageJson = require(paths.appPackageJson); const appPackageJson = require(paths.appPackageJson);
// Source maps are resource heavy and can cause out of memory issue for large source files. // Source maps are resource heavy and can cause out of memory issue for large source files.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false'; const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== "false";
const webpackDevClientEntry = require.resolve( const webpackDevClientEntry = require.resolve(
'react-dev-utils/webpackHotDevClient' "react-dev-utils/webpackHotDevClient"
); );
const reactRefreshOverlayEntry = require.resolve( const reactRefreshOverlayEntry = require.resolve(
'react-dev-utils/refreshOverlayInterop' "react-dev-utils/refreshOverlayInterop"
); );
// Some apps do not need the benefits of saving a web request, so not inlining the chunk // Some apps do not need the benefits of saving a web request, so not inlining the chunk
// makes for a smoother build process. // makes for a smoother build process.
const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false'; const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== "false";
const emitErrorsAsWarnings = process.env.ESLINT_NO_DEV_ERRORS === 'true'; const emitErrorsAsWarnings = process.env.ESLINT_NO_DEV_ERRORS === "true";
const disableESLintPlugin = process.env.DISABLE_ESLINT_PLUGIN === 'true'; const disableESLintPlugin = process.env.DISABLE_ESLINT_PLUGIN === "true";
const imageInlineSizeLimit = parseInt( const imageInlineSizeLimit = parseInt(
process.env.IMAGE_INLINE_SIZE_LIMIT || '10000' process.env.IMAGE_INLINE_SIZE_LIMIT || "10000"
); );
// Check if TypeScript is setup // Check if TypeScript is setup
@ -65,12 +65,12 @@ const sassRegex = /\.(scss|sass)$/;
const sassModuleRegex = /\.module\.(scss|sass)$/; const sassModuleRegex = /\.module\.(scss|sass)$/;
const hasJsxRuntime = (() => { const hasJsxRuntime = (() => {
if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') { if (process.env.DISABLE_NEW_JSX_TRANSFORM === "true") {
return false; return false;
} }
try { try {
require.resolve('react/jsx-runtime'); require.resolve("react/jsx-runtime");
return true; return true;
} catch (e) { } catch (e) {
return false; return false;
@ -80,13 +80,13 @@ const hasJsxRuntime = (() => {
// This is the production and development configuration. // This is the production and development configuration.
// It is focused on developer experience, fast rebuilds, and a minimal bundle. // It is focused on developer experience, fast rebuilds, and a minimal bundle.
module.exports = function (webpackEnv) { module.exports = function (webpackEnv) {
const isEnvDevelopment = webpackEnv === 'development'; const isEnvDevelopment = webpackEnv === "development";
const isEnvProduction = webpackEnv === 'production'; const isEnvProduction = webpackEnv === "production";
// Variable used for enabling profiling in Production // Variable used for enabling profiling in Production
// passed into alias object. Uses a flag if passed into the build command // passed into alias object. Uses a flag if passed into the build command
const isEnvProductionProfile = const isEnvProductionProfile =
isEnvProduction && process.argv.includes('--profile'); isEnvProduction && process.argv.includes("--profile");
// We will provide `paths.publicUrlOrPath` to our app // We will provide `paths.publicUrlOrPath` to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript. // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
@ -99,33 +99,33 @@ module.exports = function (webpackEnv) {
// common function to get style loaders // common function to get style loaders
const getStyleLoaders = (cssOptions, preProcessor) => { const getStyleLoaders = (cssOptions, preProcessor) => {
const loaders = [ const loaders = [
isEnvDevelopment && require.resolve('style-loader'), isEnvDevelopment && require.resolve("style-loader"),
isEnvProduction && { isEnvProduction && {
loader: MiniCssExtractPlugin.loader, loader: MiniCssExtractPlugin.loader,
// css is located in `static/css`, use '../../' to locate index.html folder // css is located in `static/css`, use '../../' to locate index.html folder
// in production `paths.publicUrlOrPath` can be a relative path // in production `paths.publicUrlOrPath` can be a relative path
options: paths.publicUrlOrPath.startsWith('.') options: paths.publicUrlOrPath.startsWith(".")
? { publicPath: '../../' } ? { publicPath: "../../" }
: {}, : {},
}, },
{ {
loader: require.resolve('css-loader'), loader: require.resolve("css-loader"),
options: cssOptions, options: cssOptions,
}, },
{ {
// Options for PostCSS as we reference these options twice // Options for PostCSS as we reference these options twice
// Adds vendor prefixing based on your specified browser support in // Adds vendor prefixing based on your specified browser support in
// package.json // package.json
loader: require.resolve('postcss-loader'), loader: require.resolve("postcss-loader"),
options: { options: {
// Necessary for external CSS imports to work // Necessary for external CSS imports to work
// https://github.com/facebook/create-react-app/issues/2677 // https://github.com/facebook/create-react-app/issues/2677
ident: 'postcss', ident: "postcss",
plugins: () => [ plugins: () => [
require('postcss-flexbugs-fixes'), require("postcss-flexbugs-fixes"),
require('postcss-preset-env')({ require("postcss-preset-env")({
autoprefixer: { autoprefixer: {
flexbox: 'no-2009', flexbox: "no-2009",
}, },
stage: 3, stage: 3,
}), }),
@ -141,7 +141,7 @@ module.exports = function (webpackEnv) {
if (preProcessor) { if (preProcessor) {
loaders.push( loaders.push(
{ {
loader: require.resolve('resolve-url-loader'), loader: require.resolve("resolve-url-loader"),
options: { options: {
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
root: paths.appSrc, root: paths.appSrc,
@ -159,14 +159,14 @@ module.exports = function (webpackEnv) {
}; };
return { return {
mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development', mode: isEnvProduction ? "production" : isEnvDevelopment && "development",
// Stop compilation early in production // Stop compilation early in production
bail: isEnvProduction, bail: isEnvProduction,
devtool: isEnvProduction devtool: isEnvProduction
? shouldUseSourceMap ? shouldUseSourceMap
? 'source-map' ? "source-map"
: false : false
: isEnvDevelopment && 'cheap-module-source-map', : isEnvDevelopment && "cheap-module-source-map",
// These are the "entry points" to our application. // These are the "entry points" to our application.
// This means they will be the "root" imports that are included in JS bundle. // This means they will be the "root" imports that are included in JS bundle.
entry: entry:
@ -202,32 +202,33 @@ module.exports = function (webpackEnv) {
// There will be one main bundle, and one file per asynchronous chunk. // There will be one main bundle, and one file per asynchronous chunk.
// In development, it does not produce real files. // In development, it does not produce real files.
filename: isEnvProduction filename: isEnvProduction
? 'static/js/[name].[contenthash:8].js' ? "static/js/[name].[contenthash:8].js"
: isEnvDevelopment && 'static/js/bundle.js', : isEnvDevelopment && "static/js/bundle.js",
// TODO: remove this when upgrading to webpack 5 // TODO: remove this when upgrading to webpack 5
futureEmitAssets: true, futureEmitAssets: true,
// There are also additional JS chunk files if you use code splitting. // There are also additional JS chunk files if you use code splitting.
chunkFilename: isEnvProduction chunkFilename: isEnvProduction
? 'static/js/[name].[contenthash:8].chunk.js' ? "static/js/[name].[contenthash:8].chunk.js"
: isEnvDevelopment && 'static/js/[name].chunk.js', : isEnvDevelopment && "static/js/[name].chunk.js",
// webpack uses `publicPath` to determine where the app is being served from. // webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path. // It requires a trailing slash, or the file assets will get an incorrect path.
// We inferred the "public path" (such as / or /my-project) from homepage. // We inferred the "public path" (such as / or /my-project) from homepage.
publicPath: paths.publicUrlOrPath, publicPath: paths.publicUrlOrPath,
// Point sourcemap entries to original disk location (format as URL on Windows) // Point sourcemap entries to original disk location (format as URL on Windows)
devtoolModuleFilenameTemplate: isEnvProduction devtoolModuleFilenameTemplate: isEnvProduction
? info => ? (info) =>
path path
.relative(paths.appSrc, info.absoluteResourcePath) .relative(paths.appSrc, info.absoluteResourcePath)
.replace(/\\/g, '/') .replace(/\\/g, "/")
: isEnvDevelopment && : isEnvDevelopment &&
(info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')), ((info) =>
path.resolve(info.absoluteResourcePath).replace(/\\/g, "/")),
// Prevents conflicts when multiple webpack runtimes (from different apps) // Prevents conflicts when multiple webpack runtimes (from different apps)
// are used on the same page. // are used on the same page.
jsonpFunction: `webpackJsonp${appPackageJson.name}`, jsonpFunction: `webpackJsonp${appPackageJson.name}`,
// this defaults to 'window', but by setting it to 'this' then // this defaults to 'window', but by setting it to 'this' then
// module chunks which are built will work in web workers as well. // module chunks which are built will work in web workers as well.
globalObject: 'this', globalObject: "this",
}, },
optimization: { optimization: {
minimize: isEnvProduction, minimize: isEnvProduction,
@ -289,7 +290,7 @@ module.exports = function (webpackEnv) {
: false, : false,
}, },
cssProcessorPluginOptions: { cssProcessorPluginOptions: {
preset: ['default', { minifyFontValues: { removeQuotes: false } }], preset: ["default", { minifyFontValues: { removeQuotes: false } }],
}, },
}), }),
], ],
@ -297,14 +298,14 @@ module.exports = function (webpackEnv) {
// https://twitter.com/wSokra/status/969633336732905474 // https://twitter.com/wSokra/status/969633336732905474
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366 // https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
splitChunks: { splitChunks: {
chunks: 'all', chunks: "all",
name: isEnvDevelopment, name: isEnvDevelopment,
}, },
// Keep the runtime chunk separated to enable long term caching // Keep the runtime chunk separated to enable long term caching
// https://twitter.com/wSokra/status/969679223278505985 // https://twitter.com/wSokra/status/969679223278505985
// https://github.com/facebook/create-react-app/issues/5358 // https://github.com/facebook/create-react-app/issues/5358
runtimeChunk: { runtimeChunk: {
name: entrypoint => `runtime-${entrypoint.name}`, name: (entrypoint) => `runtime-${entrypoint.name}`,
}, },
}, },
resolve: { resolve: {
@ -312,7 +313,7 @@ module.exports = function (webpackEnv) {
// We placed these paths second because we want `node_modules` to "win" // We placed these paths second because we want `node_modules` to "win"
// if there are any conflicts. This matches Node resolution mechanism. // if there are any conflicts. This matches Node resolution mechanism.
// https://github.com/facebook/create-react-app/issues/253 // https://github.com/facebook/create-react-app/issues/253
modules: ['node_modules', paths.appNodeModules].concat( modules: ["node_modules", paths.appNodeModules].concat(
modules.additionalModulePaths || [] modules.additionalModulePaths || []
), ),
// These are the reasonable defaults supported by the Node ecosystem. // These are the reasonable defaults supported by the Node ecosystem.
@ -322,16 +323,16 @@ module.exports = function (webpackEnv) {
// `web` extension prefixes have been added for better support // `web` extension prefixes have been added for better support
// for React Native Web. // for React Native Web.
extensions: paths.moduleFileExtensions extensions: paths.moduleFileExtensions
.map(ext => `.${ext}`) .map((ext) => `.${ext}`)
.filter(ext => useTypeScript || !ext.includes('ts')), .filter((ext) => useTypeScript || !ext.includes("ts")),
alias: { alias: {
// Support React Native Web // Support React Native Web
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/ // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
'react-native': 'react-native-web', "react-native": "react-native-web",
// Allows for better profiling with ReactDevTools // Allows for better profiling with ReactDevTools
...(isEnvProductionProfile && { ...(isEnvProductionProfile && {
'react-dom$': 'react-dom/profiling', "react-dom$": "react-dom/profiling",
'scheduler/tracing': 'scheduler/tracing-profiling', "scheduler/tracing": "scheduler/tracing-profiling",
}), }),
...(modules.webpackAliases || {}), ...(modules.webpackAliases || {}),
}, },
@ -371,11 +372,11 @@ module.exports = function (webpackEnv) {
// https://github.com/jshttp/mime-db // https://github.com/jshttp/mime-db
{ {
test: [/\.avif$/], test: [/\.avif$/],
loader: require.resolve('url-loader'), loader: require.resolve("url-loader"),
options: { options: {
limit: imageInlineSizeLimit, limit: imageInlineSizeLimit,
mimetype: 'image/avif', mimetype: "image/avif",
name: 'static/media/[name].[hash:8].[ext]', name: "static/media/[name].[hash:8].[ext]",
}, },
}, },
// "url" loader works like "file" loader except that it embeds assets // "url" loader works like "file" loader except that it embeds assets
@ -383,10 +384,19 @@ module.exports = function (webpackEnv) {
// A missing `test` is equivalent to a match. // A missing `test` is equivalent to a match.
{ {
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/], test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
loader: require.resolve('url-loader'), loader: require.resolve("url-loader"),
options: { options: {
limit: imageInlineSizeLimit, limit: imageInlineSizeLimit,
name: 'static/media/[name].[hash:8].[ext]', name: "static/media/[name].[hash:8].[ext]",
},
},
{
test: /\.*pdfjs-dist.*$/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"],
},
}, },
}, },
// Process application JS with Babel. // Process application JS with Babel.
@ -394,35 +404,35 @@ module.exports = function (webpackEnv) {
{ {
test: /\.(js|mjs|jsx|ts|tsx)$/, test: /\.(js|mjs|jsx|ts|tsx)$/,
include: paths.appSrc, include: paths.appSrc,
loader: require.resolve('babel-loader'), loader: require.resolve("babel-loader"),
options: { options: {
customize: require.resolve( customize: require.resolve(
'babel-preset-react-app/webpack-overrides' "babel-preset-react-app/webpack-overrides"
), ),
presets: [ presets: [
[ [
require.resolve('babel-preset-react-app'), require.resolve("babel-preset-react-app"),
{ {
runtime: hasJsxRuntime ? 'automatic' : 'classic', runtime: hasJsxRuntime ? "automatic" : "classic",
}, },
], ],
], ],
plugins: [ plugins: [
[ [
require.resolve('babel-plugin-named-asset-import'), require.resolve("babel-plugin-named-asset-import"),
{ {
loaderMap: { loaderMap: {
svg: { svg: {
ReactComponent: ReactComponent:
'@svgr/webpack?-svgo,+titleProp,+ref![path]', "@svgr/webpack?-svgo,+titleProp,+ref![path]",
}, },
}, },
}, },
], ],
isEnvDevelopment && isEnvDevelopment &&
shouldUseReactRefresh && shouldUseReactRefresh &&
require.resolve('react-refresh/babel'), require.resolve("react-refresh/babel"),
].filter(Boolean), ].filter(Boolean),
// This is a feature of `babel-loader` for webpack (not Babel itself). // This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/ // It enables caching results in ./node_modules/.cache/babel-loader/
@ -438,14 +448,14 @@ module.exports = function (webpackEnv) {
{ {
test: /\.(js|mjs)$/, test: /\.(js|mjs)$/,
exclude: /@babel(?:\/|\\{1,2})runtime/, exclude: /@babel(?:\/|\\{1,2})runtime/,
loader: require.resolve('babel-loader'), loader: require.resolve("babel-loader"),
options: { options: {
babelrc: false, babelrc: false,
configFile: false, configFile: false,
compact: false, compact: false,
presets: [ presets: [
[ [
require.resolve('babel-preset-react-app/dependencies'), require.resolve("babel-preset-react-app/dependencies"),
{ helpers: true }, { helpers: true },
], ],
], ],
@ -509,7 +519,7 @@ module.exports = function (webpackEnv) {
? shouldUseSourceMap ? shouldUseSourceMap
: isEnvDevelopment, : isEnvDevelopment,
}, },
'sass-loader' "sass-loader"
), ),
// Don't consider CSS imports dead code even if the // Don't consider CSS imports dead code even if the
// containing package claims to have no side effects. // containing package claims to have no side effects.
@ -531,7 +541,7 @@ module.exports = function (webpackEnv) {
getLocalIdent: getCSSModuleLocalIdent, getLocalIdent: getCSSModuleLocalIdent,
}, },
}, },
'sass-loader' "sass-loader"
), ),
}, },
// "file" loader makes sure those assets get served by WebpackDevServer. // "file" loader makes sure those assets get served by WebpackDevServer.
@ -540,14 +550,14 @@ module.exports = function (webpackEnv) {
// This loader doesn't use a "test" so it will catch all modules // This loader doesn't use a "test" so it will catch all modules
// that fall through the other loaders. // that fall through the other loaders.
{ {
loader: require.resolve('file-loader'), loader: require.resolve("file-loader"),
// Exclude `js` files to keep "css" loader working as it injects // Exclude `js` files to keep "css" loader working as it injects
// its runtime that would otherwise be processed through "file" loader. // its runtime that would otherwise be processed through "file" loader.
// Also exclude `html` and `json` extensions so they get processed // Also exclude `html` and `json` extensions so they get processed
// by webpacks internal loaders. // by webpacks internal loaders.
exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/], exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
options: { options: {
name: 'static/media/[name].[hash:8].[ext]', name: "static/media/[name].[hash:8].[ext]",
}, },
}, },
// ** STOP ** Are you adding a new loader? // ** STOP ** Are you adding a new loader?
@ -635,8 +645,8 @@ module.exports = function (webpackEnv) {
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output // Options similar to the same options in webpackOptions.output
// both options are optional // both options are optional
filename: 'static/css/[name].[contenthash:8].css', filename: "static/css/[name].[contenthash:8].css",
chunkFilename: 'static/css/[name].[contenthash:8].chunk.css', chunkFilename: "static/css/[name].[contenthash:8].chunk.css",
}), }),
// Generate an asset manifest file with the following content: // Generate an asset manifest file with the following content:
// - "files" key: Mapping of all asset filenames to their corresponding // - "files" key: Mapping of all asset filenames to their corresponding
@ -645,7 +655,7 @@ module.exports = function (webpackEnv) {
// - "entrypoints" key: Array of files which are included in `index.html`, // - "entrypoints" key: Array of files which are included in `index.html`,
// can be used to reconstruct the HTML if necessary // can be used to reconstruct the HTML if necessary
new ManifestPlugin({ new ManifestPlugin({
fileName: 'asset-manifest.json', fileName: "asset-manifest.json",
publicPath: paths.publicUrlOrPath, publicPath: paths.publicUrlOrPath,
generate: (seed, files, entrypoints) => { generate: (seed, files, entrypoints) => {
const manifestFiles = files.reduce((manifest, file) => { const manifestFiles = files.reduce((manifest, file) => {
@ -653,7 +663,7 @@ module.exports = function (webpackEnv) {
return manifest; return manifest;
}, seed); }, seed);
const entrypointFiles = entrypoints.main.filter( const entrypointFiles = entrypoints.main.filter(
fileName => !fileName.endsWith('.map') (fileName) => !fileName.endsWith(".map")
); );
return { return {
@ -684,7 +694,7 @@ module.exports = function (webpackEnv) {
// TypeScript type checking // TypeScript type checking
useTypeScript && useTypeScript &&
new ForkTsCheckerWebpackPlugin({ new ForkTsCheckerWebpackPlugin({
typescript: resolve.sync('typescript', { typescript: resolve.sync("typescript", {
basedir: paths.appNodeModules, basedir: paths.appNodeModules,
}), }),
async: isEnvDevelopment, async: isEnvDevelopment,
@ -701,12 +711,12 @@ module.exports = function (webpackEnv) {
// as micromatch doesn't match // as micromatch doesn't match
// '../cra-template-typescript/template/src/App.tsx' // '../cra-template-typescript/template/src/App.tsx'
// otherwise. // otherwise.
'../**/src/**/*.{ts,tsx}', "../**/src/**/*.{ts,tsx}",
'**/src/**/*.{ts,tsx}', "**/src/**/*.{ts,tsx}",
'!**/src/**/__tests__/**', "!**/src/**/__tests__/**",
'!**/src/**/?(*.)(spec|test).*', "!**/src/**/?(*.)(spec|test).*",
'!**/src/setupProxy.*', "!**/src/setupProxy.*",
'!**/src/setupTests.*', "!**/src/setupTests.*",
], ],
silent: true, silent: true,
// The formatter is invoked directly in WebpackDevServerUtils during development // The formatter is invoked directly in WebpackDevServerUtils during development
@ -715,24 +725,24 @@ module.exports = function (webpackEnv) {
!disableESLintPlugin && !disableESLintPlugin &&
new ESLintPlugin({ new ESLintPlugin({
// Plugin options // Plugin options
extensions: ['js', 'mjs', 'jsx', 'ts', 'tsx'], extensions: ["js", "mjs", "jsx", "ts", "tsx"],
formatter: require.resolve('react-dev-utils/eslintFormatter'), formatter: require.resolve("react-dev-utils/eslintFormatter"),
eslintPath: require.resolve('eslint'), eslintPath: require.resolve("eslint"),
failOnError: !(isEnvDevelopment && emitErrorsAsWarnings), failOnError: !(isEnvDevelopment && emitErrorsAsWarnings),
context: paths.appSrc, context: paths.appSrc,
cache: true, cache: true,
cacheLocation: path.resolve( cacheLocation: path.resolve(
paths.appNodeModules, paths.appNodeModules,
'.cache/.eslintcache' ".cache/.eslintcache"
), ),
// ESLint class options // ESLint class options
cwd: paths.appPath, cwd: paths.appPath,
resolvePluginsRelativeTo: __dirname, resolvePluginsRelativeTo: __dirname,
baseConfig: { baseConfig: {
extends: [require.resolve('eslint-config-react-app/base')], extends: [require.resolve("eslint-config-react-app/base")],
rules: { rules: {
...(!hasJsxRuntime && { ...(!hasJsxRuntime && {
'react/react-in-jsx-scope': 'error', "react/react-in-jsx-scope": "error",
}), }),
}, },
}, },
@ -741,14 +751,14 @@ module.exports = function (webpackEnv) {
// Some libraries import Node modules but don't use them in the browser. // Some libraries import Node modules but don't use them in the browser.
// Tell webpack to provide empty mocks for them so importing them works. // Tell webpack to provide empty mocks for them so importing them works.
node: { node: {
module: 'empty', module: "empty",
dgram: 'empty', dgram: "empty",
dns: 'mock', dns: "mock",
fs: 'empty', fs: "empty",
http2: 'empty', http2: "empty",
net: 'empty', net: "empty",
tls: 'empty', tls: "empty",
child_process: 'empty', child_process: "empty",
}, },
// Turn off performance processing because we utilize // Turn off performance processing because we utilize
// our own hints via the FileSizeReporter // our own hints via the FileSizeReporter

48201
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -57,6 +57,7 @@
"material-ui-player": "^0.2.2", "material-ui-player": "^0.2.2",
"mini-css-extract-plugin": "0.11.3", "mini-css-extract-plugin": "0.11.3",
"optimize-css-assets-webpack-plugin": "5.0.4", "optimize-css-assets-webpack-plugin": "5.0.4",
"pdf-viewer-reactjs": "^2.2.3",
"pnp-webpack-plugin": "1.6.4", "pnp-webpack-plugin": "1.6.4",
"postcss-flexbugs-fixes": "4.2.1", "postcss-flexbugs-fixes": "4.2.1",
"postcss-loader": "3.0.0", "postcss-loader": "3.0.0",
@ -72,6 +73,7 @@
"react-dev-utils": "^11.0.3", "react-dev-utils": "^11.0.3",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-elastic-carousel": "^0.11.5", "react-elastic-carousel": "^0.11.5",
"react-iframe": "^1.8.0",
"react-pdf": "^5.3.2", "react-pdf": "^5.3.2",
"react-player": "^2.9.0", "react-player": "^2.9.0",
"react-qr-reader": "^2.2.1", "react-qr-reader": "^2.2.1",
@ -84,6 +86,7 @@
"react-swipeable-views": "^0.14.0", "react-swipeable-views": "^0.14.0",
"react-toastify": "^7.0.4", "react-toastify": "^7.0.4",
"react-video-js-player": "^1.1.1", "react-video-js-player": "^1.1.1",
"reactjs-pdf-reader": "^1.0.12",
"redux": "^4.1.0", "redux": "^4.1.0",
"redux-devtools-extension": "^2.13.9", "redux-devtools-extension": "^2.13.9",
"redux-thunk": "^2.3.0", "redux-thunk": "^2.3.0",

Binary file not shown.

@ -1,4 +1,4 @@
const CACHE_NAME = "version-11"; const CACHE_NAME = "version-26-6-19";
const urlsToCache = ["index.html", "offline.html"]; const urlsToCache = ["index.html", "offline.html"];
const self = this; const self = this;

@ -31,8 +31,8 @@ import Callback from "./views/Callback/index";
import NewProfile from "./views/NewProfile/index"; import NewProfile from "./views/NewProfile/index";
import Blogs from "./views/Blogs/index"; import Blogs from "./views/Blogs/index";
import Blog from "./views/Blog/index"; import Blog from "./views/Blog/index";
import Sample from "./views/Sample/index"; // import Sample from "./views/Sample/index";
import PDF from "./views/PDF/index";
class AppRouter extends Component { class AppRouter extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -101,8 +101,11 @@ class AppRouter extends Component {
<Route exact path={"/products"}> <Route exact path={"/products"}>
<Products /> <Products />
</Route> </Route>
<Route path={"/sample"}> {/* <Route path={"/sample"}>
<Sample /> <Sample />
</Route> */}
<Route path={"/pdf"}>
<PDF />
</Route> </Route>
<Route exact path={"/newProfile"}> <Route exact path={"/newProfile"}>
{mobile ? ( {mobile ? (

Binary file not shown.

@ -19,7 +19,7 @@ const publicApi = {
getBlogInfo: (data, history) => async (dispatch) => getBlogInfo: (data, history) => async (dispatch) =>
await proxy.get("public/blogInfo", data, { history, dispatch }), await proxy.get("public/blogInfo", data, { history, dispatch }),
filterNewProducts: (data, history) => async (dispatch) => filterNewProducts: (data, history) => async (dispatch) =>
await dispatch({ type: "public/filter", data: data }), await dispatch({ type: "public/filter", data }),
getProvince: (data, history) => async (dispatch) => getProvince: (data, history) => async (dispatch) =>
await proxy.get("public/province", data, { history, dispatch }), await proxy.get("public/province", data, { history, dispatch }),
getCity: (data, history) => async (dispatch) => getCity: (data, history) => async (dispatch) =>

@ -11,7 +11,8 @@ const userFactor = {
update: update:
(data = {}, data2 = {}) => (data = {}, data2 = {}) =>
async (dispatch) => { async (dispatch) => {
await proxy.put("userFactor/update", data); await proxy.put("userFactor/update", data, { dispatch });
await proxy.get("userFactor/info", data2, { dispatch });
}, },
payment: payment:
(data = {}, data2 = {}) => (data = {}, data2 = {}) =>
@ -32,7 +33,7 @@ const userFactor = {
del: del:
(data = {}, data2 = {}) => (data = {}, data2 = {}) =>
async (dispatch) => { async (dispatch) => {
await proxy.delete("userFactor/delete", data); await proxy.delete("userFactor/delete", data, { dispatch });
await proxy.get("userFactor/list", data2, { dispatch }); await proxy.get("userFactor/list", data2, { dispatch });
}, },
}; };

@ -132,7 +132,7 @@ export default function publicApi(state = initialState, action) {
loading: false, loading: false,
error: null, error: null,
homeData: state.homeData.map((item) => homeData: state.homeData.map((item) =>
item.title === "جدیدترین کتابهای دانوین" item.title === "کتابهای دانوین"
? { ...item, data: bySearchFilter } ? { ...item, data: bySearchFilter }
: { ...item } : { ...item }
), ),

@ -20,7 +20,7 @@ export default function user(state = initialState, action) {
toast.success("کد به شماره شما ارسال گردید."); toast.success("کد به شماره شما ارسال گردید.");
return { ...state, loading: false, status: data.profile, error: null }; return { ...state, loading: false, status: data.profile, error: null };
case "user/otp/login": case "user/otp/login":
window.location = "https://dnvn.ir/"; // window.location = "https://dnvn.ir/?" + Math.random();
toast.success("به دانوین خوش آمدید."); toast.success("به دانوین خوش آمدید.");
return { return {
@ -43,7 +43,7 @@ export default function user(state = initialState, action) {
localStorage.removeItem("refresh"); localStorage.removeItem("refresh");
localStorage.removeItem("access"); localStorage.removeItem("access");
localStorage.removeItem("userData"); localStorage.removeItem("userData");
window.location = "https://dnvn.ir/"; // window.location = "https://dnvn.ir/?" + Math.random();
return { ...state, loading: false, status: proxy.status(), error: null }; return { ...state, loading: false, status: proxy.status(), error: null };
case "user/getUserRole": case "user/getUserRole":
return { ...state, loading: false, userRoles: data, error: null }; return { ...state, loading: false, userRoles: data, error: null };

@ -26,6 +26,8 @@ export default function userFactor(state = initialState, action) {
case "userFactor/info": case "userFactor/info":
return { ...state, loading: false, info: data, error: null }; return { ...state, loading: false, info: data, error: null };
case "userFactor/update": case "userFactor/update":
console.log("userFactor/update");
toast.success("درخواست شما با موفقیت انجام شد.");
return { ...state, loading: false, error: null }; return { ...state, loading: false, error: null };
case "userFactor/add": case "userFactor/add":
toast.success("درخواست شما با موفقیت انجام شد."); toast.success("درخواست شما با موفقیت انجام شد.");
@ -40,6 +42,7 @@ export default function userFactor(state = initialState, action) {
case "userFactor/loading": case "userFactor/loading":
return { ...state, loading: true }; return { ...state, loading: true };
case "userFactor/error": case "userFactor/error":
console.log("error");
toast.error(data.message); toast.error(data.message);
return { ...state, loading: false, error: data.message }; return { ...state, loading: false, error: data.message };
default: default:

@ -2,7 +2,6 @@ import React, { Component } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import proxy from "~/Redux/proxy"; import proxy from "~/Redux/proxy";
import "./index.scss"; import "./index.scss";
const status = proxy.status();
const maxDesktopSize = 1250; const maxDesktopSize = 1250;
const fontSize = { const fontSize = {
@ -19,6 +18,8 @@ export default class Simple extends Component {
render() { render() {
const mobile = window.innerWidth < 1000; const mobile = window.innerWidth < 1000;
const { height, data } = this.props; const { height, data } = this.props;
const status = proxy.status();
return ( return (
<article <article
className="slider-simple d-flex flex-column" className="slider-simple d-flex flex-column"

@ -3,7 +3,7 @@ import ChevronLeftIcon from "@material-ui/icons/ChevronLeft";
import Identifier from "./Identifier/index"; import Identifier from "./Identifier/index";
import proxy from "~/Redux/proxy"; import proxy from "~/Redux/proxy";
import "./index.scss"; import "./index.scss";
const status = proxy.status();
const maxDesktopSize = 1250; const maxDesktopSize = 1250;
const fontSize = { const fontSize = {
@ -14,7 +14,9 @@ const fontSize = {
export default class HomeStatic extends Component { export default class HomeStatic extends Component {
render() { render() {
const status = proxy.status();
const { data, height, title, designType } = this.props; const { data, height, title, designType } = this.props;
console.log(data);
return ( return (
<> <>
{window.innerWidth > 1000 ? ( {window.innerWidth > 1000 ? (
@ -49,10 +51,10 @@ export default class HomeStatic extends Component {
{window.innerWidth < 1000 ? ( {window.innerWidth < 1000 ? (
<section <section
className="mobile-home-static d-flex" className="mobile-home-static d-flex"
style={{ height: height, margin: "5px 0px" }} style={{ height: height }}
> >
{data.map((item, i) => {data.map((item, i) =>
status ? ( proxy.status() ? (
<Identifier data={item} key={i} status={status} /> <Identifier data={item} key={i} status={status} />
) : ( ) : (
<Item data={item} height={height} key={i} /> <Item data={item} height={height} key={i} />

@ -102,7 +102,10 @@ class LaptopNavbar extends Component {
onClose={() => this.setState({ dropdown: false })} onClose={() => this.setState({ dropdown: false })}
> >
<MenuItem onClick={() => this.setState({ dropdown: false })}> <MenuItem onClick={() => this.setState({ dropdown: false })}>
<Link to={"/newProfile"}>اضافه کردن حساب</Link> <Link to={"/profile"}>ویرایش مشخصات</Link>
</MenuItem>
<MenuItem onClick={() => this.setState({ dropdown: false })}>
<Link to={"/newProfile"}>افزودن حساب</Link>
</MenuItem> </MenuItem>
<MenuItem <MenuItem
onClick={() => { onClick={() => {

@ -53,7 +53,6 @@ class Home extends Component {
} }
//componentDidupdate = this.componentDidMount(); //componentDidupdate = this.componentDidMount();
render() { render() {
console.log("!xx");
const { homeData, loading, status } = this.props; const { homeData, loading, status } = this.props;
if (!loading && this.props.homeData.length == 0) if (!loading && this.props.homeData.length == 0)
return this.componentDidMount(); return this.componentDidMount();
@ -68,6 +67,7 @@ class Home extends Component {
<Loader /> <Loader />
</div> </div>
); );
console.log({ homeData });
return ( return (
<> <>
<> <>
@ -99,6 +99,7 @@ export default connect(
)(Home); )(Home);
const Identifier = (props) => { const Identifier = (props) => {
console.log({ item: props.item });
return ( return (
<> <>
{props.item.type === "header" ? ( {props.item.type === "header" ? (

@ -0,0 +1,23 @@
import React, { Component } from "react";
import Iframe from "react-iframe";
import Navbar from "../Home/Navbar/index";
export default class Test extends Component {
render() {
const id = +window.location.pathname.split("/").slice(-1)[0];
return (
<div style={{ height: "100%" }}>
<Navbar />
<br />
<br />
<Iframe
url={"https://dnvn.ir/xpdf/" + id}
width="100%"
height="100%"
style={{ position: "relative", top: 80 }}
/>
</div>
);
}
}

@ -0,0 +1,5 @@
.sample {
&_document {
margin-top: 85px;
}
}

@ -67,16 +67,17 @@ function AddToCart(props) {
</span> </span>
) : null} ) : null}
</div> </div>
<a <Link
href={file(sampleFileId)} to={"/pdf/" + sampleFileId}
target="_blank" // href={file(sampleFileId)}
rel="noopener noreferrer" // target="_blank"
// rel="noopener noreferrer"
style={{ fontSize: fontSize.desktop.button }} style={{ fontSize: fontSize.desktop.button }}
className="product-addtocart__box--sampleButton" className="product-addtocart__box--sampleButton"
> >
مشاهده نمونه کتاب مشاهده نمونه کتاب
<img src={document_red} alt="" /> <img src={document_red} alt="" />
</a> </Link>
<Link <Link
// to={`/products/${ // to={`/products/${
// page === "digital" // page === "digital"

@ -201,8 +201,13 @@ class Product extends Component {
{page === "digital" ? "نسخه چاپی" : "نسخه الکترونیک"} {page === "digital" ? "نسخه چاپی" : "نسخه الکترونیک"}
</Link> </Link>
<Link <Link
to={
info.sampleFileId ? `/pdf/${info.sampleFileId}` : "#"
}
onClick={() => onClick={() =>
toast.info("برای این کتاب نمونهای درج نشده است.") !info.sampleFileId
? toast.info("برای این کتاب نمونهای درج نشده است.")
: null
} }
className="mobile-product__header--purchase" className="mobile-product__header--purchase"
style={{ fontSize: fontSize.mobile.a }} style={{ fontSize: fontSize.mobile.a }}

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import PictureAsPdfRoundedIcon from "@material-ui/icons/PictureAsPdfRounded"; import PictureAsPdfRoundedIcon from "@material-ui/icons/PictureAsPdfRounded";
import "./index.scss"; import "./index.scss";
import { Link } from "react-router-dom";
const maxDesktopSize = 1250; const maxDesktopSize = 1250;
const maxMobileSize = 550; const maxMobileSize = 550;
@ -22,15 +22,16 @@ export default function PDF(props) {
return ( return (
<> <>
{window.innerWidth > 1000 ? ( {window.innerWidth > 1000 ? (
<div className="d-flex flex-column"> <Link to={`pdf/${props.data.fileIds}`} className="d-flex flex-column">
<h3 style={{ fontSize: fontSize.desktop.h3 }}> <h3 style={{ fontSize: fontSize.desktop.h3 }}>
<PictureAsPdfRoundedIcon style={{ fontSize: 30 }} /> فایل PDF <PictureAsPdfRoundedIcon style={{ fontSize: 30 }} /> فایل PDF
</h3> </h3>
<a <a
href={`https://dnvn.ir/api/v1/file/${props.data.fileIds}`}
download
className="pdf-box d-flex flex-column" className="pdf-box d-flex flex-column"
id="pdf" id="pdf"
target="_blank"
rel="noreferrer"
href={`https://dnvn.ir/xpdf/${props.data.fileIds}`}
> >
<h2 <h2
style={{ fontSize: fontSize.desktop.h2 }} style={{ fontSize: fontSize.desktop.h2 }}
@ -43,19 +44,20 @@ export default function PDF(props) {
برای دانلود این فایل روی اینجا کلیک کن برای دانلود این فایل روی اینجا کلیک کن
</div> </div>
</a> </a>
</div> </Link>
) : null} ) : null}
{window.innerWidth < 1000 ? ( {window.innerWidth < 1000 ? (
<div className="d-flex flex-column"> <Link
to={`pdf/${props.data.fileIds}`}
className="d-flex flex-column"
// onClick={() => {
// window.location = `https://dnvn.ir/xpdf/${props.data.fileIds}`;
// }}
>
<h3 style={{ fontSize: fontSize.mobile.h3 }}> <h3 style={{ fontSize: fontSize.mobile.h3 }}>
<PictureAsPdfRoundedIcon style={{ fontSize: 30 }} /> فایل PDF <PictureAsPdfRoundedIcon style={{ fontSize: 30 }} /> فایل PDF
</h3> </h3>
<a <div className="mobile-pdf-box d-flex flex-column">
href={`https://dnvn.ir/api/v1/file/${props.data.fileIds}`}
id="pdf"
download
className="mobile-pdf-box d-flex flex-column"
>
<h2 <h2
style={{ fontSize: fontSize.mobile.h2 }} style={{ fontSize: fontSize.mobile.h2 }}
className="d-flex align-items-center" className="d-flex align-items-center"
@ -63,11 +65,16 @@ export default function PDF(props) {
<span></span> <span></span>
{props.data.name} {props.data.name}
</h2> </h2>
<div style={{ fontSize: fontSize.mobile.div }}> {/* <a
برای دانلود این فایل روی اینجا کلیک کن target="_blank"
</div> rel="noreferrer"
</a> href={`https://dnvn.ir/xpdf/${props.data.fileIds}`}
style={{ fontSize: fontSize.mobile.div }}
>
دریافت فایل
</a> */}
</div> </div>
</Link>
) : null} ) : null}
</> </>
); );

@ -9,6 +9,7 @@
background: url(../../../assets/icons/pdf.svg) no-repeat #ffa9a91e; background: url(../../../assets/icons/pdf.svg) no-repeat #ffa9a91e;
background-size: 50px; background-size: 50px;
background-position: 18px 50%; background-position: 18px 50%;
cursor: pointer;
h2 { h2 {
font-family: numeralMedium; font-family: numeralMedium;
font-size: calc(100vw / 32); font-size: calc(100vw / 32);

@ -18,9 +18,9 @@ export default function Sample({ fileId }) {
setProgress(null); setProgress(null);
} }
const id = +window.location.pathname.split("/").slice(-1)[0]; const id = +window.location.pathname.split("/").slice(-1)[0];
console.log(progress); console.log({ pageNumber });
return ( return (
<div className="sample"> <div className="sample" style={{ direction: "ltr" }}>
<Navbar page="sample" /> <Navbar page="sample" />
<br /> <br />
<br /> <br />
@ -29,16 +29,17 @@ export default function Sample({ fileId }) {
<LinearProgress variant="determinate" value={progress} /> <LinearProgress variant="determinate" value={progress} />
) : null} ) : null}
<Document <Document
height="400" // height="400"
width="300" // width="300"
className="sample_documnet" className="sample_documnet"
onLoadProgress={({ loaded, total }) => { onLoadProgress={({ loaded, total }) => {
console.log({ loaded, total, progress }); console.log({ loaded, total, progress });
setProgress((loaded / total) * 100); //setProgress((loaded / total) * 100);
}} }}
//file={"../" + id + ".pdf"} //file={"../8.pdf"}
//file={"https://dnvn.ir/files/sample/science/7.pdf"} //file={"https://dnvn.ir/files/sample/science/7.pdf"}
file={file(id)} file={file(id)}
cd
onLoadSuccess={onDocumentLoadSuccess} onLoadSuccess={onDocumentLoadSuccess}
> >
<Page <Page
@ -46,12 +47,31 @@ export default function Sample({ fileId }) {
noData="نمونه ای برای این محصول درج نشده است" noData="نمونه ای برای این محصول درج نشده است"
/> />
</Document> </Document>
<div onClick={() => setPageNumber(Math.max(1, pageNumber - 1))}>قبل</div>
<p> <p>
صفجه {pageNumber} از {numPages} صفجه {pageNumber} از {numPages}
</p> </p>
<div onClick={() => setPageNumber(Math.min(numPages, pageNumber + 1))}> <div
بعد{" "} style={{
borederRadius: 5,
backgroundColor: "green",
color: "white",
cursor: "pointer",
}}
onClick={() => setPageNumber(Math.max(1, pageNumber - 1))}
>
قبل
</div>
<div
onClick={() => setPageNumber(Math.min(numPages, pageNumber + 1))}
style={{
borederRadius: 5,
backgroundColor: "green",
color: "white",
cursor: "pointer",
}}
>
بعد
</div> </div>
</div> </div>
); );

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save