From ebdcf3c301b032d71b729283ad82dd8717d7d473 Mon Sep 17 00:00:00 2001 From: amirhoseingorji Date: Thu, 16 May 2024 05:25:30 +0330 Subject: [PATCH] update 51 files --- public/index.html | 154 +- public/serviceworker.js | 82 +- scripts/build.js | 424 +++--- scripts/start.js | 330 ++--- src/App.js | 72 +- src/AppRouter.js | 840 +++++------ src/QRScan/Scanner/index.js | 114 +- src/QRScan/index.js | 488 +++---- src/Redux/reducers/blog.js | 56 +- src/Redux/reducers/public.js | 386 ++--- src/views/About/index.js | 562 ++++---- src/views/Arabickar/index.js | 96 +- src/views/Auth/Login/index.js | 110 +- src/views/Auth/Profile/Birthdate/index.js | 214 +-- src/views/Auth/Profile/index.js | 1226 ++++++++-------- src/views/Cart/Discount/index.js | 330 ++--- src/views/Cart/Table/index.js | 926 ++++++------ src/views/Cart/index.js | 864 +++++------ .../Body/Message/MultiSelect/index.js | 146 +- .../ChatRoom/Body/Message/Select/index.js | 128 +- .../ChatRoom/Body/Message/Slider/index.js | 120 +- src/views/ChatRoom/Body/Message/Sort/index.js | 118 +- src/views/ChatRoom/Body/Message/Tap/index.js | 60 +- src/views/ChatRoom/Body/index.js | 1272 ++++++++--------- src/views/Checkout/Discount/index.js | 184 +-- src/views/Checkout/Table/index.js | 510 +++---- src/views/Checkout/index.js | 1136 +++++++-------- src/views/Contact/index.js | 344 ++--- src/views/Download/Item/index.js | 128 +- src/views/Home/Footer/index.js | 510 +++---- src/views/Home/HomeSlider/Header/index.js | 150 +- src/views/Home/HomeSlider/index.js | 402 +++--- src/views/Home/HomeStatic/index.js | 278 ++-- src/views/Home/Navbar/Laptop/index.js | 538 +++---- src/views/Home/index.js | 348 ++--- src/views/MyBooks/index.js | 202 +-- src/views/NewProfile/index.js | 1086 +++++++------- src/views/Orders/index.js | 290 ++-- src/views/PDF/index.js | 50 +- src/views/Product/Info/index.js | 62 +- src/views/Product/index.js | 912 ++++++------ .../Products/Filters/TypicalFilters/index.js | 236 +-- src/views/Products/List/index.js | 178 +-- src/views/Products/Product/index.js | 416 +++--- src/views/Products/Select/index.js | 180 +-- src/views/Products/Sort/index.js | 142 +- src/views/Products/index.js | 348 ++--- src/views/QRScan/LastQr/index.js | 94 +- src/views/QRScan/Scanner/index.js | 98 +- src/views/QRScan/index.js | 358 ++--- src/views/Support/index.js | 386 ++--- 51 files changed, 9355 insertions(+), 9329 deletions(-) diff --git a/public/index.html b/public/index.html index 01dcf92..81cad50 100644 --- a/public/index.html +++ b/public/index.html @@ -1,78 +1,78 @@ - - - - - - - - - - - - - - - - دانوین - - - - - - - - - - - -
- - - + + + + + + + + + + + + + + + + دانوین + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/public/serviceworker.js b/public/serviceworker.js index fe51607..7735711 100644 --- a/public/serviceworker.js +++ b/public/serviceworker.js @@ -1,41 +1,41 @@ -const CACHE_NAME = "version-26-6-19aimmi"; -const urlsToCache = ["index.html", "offline.html"]; - -const self = this; - -//Install SW -self.addEventListener("install", (event) => { - event.waitUntil( - caches.open(CACHE_NAME).then((cache) => { - console.log("Opened cache"); - - return cache.addAll(urlsToCache); - }) - ); -}); - -//Listen for requests -self.addEventListener("fetch", (event) => { - event.respondWith( - caches.match(event.request).then(() => { - return fetch(event.request).catch(() => caches.match("offline.html")); - }) - ); -}); -//Activate the SW -self.addEventListener("activate", (event) => { - const cacheWhiteList = []; - cacheWhiteList.push(CACHE_NAME); - - event.waitUntil( - caches.keys().then((cacheNames) => - Promise.all( - cacheNames.map((cacheName) => { - if (!cacheWhiteList.includes(cacheName)) { - return caches.delete(cacheName); - } - }) - ) - ) - ); -}); +const CACHE_NAME = "version-26-6-34aimmi"; +const urlsToCache = ["index.html", "offline.html"]; + +const self = this; + +//Install SW +self.addEventListener("install", (event) => { + event.waitUntil( + caches.open(CACHE_NAME).then((cache) => { + console.log("Opened cache"); + + return cache.addAll(urlsToCache); + }) + ); +}); + +//Listen for requests +self.addEventListener("fetch", (event) => { + event.respondWith( + caches.match(event.request).then(() => { + return fetch(event.request).catch(() => caches.match("offline.html")); + }) + ); +}); +//Activate the SW +self.addEventListener("activate", (event) => { + const cacheWhiteList = []; + cacheWhiteList.push(CACHE_NAME); + + event.waitUntil( + caches.keys().then((cacheNames) => + Promise.all( + cacheNames.map((cacheName) => { + if (!cacheWhiteList.includes(cacheName)) { + return caches.delete(cacheName); + } + }) + ) + ) + ); +}); diff --git a/scripts/build.js b/scripts/build.js index 05f340f..c8fbc65 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -1,212 +1,212 @@ -'use strict'; - -// Do this as the first thing so that any code reading it knows the right env. -process.env.BABEL_ENV = 'production'; -process.env.NODE_ENV = 'production'; - -// Makes the script crash on unhandled rejections instead of silently -// ignoring them. In the future, promise rejections that are not handled will -// terminate the Node.js process with a non-zero exit code. -process.on('unhandledRejection', err => { - throw err; -}); - -// Ensure environment variables are read. -require('../config/env'); - - -const path = require('path'); -const chalk = require('react-dev-utils/chalk'); -const fs = require('fs-extra'); -const bfj = require('bfj'); -const webpack = require('webpack'); -const configFactory = require('../config/webpack.config'); -const paths = require('../config/paths'); -const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles'); -const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages'); -const printHostingInstructions = require('react-dev-utils/printHostingInstructions'); -const FileSizeReporter = require('react-dev-utils/FileSizeReporter'); -const printBuildError = require('react-dev-utils/printBuildError'); - -const measureFileSizesBeforeBuild = - FileSizeReporter.measureFileSizesBeforeBuild; -const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild; -const useYarn = fs.existsSync(paths.yarnLockFile); - -// These sizes are pretty large. We'll warn for bundles exceeding them. -const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024; -const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024; - -const isInteractive = process.stdout.isTTY; - -// Warn and crash if required files are missing -if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { - process.exit(1); -} - -const argv = process.argv.slice(2); -const writeStatsJson = argv.indexOf('--stats') !== -1; - -// Generate configuration -const config = configFactory('production'); - -// We require that you explicitly set browsers and do not fall back to -// browserslist defaults. -const { checkBrowsers } = require('react-dev-utils/browsersHelper'); -checkBrowsers(paths.appPath, isInteractive) - .then(() => { - // First, read the current file sizes in build directory. - // This lets us display how much they changed later. - return measureFileSizesBeforeBuild(paths.appBuild); - }) - .then(previousFileSizes => { - // Remove all content but keep the directory so that - // if you're in it, you don't end up in Trash - fs.emptyDirSync(paths.appBuild); - // Merge with the public folder - copyPublicFolder(); - // Start the webpack build - return build(previousFileSizes); - }) - .then( - ({ stats, previousFileSizes, warnings }) => { - if (warnings.length) { - console.log(chalk.yellow('Compiled with warnings.\n')); - console.log(warnings.join('\n\n')); - console.log( - '\nSearch for the ' + - chalk.underline(chalk.yellow('keywords')) + - ' to learn more about each warning.' - ); - console.log( - 'To ignore, add ' + - chalk.cyan('// eslint-disable-next-line') + - ' to the line before.\n' - ); - } else { - console.log(chalk.green('Compiled successfully.\n')); - } - - console.log('File sizes after gzip:\n'); - printFileSizesAfterBuild( - stats, - previousFileSizes, - paths.appBuild, - WARN_AFTER_BUNDLE_GZIP_SIZE, - WARN_AFTER_CHUNK_GZIP_SIZE - ); - console.log(); - - const appPackage = require(paths.appPackageJson); - const publicUrl = paths.publicUrlOrPath; - const publicPath = config.output.publicPath; - const buildFolder = path.relative(process.cwd(), paths.appBuild); - printHostingInstructions( - appPackage, - publicUrl, - publicPath, - buildFolder, - useYarn - ); - }, - err => { - const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true'; - if (tscCompileOnError) { - console.log( - chalk.yellow( - 'Compiled with the following type errors (you may want to check these before deploying your app):\n' - ) - ); - printBuildError(err); - } else { - console.log(chalk.red('Failed to compile.\n')); - printBuildError(err); - process.exit(1); - } - } - ) - .catch(err => { - if (err && err.message) { - console.log(err.message); - } - process.exit(1); - }); - -// Create the production build and print the deployment instructions. -function build(previousFileSizes) { - console.log('Creating an optimized production build...'); - - const compiler = webpack(config); - return new Promise((resolve, reject) => { - compiler.run((err, stats) => { - let messages; - if (err) { - if (!err.message) { - return reject(err); - } - - let errMessage = err.message; - - // Add additional information for postcss errors - if (Object.prototype.hasOwnProperty.call(err, 'postcssNode')) { - errMessage += - '\nCompileError: Begins at CSS selector ' + - err['postcssNode'].selector; - } - - messages = formatWebpackMessages({ - errors: [errMessage], - warnings: [], - }); - } else { - messages = formatWebpackMessages( - stats.toJson({ all: false, warnings: true, errors: true }) - ); - } - if (messages.errors.length) { - // Only keep the first error. Others are often indicative - // of the same problem, but confuse the reader with noise. - if (messages.errors.length > 1) { - messages.errors.length = 1; - } - return reject(new Error(messages.errors.join('\n\n'))); - } - if ( - process.env.CI && - (typeof process.env.CI !== 'string' || - process.env.CI.toLowerCase() !== 'false') && - messages.warnings.length - ) { - console.log( - chalk.yellow( - '\nTreating warnings as errors because process.env.CI = true.\n' + - 'Most CI servers set it automatically.\n' - ) - ); - return reject(new Error(messages.warnings.join('\n\n'))); - } - - const resolveArgs = { - stats, - previousFileSizes, - warnings: messages.warnings, - }; - - if (writeStatsJson) { - return bfj - .write(paths.appBuild + '/bundle-stats.json', stats.toJson()) - .then(() => resolve(resolveArgs)) - .catch(error => reject(new Error(error))); - } - - return resolve(resolveArgs); - }); - }); -} - -function copyPublicFolder() { - fs.copySync(paths.appPublic, paths.appBuild, { - dereference: true, - filter: file => file !== paths.appHtml, - }); -} +'use strict'; + +// Do this as the first thing so that any code reading it knows the right env. +process.env.BABEL_ENV = 'production'; +process.env.NODE_ENV = 'production'; + +// Makes the script crash on unhandled rejections instead of silently +// ignoring them. In the future, promise rejections that are not handled will +// terminate the Node.js process with a non-zero exit code. +process.on('unhandledRejection', err => { + throw err; +}); + +// Ensure environment variables are read. +require('../config/env'); + + +const path = require('path'); +const chalk = require('react-dev-utils/chalk'); +const fs = require('fs-extra'); +const bfj = require('bfj'); +const webpack = require('webpack'); +const configFactory = require('../config/webpack.config'); +const paths = require('../config/paths'); +const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles'); +const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages'); +const printHostingInstructions = require('react-dev-utils/printHostingInstructions'); +const FileSizeReporter = require('react-dev-utils/FileSizeReporter'); +const printBuildError = require('react-dev-utils/printBuildError'); + +const measureFileSizesBeforeBuild = + FileSizeReporter.measureFileSizesBeforeBuild; +const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild; +const useYarn = fs.existsSync(paths.yarnLockFile); + +// These sizes are pretty large. We'll warn for bundles exceeding them. +const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024; +const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024; + +const isInteractive = process.stdout.isTTY; + +// Warn and crash if required files are missing +if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { + process.exit(1); +} + +const argv = process.argv.slice(2); +const writeStatsJson = argv.indexOf('--stats') !== -1; + +// Generate configuration +const config = configFactory('production'); + +// We require that you explicitly set browsers and do not fall back to +// browserslist defaults. +const { checkBrowsers } = require('react-dev-utils/browsersHelper'); +checkBrowsers(paths.appPath, isInteractive) + .then(() => { + // First, read the current file sizes in build directory. + // This lets us display how much they changed later. + return measureFileSizesBeforeBuild(paths.appBuild); + }) + .then(previousFileSizes => { + // Remove all content but keep the directory so that + // if you're in it, you don't end up in Trash + fs.emptyDirSync(paths.appBuild); + // Merge with the public folder + copyPublicFolder(); + // Start the webpack build + return build(previousFileSizes); + }) + .then( + ({ stats, previousFileSizes, warnings }) => { + if (warnings.length) { + console.log(chalk.yellow('Compiled with warnings.\n')); + console.log(warnings.join('\n\n')); + console.log( + '\nSearch for the ' + + chalk.underline(chalk.yellow('keywords')) + + ' to learn more about each warning.' + ); + console.log( + 'To ignore, add ' + + chalk.cyan('// eslint-disable-next-line') + + ' to the line before.\n' + ); + } else { + console.log(chalk.green('Compiled successfully.\n')); + } + + console.log('File sizes after gzip:\n'); + printFileSizesAfterBuild( + stats, + previousFileSizes, + paths.appBuild, + WARN_AFTER_BUNDLE_GZIP_SIZE, + WARN_AFTER_CHUNK_GZIP_SIZE + ); + console.log(); + + const appPackage = require(paths.appPackageJson); + const publicUrl = paths.publicUrlOrPath; + const publicPath = config.output.publicPath; + const buildFolder = path.relative(process.cwd(), paths.appBuild); + printHostingInstructions( + appPackage, + publicUrl, + publicPath, + buildFolder, + useYarn + ); + }, + err => { + const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true'; + if (tscCompileOnError) { + console.log( + chalk.yellow( + 'Compiled with the following type errors (you may want to check these before deploying your app):\n' + ) + ); + printBuildError(err); + } else { + console.log(chalk.red('Failed to compile.\n')); + printBuildError(err); + process.exit(1); + } + } + ) + .catch(err => { + if (err && err.message) { + console.log(err.message); + } + process.exit(1); + }); + +// Create the production build and print the deployment instructions. +function build(previousFileSizes) { + console.log('Creating an optimized production build...'); + + const compiler = webpack(config); + return new Promise((resolve, reject) => { + compiler.run((err, stats) => { + let messages; + if (err) { + if (!err.message) { + return reject(err); + } + + let errMessage = err.message; + + // Add additional information for postcss errors + if (Object.prototype.hasOwnProperty.call(err, 'postcssNode')) { + errMessage += + '\nCompileError: Begins at CSS selector ' + + err['postcssNode'].selector; + } + + messages = formatWebpackMessages({ + errors: [errMessage], + warnings: [], + }); + } else { + messages = formatWebpackMessages( + stats.toJson({ all: false, warnings: true, errors: true }) + ); + } + if (messages.errors.length) { + // Only keep the first error. Others are often indicative + // of the same problem, but confuse the reader with noise. + if (messages.errors.length > 1) { + messages.errors.length = 1; + } + return reject(new Error(messages.errors.join('\n\n'))); + } + if ( + process.env.CI && + (typeof process.env.CI !== 'string' || + process.env.CI.toLowerCase() !== 'false') && + messages.warnings.length + ) { + console.log( + chalk.yellow( + '\nTreating warnings as errors because process.env.CI = true.\n' + + 'Most CI servers set it automatically.\n' + ) + ); + return reject(new Error(messages.warnings.join('\n\n'))); + } + + const resolveArgs = { + stats, + previousFileSizes, + warnings: messages.warnings, + }; + + if (writeStatsJson) { + return bfj + .write(paths.appBuild + '/bundle-stats.json', stats.toJson()) + .then(() => resolve(resolveArgs)) + .catch(error => reject(new Error(error))); + } + + return resolve(resolveArgs); + }); + }); +} + +function copyPublicFolder() { + fs.copySync(paths.appPublic, paths.appBuild, { + dereference: true, + filter: file => file !== paths.appHtml, + }); +} diff --git a/scripts/start.js b/scripts/start.js index c6a2215..03f4309 100644 --- a/scripts/start.js +++ b/scripts/start.js @@ -1,165 +1,165 @@ -"use strict"; - -// Do this as the first thing so that any code reading it knows the right env. -process.env.BABEL_ENV = "development"; -process.env.NODE_ENV = "development"; - -// Makes the script crash on unhandled rejections instead of silently -// ignoring them. In the future, promise rejections that are not handled will -// terminate the Node.js process with a non-zero exit code. -process.on("unhandledRejection", (err) => { - throw err; -}); - -// Ensure environment variables are read. -require("../config/env"); - -const fs = require("fs"); -const chalk = require("react-dev-utils/chalk"); -const webpack = require("webpack"); -const WebpackDevServer = require("webpack-dev-server"); -const clearConsole = require("react-dev-utils/clearConsole"); -const checkRequiredFiles = require("react-dev-utils/checkRequiredFiles"); -const { - choosePort, - createCompiler, - prepareProxy, - prepareUrls, -} = require("react-dev-utils/WebpackDevServerUtils"); -const openBrowser = require("react-dev-utils/openBrowser"); -const semver = require("semver"); -const paths = require("../config/paths"); -const configFactory = require("../config/webpack.config"); -const createDevServerConfig = require("../config/webpackDevServer.config"); -const getClientEnvironment = require("../config/env"); -const react = require(require.resolve("react", { paths: [paths.appPath] })); - -const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1)); -const useYarn = fs.existsSync(paths.yarnLockFile); -const isInteractive = process.stdout.isTTY; - -// Warn and crash if required files are missing -if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { - process.exit(1); -} - -// Tools like Cloud9 rely on this. -const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000; -const HOST = process.env.HOST || "0.0.0.0"; - -if (process.env.HOST) { - console.log( - chalk.cyan( - `Attempting to bind to HOST environment variable: ${chalk.yellow( - chalk.bold(process.env.HOST) - )}` - ) - ); - console.log( - `If this was unintentional, check that you haven't mistakenly set it in your shell.` - ); - console.log( - `Learn more here: ${chalk.yellow("https://cra.link/advanced-config")}` - ); - console.log(); -} - -// We require that you explicitly set browsers and do not fall back to -// browserslist defaults. -const { checkBrowsers } = require("react-dev-utils/browsersHelper"); -checkBrowsers(paths.appPath, isInteractive) - .then(() => { - // We attempt to use the default port but if it is busy, we offer the user to - // run on a different port. `choosePort()` Promise resolves to the next free port. - return choosePort(HOST, DEFAULT_PORT); - }) - .then((port) => { - if (port == null) { - // We have not found a port. - return; - } - - const config = configFactory("development"); - const protocol = process.env.HTTPS === "true" ? "https" : "http"; - const appName = require(paths.appPackageJson).name; - - const useTypeScript = fs.existsSync(paths.appTsConfig); - const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === "true"; - const urls = prepareUrls( - protocol, - HOST, - port, - paths.publicUrlOrPath.slice(0, -1) - ); - const devSocket = { - warnings: (warnings) => - devServer.sockWrite(devServer.sockets, "warnings", warnings), - errors: (errors) => - devServer.sockWrite(devServer.sockets, "errors", errors), - }; - // Create a webpack compiler that is configured with custom messages. - const compiler = createCompiler({ - appName, - config, - devSocket, - urls, - useYarn, - useTypeScript, - tscCompileOnError, - webpack, - }); - // Load proxy config - const proxySetting = require(paths.appPackageJson).proxy; - const proxyConfig = prepareProxy( - proxySetting, - paths.appPublic, - paths.publicUrlOrPath - ); - // Serve webpack assets generated by the compiler over a web server. - const serverConfig = createDevServerConfig( - proxyConfig, - urls.lanUrlForConfig - ); - const devServer = new WebpackDevServer(compiler, serverConfig); - // Launch WebpackDevServer. - devServer.listen(port, HOST, (err) => { - if (err) { - return console.log(err); - } - if (isInteractive) { - clearConsole(); - } - - if (env.raw.FAST_REFRESH && semver.lt(react.version, "16.10.0")) { - console.log( - chalk.yellow( - `Fast Refresh requires React 16.10 or higher. You are using React ${react.version}.` - ) - ); - } - - console.log(chalk.cyan("Starting the development server...\n")); - openBrowser(urls.localUrlForBrowser); - }); - - ["SIGINT", "SIGTERM"].forEach(function (sig) { - process.on(sig, function () { - devServer.close(); - process.exit(); - }); - }); - - if (process.env.CI !== "true") { - // Gracefully exit when stdin ends - process.stdin.on("end", function () { - devServer.close(); - process.exit(); - }); - } - }) - .catch((err) => { - if (err && err.message) { - console.log(err.message); - } - process.exit(1); - }); +"use strict"; + +// Do this as the first thing so that any code reading it knows the right env. +process.env.BABEL_ENV = "development"; +process.env.NODE_ENV = "development"; + +// Makes the script crash on unhandled rejections instead of silently +// ignoring them. In the future, promise rejections that are not handled will +// terminate the Node.js process with a non-zero exit code. +process.on("unhandledRejection", (err) => { + throw err; +}); + +// Ensure environment variables are read. +require("../config/env"); + +const fs = require("fs"); +const chalk = require("react-dev-utils/chalk"); +const webpack = require("webpack"); +const WebpackDevServer = require("webpack-dev-server"); +const clearConsole = require("react-dev-utils/clearConsole"); +const checkRequiredFiles = require("react-dev-utils/checkRequiredFiles"); +const { + choosePort, + createCompiler, + prepareProxy, + prepareUrls, +} = require("react-dev-utils/WebpackDevServerUtils"); +const openBrowser = require("react-dev-utils/openBrowser"); +const semver = require("semver"); +const paths = require("../config/paths"); +const configFactory = require("../config/webpack.config"); +const createDevServerConfig = require("../config/webpackDevServer.config"); +const getClientEnvironment = require("../config/env"); +const react = require(require.resolve("react", { paths: [paths.appPath] })); + +const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1)); +const useYarn = fs.existsSync(paths.yarnLockFile); +const isInteractive = process.stdout.isTTY; + +// Warn and crash if required files are missing +if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { + process.exit(1); +} + +// Tools like Cloud9 rely on this. +const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000; +const HOST = process.env.HOST || "0.0.0.0"; + +if (process.env.HOST) { + console.log( + chalk.cyan( + `Attempting to bind to HOST environment variable: ${chalk.yellow( + chalk.bold(process.env.HOST) + )}` + ) + ); + console.log( + `If this was unintentional, check that you haven't mistakenly set it in your shell.` + ); + console.log( + `Learn more here: ${chalk.yellow("https://cra.link/advanced-config")}` + ); + console.log(); +} + +// We require that you explicitly set browsers and do not fall back to +// browserslist defaults. +const { checkBrowsers } = require("react-dev-utils/browsersHelper"); +checkBrowsers(paths.appPath, isInteractive) + .then(() => { + // We attempt to use the default port but if it is busy, we offer the user to + // run on a different port. `choosePort()` Promise resolves to the next free port. + return choosePort(HOST, DEFAULT_PORT); + }) + .then((port) => { + if (port == null) { + // We have not found a port. + return; + } + + const config = configFactory("development"); + const protocol = process.env.HTTPS === "true" ? "https" : "http"; + const appName = require(paths.appPackageJson).name; + + const useTypeScript = fs.existsSync(paths.appTsConfig); + const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === "true"; + const urls = prepareUrls( + protocol, + HOST, + port, + paths.publicUrlOrPath.slice(0, -1) + ); + const devSocket = { + warnings: (warnings) => + devServer.sockWrite(devServer.sockets, "warnings", warnings), + errors: (errors) => + devServer.sockWrite(devServer.sockets, "errors", errors), + }; + // Create a webpack compiler that is configured with custom messages. + const compiler = createCompiler({ + appName, + config, + devSocket, + urls, + useYarn, + useTypeScript, + tscCompileOnError, + webpack, + }); + // Load proxy config + const proxySetting = require(paths.appPackageJson).proxy; + const proxyConfig = prepareProxy( + proxySetting, + paths.appPublic, + paths.publicUrlOrPath + ); + // Serve webpack assets generated by the compiler over a web server. + const serverConfig = createDevServerConfig( + proxyConfig, + urls.lanUrlForConfig + ); + const devServer = new WebpackDevServer(compiler, serverConfig); + // Launch WebpackDevServer. + devServer.listen(port, HOST, (err) => { + if (err) { + return console.log(err); + } + if (isInteractive) { + clearConsole(); + } + + if (env.raw.FAST_REFRESH && semver.lt(react.version, "16.10.0")) { + console.log( + chalk.yellow( + `Fast Refresh requires React 16.10 or higher. You are using React ${react.version}.` + ) + ); + } + + console.log(chalk.cyan("Starting the development server...\n")); + openBrowser(urls.localUrlForBrowser); + }); + + ["SIGINT", "SIGTERM"].forEach(function (sig) { + process.on(sig, function () { + devServer.close(); + process.exit(); + }); + }); + + if (process.env.CI !== "true") { + // Gracefully exit when stdin ends + process.stdin.on("end", function () { + devServer.close(); + process.exit(); + }); + } + }) + .catch((err) => { + if (err && err.message) { + console.log(err.message); + } + process.exit(1); + }); diff --git a/src/App.js b/src/App.js index 270f262..b540bbe 100644 --- a/src/App.js +++ b/src/App.js @@ -1,36 +1,36 @@ -import React, { Component } from "react"; -import { ToastContainer } from "react-toastify"; -import AppRouter from "./AppRouter"; -import store from "./Redux/store"; -import { Provider } from "react-redux"; -import "bootstrap/dist/css/bootstrap.min.css"; -import "react-toastify/dist/ReactToastify.css"; - -class App extends Component { - state = { lang: window.lang }; - componentDidMount() { - window.forceUpdate = () => { - this.setState({ lang: window.lang }); - }; - } - render() { - return ( - - - - - ); - } -} - -export default App; +import React, { Component } from "react"; +import { ToastContainer } from "react-toastify"; +import AppRouter from "./AppRouter"; +import store from "./Redux/store"; +import { Provider } from "react-redux"; +import "bootstrap/dist/css/bootstrap.min.css"; +import "react-toastify/dist/ReactToastify.css"; + +class App extends Component { + state = { lang: window.lang }; + componentDidMount() { + window.forceUpdate = () => { + this.setState({ lang: window.lang }); + }; + } + render() { + return ( + + + + + ); + } +} + +export default App; diff --git a/src/AppRouter.js b/src/AppRouter.js index da6fe0c..0d1d386 100644 --- a/src/AppRouter.js +++ b/src/AppRouter.js @@ -1,420 +1,420 @@ -import React, { Component } from "react"; -import "./App.css"; -import { - BrowserRouter as Router, - Route, - Switch, - Redirect, -} from "react-router-dom"; -import { connect } from "react-redux"; -import { user } from "~/Redux/actions"; -import { userProduct } from "~/Redux/actions"; -import proxy from "./Redux/proxy"; -import Home from "./views/Home/index"; -import Faq from "./views/Faq/index"; -import Arabickar from "./views/Arabickar/index"; -import Contact from "./views/Contact/index"; -import About from "./views/About/index"; -import Products from "./views/Products/index"; -import Product from "./views/Product/index"; -import QR from "./views/QR/index"; -import Reset from "./views/Reset"; -import Auth from "./views/Auth/index"; -import QRScan from "./views/QRScan/index"; -import Activation from "./views/Activation/index"; -import ChatList from "./views/ChatList/index"; -import Chatroom from "./views/ChatRoom/index"; -import Cart from "./views/Cart/index"; -import Checkout from "./views/Checkout/index"; -import MyBooks from "./views/MyBooks/index"; -import AR from "./views/AR/index"; -import Download from "./views/Download/index"; -import Support from "./views/Support/index"; -import NewProfile from "./views/NewProfile/index"; -import Blogs from "./views/Blogs/index"; -import Blog from "./views/Blog/index"; -// import Sample from "./views/Sample/index"; -import PDF from "./views/PDF/index"; -import Orders from "./views/Orders"; -// import MyBooks2 from "./views/MyBook2"; -class AppRouter extends Component { - constructor(props) { - super(props); - window.router = this; - this.state = { - cartControll: false, - }; - } - - state = {}; - - componentDidUpdate(prevProps, prevState) { - if (this.props.userProductList > 0) { - if (!this.state.cartControll) { - this.setState({ - cartControll: true, - }); - } - } else { - if (!this.state.cartControll) { - this.setState({ - cartControll: true, - }); - } - } - } - - componentDidMount() { - // if (proxy.status() && this.props.userProductList == null) - // this.props.getUserProductList(); - } - - render() { - const mobile = window.innerWidth < 1000 ? true : false; - let status = proxy.status(); - const afterLogin = localStorage.getItem("afterLogin"); - - let home = ( - - {status && status.status === 0 ? ( - - ) : afterLogin ? ( - <> - - - ) : ( - - )} - - ); - const pathname = window.location.pathname; - return ( -
- - - {home} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {/* - - */} - - - - - {mobile ? ( - status ? ( - - ) : ( - - ) - ) : ( - - )} - - - {mobile ? ( - status ? ( - - ) : ( - - ) - ) : ( - - )} - - - - - - - - - - - - {proxy.status() ? ( - - ) : ( - - )} - - - - {/* {mobile ? ( - status ? ( - - ) : ( - - ) - ) : ( - - )} */} - - - - - - - - - - - - {proxy.status() ? ( - - ) : ( - - )} - - - {status ? : null} - - - {mobile ? ( - status ? ( - - ) : ( - - ) - ) : status ? ( - - ) : ( - - )} - - - {mobile ? ( - status ? ( - - ) : ( - - ) - ) : status ? ( - - ) : ( - - )} - - - {mobile ? ( - status ? ( - - ) : ( - - ) - ) : status ? ( - - ) : ( - - )} - - - - - {/* {status ? ( - - ) : ( - - )} */} - - - {status ? ( - - ) : ( - - )} - - {/* - {mobile ? ( - status ? ( - - ) : ( - - ) - ) : status ? ( - - ) : ( - - )} - */} - - {mobile ? ( - status ? ( - - ) : ( - - ) - ) : status ? ( - - ) : ( - - )} - - - - {mobile ? ( - status ? ( - - ) : ( - - ) - ) : status ? ( - - ) : ( - - )} - - - {/* {pathname.split("/").slice(-1)[0] == "origami" ? ( - - ) : ( */} - - {/* )} */} - - - -
- ); - } -} - -export default connect( - (state) => ({ - profile: state.user.status, - userProductList: state.userProduct.list, - config: state.publicApi.config, - lang: state.publicApi.lang, - // status: state.user.status, - }), - { getProfile: user.getProfile, getUserProductList: userProduct.list } -)(AppRouter); +import React, { Component } from "react"; +import "./App.css"; +import { + BrowserRouter as Router, + Route, + Switch, + Redirect, +} from "react-router-dom"; +import { connect } from "react-redux"; +import { user } from "~/Redux/actions"; +import { userProduct } from "~/Redux/actions"; +import proxy from "./Redux/proxy"; +import Home from "./views/Home/index"; +import Faq from "./views/Faq/index"; +import Arabickar from "./views/Arabickar/index"; +import Contact from "./views/Contact/index"; +import About from "./views/About/index"; +import Products from "./views/Products/index"; +import Product from "./views/Product/index"; +import QR from "./views/QR/index"; +import Reset from "./views/Reset"; +import Auth from "./views/Auth/index"; +import QRScan from "./views/QRScan/index"; +import Activation from "./views/Activation/index"; +import ChatList from "./views/ChatList/index"; +import Chatroom from "./views/ChatRoom/index"; +import Cart from "./views/Cart/index"; +import Checkout from "./views/Checkout/index"; +import MyBooks from "./views/MyBooks/index"; +import AR from "./views/AR/index"; +import Download from "./views/Download/index"; +import Support from "./views/Support/index"; +import NewProfile from "./views/NewProfile/index"; +import Blogs from "./views/Blogs/index"; +import Blog from "./views/Blog/index"; +// import Sample from "./views/Sample/index"; +import PDF from "./views/PDF/index"; +import Orders from "./views/Orders"; +// import MyBooks2 from "./views/MyBook2"; +class AppRouter extends Component { + constructor(props) { + super(props); + window.router = this; + this.state = { + cartControll: false, + }; + } + + state = {}; + + componentDidUpdate(prevProps, prevState) { + if (this.props.userProductList > 0) { + if (!this.state.cartControll) { + this.setState({ + cartControll: true, + }); + } + } else { + if (!this.state.cartControll) { + this.setState({ + cartControll: true, + }); + } + } + } + + componentDidMount() { + // if (proxy.status() && this.props.userProductList == null) + // this.props.getUserProductList(); + } + + render() { + const mobile = window.innerWidth < 1000 ? true : false; + let status = proxy.status(); + const afterLogin = localStorage.getItem("afterLogin"); + + let home = ( + + {status && status.status === 0 ? ( + + ) : afterLogin ? ( + <> + + + ) : ( + + )} + + ); + const pathname = window.location.pathname; + return ( +
+ + + {home} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {/* + + */} + + + + + {mobile ? ( + status ? ( + + ) : ( + + ) + ) : ( + + )} + + + {mobile ? ( + status ? ( + + ) : ( + + ) + ) : ( + + )} + + + + + + + + + + + + {proxy.status() ? ( + + ) : ( + + )} + + + + {/* {mobile ? ( + status ? ( + + ) : ( + + ) + ) : ( + + )} */} + + + + + + + + + + + + {proxy.status() ? ( + + ) : ( + + )} + + + {status ? : null} + + + {mobile ? ( + status ? ( + + ) : ( + + ) + ) : status ? ( + + ) : ( + + )} + + + {mobile ? ( + status ? ( + + ) : ( + + ) + ) : status ? ( + + ) : ( + + )} + + + {mobile ? ( + status ? ( + + ) : ( + + ) + ) : status ? ( + + ) : ( + + )} + + + + + {/* {status ? ( + + ) : ( + + )} */} + + + {status ? ( + + ) : ( + + )} + + {/* + {mobile ? ( + status ? ( + + ) : ( + + ) + ) : status ? ( + + ) : ( + + )} + */} + + {mobile ? ( + status ? ( + + ) : ( + + ) + ) : status ? ( + + ) : ( + + )} + + + + {mobile ? ( + status ? ( + + ) : ( + + ) + ) : status ? ( + + ) : ( + + )} + + + {/* {pathname.split("/").slice(-1)[0] == "origami" ? ( + + ) : ( */} + + {/* )} */} + + + +
+ ); + } +} + +export default connect( + (state) => ({ + profile: state.user.status, + userProductList: state.userProduct.list, + config: state.publicApi.config, + lang: state.publicApi.lang, + // status: state.user.status, + }), + { getProfile: user.getProfile, getUserProductList: userProduct.list } +)(AppRouter); diff --git a/src/QRScan/Scanner/index.js b/src/QRScan/Scanner/index.js index 0c25ecf..078e5bd 100644 --- a/src/QRScan/Scanner/index.js +++ b/src/QRScan/Scanner/index.js @@ -1,57 +1,57 @@ -import React, { Component } from "react"; -//import QrReader from "react-camera-qr"; -import QrReader from "react-qr-reader"; - -export default class Scanner extends Component { - constructor(props) { - super(props); - this.state = { - delay: 100, - result: "", - }; - - this.handleScan = this.handleScan.bind(this); - } - - handleScan(data) { - this.props.parent.setState({ - value: data, - }); - } - - handleError(err) { - console.error(err); - } - - render() { - let cam = this.props.parent.state.cameraId; - - let facingMode = this.props.parent.state.cameraId; - return ( - <> - {window.innerWidth < 1000 ? ( - - ) : null} - {window.innerWidth > 1000 ? ( - - ) : null} - {/*
{facingMode[this.props.parent.state.facingMode]}
-
{(this.state?.devices || []).join(",")}
*/} - - ); - } -} +import React, { Component } from "react"; +//import QrReader from "react-camera-qr"; +import QrReader from "react-qr-reader"; + +export default class Scanner extends Component { + constructor(props) { + super(props); + this.state = { + delay: 100, + result: "", + }; + + this.handleScan = this.handleScan.bind(this); + } + + handleScan(data) { + this.props.parent.setState({ + value: data, + }); + } + + handleError(err) { + console.error(err); + } + + render() { + let cam = this.props.parent.state.cameraId; + + let facingMode = this.props.parent.state.cameraId; + return ( + <> + {window.innerWidth < 1000 ? ( + + ) : null} + {window.innerWidth > 1000 ? ( + + ) : null} + {/*
{facingMode[this.props.parent.state.facingMode]}
+
{(this.state?.devices || []).join(",")}
*/} + + ); + } +} diff --git a/src/QRScan/index.js b/src/QRScan/index.js index 85cb891..d839405 100644 --- a/src/QRScan/index.js +++ b/src/QRScan/index.js @@ -1,244 +1,244 @@ -import React, { Component } from "react"; -import Navbar from "../Home/Navbar/index"; -import Footer from "../Home/Footer/index"; - -import Scanner from "./Scanner/index"; -import LastQr from "./LastQr/index"; -import Modal from "./Modal/index"; -import ReplayIcon from "@material-ui/icons/Replay"; -import FlipCameraIosIcon from "@material-ui/icons/FlipCameraIos"; - -import { connect } from "react-redux"; -import { qr } from "~/Redux/actions"; - -import sciense_6 from "../../assets/images/sciense-6.png"; - -import "./index.scss"; - -const maxDesktopSize = 1250; - -const fontSize = { - desktop: { - h1: window.innerWidth > maxDesktopSize ? 25 : window.innerWidth / 70, - p: window.innerHeight > maxDesktopSize ? 15 : window.innerWidth / 90, - }, -}; - -class QRScan extends Component { - state = { - value: null, - facingMode: 0, - tail: null, - cameraIds: [], - cameraId: "rare", - }; - componentDidMount() { - navigator.mediaDevices.enumerateDevices().then((devices) => { - console.log({ devices }); - var cameraIds = devices - .filter(function (device) { - return device.kind === "videoinput"; - }) - .map((e) => [e.label, e.deviceId]); - - var environmentPattern = /rear|back|environment/gi; - var userPattern = /front|user|face/gi; - var backs = cameraIds.filter((label) => environmentPattern.test(label)); - var notFronts = cameraIds.filter((label) => !userPattern.test(label)); - let cameraId = backs[0] || notFronts[0] || cameraIds[0]; - let cameraIdx = cameraIds.findIndex((cam) => cam[1] === cameraId[1]); - console.log({ - cameraIds, - cameraId: cameraId[0], - cameraIdx, - }); - this.setState({ - cameraIds, - cameraId, - cameraIdx, - }); - }); - } - async componentDidUpdate() { - if (this.state.value) { - let tail = this.state.value.slice( - this.state.value.lastIndexOf("/") + 1, - this.state.value.length - ); - this.props.info({ tail: tail }); - this.setState({ value: null, tail: tail }); - } - } - - render() { - const { data } = this.props; - return ( - <> - {window.innerWidth > 100 ? ( - <> -
- -
-
-

- {window.t("نکته")} -

-

- {window.t( - "لطفا دوربین خود را روی کدی که در اختیار شما قرار گرفته قرار" - )} - {window.t("دهید تا اسکن دوربین انجام شود")}{" "} -

-
- {this.state.cameraIds.length > 1 ? ( -
- -
- ) : null} -
- - this.setState({ - facingMode: (this.state.facingMode + 1) % 2, - }) - } - /> - {this.state.value !== null ? ( -
this.setState({ value: null })} - > - -
- ) : ( - - )} -
- {this.state.tail === null ? null : ( - - )} -
-
-