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 ? (
- <>
-
-
-
-
- {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 : (
-
- )}
-
-
-
- >
- ) : null}
- {window.innerWidth < 100 ? (
- <>
-
-
-
-
-
-
- {this.state.cameraIds.length > 1 ? (
- <>
-
-
-
- {
- let cameraIdx =
- (this.state.cameraIdx + 1) %
- this.state.cameraIds.length;
-
- this.setState({
- cameraIdx,
- cameraId: this.state.cameraIds[cameraIdx],
- });
- }}
- />
- >
- ) : null}
- {false && this.state.cameraId === "" ? (
- this.setState({ value: null })}
- >
-
-
- ) : (
-
- )}
-
- {this.state.tail === null ? null : (
-
- )}
- {localStorage.getItem("latestQr") ? (
-
- {window.t("آخرین مشاهدات")}
- {data.map((item, i) => (
-
- ))}
-
- ) : null}
-
- >
- ) : null}
- >
- );
- }
-}
-
-export default connect((state) => ({ list: state.qr.list }), { info: qr.info })(
- QRScan
-);
-
-QRScan.defaultProps = {
- data: [
- {
- title: "ریاضیات گسسته خیلی پیشرفته",
- subTitle: "پایه هفتم ابتدایی",
- page: 13,
- image: sciense_6,
- },
- ],
-};
+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 ? (
+ <>
+
+
+
+
+ {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 : (
+
+ )}
+
+
+
+ >
+ ) : null}
+ {window.innerWidth < 100 ? (
+ <>
+
+
+
+
+
+
+ {this.state.cameraIds.length > 1 ? (
+ <>
+
+
+
+ {
+ let cameraIdx =
+ (this.state.cameraIdx + 1) %
+ this.state.cameraIds.length;
+
+ this.setState({
+ cameraIdx,
+ cameraId: this.state.cameraIds[cameraIdx],
+ });
+ }}
+ />
+ >
+ ) : null}
+ {false && this.state.cameraId === "" ? (
+ this.setState({ value: null })}
+ >
+
+
+ ) : (
+
+ )}
+
+ {this.state.tail === null ? null : (
+
+ )}
+ {localStorage.getItem("latestQr") ? (
+
+ {window.t("آخرین مشاهدات")}
+ {data.map((item, i) => (
+
+ ))}
+
+ ) : null}
+
+ >
+ ) : null}
+ >
+ );
+ }
+}
+
+export default connect((state) => ({ list: state.qr.list }), { info: qr.info })(
+ QRScan
+);
+
+QRScan.defaultProps = {
+ data: [
+ {
+ title: "ریاضیات گسسته خیلی پیشرفته",
+ subTitle: "پایه هفتم ابتدایی",
+ page: 13,
+ image: sciense_6,
+ },
+ ],
+};
diff --git a/src/Redux/reducers/blog.js b/src/Redux/reducers/blog.js
index c77651e..94b1b27 100644
--- a/src/Redux/reducers/blog.js
+++ b/src/Redux/reducers/blog.js
@@ -1,28 +1,28 @@
-import { toast } from "react-toastify";
-
-const initialState = {
- loading: false,
- error: null,
- list: [],
-};
-export default function blog(state = initialState, action) {
- let { type, data } = action;
- switch (type) {
- case "blog/list":
- return { ...state, loading: false, list: data, error: null };
- case "blog/update":
- return { ...state, loading: false, error: null };
- case "blog/add":
- return { ...state, loading: false, error: null };
- case "blog/delete":
- return { ...state, loading: false, error: null };
- /////////////
- case "blog/loading":
- return { ...state, loading: true };
- case "blog/error":
- toast.error(data.message);
- return { ...state, loading: false, error: data.message };
- default:
- return state;
- }
-}
+import { toast } from "react-toastify";
+
+const initialState = {
+ loading: false,
+ error: null,
+ list: [],
+};
+export default function blog(state = initialState, action) {
+ let { type, data } = action;
+ switch (type) {
+ case "blog/list":
+ return { ...state, loading: false, list: data, error: null };
+ case "blog/update":
+ return { ...state, loading: false, error: null };
+ case "blog/add":
+ return { ...state, loading: false, error: null };
+ case "blog/delete":
+ return { ...state, loading: false, error: null };
+ /////////////
+ case "blog/loading":
+ return { ...state, loading: true };
+ case "blog/error":
+ toast.error(data.message);
+ return { ...state, loading: false, error: data.message };
+ default:
+ return state;
+ }
+}
diff --git a/src/Redux/reducers/public.js b/src/Redux/reducers/public.js
index 0e82ff4..2f0ac5e 100644
--- a/src/Redux/reducers/public.js
+++ b/src/Redux/reducers/public.js
@@ -1,193 +1,193 @@
-import { toast } from "react-toastify";
-const initialState = {
- homeData: [],
- newProducts: [],
- levels: [],
- faqList: [],
- loading: false,
- error: null,
- searchResult: [],
- contactData: null,
- arList: [],
- blogList: [],
- blog: null,
- province: [],
- city: [],
- config: {
- direction: "ltr",
- },
-};
-
-export default function publicApi(state = initialState, action) {
- const grades = [
- window.t("پیش دبستان"),
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
- ];
- let { type, data } = action;
- switch (type) {
- case "public/direction":
- return { ...state, config: { [data.name]: data.value } };
- case "public/homePage":
- let itemsLevel;
- // if (window.innerWidth > 1000) {
-
- const jadidTarin = data?.filter(
- (item) => item.title === window.t("کتابهای دانوین")
- );
- itemsLevel =
- jadidTarin && jadidTarin[0] && jadidTarin[0].data
- ? jadidTarin[0].data
- .map((item) => item.book.gradeId * 1)
- .sort((a, b) => a - b)
- .map((e) => grades[e])
- : [];
- itemsLevel.unshift(window.t("پایه تحصیلی"));
- // }
-
- return {
- ...state,
- loading: false,
- levels: [...new Set(itemsLevel)],
- error: null,
- homeData: data,
- };
- case "user/logout":
- case "user/login":
- case "user/otp/login":
- return { ...state, homeData: [] };
- case "public/filter":
- const realList =
- state.newProducts.length === 0
- ? state.homeData.filter(
- (item) => item.title === window.t("کتابهای دانوین")
- )[0].data
- : state.newProducts;
- if (state.newProducts.length === 0) {
- state = {
- ...state,
- newProducts: realList,
- };
- }
- const level = data.levels;
- const search = data.search;
- if (level.length > 0 || search) {
- localStorage.setItem("filter", "ON");
- } else {
- return {
- ...state,
- loading: false,
- error: null,
- homeData: state.homeData.map((item) =>
- item.title === window.t("کتابهای دانوین")
- ? { ...item, data: state.newProducts }
- : { ...item }
- ),
- newProducts: [],
- };
- }
- let byLevelFilter = [];
- if (level.length > 0) {
- level.forEach((item1) => {
- for (let i = 0; i < realList.length; i++) {
- if (grades[realList[i].book.gradeId] === item1) {
- byLevelFilter.push(realList[i]);
- }
- }
- });
- } else {
- byLevelFilter = realList;
- }
-
- // let bySubjectFilter = [];
- // if (subject.length > 0) {
- // subject.map((item1) => {
- // for (let i = 0; i < byLevelFilter.length; i++) {
- // if (byLevelFilter[i].name === item1) {
- // bySubjectFilter.push(byLevelFilter[i]);
- // }
- // }
- // });
- // } else {
- // bySubjectFilter = byLevelFilter;
- // }
-
- const bySearchFilter = search
- ? byLevelFilter.filter((item1) => item1.name.indexOf(search) !== -1)
- : byLevelFilter;
- // if (sort === window.t("گران ترین")) {
- // finalSort = bySearchFilter.sort((item1, item2) => {
- // return item1.product[0].price - item2.product[0].price;
- // });
- // } else {
- // finalSort = bySearchFilter;
- // }
-
- return {
- ...state,
- loading: false,
- error: null,
- homeData: state.homeData.map((item) =>
- item.title === window.t("کتابهای دانوین")
- ? { ...item, data: bySearchFilter }
- : { ...item }
- ),
- };
- case "faq/list":
- return { ...state, loading: false, error: null, faqList: data };
- case "public/province":
- return { ...state, loading: false, error: null, province: data };
- case "public/city":
- return { ...state, loading: false, error: null, city: data };
- case "public/faq/activate":
- return {
- ...state,
- loading: false,
- error: null,
- faqList: state.faqList.map((item) =>
- item.id === data
- ? { ...item, active: !item.active }
- : { ...item, active: false }
- ),
- };
-
- case "public/faq/search":
- return {
- ...state,
- loading: false,
- error: null,
- searchResult: state.faqList.filter(
- (item) =>
- item.title.indexOf(data) !== -1 ||
- item.description.indexOf(data) !== -1
- ),
- };
- case "public/contact":
- return { ...state, loading: false, error: null, contactData: data };
- case "public/ar":
- return { ...state, loading: false, error: null, arList: data };
- case "public/blogList":
- return { ...state, loading: false, error: null, blogList: data };
- case "public/blogInfo":
- return { ...state, loading: false, error: null, blog: data };
- case "public/loading":
- return { ...state, loading: true };
- case "public/error":
- toast.error(data.message);
- return { ...state, loading: false, error: data.message };
- case "public/changeLanguage":
- return { ...state, lang: window.lang, contactData: null, faqList: [] };
- default:
- return state;
- }
-}
+import { toast } from "react-toastify";
+const initialState = {
+ homeData: [],
+ newProducts: [],
+ levels: [],
+ faqList: [],
+ loading: false,
+ error: null,
+ searchResult: [],
+ contactData: null,
+ arList: [],
+ blogList: [],
+ blog: null,
+ province: [],
+ city: [],
+ config: {
+ direction: "ltr",
+ },
+};
+
+export default function publicApi(state = initialState, action) {
+ const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
+ let { type, data } = action;
+ switch (type) {
+ case "public/direction":
+ return { ...state, config: { [data.name]: data.value } };
+ case "public/homePage":
+ let itemsLevel;
+ // if (window.innerWidth > 1000) {
+
+ const jadidTarin = data?.filter(
+ (item) => item.title === window.t("کتابهای دانوین")
+ );
+ itemsLevel =
+ jadidTarin && jadidTarin[0] && jadidTarin[0].data
+ ? jadidTarin[0].data
+ .map((item) => item.book.gradeId * 1)
+ .sort((a, b) => a - b)
+ .map((e) => grades[e])
+ : [];
+ itemsLevel.unshift(window.t("پایه تحصیلی"));
+ // }
+
+ return {
+ ...state,
+ loading: false,
+ levels: [...new Set(itemsLevel)],
+ error: null,
+ homeData: data,
+ };
+ case "user/logout":
+ case "user/login":
+ case "user/otp/login":
+ return { ...state, homeData: [] };
+ case "public/filter":
+ const realList =
+ state.newProducts.length === 0
+ ? state.homeData.filter(
+ (item) => item.title === window.t("کتابهای دانوین")
+ )[0].data
+ : state.newProducts;
+ if (state.newProducts.length === 0) {
+ state = {
+ ...state,
+ newProducts: realList,
+ };
+ }
+ const level = data.levels;
+ const search = data.search;
+ if (level.length > 0 || search) {
+ localStorage.setItem("filter", "ON");
+ } else {
+ return {
+ ...state,
+ loading: false,
+ error: null,
+ homeData: state.homeData.map((item) =>
+ item.title === window.t("کتابهای دانوین")
+ ? { ...item, data: state.newProducts }
+ : { ...item }
+ ),
+ newProducts: [],
+ };
+ }
+ let byLevelFilter = [];
+ if (level.length > 0) {
+ level.forEach((item1) => {
+ for (let i = 0; i < realList.length; i++) {
+ if (grades[realList[i].book.gradeId] === item1) {
+ byLevelFilter.push(realList[i]);
+ }
+ }
+ });
+ } else {
+ byLevelFilter = realList;
+ }
+
+ // let bySubjectFilter = [];
+ // if (subject.length > 0) {
+ // subject.map((item1) => {
+ // for (let i = 0; i < byLevelFilter.length; i++) {
+ // if (byLevelFilter[i].name === item1) {
+ // bySubjectFilter.push(byLevelFilter[i]);
+ // }
+ // }
+ // });
+ // } else {
+ // bySubjectFilter = byLevelFilter;
+ // }
+
+ const bySearchFilter = search
+ ? byLevelFilter.filter((item1) => item1.name.indexOf(search) !== -1)
+ : byLevelFilter;
+ // if (sort === window.t("گران ترین")) {
+ // finalSort = bySearchFilter.sort((item1, item2) => {
+ // return item1.product[0].price - item2.product[0].price;
+ // });
+ // } else {
+ // finalSort = bySearchFilter;
+ // }
+
+ return {
+ ...state,
+ loading: false,
+ error: null,
+ homeData: state.homeData.map((item) =>
+ item.title === window.t("کتابهای دانوین")
+ ? { ...item, data: bySearchFilter }
+ : { ...item }
+ ),
+ };
+ case "faq/list":
+ return { ...state, loading: false, error: null, faqList: data };
+ case "public/province":
+ return { ...state, loading: false, error: null, province: data };
+ case "public/city":
+ return { ...state, loading: false, error: null, city: data };
+ case "public/faq/activate":
+ return {
+ ...state,
+ loading: false,
+ error: null,
+ faqList: state.faqList.map((item) =>
+ item.id === data
+ ? { ...item, active: !item.active }
+ : { ...item, active: false }
+ ),
+ };
+
+ case "public/faq/search":
+ return {
+ ...state,
+ loading: false,
+ error: null,
+ searchResult: state.faqList.filter(
+ (item) =>
+ item.title.indexOf(data) !== -1 ||
+ item.description.indexOf(data) !== -1
+ ),
+ };
+ case "public/contact":
+ return { ...state, loading: false, error: null, contactData: data };
+ case "public/ar":
+ return { ...state, loading: false, error: null, arList: data };
+ case "public/blogList":
+ return { ...state, loading: false, error: null, blogList: data };
+ case "public/blogInfo":
+ return { ...state, loading: false, error: null, blog: data };
+ case "public/loading":
+ return { ...state, loading: true };
+ case "public/error":
+ toast.error(data.message);
+ return { ...state, loading: false, error: data.message };
+ case "public/changeLanguage":
+ return { ...state, lang: window.lang, contactData: null, faqList: [] };
+ default:
+ return state;
+ }
+}
diff --git a/src/views/About/index.js b/src/views/About/index.js
index b9f0920..30336ef 100644
--- a/src/views/About/index.js
+++ b/src/views/About/index.js
@@ -1,281 +1,281 @@
-import React, { Component, Fragment } from "react";
-import Navbar from "../Home/Navbar/index";
-import Footer from "../Home/Footer/index";
-
-import pic from "../../assets/images/pic.png";
-import aboutLg from "../../assets/images/about-lg.png";
-
-import "./index.scss";
-
-const maxDesktopSize = 1250;
-const maxMobileSize = 650;
-
-const fontSize = {
- desktop: {
- h1: window.innerWidth > maxDesktopSize ? 30 : window.innerWidth / 40,
- p: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 80,
- h2: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 70,
- li: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 80,
- },
- mobile: {
- h1: window.innerWidth > maxMobileSize ? 30 : window.innerWidth / 18,
- p: window.innerWidth > maxMobileSize ? 18 : window.innerWidth / 28,
- h2: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 23,
- li: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 28,
- },
-};
-
-export default class About extends Component {
- render() {
- const state = {
- first: {
- title: window.t("درباره ما"),
- text: window.t(
- "ما در دانوین با هدف ایجاد زیرساخت تعاملی و آموزشی با تولید محتوایی جذاب بصورت کتاب با کمک پلتفرم دانوین، قصد تغییراتی بنیادین در نظام آموزش و پرورش کشور داریم. دانوین پلتفرمی شامل کتاب، محتوای الکترونیکی، رویه های آموزشی، پشتیبانی علمی و نرم افزار ارائه خدمات با رویکرد مخاطب محور است."
- ),
- },
- fury: {
- title: window.t("ماموریت ما در دانوین چیست ؟"),
- text: window.t(
- "ارتقای سطح کیفیت و جذابیت آموزش در مدارس بصورت سازگار با نظام رسمی و کنونی آ.پ در راستای نیل به اهداف سند تحول"
- ),
- },
-
- keywords: {
- title: window.t("کیفیت آموزش را بالا میبریم"),
- list: [
- window.t(
- "شایستگی در ایجاد فهم علمی در موضوع هدف و در موضوعات وابسته به آن"
- ),
- window.t(
- "شایستگی در ایجاد زمینه ی معرفتی- ارزشی موثر برای محتواهای آموزشی"
- ),
- ],
- },
- keywords2: {
- title: window.t("جذابیت کلید بهبود یادگیری"),
- list: [
- window.t(
- "بکارگیری عوامل متنوع سازگار با ارزشها برای علاقمندی دانش آموز و معلم به استفاده از محتوای دانوین"
- ),
- window.t(
- "سازگار با نظام آ.پ : بطوریکه بتواند در مدارس فعلی مورد استفاده قرار گرفته و با نظام رسمی فعلی در تضاد نباشد"
- ),
- window.t(
- "در راستای نیل به سند تحول : تلاش برای نزدیکی گام به گام به آرمانها و اهداف سند تحول"
- ),
- ],
- },
- advantages: {
- title: window.t("مزیت رقابتی دانوین"),
- list: [
- window.t(
- "بکارگیری بروز ترین تکنولوژی های تولید و مدیریت محتوای آموزشی-تربیتی (مانند واقعیت افزوده)"
- ),
- window.t("دارای رویکرد آموزش سرگرم کننده"),
- window.t("بستر تعاملی و اشتراک گذاری فیلم و محتوای آموزشی"),
- window.t("رویکرد معرفتی-ارزشی"),
- window.t("ویدئو های منحصر بفرد"),
- window.t("متن گفتگو محور ، روایی ، قابل فهم ،جذاب و سرگرم کننده"),
- ],
- },
- };
- const { fury, advantages, keywords, keywords2, first } = state;
- return (
- <>
- {window.innerWidth > 1000 ? (
- <>
-
-
-
-
-
- {first.title}
-
-
- {first.text}
-
-
-
-
-
-
-
-
- {fury.title}
-
-
{fury.text}
-
-
-
- {keywords.title}
-
-
- {keywords.list.map((item, i) => (
-
- -
- {item}
-
-
- ))}
-
-
-
-
- {keywords2.title}
-
-
- {keywords2.list.map((item, i) => (
-
- -
- {item}
-
-
- ))}
-
-
-
-
-

- {/* {this.props.absoluteImages.map((item, i) => (
-

- ))} */}
-
-
-
-
-

-
-
-
- {advantages.title}
-
-
- {advantages.list.map((item, i) => (
-
- -
- {item}
-
-
- ))}
-
-
-
-
-
- >
- ) : null}
- {window.innerWidth < 1000 ? (
-
-
-
-
-
{first.title}
-
- {first.text}
-
-
-
-
-
-
-
{fury.title}
-
-
{fury.text}
-
-
- {this.props.absoluteImages.map((item, i) => (
-

- ))}
-
-
-
-
- {keywords.title}
-
-
-
- {keywords.list.map((item, i) => (
-
- - {item}
-
- ))}
-
-
-
-
-

-
-
-
-
- {advantages.title}
-
-
-
- {advantages.list.map((item, i) => (
-
- - {item}
-
- ))}
-
-
-
- ) : null}
- >
- );
- }
-}
-
-About.defaultProps = {
- absoluteImages: [
- {
- class:
- window.innerWidth > 1000
- ? "about__fury--left__1"
- : "mobile-about__images--1",
- imageUrl: aboutLg,
- },
- ],
-};
+import React, { Component, Fragment } from "react";
+import Navbar from "../Home/Navbar/index";
+import Footer from "../Home/Footer/index";
+
+import pic from "../../assets/images/pic.png";
+import aboutLg from "../../assets/images/about-lg.png";
+
+import "./index.scss";
+
+const maxDesktopSize = 1250;
+const maxMobileSize = 650;
+
+const fontSize = {
+ desktop: {
+ h1: window.innerWidth > maxDesktopSize ? 30 : window.innerWidth / 40,
+ p: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 80,
+ h2: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 70,
+ li: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 80,
+ },
+ mobile: {
+ h1: window.innerWidth > maxMobileSize ? 30 : window.innerWidth / 18,
+ p: window.innerWidth > maxMobileSize ? 18 : window.innerWidth / 28,
+ h2: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 23,
+ li: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 28,
+ },
+};
+
+export default class About extends Component {
+ render() {
+ const state = {
+ first: {
+ title: window.t("درباره ما"),
+ text: window.t(
+ "ما در دانوین با هدف ایجاد زیرساخت تعاملی و آموزشی با تولید محتوایی جذاب بصورت کتاب با کمک پلتفرم دانوین، قصد تغییراتی بنیادین در نظام آموزش و پرورش کشور داریم. دانوین پلتفرمی شامل کتاب، محتوای الکترونیکی، رویه های آموزشی، پشتیبانی علمی و نرم افزار ارائه خدمات با رویکرد مخاطب محور است."
+ ),
+ },
+ fury: {
+ title: window.t("ماموریت ما در دانوین چیست ؟"),
+ text: window.t(
+ "ارتقای سطح کیفیت و جذابیت آموزش در مدارس بصورت سازگار با نظام رسمی و کنونی آ.پ در راستای نیل به اهداف سند تحول"
+ ),
+ },
+
+ keywords: {
+ title: window.t("کیفیت آموزش را بالا میبریم"),
+ list: [
+ window.t(
+ "شایستگی در ایجاد فهم علمی در موضوع هدف و در موضوعات وابسته به آن"
+ ),
+ window.t(
+ "شایستگی در ایجاد زمینه ی معرفتی- ارزشی موثر برای محتواهای آموزشی"
+ ),
+ ],
+ },
+ keywords2: {
+ title: window.t("جذابیت کلید بهبود یادگیری"),
+ list: [
+ window.t(
+ "بکارگیری عوامل متنوع سازگار با ارزشها برای علاقمندی دانش آموز و معلم به استفاده از محتوای دانوین"
+ ),
+ window.t(
+ "سازگار با نظام آ.پ : بطوریکه بتواند در مدارس فعلی مورد استفاده قرار گرفته و با نظام رسمی فعلی در تضاد نباشد"
+ ),
+ window.t(
+ "در راستای نیل به سند تحول : تلاش برای نزدیکی گام به گام به آرمانها و اهداف سند تحول"
+ ),
+ ],
+ },
+ advantages: {
+ title: window.t("مزیت رقابتی دانوین"),
+ list: [
+ window.t(
+ "بکارگیری بروز ترین تکنولوژی های تولید و مدیریت محتوای آموزشی-تربیتی (مانند واقعیت افزوده)"
+ ),
+ window.t("دارای رویکرد آموزش سرگرم کننده"),
+ window.t("بستر تعاملی و اشتراک گذاری فیلم و محتوای آموزشی"),
+ window.t("رویکرد معرفتی-ارزشی"),
+ window.t("ویدئو های منحصر بفرد"),
+ window.t("متن گفتگو محور ، روایی ، قابل فهم ،جذاب و سرگرم کننده"),
+ ],
+ },
+ };
+ const { fury, advantages, keywords, keywords2, first } = state;
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+ <>
+
+
+
+
+
+ {first.title}
+
+
+ {first.text}
+
+
+
+
+
+
+
+
+ {fury.title}
+
+
{fury.text}
+
+
+
+ {keywords.title}
+
+
+ {keywords.list.map((item, i) => (
+
+ -
+ {item}
+
+
+ ))}
+
+
+
+
+ {keywords2.title}
+
+
+ {keywords2.list.map((item, i) => (
+
+ -
+ {item}
+
+
+ ))}
+
+
+
+
+

+ {/* {this.props.absoluteImages.map((item, i) => (
+

+ ))} */}
+
+
+
+
+

+
+
+
+ {advantages.title}
+
+
+ {advantages.list.map((item, i) => (
+
+ -
+ {item}
+
+
+ ))}
+
+
+
+
+
+ >
+ ) : null}
+ {window.innerWidth < 1000 ? (
+
+
+
+
+
{first.title}
+
+ {first.text}
+
+
+
+
+
+
+
{fury.title}
+
+
{fury.text}
+
+
+ {this.props.absoluteImages.map((item, i) => (
+

+ ))}
+
+
+
+
+ {keywords.title}
+
+
+
+ {keywords.list.map((item, i) => (
+
+ - {item}
+
+ ))}
+
+
+
+
+

+
+
+
+
+ {advantages.title}
+
+
+
+ {advantages.list.map((item, i) => (
+
+ - {item}
+
+ ))}
+
+
+
+ ) : null}
+ >
+ );
+ }
+}
+
+About.defaultProps = {
+ absoluteImages: [
+ {
+ class:
+ window.innerWidth > 1000
+ ? "about__fury--left__1"
+ : "mobile-about__images--1",
+ imageUrl: aboutLg,
+ },
+ ],
+};
diff --git a/src/views/Arabickar/index.js b/src/views/Arabickar/index.js
index e56c3ab..310100e 100644
--- a/src/views/Arabickar/index.js
+++ b/src/views/Arabickar/index.js
@@ -1,48 +1,48 @@
-import React, { Component } from "react";
-import ArabickarImg from "../../assets/images/origami.jpg";
-
-class Arabickar extends Component {
- render() {
- return (
-
- );
- }
-}
-
-export default Arabickar;
+import React, { Component } from "react";
+import ArabickarImg from "../../assets/images/origami.jpg";
+
+class Arabickar extends Component {
+ render() {
+ return (
+
+ );
+ }
+}
+
+export default Arabickar;
diff --git a/src/views/Auth/Login/index.js b/src/views/Auth/Login/index.js
index d8c0500..b34ba48 100644
--- a/src/views/Auth/Login/index.js
+++ b/src/views/Auth/Login/index.js
@@ -1,55 +1,55 @@
-import React, { Component } from "react";
-
-import Cellphone from "./Cellphone/index";
-import Code from "./Code/index";
-import Splash from "../Splash/index";
-
-import { user } from "../../../Redux/actions";
-import { connect } from "react-redux";
-
-class Login extends Component {
- constructor(props) {
- super(props);
- this.state = {
- page: 0,
- splash: false,
- };
- }
-
- async componentDidUpdate() {
- const { cellphone, otp, page } = this.state;
- if (cellphone && !otp) this.props.otp({ cellphone });
- if (page && cellphone && otp)
- this.props.otp_login({
- cellphone,
- otp,
- userToken: "2",
- applicationToken: "22",
- });
- }
-
- resend = () => {
- const { cellphone } = this.state;
- this.props.otp({ cellphone });
- };
-
- render() {
- return (
- <>
- {this.state.page === 0 ? (
- !this.state.splash ? (
-
- ) : null
- ) : (
-
- )}
- {this.state.splash ? : null}
- >
- );
- }
-}
-
-export default connect((state) => ({ isLogin: state.user.isLogin }), {
- otp: user.otp,
- otp_login: user.otp_login,
-})(Login);
+import React, { Component } from "react";
+
+import Cellphone from "./Cellphone/index";
+import Code from "./Code/index";
+import Splash from "../Splash/index";
+
+import { user } from "../../../Redux/actions";
+import { connect } from "react-redux";
+
+class Login extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ page: 0,
+ splash: false,
+ };
+ }
+
+ async componentDidUpdate() {
+ const { cellphone, otp, page } = this.state;
+ if (cellphone && !otp) this.props.otp({ cellphone });
+ if (page && cellphone && otp)
+ this.props.otp_login({
+ cellphone,
+ otp,
+ userToken: "2",
+ applicationToken: "22",
+ });
+ }
+
+ resend = () => {
+ const { cellphone } = this.state;
+ this.props.otp({ cellphone });
+ };
+
+ render() {
+ return (
+ <>
+ {this.state.page === 0 ? (
+ !this.state.splash ? (
+
+ ) : null
+ ) : (
+
+ )}
+ {this.state.splash ? : null}
+ >
+ );
+ }
+}
+
+export default connect((state) => ({ isLogin: state.user.isLogin }), {
+ otp: user.otp,
+ otp_login: user.otp_login,
+})(Login);
diff --git a/src/views/Auth/Profile/Birthdate/index.js b/src/views/Auth/Profile/Birthdate/index.js
index dea7eb6..8469d1d 100644
--- a/src/views/Auth/Profile/Birthdate/index.js
+++ b/src/views/Auth/Profile/Birthdate/index.js
@@ -1,107 +1,107 @@
-import React, { useState } from "react";
-import onInput from "~/util/onInput";
-import Input from "../Input/index";
-import "./index.scss";
-import moment from "jalali-moment";
-
-export default function Birthdate(props) {
- const { defaultValue, parent, name } = props;
- console.log({ defaultValue });
- let momentDate = moment((defaultValue || {})[name]);
- let isvalid = momentDate?.isValid();
- const day = isvalid ? momentDate?.format("jDD") : null,
- month = isvalid ? momentDate?.format("jMM") : null,
- year = isvalid ? momentDate?.format("jYYYY") : null;
- const [state, setState] = useState({ day, month, year });
- const onChange = (_name, value) => {
- let _state = { ...state, [_name]: value };
- setState(_state);
-
- parent.onChange(
- name,
- moment
- .from(
- `${_state?.year}/${_state?.month}/${_state?.day}`,
- "fa",
- "YYYY/M/D"
- )
- .locale("en")
- );
- };
- return (
- <>
- {window.innerWidth < 1000 ? (
-
- ) : null}
- {window.innerWidth > 1000 ? (
-
- ) : null}
- >
- );
-}
+import React, { useState } from "react";
+import onInput from "~/util/onInput";
+import Input from "../Input/index";
+import "./index.scss";
+import moment from "jalali-moment";
+
+export default function Birthdate(props) {
+ const { defaultValue, parent, name } = props;
+ console.log({ defaultValue });
+ let momentDate = moment((defaultValue || {})[name]);
+ let isvalid = momentDate?.isValid();
+ const day = isvalid ? momentDate?.format("jDD") : null,
+ month = isvalid ? momentDate?.format("jMM") : null,
+ year = isvalid ? momentDate?.format("jYYYY") : null;
+ const [state, setState] = useState({ day, month, year });
+ const onChange = (_name, value) => {
+ let _state = { ...state, [_name]: value };
+ setState(_state);
+
+ parent.onChange(
+ name,
+ moment
+ .from(
+ `${_state?.year}/${_state?.month}/${_state?.day}`,
+ "fa",
+ "YYYY/M/D"
+ )
+ .locale("en")
+ );
+ };
+ return (
+ <>
+ {window.innerWidth < 1000 ? (
+
+ ) : null}
+ {window.innerWidth > 1000 ? (
+
+ ) : null}
+ >
+ );
+}
diff --git a/src/views/Auth/Profile/index.js b/src/views/Auth/Profile/index.js
index e2b4ee9..076636b 100644
--- a/src/views/Auth/Profile/index.js
+++ b/src/views/Auth/Profile/index.js
@@ -1,613 +1,613 @@
-import React, { Component } from "react";
-import onInput from "~/util/onInput";
-import { user, file, publicApi } from "~/Redux/actions";
-import { connect } from "react-redux";
-
-import Select from "./Select/index";
-import Input from "./Input/index";
-import TextArea from "./TextArea/index";
-import Upload from "./Upload/index";
-import Gender from "./GenderSwitch/index";
-import Birthdate from "./Birthdate/index";
-import MultipleSelector from "./MultipleSelector/index";
-import Loader from "~/components/Loader/index";
-import Document from "./Document/index";
-import pic from "../../../assets/images/pic.png";
-import "./index.scss";
-import { useHistory } from "react-router-dom";
-import Navbar from "../../Home/Navbar/index";
-function Navigate({ path }) {
- let history = useHistory();
- return <>{history.push(path)}>;
-}
-
-const maxDesktopSize = 1250;
-const maxMobileSize = 550;
-
-const fontSize = {
- desktop: {
- h1: window.innerWidth > maxDesktopSize ? 25 : window.innerWidth / 55,
- p: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 90,
- },
- mobile: {
- h1: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 18,
- p: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 28,
- },
-};
-
-class Profile extends Component {
- state = {
- render: false,
- file: this.props.uploads["file"] || this.props.profile.picFileId || null,
- picFileId:
- this.props.uploads["file"] || this.props.profile.picFileId || null,
- docFileIds:
- this.props.uploads["docFileIds"] || this.props.profile.docFileIds || "",
- firstName: "",
- lastName: "",
- password: "",
- username: "",
- address: "",
- email: "",
- birthDate: "",
- gender: this.props.profile.gender || 1,
- status: this.props.profile.status || 1,
- nationalId: "",
-
- phone: "",
-
- zoneId: "",
- schoolId: "",
- postalCode: "",
- gradeIds: this.props.profile.gradeIds,
- provinceId: this.props.profile.provinceId,
- cityId: this.props.profile.cityId,
-
- validation: {
- firstName: "",
- lastName: "",
- username: "",
- email: "",
- postalCode: "",
- nationalId: "",
- schoolId: "",
- },
- };
-
- componentDidMount() {
- this.props.getProvince();
- this.props.getCity({ provinceId: this.props.profile.provinceId });
- // this.props.getProfile();
- }
-
- onChange = (name, value) => {
- if (name === "provinceId") {
- this.props.getCity({ provinceId: value });
- this.setState({
- cityId: null,
- [name]: value,
- });
- } else if (name === "status") {
- this.setState((prevState) => ({
- gradeIds: String(prevState?.gradeIds || "").slice(0, 1) || "",
- [name]: value,
- }));
- } else if (name === "docFileIds") {
- this.props.upload({ file: value, target: name });
- this.setState({
- [name]: value,
- });
- } else if (name === "file") {
- this.props.upload({ file: value, target: name });
- this.setState({
- [name]: value,
- });
- } else {
- this.setState({
- [name]: value,
- });
- }
- };
-
- onSubmit = async (e) => {
- const {
- firstName,
- lastName,
- username,
- //cellphone,
- password,
- postalCode,
- address,
- email,
- phone,
- picFileId,
- gender,
- nationalId,
- birthDate,
- schools,
- gradeIds,
- status,
- provinceId,
- cityId,
- docFileIds,
- } = this.state;
- const { profile, setProfile } = this.props;
- const data = {
- firstName: firstName || profile.firstName,
- lastName: lastName || profile.lastName,
- username: username || profile.username,
- cellphone: profile.cellphone,
- password: password || profile.password,
- postalCode: postalCode || profile.postalCode,
- address: address || profile.address,
- email: email || profile.email,
- phone: phone || profile.phone,
- nationalId: nationalId || profile.nationalId,
- picFileId: String(
- this.props.uploads["file"] || picFileId || profile.picFileId
- ),
- gender: gender || profile.gender,
- birthDate: birthDate || profile.birthDate,
- schools: schools || profile.schools,
- gradeIds: String(gradeIds || profile.gradeIds),
- status: status || profile.status,
- provinceId: provinceId || profile.provinceId,
- cityId: cityId || profile.cityId,
- docFileIds: String(
- this.props.uploads["docFileIds"] || docFileIds || profile.docFileIds
- ),
- };
- await setProfile(data);
- };
-
- render() {
- if (this.props.setDone) return ;
- const grades = [
- window.t("پیش دبستان"),
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
- ];
- const { profile } = this.props;
- console.log({ profile });
- return (
- <>
- {window.innerWidth > 1000 ? (
- profile ? (
-
-
-
- {window.t("حساب کاربری")}
-
-
- {window.t("لطفا مشخصات خود را به صورت کامل نمایید.")}
-
-
this.onSubmit(e)}
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {/*
-
-
*/}
-
-
-
-
-
- {this.state.status === 1 ? (
-
-
-
- ) : null}
- {this.state.status === 2 ? (
-
-
-
- ) : null}
-
- {this.state.status === window.t("دانش آموز") &&
- this.state.gradeIds > 9 ? (
-
-
-
- ) : null}
-
-
-
-
-
-
- {/*
-
-
*/}
- {this.state.status === 1 ? (
-
-
-
- ) : null}
- {this.state.status === 2 ? (
-
-
-
- ) : null}
- {this.state.status === 2 ? (
-
- ) : null}
-
-
-
-
-
-
-
-
-
-
-
-
-
- ) : (
-
-
-
- )
- ) : null}
- {window.innerWidth < 1000 ? (
- profile ? (
- <>
-
-
-
- {/*

*/}
-
-
-
-
- {window.t("حساب کاربری")}{" "}
-
-
- {window.t("لطفا مشخصات خود را به صورت کامل وارد نمایید")}{" "}
-
-
-
-
-
-
-
-
-
-
-
-
- {this.state.status === 1 ? (
-
- ) : null}
- {this.state.status === 2 ? (
-
- ) : null}
- {this.state.status === 1 && Number(this.state.gradeIds) > 9 ? (
-
- ) : null}
-
-
-
- {/*
*/}
- {this.state.status === 1 ? (
-
- ) : null}
- {this.state.status === 2 ? (
-
- ) : null}
- {this.state.status === 2 ? (
-
- ) : null}
-
-
-
- {" "}
-
-
- >
- ) : (
-
-
-
- )
- ) : null}
- >
- );
- }
-}
-
-export default connect(
- (state) => ({
- profile: state.user.status,
- setDone: state.user.setDone,
- loading: state.user.loading,
- uploading: state.file.loading,
- uploads: state.file.uploads,
- provinceList: state.publicApi.province,
- cityList: state.publicApi.city,
- }),
- {
- getProfile: user.getProfile,
- setProfile: user.setProfile,
- upload: file.upload,
- getProvince: publicApi.getProvince,
- getCity: publicApi.getCity,
- }
-)(Profile);
-
-Profile.defaultProps = {
- user: {
- name: "اکبر",
- icon: pic,
- description: "",
- },
-};
+import React, { Component } from "react";
+import onInput from "~/util/onInput";
+import { user, file, publicApi } from "~/Redux/actions";
+import { connect } from "react-redux";
+
+import Select from "./Select/index";
+import Input from "./Input/index";
+import TextArea from "./TextArea/index";
+import Upload from "./Upload/index";
+import Gender from "./GenderSwitch/index";
+import Birthdate from "./Birthdate/index";
+import MultipleSelector from "./MultipleSelector/index";
+import Loader from "~/components/Loader/index";
+import Document from "./Document/index";
+import pic from "../../../assets/images/pic.png";
+import "./index.scss";
+import { useHistory } from "react-router-dom";
+import Navbar from "../../Home/Navbar/index";
+function Navigate({ path }) {
+ let history = useHistory();
+ return <>{history.push(path)}>;
+}
+
+const maxDesktopSize = 1250;
+const maxMobileSize = 550;
+
+const fontSize = {
+ desktop: {
+ h1: window.innerWidth > maxDesktopSize ? 25 : window.innerWidth / 55,
+ p: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 90,
+ },
+ mobile: {
+ h1: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 18,
+ p: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 28,
+ },
+};
+
+class Profile extends Component {
+ state = {
+ render: false,
+ file: this.props.uploads["file"] || this.props.profile.picFileId || null,
+ picFileId:
+ this.props.uploads["file"] || this.props.profile.picFileId || null,
+ docFileIds:
+ this.props.uploads["docFileIds"] || this.props.profile.docFileIds || "",
+ firstName: "",
+ lastName: "",
+ password: "",
+ username: "",
+ address: "",
+ email: "",
+ birthDate: "",
+ gender: this.props.profile.gender || 1,
+ status: this.props.profile.status || 1,
+ nationalId: "",
+
+ phone: "",
+
+ zoneId: "",
+ schoolId: "",
+ postalCode: "",
+ gradeIds: this.props.profile.gradeIds,
+ provinceId: this.props.profile.provinceId,
+ cityId: this.props.profile.cityId,
+
+ validation: {
+ firstName: "",
+ lastName: "",
+ username: "",
+ email: "",
+ postalCode: "",
+ nationalId: "",
+ schoolId: "",
+ },
+ };
+
+ componentDidMount() {
+ this.props.getProvince();
+ this.props.getCity({ provinceId: this.props.profile.provinceId });
+ // this.props.getProfile();
+ }
+
+ onChange = (name, value) => {
+ if (name === "provinceId") {
+ this.props.getCity({ provinceId: value });
+ this.setState({
+ cityId: null,
+ [name]: value,
+ });
+ } else if (name === "status") {
+ this.setState((prevState) => ({
+ gradeIds: String(prevState?.gradeIds || "").slice(0, 1) || "",
+ [name]: value,
+ }));
+ } else if (name === "docFileIds") {
+ this.props.upload({ file: value, target: name });
+ this.setState({
+ [name]: value,
+ });
+ } else if (name === "file") {
+ this.props.upload({ file: value, target: name });
+ this.setState({
+ [name]: value,
+ });
+ } else {
+ this.setState({
+ [name]: value,
+ });
+ }
+ };
+
+ onSubmit = async (e) => {
+ const {
+ firstName,
+ lastName,
+ username,
+ //cellphone,
+ password,
+ postalCode,
+ address,
+ email,
+ phone,
+ picFileId,
+ gender,
+ nationalId,
+ birthDate,
+ schools,
+ gradeIds,
+ status,
+ provinceId,
+ cityId,
+ docFileIds,
+ } = this.state;
+ const { profile, setProfile } = this.props;
+ const data = {
+ firstName: firstName || profile.firstName,
+ lastName: lastName || profile.lastName,
+ username: username || profile.username,
+ cellphone: profile.cellphone,
+ password: password || profile.password,
+ postalCode: postalCode || profile.postalCode,
+ address: address || profile.address,
+ email: email || profile.email,
+ phone: phone || profile.phone,
+ nationalId: nationalId || profile.nationalId,
+ picFileId: String(
+ this.props.uploads["file"] || picFileId || profile.picFileId
+ ),
+ gender: gender || profile.gender,
+ birthDate: birthDate || profile.birthDate,
+ schools: schools || profile.schools,
+ gradeIds: String(gradeIds || profile.gradeIds),
+ status: status || profile.status,
+ provinceId: provinceId || profile.provinceId,
+ cityId: cityId || profile.cityId,
+ docFileIds: String(
+ this.props.uploads["docFileIds"] || docFileIds || profile.docFileIds
+ ),
+ };
+ await setProfile(data);
+ };
+
+ render() {
+ if (this.props.setDone) return ;
+ const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
+ const { profile } = this.props;
+ console.log({ profile });
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+ profile ? (
+
+
+
+ {window.t("حساب کاربری")}
+
+
+ {window.t("لطفا مشخصات خود را به صورت کامل نمایید.")}
+
+
this.onSubmit(e)}
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {/*
+
+
*/}
+
+
+
+
+
+ {this.state.status === 1 ? (
+
+
+
+ ) : null}
+ {this.state.status === 2 ? (
+
+
+
+ ) : null}
+
+ {this.state.status === window.t("دانش آموز") &&
+ this.state.gradeIds > 9 ? (
+
+
+
+ ) : null}
+
+
+
+
+
+
+ {/*
+
+
*/}
+ {this.state.status === 1 ? (
+
+
+
+ ) : null}
+ {this.state.status === 2 ? (
+
+
+
+ ) : null}
+ {this.state.status === 2 ? (
+
+ ) : null}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ) : (
+
+
+
+ )
+ ) : null}
+ {window.innerWidth < 1000 ? (
+ profile ? (
+ <>
+
+
+
+ {/*

*/}
+
+
+
+
+ {window.t("حساب کاربری")}{" "}
+
+
+ {window.t("لطفا مشخصات خود را به صورت کامل وارد نمایید")}{" "}
+
+
+
+
+
+
+
+
+
+
+
+
+ {this.state.status === 1 ? (
+
+ ) : null}
+ {this.state.status === 2 ? (
+
+ ) : null}
+ {this.state.status === 1 && Number(this.state.gradeIds) > 9 ? (
+
+ ) : null}
+
+
+
+ {/*
*/}
+ {this.state.status === 1 ? (
+
+ ) : null}
+ {this.state.status === 2 ? (
+
+ ) : null}
+ {this.state.status === 2 ? (
+
+ ) : null}
+
+
+
+ {" "}
+
+
+ >
+ ) : (
+
+
+
+ )
+ ) : null}
+ >
+ );
+ }
+}
+
+export default connect(
+ (state) => ({
+ profile: state.user.status,
+ setDone: state.user.setDone,
+ loading: state.user.loading,
+ uploading: state.file.loading,
+ uploads: state.file.uploads,
+ provinceList: state.publicApi.province,
+ cityList: state.publicApi.city,
+ }),
+ {
+ getProfile: user.getProfile,
+ setProfile: user.setProfile,
+ upload: file.upload,
+ getProvince: publicApi.getProvince,
+ getCity: publicApi.getCity,
+ }
+)(Profile);
+
+Profile.defaultProps = {
+ user: {
+ name: "اکبر",
+ icon: pic,
+ description: "",
+ },
+};
diff --git a/src/views/Cart/Discount/index.js b/src/views/Cart/Discount/index.js
index 32a3dd5..6efdfe0 100644
--- a/src/views/Cart/Discount/index.js
+++ b/src/views/Cart/Discount/index.js
@@ -1,165 +1,165 @@
-import React from "react";
-import "./index.scss";
-import { connect } from "react-redux";
-import { userFactor } from "~/Redux/actions";
-
-const maxDesktopSize = 1250;
-const maxMobileSize = 550;
-
-const fontSize = {
- desktop: {
- h2: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 55,
- input: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 75,
- button: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 75,
- p: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 90,
- },
- mobile: {
- h2: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 24,
- p: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 32,
- input: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 20,
- button: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 25,
- },
-};
-
-const DiscoutCode = ({
- codeId,
- setCodeId,
- delCodeId,
- userId,
- factorId,
- code,
-}) => {
- const [value, setValue] = React.useState(code || "");
- function setOff() {
- setCodeId({ offCodeValue: value, userId: userId, id: factorId || null });
- }
- return (
- <>
- {window.innerWidth > 1000 ? (
-
-
- {window.t("کد تخفیف")}
-
- {!code ? (
- <>
-
- {window.t("اگر کد تخفیفی دارید آن را در کادر زیر وارد نمائید")}{" "}
-
-
- setValue(e.target.value)}
- />
-
-
- >
- ) : (
- <>
-
- {window.t("کد تخفیف برای شما ثبت شده است")}{" "}
-
-
-
-
-
- >
- )}
-
- ) : null}
- {window.innerWidth < 1000 ? (
-
-
- {window.t("کد تخفیف")}
-
- {!code ? (
- <>
- {" "}
-
- {window.t("اگر کد تخفیفی دارید آن را در کادر زیر وارد نمائید")}{" "}
-
-
- setValue(e.target.value)}
- />
-
-
- >
- ) : (
- <>
- {" "}
-
- {window.t("کد تخفیف برای شما ثبت شده است")}{" "}
-
-
-
-
-
- >
- )}
-
- ) : null}
- >
- );
-};
-
-export default connect(
- (state) => ({
- codeId: state.userFactor.info?.codeId,
- code: state.userFactor.info?.offCode?.code,
- userId: state.user.status.id,
- factorId: state.userFactor.info?.id,
- lang: state.publicApi.lang,
- }),
- {
- setCodeId: userFactor.update,
- delCodeId: userFactor.deleteUserOffCode,
- }
-)(DiscoutCode);
+import React from "react";
+import "./index.scss";
+import { connect } from "react-redux";
+import { userFactor } from "~/Redux/actions";
+
+const maxDesktopSize = 1250;
+const maxMobileSize = 550;
+
+const fontSize = {
+ desktop: {
+ h2: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 55,
+ input: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 75,
+ button: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 75,
+ p: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 90,
+ },
+ mobile: {
+ h2: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 24,
+ p: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 32,
+ input: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 20,
+ button: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 25,
+ },
+};
+
+const DiscoutCode = ({
+ codeId,
+ setCodeId,
+ delCodeId,
+ userId,
+ factorId,
+ code,
+}) => {
+ const [value, setValue] = React.useState(code || "");
+ function setOff() {
+ setCodeId({ offCodeValue: value, userId: userId, id: factorId || null });
+ }
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+
+
+ {window.t("کد تخفیف")}
+
+ {!code ? (
+ <>
+
+ {window.t("اگر کد تخفیفی دارید آن را در کادر زیر وارد نمائید")}{" "}
+
+
+ setValue(e.target.value)}
+ />
+
+
+ >
+ ) : (
+ <>
+
+ {window.t("کد تخفیف برای شما ثبت شده است")}{" "}
+
+
+
+
+
+ >
+ )}
+
+ ) : null}
+ {window.innerWidth < 1000 ? (
+
+
+ {window.t("کد تخفیف")}
+
+ {!code ? (
+ <>
+ {" "}
+
+ {window.t("اگر کد تخفیفی دارید آن را در کادر زیر وارد نمائید")}{" "}
+
+
+ setValue(e.target.value)}
+ />
+
+
+ >
+ ) : (
+ <>
+ {" "}
+
+ {window.t("کد تخفیف برای شما ثبت شده است")}{" "}
+
+
+
+
+
+ >
+ )}
+
+ ) : null}
+ >
+ );
+};
+
+export default connect(
+ (state) => ({
+ codeId: state.userFactor.info?.codeId,
+ code: state.userFactor.info?.offCode?.code,
+ userId: state.user.status.id,
+ factorId: state.userFactor.info?.id,
+ lang: state.publicApi.lang,
+ }),
+ {
+ setCodeId: userFactor.update,
+ delCodeId: userFactor.deleteUserOffCode,
+ }
+)(DiscoutCode);
diff --git a/src/views/Cart/Table/index.js b/src/views/Cart/Table/index.js
index 2be6308..7973950 100644
--- a/src/views/Cart/Table/index.js
+++ b/src/views/Cart/Table/index.js
@@ -1,463 +1,463 @@
-import React from "react";
-import { connect } from "react-redux";
-import { userProduct } from "~/Redux/actions";
-
-import { makeStyles } from "@material-ui/core/styles";
-import Table from "@material-ui/core/Table";
-import TableBody from "@material-ui/core/TableBody";
-import TableCell from "@material-ui/core/TableCell";
-import TableContainer from "@material-ui/core/TableContainer";
-import TableHead from "@material-ui/core/TableHead";
-import TableRow from "@material-ui/core/TableRow";
-import Paper from "@material-ui/core/Paper";
-import DeleteOutlineOutlinedIcon from "@material-ui/icons/DeleteOutlineOutlined";
-
-import "./index.scss";
-const useStyles = makeStyles({
- table: {},
-});
-
-const maxMobileSize = 550;
-const maxDesktopSize = 1250;
-
-const fontSize = {
- mobile: {
- info: {
- strong: window.innerWidth > maxMobileSize ? 15 : window.innerWidth / 28,
- p: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 36,
- span: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 36,
- },
- price: {
- strong: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 22,
- span: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 40,
- },
- counter: {
- button: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 25,
- span: window.innerWidth > maxMobileSize ? 15 : window.innerWidth / 25,
- },
- delete: {
- span: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 28,
- },
- },
- desktop: {
- info: {
- strong: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 75,
- p: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 95,
- span: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 95,
- },
- price: {
- strong: window.innerWidth > maxDesktopSize ? 18 : window.innerWidth / 60,
- span: window.innerWidth > maxDesktopSize ? 13 : window.innerWidth / 95,
- },
- counter: {
- button: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 65,
- span: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 65,
- },
- delete: {
- span: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 75,
- },
- },
-};
-
-function BasicTable(props) {
- const classes = useStyles();
- const { list, handleDelete, route, factorInfo } = props;
- const sum = () => {
- let total = 0;
- for (let i = 0; i < list.length; i++) {
- total += list[i].count * 1;
- }
- return total;
- };
-
- return (
- <>
- {window.innerWidth < 1000 ? (
-
-
-
-
- {window.t("محصولات")}
- {window.t("قیمت")}
-
- {route === "callback" ? (
- {window.t("تعداد")}
- ) : null}
-
-
-
- {list.map((row, i) => (
-
- ))}
- {route === "cart" && factorInfo ? (
-
-
-
- {window.t("مبلغ کل")} {window.tr(factorInfo.sumPrice)}
-
-
-
-
- {sum()} {window.t("محصول")}
-
-
-
- ) : null}
-
-
-
- ) : null}
- {window.innerWidth > 1000 ? (
-
-
-
-
- {window.t("محصولات")}
- {window.t("قیمت")}
- {window.t("تعداد")}
-
-
-
-
- {list.map((row, i) => (
-
- ))}
- {factorInfo ? (
-
-
-
-
-
-
- {window.t("مبلغ کل")} {window.tr(factorInfo.sumPrice)}
-
-
-
-
- {sum()} {window.t("محصول")}
-
-
-
-
-
-
- ) : null}
-
-
-
- ) : null}
- >
- );
-}
-
-const Item = (props) => {
- const grades = [
- window.t("پیش دبستان"),
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
- ];
- const { data, pushToCart, id, route } = props;
- if (!data.product) return null;
- return (
- <>
- {window.innerWidth < 1000 ? (
-
-
-
-

-
-
- {window.t("نسخه") +
- ` ${
- +data.product.productType === 1
- ? window.t("الکترونیکی")
- : window.t("چاپی")
- } ${data.product.book.name} `}
-
-
- {window.t("پایه") + ` ${grades[data.product.book.gradeId]}`}
-
-
- {window.t("همراه با:")}
- {data.product.book.items ||
- window.t("کد فعالسازی محتوای الکترونیک")}
-
- {route !== "callback" ? (
-
-
- pushToCart({
- productId: data.productId,
- userId: id,
- count: -data.count,
- })
- }
- />
-
- pushToCart({
- productId: data.productId,
- userId: id,
- count: -data.count,
- })
- }
- style={{
- fontSize: fontSize.mobile.delete.span,
- color: "#FC120A",
- cursor: "pointer",
- }}
- >
- {window.t("حذف")}
-
-
- ) : null}
-
-
-
-
-
-
-
- {window.tr(data.product.price * data.count || 1000)}
-
- {route !== "callback" ? (
-
- {window.tr(data.product.price || "100")}{" "}
- {window.t("قیمت هر واحد")}{" "}
-
- ) : null}
-
- {route === "cart" ? (
-
-
-
- {data.count}
-
-
-
- ) : null}
-
-
- {route === "callback" ? (
-
-
- {data.count}
-
-
- ) : null}
-
- ) : null}
- {window.innerWidth > 1000 ? (
-
-
-
-

-
-
- {`${window.t("نسخه")} ${
- +data.product?.productType === 1
- ? window.t("الکترونیکی")
- : window.t("چاپی")
- } ${data.product?.book?.name} `}
-
-
- {window.t("پایه") + ` ${grades[data.product?.book?.gradeId]}`}
-
-
- {window.t("همراه با:")}
- {data.product?.book?.items ||
- window.t("کد فعالسازی محتوای الکترونیک")}
-
-
-
-
-
-
-
- {window.tr(data.product.price * data.count || "1000")}{" "}
- {window.t("تومان")}
-
-
- {window.t("قیمت هر عدد")}{" "}
- {window.tr(data.product.price) || "100"}
- {window.t("تومان")}
-
-
-
-
-
-
-
-
- {data.count}
-
-
-
-
-
-
-
- handleDelete(data.id)}
- onClick={() =>
- pushToCart({
- productId: data.productId,
- userId: id,
- count: -data.count,
- })
- }
- />
- handleDelete(data.id)}
- onClick={() =>
- pushToCart({
- productId: data.productId,
- userId: id,
- count: -data.count,
- })
- }
- style={{
- fontSize: fontSize.desktop.delete.span,
- cursor: "pointer",
- }}
- >
- {window.t("حذف")}
-
-
-
-
- ) : null}
- >
- );
-};
-
-export default connect(
- (state) => ({
- loading: state.userProduct.loading,
- info: state.book.info,
- id: state.user.status.id,
- factorInfo: state.userFactor.info,
- lang: state.publicApi.lang,
- }),
- { pushToCart: userProduct.add }
-)(BasicTable);
+import React from "react";
+import { connect } from "react-redux";
+import { userProduct } from "~/Redux/actions";
+
+import { makeStyles } from "@material-ui/core/styles";
+import Table from "@material-ui/core/Table";
+import TableBody from "@material-ui/core/TableBody";
+import TableCell from "@material-ui/core/TableCell";
+import TableContainer from "@material-ui/core/TableContainer";
+import TableHead from "@material-ui/core/TableHead";
+import TableRow from "@material-ui/core/TableRow";
+import Paper from "@material-ui/core/Paper";
+import DeleteOutlineOutlinedIcon from "@material-ui/icons/DeleteOutlineOutlined";
+
+import "./index.scss";
+const useStyles = makeStyles({
+ table: {},
+});
+
+const maxMobileSize = 550;
+const maxDesktopSize = 1250;
+
+const fontSize = {
+ mobile: {
+ info: {
+ strong: window.innerWidth > maxMobileSize ? 15 : window.innerWidth / 28,
+ p: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 36,
+ span: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 36,
+ },
+ price: {
+ strong: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 22,
+ span: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 40,
+ },
+ counter: {
+ button: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 25,
+ span: window.innerWidth > maxMobileSize ? 15 : window.innerWidth / 25,
+ },
+ delete: {
+ span: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 28,
+ },
+ },
+ desktop: {
+ info: {
+ strong: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 75,
+ p: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 95,
+ span: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 95,
+ },
+ price: {
+ strong: window.innerWidth > maxDesktopSize ? 18 : window.innerWidth / 60,
+ span: window.innerWidth > maxDesktopSize ? 13 : window.innerWidth / 95,
+ },
+ counter: {
+ button: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 65,
+ span: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 65,
+ },
+ delete: {
+ span: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 75,
+ },
+ },
+};
+
+function BasicTable(props) {
+ const classes = useStyles();
+ const { list, handleDelete, route, factorInfo } = props;
+ const sum = () => {
+ let total = 0;
+ for (let i = 0; i < list.length; i++) {
+ total += list[i].count * 1;
+ }
+ return total;
+ };
+
+ return (
+ <>
+ {window.innerWidth < 1000 ? (
+
+
+
+
+ {window.t("محصولات")}
+ {window.t("قیمت")}
+
+ {route === "callback" ? (
+ {window.t("تعداد")}
+ ) : null}
+
+
+
+ {list.map((row, i) => (
+
+ ))}
+ {route === "cart" && factorInfo ? (
+
+
+
+ {window.t("مبلغ کل")} {window.tr(factorInfo.sumPrice)}
+
+
+
+
+ {sum()} {window.t("محصول")}
+
+
+
+ ) : null}
+
+
+
+ ) : null}
+ {window.innerWidth > 1000 ? (
+
+
+
+
+ {window.t("محصولات")}
+ {window.t("قیمت")}
+ {window.t("تعداد")}
+
+
+
+
+ {list.map((row, i) => (
+
+ ))}
+ {factorInfo ? (
+
+
+
+
+
+
+ {window.t("مبلغ کل")} {window.tr(factorInfo.sumPrice)}
+
+
+
+
+ {sum()} {window.t("محصول")}
+
+
+
+
+
+
+ ) : null}
+
+
+
+ ) : null}
+ >
+ );
+}
+
+const Item = (props) => {
+ const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
+ const { data, pushToCart, id, route } = props;
+ if (!data.product) return null;
+ return (
+ <>
+ {window.innerWidth < 1000 ? (
+
+
+
+

+
+
+ {window.t("نسخه") +
+ ` ${
+ +data.product.productType === 1
+ ? window.t("الکترونیکی")
+ : window.t("چاپی")
+ } ${data.product.book.name} `}
+
+
+ {window.t("پایه") + ` ${grades[data.product.book.gradeId]}`}
+
+
+ {window.t("همراه با:")}
+ {data.product.book.items ||
+ window.t("کد فعالسازی محتوای الکترونیک")}
+
+ {route !== "callback" ? (
+
+
+ pushToCart({
+ productId: data.productId,
+ userId: id,
+ count: -data.count,
+ })
+ }
+ />
+
+ pushToCart({
+ productId: data.productId,
+ userId: id,
+ count: -data.count,
+ })
+ }
+ style={{
+ fontSize: fontSize.mobile.delete.span,
+ color: "#FC120A",
+ cursor: "pointer",
+ }}
+ >
+ {window.t("حذف")}
+
+
+ ) : null}
+
+
+
+
+
+
+
+ {window.tr(data.product.price * data.count || 1000)}
+
+ {route !== "callback" ? (
+
+ {window.tr(data.product.price || "100")}{" "}
+ {window.t("قیمت هر واحد")}{" "}
+
+ ) : null}
+
+ {route === "cart" ? (
+
+
+
+ {data.count}
+
+
+
+ ) : null}
+
+
+ {route === "callback" ? (
+
+
+ {data.count}
+
+
+ ) : null}
+
+ ) : null}
+ {window.innerWidth > 1000 ? (
+
+
+
+

+
+
+ {`${window.t("نسخه")} ${
+ +data.product?.productType === 1
+ ? window.t("الکترونیکی")
+ : window.t("چاپی")
+ } ${data.product?.book?.name} `}
+
+
+ {window.t("پایه") + ` ${grades[data.product?.book?.gradeId]}`}
+
+
+ {window.t("همراه با:")}
+ {data.product?.book?.items ||
+ window.t("کد فعالسازی محتوای الکترونیک")}
+
+
+
+
+
+
+
+ {window.tr(data.product.price * data.count || "1000")}{" "}
+ {window.t("تومان")}
+
+
+ {window.t("قیمت هر عدد")}{" "}
+ {window.tr(data.product.price) || "100"}
+ {window.t("تومان")}
+
+
+
+
+
+
+
+
+ {data.count}
+
+
+
+
+
+
+
+ handleDelete(data.id)}
+ onClick={() =>
+ pushToCart({
+ productId: data.productId,
+ userId: id,
+ count: -data.count,
+ })
+ }
+ />
+ handleDelete(data.id)}
+ onClick={() =>
+ pushToCart({
+ productId: data.productId,
+ userId: id,
+ count: -data.count,
+ })
+ }
+ style={{
+ fontSize: fontSize.desktop.delete.span,
+ cursor: "pointer",
+ }}
+ >
+ {window.t("حذف")}
+
+
+
+
+ ) : null}
+ >
+ );
+};
+
+export default connect(
+ (state) => ({
+ loading: state.userProduct.loading,
+ info: state.book.info,
+ id: state.user.status.id,
+ factorInfo: state.userFactor.info,
+ lang: state.publicApi.lang,
+ }),
+ { pushToCart: userProduct.add }
+)(BasicTable);
diff --git a/src/views/Cart/index.js b/src/views/Cart/index.js
index db94c8c..9177216 100644
--- a/src/views/Cart/index.js
+++ b/src/views/Cart/index.js
@@ -1,432 +1,432 @@
-import React, { Component } from "react";
-import { connect } from "react-redux";
-import { transport, userFactor } from "~/Redux/actions";
-
-import Navbar from "../Home/Navbar/index";
-import Footer from "../Home/Footer/index";
-import Table from "./Table/index";
-import DiscoutCode from "./Discount/index";
-import DeliveryMethod from "./DeliveryMethod/index";
-import Factor from "./Factor/index";
-import Loader from "~/components/Loader/index";
-import { Link, useHistory } from "react-router-dom";
-import "./index.scss";
-function Navigate({ path }) {
- let history = useHistory();
- return <>{history.push(path)}>;
-}
-
-const maxDesktopSize = 1250;
-const maxMobileSize = 550;
-
-const fontSize = {
- desktop: {
- h1: window.innerWidth > maxDesktopSize ? 30 : window.innerWidth / 40,
- th: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 80,
- h2: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 55,
- h3: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 90,
- strong: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 90,
- span: window.innerWidth > maxDesktopSize ? 10 : window.innerWidth / 95,
- p: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 90,
- },
- mobile: {
- h1: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 13,
- h2: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 24,
- h3: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 30,
- strong: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 30,
- span: window.innerWidth > maxMobileSize ? 10 : window.innerWidth / 34,
- p: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 32,
- input: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 20,
- },
-};
-class Cart extends Component {
- state = {
- selectedDelivery: { name: "", price: 0 },
- discount: 0,
- totalPrice: null,
- list: this.props.list,
- controlFactorInfoRepeat: true,
- };
-
- componentDidUpdate(prevProps, prevState) {
- // if (this.props.factorInfo === null && !this.props.loading) {
- // this.props.getFactorInfo({});
- // }
-
- if (window.location.search)
- if (!window.location.search.includes("NOK") && !window.location.hash) {
- let Authority = window.location.search
- .slice(1)
- .split("&")[0]
- .split("=")[1];
- this.props.getVerify({ Authority });
- window.location.hash = "verified";
- }
-
- // if (this.props.factorInfo === null && !this.controlFactorInfoRepeat) {
- // this.props.getFactorInfo({});
- // this.controlFactorInfoRepeat = true;
- // }
- // if (this.props.list.length > 0) {
- // let wantedId; //should be zero
- // for (let item of this.props.list) {
- // if (item.condition === 2) {
- // wantedId = item.id;
- // break;
- // }
- // }
- // if (this.props.list.length !== 1) {
- // // this.props.getInfo({ id: wantedId });
- // }
- // } else {
- // // this.props.getFactorInfo({});
- // }
- }
-
- componentDidMount() {
- localStorage.removeItem("afterLogin");
-
- window.scrollTo(0, 0);
- this.props.getTransportList();
- this.props.getFactorInfo({});
- }
-
- handleCounter = (type, id) => {
- if (type === "increase") {
- this.setState((prevState) => ({
- list: prevState.list.map((item) =>
- item.id === id ? { ...item, number: item.number + 1 } : item
- ),
- }));
- } else {
- this.setState((prevState) => ({
- list: prevState.list.map((item) =>
- item.id === id ? { ...item, number: item.number - 1 } : item
- ),
- }));
- }
- };
-
- handleDelete = (id) => {
- let list = this.state.list.filter((item) => item.id !== id);
- this.setState({
- list: list,
- });
- };
-
- totalPrice = () => {
- let total = 0;
- for (let i = 0; i < this.state.list.length; i++) {
- total += this.state.list[i].price * this.state.list[i].number;
- }
- return total - this.state.discount + this.state.selectedDelivery.price;
- };
-
- render() {
- const { list, payPrice, payMethods, factorInfo } = this.props;
- if (!factorInfo || list.length === 0)
- return (
-
-
-
- {window.t("هیچ محصولی در سبد خرید شما وجود ندارد")}{" "}
-
-
-
- {window.t("فروشگاه")}{" "}
-
-
- );
- return (
- <>
- {window.innerWidth > 1000 ? (
- list.length > 0 ? (
- <>
-
-
- {window.location.search.includes("NOK") ||
- this.props.isVerified === false ? (
-
- {window.t(
- "پرداخت شما با خطا مواجه شد ، لطفا مجدد تلاش نمایید"
- )}{" "}
-
- ) : window.location.search.includes("OK") ? (
-
- ) : null}
-
-
-
-
- {window.t("سبد پیش خرید")}{" "}
-
-
-
-
-
- {false && factorInfo.transportId ? (
-
- ) : null}
- {factorInfo ? : null}
- {factorInfo ? : null}
- {factorInfo ? (
-
-
- {window.t("جمع کل")}
-
- {window.t("سبد خرید")}{" "}
-
-
-
- {window.tr(
- factorInfo.payPrice - factorInfo.transportPrice
- )}
-
-
- {window.t("تومان")}
-
-
-
- ) : null}
-
- {/*
-
- {window.t("روشهای ارسال")}
-
-
- {window.t("با توجه به شرایط یکی از دو گزینه زیر را انتخاب کنید")}
-
- {payMethods.map((item, i) => (
-
- ))}
-
-
*/}
-
- this.props.payFactor({ userId: userId })}
- >
- {window.t("ادامه")}{" "}
-
-
-
-
-
- >
- ) : (
-
-
-
- )
- ) : null}
- {window.innerWidth < 1000 ? (
- list.length > 0 ? (
-
-
- {window.location.search.includes("NOK") ? (
-
- {window.t(
- "پرداخت شما با خطا مواجه شد ، لطفا مجدد تلاش نمایید"
- )}
-
- ) : null}
-
- {window.t("سبد پیش خرید")}
-
-
- {false && factorInfo.transportId ? (
-
-
- {window.t("روشهای ارسال")}
-
-
- {window.t(
- "با توجه به شرایط یکی از دو گزینه زیر را انتخاب کنید"
- )}{" "}
-
-
-
- {this.props.payMethods.map((item, i) => (
-
- ))}
-
-
- ) : null}
-
- {factorInfo ?
: null}
-
-
-
- {window.t("جمع کل")}
- {window.t("سبد خرید")}{" "}
-
- {factorInfo ? (
-
-
- {window.tr(
- factorInfo.payPrice - factorInfo.transportPrice
- )}
- {/* // factorInfo.transportPrice - // factorInfo.offPrice} */}
-
-
- {window.t("تومان")}
-
-
- ) : null}
-
- {/*
-
{window.t("روشهای ارسال")}
-
- با توجه به شرایط یکی از دو گزینه زیر را انتخاب کنید")}
-
-
- {this.props.payMethods.map((item, i) => (
-
- ))}
-
-
*/}
- {/*
*/}
-
-
-
-
-
- {window.t(
- "شرایط استفاده از دانوین و حریم خصوصی را مطالعه کرده ام"
- )}
-
-
-
-
-
- {window.t("شرایط مرجوع کردن کالا در دانوین")}
-
-
-
this.props.payFactor({ userId: userId })}
- >
- {window.t("ادامه")}{" "}
-
-
- ) : (
-
-
-
- )
- ) : null}
- >
- );
- }
-}
-
-export default connect(
- (state) => ({
- list:
- state.userFactor.info?.products?.filter((item) => +item.condition < 2) ||
- [],
- payPrice: state.userProduct.sum,
- payMethods: state.transport.list,
- factorInfo: state.userFactor.info,
- loading: state.userFactor.loading,
- userId: state.user.status.id,
- lang: state.publicApi.lang,
- isVerified: state.userFactor.isVerified,
- }),
- {
- // getList: userProduct.list,
- // getInfo: userProduct.info,
- getTransportList: transport.list,
- getFactorInfo: userFactor.info,
- payFactor: userFactor.payment,
- getVerify: userFactor.verify,
- }
-)(Cart);
+import React, { Component } from "react";
+import { connect } from "react-redux";
+import { transport, userFactor } from "~/Redux/actions";
+
+import Navbar from "../Home/Navbar/index";
+import Footer from "../Home/Footer/index";
+import Table from "./Table/index";
+import DiscoutCode from "./Discount/index";
+import DeliveryMethod from "./DeliveryMethod/index";
+import Factor from "./Factor/index";
+import Loader from "~/components/Loader/index";
+import { Link, useHistory } from "react-router-dom";
+import "./index.scss";
+function Navigate({ path }) {
+ let history = useHistory();
+ return <>{history.push(path)}>;
+}
+
+const maxDesktopSize = 1250;
+const maxMobileSize = 550;
+
+const fontSize = {
+ desktop: {
+ h1: window.innerWidth > maxDesktopSize ? 30 : window.innerWidth / 40,
+ th: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 80,
+ h2: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 55,
+ h3: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 90,
+ strong: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 90,
+ span: window.innerWidth > maxDesktopSize ? 10 : window.innerWidth / 95,
+ p: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 90,
+ },
+ mobile: {
+ h1: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 13,
+ h2: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 24,
+ h3: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 30,
+ strong: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 30,
+ span: window.innerWidth > maxMobileSize ? 10 : window.innerWidth / 34,
+ p: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 32,
+ input: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 20,
+ },
+};
+class Cart extends Component {
+ state = {
+ selectedDelivery: { name: "", price: 0 },
+ discount: 0,
+ totalPrice: null,
+ list: this.props.list,
+ controlFactorInfoRepeat: true,
+ };
+
+ componentDidUpdate(prevProps, prevState) {
+ // if (this.props.factorInfo === null && !this.props.loading) {
+ // this.props.getFactorInfo({});
+ // }
+
+ if (window.location.search)
+ if (!window.location.search.includes("NOK") && !window.location.hash) {
+ let Authority = window.location.search
+ .slice(1)
+ .split("&")[0]
+ .split("=")[1];
+ this.props.getVerify({ Authority });
+ window.location.hash = "verified";
+ }
+
+ // if (this.props.factorInfo === null && !this.controlFactorInfoRepeat) {
+ // this.props.getFactorInfo({});
+ // this.controlFactorInfoRepeat = true;
+ // }
+ // if (this.props.list.length > 0) {
+ // let wantedId; //should be zero
+ // for (let item of this.props.list) {
+ // if (item.condition === 2) {
+ // wantedId = item.id;
+ // break;
+ // }
+ // }
+ // if (this.props.list.length !== 1) {
+ // // this.props.getInfo({ id: wantedId });
+ // }
+ // } else {
+ // // this.props.getFactorInfo({});
+ // }
+ }
+
+ componentDidMount() {
+ localStorage.removeItem("afterLogin");
+
+ window.scrollTo(0, 0);
+ this.props.getTransportList();
+ this.props.getFactorInfo({});
+ }
+
+ handleCounter = (type, id) => {
+ if (type === "increase") {
+ this.setState((prevState) => ({
+ list: prevState.list.map((item) =>
+ item.id === id ? { ...item, number: item.number + 1 } : item
+ ),
+ }));
+ } else {
+ this.setState((prevState) => ({
+ list: prevState.list.map((item) =>
+ item.id === id ? { ...item, number: item.number - 1 } : item
+ ),
+ }));
+ }
+ };
+
+ handleDelete = (id) => {
+ let list = this.state.list.filter((item) => item.id !== id);
+ this.setState({
+ list: list,
+ });
+ };
+
+ totalPrice = () => {
+ let total = 0;
+ for (let i = 0; i < this.state.list.length; i++) {
+ total += this.state.list[i].price * this.state.list[i].number;
+ }
+ return total - this.state.discount + this.state.selectedDelivery.price;
+ };
+
+ render() {
+ const { list, payPrice, payMethods, factorInfo } = this.props;
+ if (!factorInfo || list.length === 0)
+ return (
+
+
+
+ {window.t("هیچ محصولی در سبد خرید شما وجود ندارد")}{" "}
+
+
+
+ {window.t("فروشگاه")}{" "}
+
+
+ );
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+ list.length > 0 ? (
+ <>
+
+
+ {window.location.search.includes("NOK") ||
+ this.props.isVerified === false ? (
+
+ {window.t(
+ "پرداخت شما با خطا مواجه شد ، لطفا مجدد تلاش نمایید"
+ )}{" "}
+
+ ) : window.location.search.includes("OK") ? (
+
+ ) : null}
+
+
+
+
+ {window.t("سبد پیش خرید")}{" "}
+
+
+
+
+
+ {false && factorInfo.transportId ? (
+
+ ) : null}
+ {factorInfo ? : null}
+ {factorInfo ? : null}
+ {factorInfo ? (
+
+
+ {window.t("جمع کل")}
+
+ {window.t("سبد خرید")}{" "}
+
+
+
+ {window.tr(
+ factorInfo.payPrice - factorInfo.transportPrice
+ )}
+
+
+ {window.t("تومان")}
+
+
+
+ ) : null}
+
+ {/*
+
+ {window.t("روشهای ارسال")}
+
+
+ {window.t("با توجه به شرایط یکی از دو گزینه زیر را انتخاب کنید")}
+
+ {payMethods.map((item, i) => (
+
+ ))}
+
+
*/}
+
+ this.props.payFactor({ userId: userId })}
+ >
+ {window.t("ادامه")}{" "}
+
+
+
+
+
+ >
+ ) : (
+
+
+
+ )
+ ) : null}
+ {window.innerWidth < 1000 ? (
+ list.length > 0 ? (
+
+
+ {window.location.search.includes("NOK") ? (
+
+ {window.t(
+ "پرداخت شما با خطا مواجه شد ، لطفا مجدد تلاش نمایید"
+ )}
+
+ ) : null}
+
+ {window.t("سبد پیش خرید")}
+
+
+ {false && factorInfo.transportId ? (
+
+
+ {window.t("روشهای ارسال")}
+
+
+ {window.t(
+ "با توجه به شرایط یکی از دو گزینه زیر را انتخاب کنید"
+ )}{" "}
+
+
+
+ {this.props.payMethods.map((item, i) => (
+
+ ))}
+
+
+ ) : null}
+
+ {factorInfo ?
: null}
+
+
+
+ {window.t("جمع کل")}
+ {window.t("سبد خرید")}{" "}
+
+ {factorInfo ? (
+
+
+ {window.tr(
+ factorInfo.payPrice - factorInfo.transportPrice
+ )}
+ {/* // factorInfo.transportPrice - // factorInfo.offPrice} */}
+
+
+ {window.t("تومان")}
+
+
+ ) : null}
+
+ {/*
+
{window.t("روشهای ارسال")}
+
+ با توجه به شرایط یکی از دو گزینه زیر را انتخاب کنید")}
+
+
+ {this.props.payMethods.map((item, i) => (
+
+ ))}
+
+
*/}
+ {/*
*/}
+
+
+
+
+
+ {window.t(
+ "شرایط استفاده از دانوین و حریم خصوصی را مطالعه کرده ام"
+ )}
+
+
+
+
+
+ {window.t("شرایط مرجوع کردن کالا در دانوین")}
+
+
+
this.props.payFactor({ userId: userId })}
+ >
+ {window.t("ادامه")}{" "}
+
+
+ ) : (
+
+
+
+ )
+ ) : null}
+ >
+ );
+ }
+}
+
+export default connect(
+ (state) => ({
+ list:
+ state.userFactor.info?.products?.filter((item) => +item.condition < 2) ||
+ [],
+ payPrice: state.userProduct.sum,
+ payMethods: state.transport.list,
+ factorInfo: state.userFactor.info,
+ loading: state.userFactor.loading,
+ userId: state.user.status.id,
+ lang: state.publicApi.lang,
+ isVerified: state.userFactor.isVerified,
+ }),
+ {
+ // getList: userProduct.list,
+ // getInfo: userProduct.info,
+ getTransportList: transport.list,
+ getFactorInfo: userFactor.info,
+ payFactor: userFactor.payment,
+ getVerify: userFactor.verify,
+ }
+)(Cart);
diff --git a/src/views/ChatRoom/Body/Message/MultiSelect/index.js b/src/views/ChatRoom/Body/Message/MultiSelect/index.js
index b44c1b8..dec24dc 100644
--- a/src/views/ChatRoom/Body/Message/MultiSelect/index.js
+++ b/src/views/ChatRoom/Body/Message/MultiSelect/index.js
@@ -1,73 +1,73 @@
-import React, { Component } from "react";
-import ArrowRightAltIcon from "@material-ui/icons/ArrowRightAlt";
-import { toast } from "react-toastify";
-
-export default class RadioMessage extends Component {
- constructor(props) {
- super(props);
- this.state = {
- value: this.props.message.value,
- };
- }
-
- handleRadioChange = (newValue) => {
- if (this.props.isActive)
- this.setState({
- value: newValue,
- });
- };
-
- render() {
- const { message, isActive } = this.props;
- return (
-
-
- {message.options.map((row) => (
-
- ))}
-
- {isActive && (
-
- )}
-
- );
- }
-}
-
-const Row = (props) => {
- return (
-
- {props.list.map((item) => (
-
- ))}
-
- );
-};
-
-const Item = (props) => {
- return (
- props.handleRadioChange(props.item.name)}
- style={{
- backgroundColor:
- props.item.name === props.value
- ? "#6f42c1"
- : "rgb(181 224 252 / 47%)",
- color: props.item.name === props.value ? "white" : "black",
- }}
- >
- {props.item.name}
-
- );
-};
+import React, { Component } from "react";
+import ArrowRightAltIcon from "@material-ui/icons/ArrowRightAlt";
+import { toast } from "react-toastify";
+
+export default class RadioMessage extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ value: this.props.message.value,
+ };
+ }
+
+ handleRadioChange = (newValue) => {
+ if (this.props.isActive)
+ this.setState({
+ value: newValue,
+ });
+ };
+
+ render() {
+ const { message, isActive } = this.props;
+ return (
+
+
+ {message.options.map((row) => (
+
+ ))}
+
+ {isActive && (
+
+ )}
+
+ );
+ }
+}
+
+const Row = (props) => {
+ return (
+
+ {props.list.map((item) => (
+
+ ))}
+
+ );
+};
+
+const Item = (props) => {
+ return (
+ props.handleRadioChange(props.item.name)}
+ style={{
+ backgroundColor:
+ props.item.name === props.value
+ ? "#6f42c1"
+ : "rgb(181 224 252 / 47%)",
+ color: props.item.name === props.value ? "white" : "black",
+ }}
+ >
+ {props.item.name}
+
+ );
+};
diff --git a/src/views/ChatRoom/Body/Message/Select/index.js b/src/views/ChatRoom/Body/Message/Select/index.js
index 584c445..cc6b108 100644
--- a/src/views/ChatRoom/Body/Message/Select/index.js
+++ b/src/views/ChatRoom/Body/Message/Select/index.js
@@ -1,64 +1,64 @@
-import React, { Component } from "react";
-import ArrowRightAltIcon from "@material-ui/icons/ArrowRightAlt";
-
-export default class RadioMessage extends Component {
- state = {
- value: this.props.message.value,
- };
- handleRadioChange = (value) => {
- if (this.props.isActive) this.setState({ value });
- };
-
- render() {
- const { message, isActive, action } = this.props;
- const { value } = this.state;
- return (
-
-
- {message.options.map((row) => (
-
- ))}
-
- {isActive && (
-
- )}
-
- );
- }
-}
-
-const Row = (props) => {
- return (
-
- {props.list.map((item) => (
-
- ))}
-
- );
-};
-
-const Item = (props) => {
- return (
- props.handleRadioChange(props.item.name)}
- style={{
- backgroundColor:
- props.item.name === props.value
- ? "rgb(100, 205, 130)"
- : "rgba(255, 255, 255, 0.4)",
- color: props.item.name === props.value ? "white" : "black",
- }}
- >
- {props.item.name}
-
- );
-};
+import React, { Component } from "react";
+import ArrowRightAltIcon from "@material-ui/icons/ArrowRightAlt";
+
+export default class RadioMessage extends Component {
+ state = {
+ value: this.props.message.value,
+ };
+ handleRadioChange = (value) => {
+ if (this.props.isActive) this.setState({ value });
+ };
+
+ render() {
+ const { message, isActive, action } = this.props;
+ const { value } = this.state;
+ return (
+
+
+ {message.options.map((row) => (
+
+ ))}
+
+ {isActive && (
+
+ )}
+
+ );
+ }
+}
+
+const Row = (props) => {
+ return (
+
+ {props.list.map((item) => (
+
+ ))}
+
+ );
+};
+
+const Item = (props) => {
+ return (
+ props.handleRadioChange(props.item.name)}
+ style={{
+ backgroundColor:
+ props.item.name === props.value
+ ? "rgb(100, 205, 130)"
+ : "rgba(255, 255, 255, 0.4)",
+ color: props.item.name === props.value ? "white" : "black",
+ }}
+ >
+ {props.item.name}
+
+ );
+};
diff --git a/src/views/ChatRoom/Body/Message/Slider/index.js b/src/views/ChatRoom/Body/Message/Slider/index.js
index bb37ef9..6918924 100644
--- a/src/views/ChatRoom/Body/Message/Slider/index.js
+++ b/src/views/ChatRoom/Body/Message/Slider/index.js
@@ -1,60 +1,60 @@
-import React, { Component } from "react";
-import Grid from "@material-ui/core/Grid";
-import Slider from "@material-ui/core/Slider";
-import Input from "@material-ui/core/Input";
-import ArrowRightAltIcon from "@material-ui/icons/ArrowRightAlt";
-
-export default class SliderMessage extends Component {
- state = {
- value: this.props.message.value || 0,
- };
- onChange = (value) => {
- if (!this.props.isActive || !value) return;
- const [min, max] = this.props.message.options[0] || [0, 100, 1];
- this.setState({ value: Math.min(max, Math.max(min, parseFloat(value))) });
- };
-
- render() {
- const { message, isActive, action } = this.props;
- const [min, max, step] = message.options[0] || [0, 100, 1];
- const { value } = this.state;
- return (
-
-
-
- this.onChange(value)}
- aria-labelledby="input-slider"
- min={min}
- max={max}
- step={step}
- />
-
-
- this.onChange(e.target.value)}
- onBlur={() => this.onChange(value)}
- inputProps={{
- step: step,
- min: min,
- max: max,
- type: "number",
- "aria-labelledby": "input-slider",
- }}
- />
-
-
- {isActive && (
-
- )}
-
- );
- }
-}
+import React, { Component } from "react";
+import Grid from "@material-ui/core/Grid";
+import Slider from "@material-ui/core/Slider";
+import Input from "@material-ui/core/Input";
+import ArrowRightAltIcon from "@material-ui/icons/ArrowRightAlt";
+
+export default class SliderMessage extends Component {
+ state = {
+ value: this.props.message.value || 0,
+ };
+ onChange = (value) => {
+ if (!this.props.isActive || !value) return;
+ const [min, max] = this.props.message.options[0] || [0, 100, 1];
+ this.setState({ value: Math.min(max, Math.max(min, parseFloat(value))) });
+ };
+
+ render() {
+ const { message, isActive, action } = this.props;
+ const [min, max, step] = message.options[0] || [0, 100, 1];
+ const { value } = this.state;
+ return (
+
+
+
+ this.onChange(value)}
+ aria-labelledby="input-slider"
+ min={min}
+ max={max}
+ step={step}
+ />
+
+
+ this.onChange(e.target.value)}
+ onBlur={() => this.onChange(value)}
+ inputProps={{
+ step: step,
+ min: min,
+ max: max,
+ type: "number",
+ "aria-labelledby": "input-slider",
+ }}
+ />
+
+
+ {isActive && (
+
+ )}
+
+ );
+ }
+}
diff --git a/src/views/ChatRoom/Body/Message/Sort/index.js b/src/views/ChatRoom/Body/Message/Sort/index.js
index 9df581f..3e8c7a4 100644
--- a/src/views/ChatRoom/Body/Message/Sort/index.js
+++ b/src/views/ChatRoom/Body/Message/Sort/index.js
@@ -1,59 +1,59 @@
-import React, { Component } from "react";
-import { SortableContainer, SortableElement } from "react-sortable-hoc";
-import arrayMove from "array-move";
-import ArrowRightAltIcon from "@material-ui/icons/ArrowRightAlt";
-
-export default class DraggableMessage extends Component {
- constructor(props) {
- super(props);
- this.state = this.props.message;
- }
- onSortEnd = ({ oldIndex, newIndex }) => {
- if (this.props.isActive)
- this.setState(({ options }) => ({
- options: arrayMove(options, oldIndex, newIndex),
- }));
- };
-
- render() {
- const { isActive, action } = this.props;
-
- return (
-
-
- {isActive && (
-
- )}
-
- );
- }
-}
-
-const SortableList = SortableContainer(({ items, disabled }) => {
- return (
-
- {items.map((row, index) => (
-
- ))}
-
- );
-});
-
-const SortableItem = SortableElement(({ value }) => (
-
- {value.map((item) => (
-
{item.name}
- ))}
-
-));
+import React, { Component } from "react";
+import { SortableContainer, SortableElement } from "react-sortable-hoc";
+import arrayMove from "array-move";
+import ArrowRightAltIcon from "@material-ui/icons/ArrowRightAlt";
+
+export default class DraggableMessage extends Component {
+ constructor(props) {
+ super(props);
+ this.state = this.props.message;
+ }
+ onSortEnd = ({ oldIndex, newIndex }) => {
+ if (this.props.isActive)
+ this.setState(({ options }) => ({
+ options: arrayMove(options, oldIndex, newIndex),
+ }));
+ };
+
+ render() {
+ const { isActive, action } = this.props;
+
+ return (
+
+
+ {isActive && (
+
+ )}
+
+ );
+ }
+}
+
+const SortableList = SortableContainer(({ items, disabled }) => {
+ return (
+
+ {items.map((row, index) => (
+
+ ))}
+
+ );
+});
+
+const SortableItem = SortableElement(({ value }) => (
+
+ {value.map((item) => (
+
{item.name}
+ ))}
+
+));
diff --git a/src/views/ChatRoom/Body/Message/Tap/index.js b/src/views/ChatRoom/Body/Message/Tap/index.js
index 0913330..e85b15d 100644
--- a/src/views/ChatRoom/Body/Message/Tap/index.js
+++ b/src/views/ChatRoom/Body/Message/Tap/index.js
@@ -1,30 +1,30 @@
-import React, { Component } from "react";
-import arrayMove from "array-move";
-import "./index.scss";
-
-export default class DraggableMessage extends Component {
- constructor(props) {
- super(props);
- this.state = this.props.message;
- }
- onSortEnd = ({ oldIndex, newIndex }) => {
- if (this.props.isActive)
- this.setState(({ options }) => ({
- options: arrayMove(options, oldIndex, newIndex),
- }));
- };
-
- render() {
- const { isActive } = this.props;
- if (!isActive) return null;
- return ;
- }
- a = (
-
- );
-}
+import React, { Component } from "react";
+import arrayMove from "array-move";
+import "./index.scss";
+
+export default class DraggableMessage extends Component {
+ constructor(props) {
+ super(props);
+ this.state = this.props.message;
+ }
+ onSortEnd = ({ oldIndex, newIndex }) => {
+ if (this.props.isActive)
+ this.setState(({ options }) => ({
+ options: arrayMove(options, oldIndex, newIndex),
+ }));
+ };
+
+ render() {
+ const { isActive } = this.props;
+ if (!isActive) return null;
+ return ;
+ }
+ a = (
+
+ );
+}
diff --git a/src/views/ChatRoom/Body/index.js b/src/views/ChatRoom/Body/index.js
index aa1bb76..767f5bb 100644
--- a/src/views/ChatRoom/Body/index.js
+++ b/src/views/ChatRoom/Body/index.js
@@ -1,636 +1,636 @@
-import React, { Component } from "react";
-import Message from "./Message";
-import ChatInputs from "./Input";
-import Keyboard from "./Keyboard";
-import { RecordState } from "audio-react-recorder";
-import ReactPlayer from "react-player";
-import ReactAudioPlayer from "react-audio-player";
-// import { list, send, sendKeys } from "../../../Redux/actions/message";
-import { chat } from "../../../Redux/actions";
-import { connect } from "react-redux";
-import Emoji from "./Emoji/index";
-
-import "./index.scss";
-class List extends Component {
- constructor(props) {
- super(props);
- this.state = {
- emoji: false,
- counter: 1,
- id:
- window.innerWidth < 1000
- ? window.location.href.split("/").pop() * 1
- : this.props.id,
- data: {},
- message: "",
- voice: null,
- file: null,
- image: null,
- video: null,
- music: null,
- document: null,
- };
- }
- addcounter(type) {
- if (type === "parent") {
- if (localStorage.getItem("tapType") === "nothing") {
- localStorage.removeItem("tapType");
- return;
- } else {
- this.setState({ counter: this.state.counter + 1 });
- }
- } else {
- localStorage.setItem("tapType", "nothing");
- return;
- }
- }
-
- start = () => {
- this.setState({
- voice: RecordState.START,
- });
- };
-
- stop = () => {
- this.setState({
- voice: RecordState.STOP,
- });
- };
-
- //audioData contains blob and blobUrl
- onStop = (audioData) => {
- this.setState({
- voice: audioData,
- });
- this.sendVoice(audioData);
- };
-
- cancel = () => {
- this.setState({
- voice: null,
- });
- };
-
- typeText = (type, val) => {
- if (type === "text") {
- this.setState({
- message: val,
- });
- } else {
- this.setState((prevState) => ({
- message: prevState.message + val,
- }));
- }
- };
-
- addFile = async (e) => {
- if (
- e.target.files[0].type === "image/apng" ||
- e.target.files[0].type === "image/avif" ||
- e.target.files[0].type === "image/gif" ||
- e.target.files[0].type === "image/jpeg" ||
- e.target.files[0].type === "image/png" ||
- e.target.files[0].type === "image/svg+xml" ||
- e.target.files[0].type === "image/webp"
- ) {
- this.setState({
- image: URL.createObjectURL(e.target.files[0]),
- file: "fill",
- video: null,
- document: null,
- music: null,
- });
- } else if (
- e.target.files[0].type === "video/3gpp" ||
- e.target.files[0].type === "video/mpeg" ||
- e.target.files[0].type === "video/mp4" ||
- e.target.files[0].type === "video/ogg" ||
- e.target.files[0].type === "video/quicktime" ||
- e.target.files[0].type === "video/webm"
- ) {
- this.setState({
- image: null,
- file: "fill",
- video: URL.createObjectURL(e.target.files[0]),
- document: null,
- music: null,
- });
- } else if (
- e.target.files[0].type === "audio/3gpp" ||
- e.target.files[0].type === "audio/aac" ||
- e.target.files[0].type === "audio/flac" ||
- e.target.files[0].type === "audio/mpeg" ||
- e.target.files[0].type === "audio/mp3" ||
- e.target.files[0].type === "audio/mp4" ||
- e.target.files[0].type === "audio/ogg" ||
- e.target.files[0].type === "audio/wav" ||
- e.target.files[0].type === "audio/webm"
- ) {
- this.setState({
- image: null,
- file: "fill",
- video: null,
- document: null,
- music: URL.createObjectURL(e.target.files[0]),
- });
- } else {
- this.setState({
- image: null,
- file: "fill",
- video: null,
- music: null,
- document: {
- data: URL.createObjectURL(e.target.files[0]),
- name: e.target.files[0].name,
- },
- });
- }
- };
-
- sendMessage = () => {
- if (this.state.file !== null) {
- this.sendFile();
- return;
- } else {
- let now = new Date();
- this.setState((prevState) => ({
- data: {
- ...prevState.data,
- messages: [
- ...prevState.data.messages,
- {
- id: "m12",
- type: "normal",
- text: prevState.message,
- voice: null,
- image: null,
- file: null,
- video: null,
- music: null,
- document: null,
- createdAt: now.toString(),
- user: {
- id: "u1",
- name: window.t("علی"),
- },
- },
- ],
- },
- }));
- this.setState({
- message: "",
- });
- }
- };
-
- sendVoice = (audioData) => {
- let now = new Date();
- this.setState((prevState) => ({
- data: {
- ...prevState.data,
- messages: [
- ...prevState.data.messages,
- {
- id: "m9",
- text: null,
- type: "normal",
- voice: audioData,
- createdAt: now.toString(),
- image: null,
- video: null,
- document: null,
- music: null,
- user: {
- id: "u1",
- name: window.t("علی"),
- },
- },
- ],
- },
- }));
- this.setState({
- voice: null,
- });
- };
-
- sendFile = () => {
- const { image, video, music, document } = this.state;
- let now = new Date();
- if (image !== null) {
- this.setState((prevState) => ({
- data: {
- ...prevState.data,
- messages: [
- ...prevState.data.messages,
- {
- id: "m8",
- type: "normal",
- text: prevState.message,
- voice: null,
- createdAt: now.toString(),
- image: image,
- video: null,
- document: null,
- music: null,
- user: {
- id: "u1",
- name: window.t("علی"),
- },
- },
- ],
- },
- }));
- this.setState({
- file: null,
- image: null,
- message: "",
- });
- } else if (video !== null) {
- this.setState((prevState) => ({
- data: {
- ...prevState.data,
- messages: [
- ...prevState.data.messages,
- {
- id: "m8",
- type: "normal",
- text: prevState.message,
- voice: null,
- createdAt: now.toString(),
- image: null,
- video: video,
- document: null,
- music: null,
- user: {
- id: "u1",
- name: window.t("علی"),
- },
- },
- ],
- },
- }));
- this.setState({
- file: null,
- video: null,
- message: "",
- });
- } else if (music !== null) {
- this.setState((prevState) => ({
- data: {
- ...prevState.data,
- messages: [
- ...prevState.data.messages,
- {
- id: "m8",
- text: prevState.message,
- type: "normal",
- voice: null,
- createdAt: now.toString(),
- image: null,
- video: null,
- document: null,
- music: music,
- user: {
- id: "u1",
- name: window.t("علی"),
- },
- },
- ],
- },
- }));
- this.setState({
- file: null,
- music: null,
- message: "",
- });
- } else if (document !== null) {
- this.setState((prevState) => ({
- data: {
- ...prevState.data,
- messages: [
- ...prevState.data.messages,
- {
- id: "m8",
- text: prevState.message,
- type: "normal",
- voice: null,
-
- createdAt: now.toString(),
- image: null,
- video: null,
- document: document,
- music: null,
- user: {
- id: "u1",
- name: window.t("علی"),
- },
- },
- ],
- },
- }));
- this.setState({
- file: null,
- document: null,
- message: "",
- });
- }
- };
-
- cancelSendFile = () => {
- this.setState({
- file: null,
- document: null,
- message: "",
- image: null,
- video: null,
- voice: null,
- music: null,
- });
- };
-
- componentDidMount() {
- this.props.list({ chatId: this.state.id });
- this.props.info({ id: this.state.id });
- // this.componentDidUpdate();
- }
-
- componentDidUpdate(prevProps) {
- let chatroom = document.getElementById("chatroom");
- chatroom.scrollTop = chatroom.scrollHeight + 40;
-
- if (prevProps.id !== this.props.id) {
- this.props.info({
- id:
- window.innerWidth < 1000
- ? window.location.href.split("/").pop() * 1
- : this.props.id,
- });
-
- this.props.list({
- chatId:
- window.innerWidth < 1000
- ? window.location.href.split("/").pop() * 1
- : this.props.id,
- });
- }
- }
-
- randomColor() {
- let hex = Math.floor(Math.random() * 0x999999);
- let color = "#" + hex.toString(16);
-
- return color;
- }
- render() {
- const { chatInfo, messageList: msaster } = this.props; //last
- const messageList = msaster.slice(0, this.state.counter);
- const last = messageList.slice(-1)[0] || {};
- const userIdx = this.userIdx || {};
- if (Object.keys(userIdx).length === 0) {
- chatInfo.users.map(
- (e) => (userIdx[e.id] = { ...e, color: this.randomColor() })
- );
- this.userIdx = userIdx;
- }
-
- return (
- <>
- {window.innerWidth < 1000 ? (
- this.addcounter("parent")}
- >
-
- {chatInfo.users &&
- messageList.map((message, i) =>
- this.state.image === null &&
- this.state.music === null &&
- this.state.video === null ? (
-
this.addcounter()}
- isActive={message.id === last.id}
- prevUserId={i > 0 ? messageList[i - 1].userId : 0}
- isSelf={new Set([101, 103, 106, 108, 110]).has(
- message.userId * 1
- )}
- key={message.id}
- file={this.state.image}
- document={this.state.document}
- message={message}
- user={
- userIdx[message.userId] || {
- id: 0,
- fileId: 0,
- name: "null",
- }
- }
- />
- ) : null
- )}
- {this.state.image !== null ? (
-
-

-
- ) : null}
- {this.state.video !== null ? (
-
-
-
- ) : null}
- {this.state.music !== null ? (
-
-
-
- ) : null}
- {this.state.document !== null ? (
-
-
-
{`ارسال (${this.state.document.name}) به ${this.props.info.title}؟`}
-
-
-
-
-
-
- ) : null}
-
-
this.addcounter("nothing")}
- >
- {last.action === "text" ? (
-
this.addcounter()}
- onStop={this.onStop}
- stop={this.stop}
- start={this.start}
- cancel={this.cancel}
- message={this.state.message}
- recordState={this.state.voice}
- typeText={this.typeText}
- sendMessage={this.sendMessage}
- addFile={this.addFile}
- file={this.state.file}
- parent={this}
- />
- ) : null}
- {last.action === "keyboard" ? (
- this.addcounter()}
- />
- ) : null}
- {this.state.emoji ? (
-
-
-
- ) : null}
-
-
- ) : null}
- {window.innerWidth > 1000 ? (
- this.addcounter("parent")}
- >
-
- {chatInfo.users &&
- messageList.map((message, i) =>
- this.state.image === null &&
- this.state.music === null &&
- this.state.video === null ? (
-
this.addcounter()}
- isActive={message.id === last.id}
- prevUserId={i > 0 ? messageList[i - 1].userId : 0}
- isSelf={new Set([101, 103, 106, 108, 110]).has(
- message.userId * 1
- )}
- key={message.id}
- file={this.state.image}
- document={this.state.document}
- message={message}
- user={
- userIdx[message.userId] || {
- id: 0,
- fileId: 0,
- name: "null",
- }
- }
- />
- ) : null
- )}
- {this.state.image !== null ? (
-
-

-
- ) : null}
- {this.state.video !== null ? (
-
-
-
- ) : null}
- {this.state.music !== null ? (
-
-
-
- ) : null}
- {this.state.document !== null ? (
-
-
-
{`ارسال (${this.state.document.name}) به ${this.props.info.title}؟`}
-
-
-
-
-
-
- ) : null}
-
-
this.addcounter("nothing")}
- >
- {last.action === "text" ? (
-
this.addcounter()}
- onStop={this.onStop}
- stop={this.stop}
- start={this.start}
- cancel={this.cancel}
- message={this.state.message}
- recordState={this.state.voice}
- typeText={this.typeText}
- sendMessage={this.sendMessage}
- addFile={this.addFile}
- file={this.state.file}
- parent={this}
- />
- ) : null}
- {last.action === "keyboard" ? (
- this.addcounter()}
- />
- ) : null}
- {this.state.emoji ? (
-
-
-
- ) : null}
-
-
- ) : null}
- >
- );
- }
-}
-export default connect(
- (state) => {
- return {
- chatInfo: state.chat.info,
- userId: state.user.isLogin.id,
- messageList: state.message.list || [],
- last: state.message.list.slice(-1)[0] || {},
- };
- },
- { info: chat.info, bio: chat.bio }
-)(List);
+import React, { Component } from "react";
+import Message from "./Message";
+import ChatInputs from "./Input";
+import Keyboard from "./Keyboard";
+import { RecordState } from "audio-react-recorder";
+import ReactPlayer from "react-player";
+import ReactAudioPlayer from "react-audio-player";
+// import { list, send, sendKeys } from "../../../Redux/actions/message";
+import { chat } from "../../../Redux/actions";
+import { connect } from "react-redux";
+import Emoji from "./Emoji/index";
+
+import "./index.scss";
+class List extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ emoji: false,
+ counter: 1,
+ id:
+ window.innerWidth < 1000
+ ? window.location.href.split("/").pop() * 1
+ : this.props.id,
+ data: {},
+ message: "",
+ voice: null,
+ file: null,
+ image: null,
+ video: null,
+ music: null,
+ document: null,
+ };
+ }
+ addcounter(type) {
+ if (type === "parent") {
+ if (localStorage.getItem("tapType") === "nothing") {
+ localStorage.removeItem("tapType");
+ return;
+ } else {
+ this.setState({ counter: this.state.counter + 1 });
+ }
+ } else {
+ localStorage.setItem("tapType", "nothing");
+ return;
+ }
+ }
+
+ start = () => {
+ this.setState({
+ voice: RecordState.START,
+ });
+ };
+
+ stop = () => {
+ this.setState({
+ voice: RecordState.STOP,
+ });
+ };
+
+ //audioData contains blob and blobUrl
+ onStop = (audioData) => {
+ this.setState({
+ voice: audioData,
+ });
+ this.sendVoice(audioData);
+ };
+
+ cancel = () => {
+ this.setState({
+ voice: null,
+ });
+ };
+
+ typeText = (type, val) => {
+ if (type === "text") {
+ this.setState({
+ message: val,
+ });
+ } else {
+ this.setState((prevState) => ({
+ message: prevState.message + val,
+ }));
+ }
+ };
+
+ addFile = async (e) => {
+ if (
+ e.target.files[0].type === "image/apng" ||
+ e.target.files[0].type === "image/avif" ||
+ e.target.files[0].type === "image/gif" ||
+ e.target.files[0].type === "image/jpeg" ||
+ e.target.files[0].type === "image/png" ||
+ e.target.files[0].type === "image/svg+xml" ||
+ e.target.files[0].type === "image/webp"
+ ) {
+ this.setState({
+ image: URL.createObjectURL(e.target.files[0]),
+ file: "fill",
+ video: null,
+ document: null,
+ music: null,
+ });
+ } else if (
+ e.target.files[0].type === "video/3gpp" ||
+ e.target.files[0].type === "video/mpeg" ||
+ e.target.files[0].type === "video/mp4" ||
+ e.target.files[0].type === "video/ogg" ||
+ e.target.files[0].type === "video/quicktime" ||
+ e.target.files[0].type === "video/webm"
+ ) {
+ this.setState({
+ image: null,
+ file: "fill",
+ video: URL.createObjectURL(e.target.files[0]),
+ document: null,
+ music: null,
+ });
+ } else if (
+ e.target.files[0].type === "audio/3gpp" ||
+ e.target.files[0].type === "audio/aac" ||
+ e.target.files[0].type === "audio/flac" ||
+ e.target.files[0].type === "audio/mpeg" ||
+ e.target.files[0].type === "audio/mp3" ||
+ e.target.files[0].type === "audio/mp4" ||
+ e.target.files[0].type === "audio/ogg" ||
+ e.target.files[0].type === "audio/wav" ||
+ e.target.files[0].type === "audio/webm"
+ ) {
+ this.setState({
+ image: null,
+ file: "fill",
+ video: null,
+ document: null,
+ music: URL.createObjectURL(e.target.files[0]),
+ });
+ } else {
+ this.setState({
+ image: null,
+ file: "fill",
+ video: null,
+ music: null,
+ document: {
+ data: URL.createObjectURL(e.target.files[0]),
+ name: e.target.files[0].name,
+ },
+ });
+ }
+ };
+
+ sendMessage = () => {
+ if (this.state.file !== null) {
+ this.sendFile();
+ return;
+ } else {
+ let now = new Date();
+ this.setState((prevState) => ({
+ data: {
+ ...prevState.data,
+ messages: [
+ ...prevState.data.messages,
+ {
+ id: "m12",
+ type: "normal",
+ text: prevState.message,
+ voice: null,
+ image: null,
+ file: null,
+ video: null,
+ music: null,
+ document: null,
+ createdAt: now.toString(),
+ user: {
+ id: "u1",
+ name: window.t("علی"),
+ },
+ },
+ ],
+ },
+ }));
+ this.setState({
+ message: "",
+ });
+ }
+ };
+
+ sendVoice = (audioData) => {
+ let now = new Date();
+ this.setState((prevState) => ({
+ data: {
+ ...prevState.data,
+ messages: [
+ ...prevState.data.messages,
+ {
+ id: "m9",
+ text: null,
+ type: "normal",
+ voice: audioData,
+ createdAt: now.toString(),
+ image: null,
+ video: null,
+ document: null,
+ music: null,
+ user: {
+ id: "u1",
+ name: window.t("علی"),
+ },
+ },
+ ],
+ },
+ }));
+ this.setState({
+ voice: null,
+ });
+ };
+
+ sendFile = () => {
+ const { image, video, music, document } = this.state;
+ let now = new Date();
+ if (image !== null) {
+ this.setState((prevState) => ({
+ data: {
+ ...prevState.data,
+ messages: [
+ ...prevState.data.messages,
+ {
+ id: "m8",
+ type: "normal",
+ text: prevState.message,
+ voice: null,
+ createdAt: now.toString(),
+ image: image,
+ video: null,
+ document: null,
+ music: null,
+ user: {
+ id: "u1",
+ name: window.t("علی"),
+ },
+ },
+ ],
+ },
+ }));
+ this.setState({
+ file: null,
+ image: null,
+ message: "",
+ });
+ } else if (video !== null) {
+ this.setState((prevState) => ({
+ data: {
+ ...prevState.data,
+ messages: [
+ ...prevState.data.messages,
+ {
+ id: "m8",
+ type: "normal",
+ text: prevState.message,
+ voice: null,
+ createdAt: now.toString(),
+ image: null,
+ video: video,
+ document: null,
+ music: null,
+ user: {
+ id: "u1",
+ name: window.t("علی"),
+ },
+ },
+ ],
+ },
+ }));
+ this.setState({
+ file: null,
+ video: null,
+ message: "",
+ });
+ } else if (music !== null) {
+ this.setState((prevState) => ({
+ data: {
+ ...prevState.data,
+ messages: [
+ ...prevState.data.messages,
+ {
+ id: "m8",
+ text: prevState.message,
+ type: "normal",
+ voice: null,
+ createdAt: now.toString(),
+ image: null,
+ video: null,
+ document: null,
+ music: music,
+ user: {
+ id: "u1",
+ name: window.t("علی"),
+ },
+ },
+ ],
+ },
+ }));
+ this.setState({
+ file: null,
+ music: null,
+ message: "",
+ });
+ } else if (document !== null) {
+ this.setState((prevState) => ({
+ data: {
+ ...prevState.data,
+ messages: [
+ ...prevState.data.messages,
+ {
+ id: "m8",
+ text: prevState.message,
+ type: "normal",
+ voice: null,
+
+ createdAt: now.toString(),
+ image: null,
+ video: null,
+ document: document,
+ music: null,
+ user: {
+ id: "u1",
+ name: window.t("علی"),
+ },
+ },
+ ],
+ },
+ }));
+ this.setState({
+ file: null,
+ document: null,
+ message: "",
+ });
+ }
+ };
+
+ cancelSendFile = () => {
+ this.setState({
+ file: null,
+ document: null,
+ message: "",
+ image: null,
+ video: null,
+ voice: null,
+ music: null,
+ });
+ };
+
+ componentDidMount() {
+ this.props.list({ chatId: this.state.id });
+ this.props.info({ id: this.state.id });
+ // this.componentDidUpdate();
+ }
+
+ componentDidUpdate(prevProps) {
+ let chatroom = document.getElementById("chatroom");
+ chatroom.scrollTop = chatroom.scrollHeight + 40;
+
+ if (prevProps.id !== this.props.id) {
+ this.props.info({
+ id:
+ window.innerWidth < 1000
+ ? window.location.href.split("/").pop() * 1
+ : this.props.id,
+ });
+
+ this.props.list({
+ chatId:
+ window.innerWidth < 1000
+ ? window.location.href.split("/").pop() * 1
+ : this.props.id,
+ });
+ }
+ }
+
+ randomColor() {
+ let hex = Math.floor(Math.random() * 0x999999);
+ let color = "#" + hex.toString(16);
+
+ return color;
+ }
+ render() {
+ const { chatInfo, messageList: msaster } = this.props; //last
+ const messageList = msaster.slice(0, this.state.counter);
+ const last = messageList.slice(-1)[0] || {};
+ const userIdx = this.userIdx || {};
+ if (Object.keys(userIdx).length === 0) {
+ chatInfo.users.map(
+ (e) => (userIdx[e.id] = { ...e, color: this.randomColor() })
+ );
+ this.userIdx = userIdx;
+ }
+
+ return (
+ <>
+ {window.innerWidth < 1000 ? (
+ this.addcounter("parent")}
+ >
+
+ {chatInfo.users &&
+ messageList.map((message, i) =>
+ this.state.image === null &&
+ this.state.music === null &&
+ this.state.video === null ? (
+
this.addcounter()}
+ isActive={message.id === last.id}
+ prevUserId={i > 0 ? messageList[i - 1].userId : 0}
+ isSelf={new Set([101, 103, 106, 108, 110]).has(
+ message.userId * 1
+ )}
+ key={message.id}
+ file={this.state.image}
+ document={this.state.document}
+ message={message}
+ user={
+ userIdx[message.userId] || {
+ id: 0,
+ fileId: 0,
+ name: "null",
+ }
+ }
+ />
+ ) : null
+ )}
+ {this.state.image !== null ? (
+
+

+
+ ) : null}
+ {this.state.video !== null ? (
+
+
+
+ ) : null}
+ {this.state.music !== null ? (
+
+
+
+ ) : null}
+ {this.state.document !== null ? (
+
+
+
{`ارسال (${this.state.document.name}) به ${this.props.info.title}؟`}
+
+
+
+
+
+
+ ) : null}
+
+
this.addcounter("nothing")}
+ >
+ {last.action === "text" ? (
+
this.addcounter()}
+ onStop={this.onStop}
+ stop={this.stop}
+ start={this.start}
+ cancel={this.cancel}
+ message={this.state.message}
+ recordState={this.state.voice}
+ typeText={this.typeText}
+ sendMessage={this.sendMessage}
+ addFile={this.addFile}
+ file={this.state.file}
+ parent={this}
+ />
+ ) : null}
+ {last.action === "keyboard" ? (
+ this.addcounter()}
+ />
+ ) : null}
+ {this.state.emoji ? (
+
+
+
+ ) : null}
+
+
+ ) : null}
+ {window.innerWidth > 1000 ? (
+ this.addcounter("parent")}
+ >
+
+ {chatInfo.users &&
+ messageList.map((message, i) =>
+ this.state.image === null &&
+ this.state.music === null &&
+ this.state.video === null ? (
+
this.addcounter()}
+ isActive={message.id === last.id}
+ prevUserId={i > 0 ? messageList[i - 1].userId : 0}
+ isSelf={new Set([101, 103, 106, 108, 110]).has(
+ message.userId * 1
+ )}
+ key={message.id}
+ file={this.state.image}
+ document={this.state.document}
+ message={message}
+ user={
+ userIdx[message.userId] || {
+ id: 0,
+ fileId: 0,
+ name: "null",
+ }
+ }
+ />
+ ) : null
+ )}
+ {this.state.image !== null ? (
+
+

+
+ ) : null}
+ {this.state.video !== null ? (
+
+
+
+ ) : null}
+ {this.state.music !== null ? (
+
+
+
+ ) : null}
+ {this.state.document !== null ? (
+
+
+
{`ارسال (${this.state.document.name}) به ${this.props.info.title}؟`}
+
+
+
+
+
+
+ ) : null}
+
+
this.addcounter("nothing")}
+ >
+ {last.action === "text" ? (
+
this.addcounter()}
+ onStop={this.onStop}
+ stop={this.stop}
+ start={this.start}
+ cancel={this.cancel}
+ message={this.state.message}
+ recordState={this.state.voice}
+ typeText={this.typeText}
+ sendMessage={this.sendMessage}
+ addFile={this.addFile}
+ file={this.state.file}
+ parent={this}
+ />
+ ) : null}
+ {last.action === "keyboard" ? (
+ this.addcounter()}
+ />
+ ) : null}
+ {this.state.emoji ? (
+
+
+
+ ) : null}
+
+
+ ) : null}
+ >
+ );
+ }
+}
+export default connect(
+ (state) => {
+ return {
+ chatInfo: state.chat.info,
+ userId: state.user.isLogin.id,
+ messageList: state.message.list || [],
+ last: state.message.list.slice(-1)[0] || {},
+ };
+ },
+ { info: chat.info, bio: chat.bio }
+)(List);
diff --git a/src/views/Checkout/Discount/index.js b/src/views/Checkout/Discount/index.js
index 7923b8b..e91fa00 100644
--- a/src/views/Checkout/Discount/index.js
+++ b/src/views/Checkout/Discount/index.js
@@ -1,92 +1,92 @@
-import React from "react";
-import "./index.scss";
-import { connect } from "react-redux";
-import { userFactor } from "~/Redux/actions";
-
-const maxDesktopSize = 1250;
-const maxMobileSize = 550;
-
-const fontSize = {
- desktop: {
- h2: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 55,
- input: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 75,
- button: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 75,
- p: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 90,
- },
- mobile: {
- h2: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 24,
- p: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 32,
- input: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 20,
- button: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 25,
- },
-};
-
-const DiscoutCode = ({ codeId, setCodeId, userId, factorId }) => {
- const [value, setValue] = React.useState(codeId || "");
- function setOff() {
- setCodeId({ offCodeValue: value, userId: userId, id: factorId || null });
- }
- return (
- <>
- {window.innerWidth > 1000 ? (
-
-
- {window.t("کد تخفیف")}
-
-
- {window.t("اگر کد تخفیفی دارید آن را در کادر زیر وارد نمائید")}{" "}
-
-
- setValue(e.target.value)}
- />
-
-
-
- ) : null}
- {window.innerWidth < 1000 ? (
-
-
- {window.t("کد تخفیف")}
-
-
- {window.t("اگر کد تخفیفی دارید آن را در کادر زیر وارد نمائید")}{" "}
-
-
- setValue(e.target.value)}
- />
-
-
-
- ) : null}
- >
- );
-};
-
-export default connect(
- (state) => ({
- codeId: state.userFactor.info?.codeId,
- userId: state.user.status.id,
- factorId: state.userFactor.info?.id,
- lang: state.publicApi.lang,
- }),
- {
- setCodeId: userFactor.update,
- }
-)(DiscoutCode);
+import React from "react";
+import "./index.scss";
+import { connect } from "react-redux";
+import { userFactor } from "~/Redux/actions";
+
+const maxDesktopSize = 1250;
+const maxMobileSize = 550;
+
+const fontSize = {
+ desktop: {
+ h2: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 55,
+ input: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 75,
+ button: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 75,
+ p: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 90,
+ },
+ mobile: {
+ h2: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 24,
+ p: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 32,
+ input: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 20,
+ button: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 25,
+ },
+};
+
+const DiscoutCode = ({ codeId, setCodeId, userId, factorId }) => {
+ const [value, setValue] = React.useState(codeId || "");
+ function setOff() {
+ setCodeId({ offCodeValue: value, userId: userId, id: factorId || null });
+ }
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+
+
+ {window.t("کد تخفیف")}
+
+
+ {window.t("اگر کد تخفیفی دارید آن را در کادر زیر وارد نمائید")}{" "}
+
+
+ setValue(e.target.value)}
+ />
+
+
+
+ ) : null}
+ {window.innerWidth < 1000 ? (
+
+
+ {window.t("کد تخفیف")}
+
+
+ {window.t("اگر کد تخفیفی دارید آن را در کادر زیر وارد نمائید")}{" "}
+
+
+ setValue(e.target.value)}
+ />
+
+
+
+ ) : null}
+ >
+ );
+};
+
+export default connect(
+ (state) => ({
+ codeId: state.userFactor.info?.codeId,
+ userId: state.user.status.id,
+ factorId: state.userFactor.info?.id,
+ lang: state.publicApi.lang,
+ }),
+ {
+ setCodeId: userFactor.update,
+ }
+)(DiscoutCode);
diff --git a/src/views/Checkout/Table/index.js b/src/views/Checkout/Table/index.js
index d871cb7..f1f41c2 100644
--- a/src/views/Checkout/Table/index.js
+++ b/src/views/Checkout/Table/index.js
@@ -1,255 +1,255 @@
-import React from "react";
-import { connect } from "react-redux";
-import { userProduct } from "~/Redux/actions";
-
-import { makeStyles } from "@material-ui/core/styles";
-import Table from "@material-ui/core/Table";
-import TableBody from "@material-ui/core/TableBody";
-import TableCell from "@material-ui/core/TableCell";
-import TableContainer from "@material-ui/core/TableContainer";
-import TableHead from "@material-ui/core/TableHead";
-import TableRow from "@material-ui/core/TableRow";
-import Paper from "@material-ui/core/Paper";
-
-import "./index.scss";
-const useStyles = makeStyles({
- table: {},
-});
-const grades = [
- window.t("پیش دبستان"),
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
-];
-const maxMobileSize = 550;
-const maxDesktopSize = 1250;
-
-const fontSize = {
- mobile: {
- info: {
- strong: window.innerWidth > maxMobileSize ? 15 : window.innerWidth / 28,
- p: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 36,
- span: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 36,
- },
- price: {
- strong: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 22,
- span: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 40,
- },
- counter: {
- button: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 25,
- span: window.innerWidth > maxMobileSize ? 15 : window.innerWidth / 25,
- },
- delete: {
- span: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 28,
- },
- },
- desktop: {
- info: {
- strong: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 75,
- p: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 95,
- span: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 95,
- },
- price: {
- strong: window.innerWidth > maxDesktopSize ? 18 : window.innerWidth / 60,
- span: window.innerWidth > maxDesktopSize ? 13 : window.innerWidth / 95,
- },
- counter: {
- button: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 65,
- span: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 65,
- },
- delete: {
- span: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 75,
- },
- },
-};
-
-function BasicTable(props) {
- const classes = useStyles();
- const { list, handleDelete, route, factorInfo } = props;
-
- return (
- <>
- {window.innerWidth < 1000 ? (
-
-
-
-
- {window.t("محصولات")}
- {window.t("قیمت")}
-
- {route === "callback" ? (
- {window.t("تعداد")}
- ) : null}
-
-
-
- {list.map((row, i) => (
-
- ))}
-
-
-
- ) : null}
- {window.innerWidth > 1000 ? (
-
-
-
-
- {window.t("محصولات")}
- {window.t("تعداد")}
- {window.t("قیمت")}
-
-
-
- {list.map((row, i) => (
-
- ))}
-
-
-
- ) : null}
- >
- );
-}
-
-const Item = (props) => {
- const { data, route } = props;
- if (!data.product) return null;
- return (
- <>
- {window.innerWidth < 1000 ? (
-
-
-
-

-
-
- {`${window.t("نسخه")} ${
- +data.product.productType === 1
- ? window.t("الکترونیکی")
- : window.t("چاپی")
- } ${data.product.book.name} `}
-
-
- {window.t("پایه") + ` ${grades[data.product.book.gradeId]}`}
-
-
- {window.t("همراه با")} :
- {data.product.book.items ||
- window.t("کد فعالسازی محتوای الکترونیک")}
-
-
-
-
-
-
-
-
- {window.tr(data.product.price * data.count) || "1000"}{" "}
- {window.t("تومان")}
-
-
- {route === "cart" ? (
-
-
- {data.count} {window.t("عدد")}
-
-
- ) : null}
-
-
- {route === "callback" ? (
-
-
- {data.count} {window.t("عدد")}{" "}
-
-
- ) : null}
-
- ) : null}
- {window.innerWidth > 1000 ? (
-
-
-
-

-
-
- {`${data.product.book.name} `}
-
-
- {" "}
- {`${window.t("نسخه")} ${
- +data.product.productType === 1
- ? window.t("الکترونیکی")
- : window.t("چاپی")
- }`}
-
-
-
- {window.t("پایه") + ` ${grades[data.product.book.gradeId]}`}
-
-
-
-
-
- {data.count}
-
-
-
-
- {data.product.price * data.count || "1000"}
-
-
-
-
- ) : null}
- >
- );
-};
-
-export default connect(
- (state) => ({
- loading: state.userProduct.loading,
- info: state.book.info,
- id: state.user.status.id,
- factorInfo: state.userFactor.info,
- }),
- { pushToCart: userProduct.add }
-)(BasicTable);
+import React from "react";
+import { connect } from "react-redux";
+import { userProduct } from "~/Redux/actions";
+
+import { makeStyles } from "@material-ui/core/styles";
+import Table from "@material-ui/core/Table";
+import TableBody from "@material-ui/core/TableBody";
+import TableCell from "@material-ui/core/TableCell";
+import TableContainer from "@material-ui/core/TableContainer";
+import TableHead from "@material-ui/core/TableHead";
+import TableRow from "@material-ui/core/TableRow";
+import Paper from "@material-ui/core/Paper";
+
+import "./index.scss";
+const useStyles = makeStyles({
+ table: {},
+});
+const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+];
+const maxMobileSize = 550;
+const maxDesktopSize = 1250;
+
+const fontSize = {
+ mobile: {
+ info: {
+ strong: window.innerWidth > maxMobileSize ? 15 : window.innerWidth / 28,
+ p: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 36,
+ span: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 36,
+ },
+ price: {
+ strong: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 22,
+ span: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 40,
+ },
+ counter: {
+ button: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 25,
+ span: window.innerWidth > maxMobileSize ? 15 : window.innerWidth / 25,
+ },
+ delete: {
+ span: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 28,
+ },
+ },
+ desktop: {
+ info: {
+ strong: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 75,
+ p: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 95,
+ span: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 95,
+ },
+ price: {
+ strong: window.innerWidth > maxDesktopSize ? 18 : window.innerWidth / 60,
+ span: window.innerWidth > maxDesktopSize ? 13 : window.innerWidth / 95,
+ },
+ counter: {
+ button: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 65,
+ span: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 65,
+ },
+ delete: {
+ span: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 75,
+ },
+ },
+};
+
+function BasicTable(props) {
+ const classes = useStyles();
+ const { list, handleDelete, route, factorInfo } = props;
+
+ return (
+ <>
+ {window.innerWidth < 1000 ? (
+
+
+
+
+ {window.t("محصولات")}
+ {window.t("قیمت")}
+
+ {route === "callback" ? (
+ {window.t("تعداد")}
+ ) : null}
+
+
+
+ {list.map((row, i) => (
+
+ ))}
+
+
+
+ ) : null}
+ {window.innerWidth > 1000 ? (
+
+
+
+
+ {window.t("محصولات")}
+ {window.t("تعداد")}
+ {window.t("قیمت")}
+
+
+
+ {list.map((row, i) => (
+
+ ))}
+
+
+
+ ) : null}
+ >
+ );
+}
+
+const Item = (props) => {
+ const { data, route } = props;
+ if (!data.product) return null;
+ return (
+ <>
+ {window.innerWidth < 1000 ? (
+
+
+
+

+
+
+ {`${window.t("نسخه")} ${
+ +data.product.productType === 1
+ ? window.t("الکترونیکی")
+ : window.t("چاپی")
+ } ${data.product.book.name} `}
+
+
+ {window.t("پایه") + ` ${grades[data.product.book.gradeId]}`}
+
+
+ {window.t("همراه با")} :
+ {data.product.book.items ||
+ window.t("کد فعالسازی محتوای الکترونیک")}
+
+
+
+
+
+
+
+
+ {window.tr(data.product.price * data.count) || "1000"}{" "}
+ {window.t("تومان")}
+
+
+ {route === "cart" ? (
+
+
+ {data.count} {window.t("عدد")}
+
+
+ ) : null}
+
+
+ {route === "callback" ? (
+
+
+ {data.count} {window.t("عدد")}{" "}
+
+
+ ) : null}
+
+ ) : null}
+ {window.innerWidth > 1000 ? (
+
+
+
+

+
+
+ {`${data.product.book.name} `}
+
+
+ {" "}
+ {`${window.t("نسخه")} ${
+ +data.product.productType === 1
+ ? window.t("الکترونیکی")
+ : window.t("چاپی")
+ }`}
+
+
+
+ {window.t("پایه") + ` ${grades[data.product.book.gradeId]}`}
+
+
+
+
+
+ {data.count}
+
+
+
+
+ {data.product.price * data.count || "1000"}
+
+
+
+
+ ) : null}
+ >
+ );
+};
+
+export default connect(
+ (state) => ({
+ loading: state.userProduct.loading,
+ info: state.book.info,
+ id: state.user.status.id,
+ factorInfo: state.userFactor.info,
+ }),
+ { pushToCart: userProduct.add }
+)(BasicTable);
diff --git a/src/views/Checkout/index.js b/src/views/Checkout/index.js
index 47aad21..1db3fe3 100644
--- a/src/views/Checkout/index.js
+++ b/src/views/Checkout/index.js
@@ -1,568 +1,568 @@
-import React, { Component } from "react";
-import { connect } from "react-redux";
-import { transport, userFactor, publicApi } from "~/Redux/actions";
-
-import Navbar from "../Home/Navbar/index";
-import Footer from "../Home/Footer/index";
-import Table from "./Table/index";
-// import DiscoutCode from "./Discount/index";
-import DeliveryMethod from "./DeliveryMethod/index";
-import Factor from "./Factor/index";
-import Loader from "~/components/Loader/index";
-import { Link } from "react-router-dom";
-import Input from "./Input/index";
-import Select from "./Select/index";
-import TextArea from "./TextArea/index";
-import "./index.scss";
-import onInput from "~/util/onInput";
-const maxDesktopSize = 1250;
-const maxMobileSize = 550;
-
-const fontSize = {
- desktop: {
- h1: window.innerWidth > maxDesktopSize ? 30 : window.innerWidth / 40,
- th: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 80,
- h2: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 55,
- h3: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 90,
- strong: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 90,
- span: window.innerWidth > maxDesktopSize ? 10 : window.innerWidth / 95,
- p: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 90,
- },
- mobile: {
- h1: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 13,
- h2: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 24,
- h3: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 30,
- strong: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 30,
- span: window.innerWidth > maxMobileSize ? 10 : window.innerWidth / 34,
- p: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 32,
- input: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 20,
- },
-};
-class Cart extends Component {
- state = {
- selectedDelivery: { name: "", price: 0 },
- discount: 0,
- totalPrice: null,
- list: this.props.list,
- controlFactorInfoRepeat: true,
- };
-
- componentDidUpdate(prevProps, prevState) {
- if (window.location.search)
- if (!window.location.search.includes("NOK") && !window.location.hash) {
- let Authority = window.location.search
- .slice(1)
- .split("&")[0]
- .split("=")[1];
- this.props.getVerify({ Authority });
- window.location.hash = "verified";
- }
-
- // if (this.props.factorInfo === null && !this.controlFactorInfoRepeat) {
- // this.props.getFactorInfo({});
- // this.controlFactorInfoRepeat = true;
- // }
- // if (this.props.list.length > 0) {
- // let wantedId; //should be zero
- // for (let item of this.props.list) {
- // if (item.condition === 2) {
- // wantedId = item.id;
- // break;
- // }
- // }
- // if (this.props.list.length !== 1) {
- // // this.props.getInfo({ id: wantedId });
- // }
- // } else {
- // // this.props.getFactorInfo({});
- // }
- }
-
- componentDidMount() {
- window.scrollTo(0, 0);
- this.props.getProvince();
- if (this.props.factorInfo?.provinceId)
- this.props.getCity({ provinceId: this.props.factorInfo.provinceId });
- this.props.getTransportList();
- this.props.getFactorInfo({});
- }
-
- handleCounter = (type, id) => {
- if (type === "increase") {
- this.setState((prevState) => ({
- list: prevState.list.map((item) =>
- item.id === id ? { ...item, number: item.number + 1 } : item
- ),
- }));
- } else {
- this.setState((prevState) => ({
- list: prevState.list.map((item) =>
- item.id === id ? { ...item, number: item.number - 1 } : item
- ),
- }));
- }
- };
- onChange(name, value) {
- if (name === "provinceId") {
- this.props.getCity({ provinceId: value });
- }
- this.setState({ [name]: value });
- }
- handleDelete = (id) => {
- let list = this.state.list.filter((item) => item.id !== id);
- this.setState({
- list: list,
- });
- };
-
- totalPrice = () => {
- let total = 0;
- for (let i = 0; i < this.state.list.length; i++) {
- total += this.state.list[i].price * this.state.list[i].number;
- }
- return total - this.state.discount + this.state.selectedDelivery.price;
- };
-
- render() {
- const { list, payPrice, payMethods, factorInfo } = this.props;
- const {
- description,
- provinceId,
- cityId,
- recieverName,
- recieverPhone,
- recieverAddress,
- recieverPostalCode,
- } = { ...factorInfo, ...this.state };
- if (!factorInfo || list.length === 0)
- return (
-
-
-
- {window.t("هیچ محصولی در سبد خرید شما وجود ندارد")}{" "}
-
-
-
- {window.t("فروشگاه")}{" "}
-
-
- );
- return (
- <>
- {window.innerWidth > 1000 ? (
- list.length > 0 ? (
- <>
-
-
- {window.location.search.includes("NOK") ||
- this.props.isVerified === false ? (
-
- {window.t(
- "پرداخت شما با خطا مواجه شد ، لطفا مجدد تلاش نمایید"
- )}{" "}
-
- ) : null}
-
-
-
-
- {window.t("جزئیات صورتحساب")}{" "}
-
-
- {window.t("مشخصات تحویل گیرنده")}
-
-
-
-
- {factorInfo.transportId ? (
-
- ) : null}
- {/* {factorInfo ? : null} */}
-
- {factorInfo ? : null}
- {factorInfo ? (
-
-
- {window.t("جمع کل")}
-
- {window.t("صورتحساب")}{" "}
-
-
-
- {window.tr(factorInfo.payPrice)}
-
-
- {window.t("تومان")}
-
-
-
- ) : null}
-
- {/*
-
- {window.t("روشهای ارسال")}
-
-
- {window.t("با توجه به شرایط یکی از دو گزینه زیر را انتخاب کنید")}
-
- {payMethods.map((item, i) => (
-
- ))}
-
-
*/}
-
-
-
-
-
- >
- ) : (
-
-
-
- )
- ) : null}
- {window.innerWidth < 1000 ? (
- list.length > 0 ? (
-
-
- {window.location.search.includes("NOK") ? (
-
- {window.t(
- "پرداخت شما با خطا مواجه شد ، لطفا مجدد تلاش نمایید"
- )}{" "}
-
- ) : null}
-
{window.t("جزئیات صورتحساب")}
-
-
{window.t("مشخصات تحویل گیرنده")}
-
-
-
- {factorInfo.transportId ? (
-
-
- {window.t("روشهای ارسال")}
-
-
- {window.t(
- "با توجه به شرایط یکی از دو گزینه زیر را انتخاب کنید"
- )}{" "}
-
-
-
- {this.props.payMethods.map((item, i) => (
-
- ))}
-
-
- ) : null}
- {/*
*/}
- {factorInfo ?
: null}
-
-
-
- {window.t("جمع کل")}
-
- {window.t("سبد خرید")}
-
- {factorInfo ? (
-
-
- {window.tr(factorInfo.payPrice)}
- {/* // factorInfo.transportPrice - // factorInfo.offPrice} */}
-
-
- {window.t("تومان")}
-
-
- ) : null}
-
- {/*
-
{window.t("روشهای ارسال")}
-
- با توجه به شرایط یکی از دو گزینه زیر را انتخاب کنید")}
-
-
- {this.props.payMethods.map((item, i) => (
-
- ))}
-
-
*/}
- {/*
*/}
-
{
- if (window.lang == "ar" || window.lang == "en") return;
- this.props.payFactor({
- provinceId,
- cityId,
- recieverName,
- recieverPhone,
- recieverAddress,
- recieverPostalCode,
- description,
- });
- }}
- >
- {window.t("پرداخت")}{" "}
-
-
- ) : (
-
-
-
- )
- ) : null}
- >
- );
- }
-}
-
-export default connect(
- (state) => ({
- list:
- state.userFactor.info?.products?.filter((item) => +item.condition < 2) ||
- [],
- payPrice: state.userProduct.sum,
- payMethods: state.transport.list,
- factorInfo: state.userFactor.info,
- userId: state.user.status.id,
- provinceList: state.publicApi.province,
- cityList: state.publicApi.city,
- isVerified: state.userFactor.isVerified,
- }),
- {
- // getList: userProduct.list,
- // getInfo: userProduct.info,
- getTransportList: transport.list,
- getFactorInfo: userFactor.info,
- payFactor: userFactor.payment,
- getVerify: userFactor.verify,
- getProvince: publicApi.getProvince,
- getCity: publicApi.getCity,
- }
-)(Cart);
+import React, { Component } from "react";
+import { connect } from "react-redux";
+import { transport, userFactor, publicApi } from "~/Redux/actions";
+
+import Navbar from "../Home/Navbar/index";
+import Footer from "../Home/Footer/index";
+import Table from "./Table/index";
+// import DiscoutCode from "./Discount/index";
+import DeliveryMethod from "./DeliveryMethod/index";
+import Factor from "./Factor/index";
+import Loader from "~/components/Loader/index";
+import { Link } from "react-router-dom";
+import Input from "./Input/index";
+import Select from "./Select/index";
+import TextArea from "./TextArea/index";
+import "./index.scss";
+import onInput from "~/util/onInput";
+const maxDesktopSize = 1250;
+const maxMobileSize = 550;
+
+const fontSize = {
+ desktop: {
+ h1: window.innerWidth > maxDesktopSize ? 30 : window.innerWidth / 40,
+ th: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 80,
+ h2: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 55,
+ h3: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 90,
+ strong: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 90,
+ span: window.innerWidth > maxDesktopSize ? 10 : window.innerWidth / 95,
+ p: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 90,
+ },
+ mobile: {
+ h1: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 13,
+ h2: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 24,
+ h3: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 30,
+ strong: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 30,
+ span: window.innerWidth > maxMobileSize ? 10 : window.innerWidth / 34,
+ p: window.innerWidth > maxMobileSize ? 12 : window.innerWidth / 32,
+ input: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 20,
+ },
+};
+class Cart extends Component {
+ state = {
+ selectedDelivery: { name: "", price: 0 },
+ discount: 0,
+ totalPrice: null,
+ list: this.props.list,
+ controlFactorInfoRepeat: true,
+ };
+
+ componentDidUpdate(prevProps, prevState) {
+ if (window.location.search)
+ if (!window.location.search.includes("NOK") && !window.location.hash) {
+ let Authority = window.location.search
+ .slice(1)
+ .split("&")[0]
+ .split("=")[1];
+ this.props.getVerify({ Authority });
+ window.location.hash = "verified";
+ }
+
+ // if (this.props.factorInfo === null && !this.controlFactorInfoRepeat) {
+ // this.props.getFactorInfo({});
+ // this.controlFactorInfoRepeat = true;
+ // }
+ // if (this.props.list.length > 0) {
+ // let wantedId; //should be zero
+ // for (let item of this.props.list) {
+ // if (item.condition === 2) {
+ // wantedId = item.id;
+ // break;
+ // }
+ // }
+ // if (this.props.list.length !== 1) {
+ // // this.props.getInfo({ id: wantedId });
+ // }
+ // } else {
+ // // this.props.getFactorInfo({});
+ // }
+ }
+
+ componentDidMount() {
+ window.scrollTo(0, 0);
+ this.props.getProvince();
+ if (this.props.factorInfo?.provinceId)
+ this.props.getCity({ provinceId: this.props.factorInfo.provinceId });
+ this.props.getTransportList();
+ this.props.getFactorInfo({});
+ }
+
+ handleCounter = (type, id) => {
+ if (type === "increase") {
+ this.setState((prevState) => ({
+ list: prevState.list.map((item) =>
+ item.id === id ? { ...item, number: item.number + 1 } : item
+ ),
+ }));
+ } else {
+ this.setState((prevState) => ({
+ list: prevState.list.map((item) =>
+ item.id === id ? { ...item, number: item.number - 1 } : item
+ ),
+ }));
+ }
+ };
+ onChange(name, value) {
+ if (name === "provinceId") {
+ this.props.getCity({ provinceId: value });
+ }
+ this.setState({ [name]: value });
+ }
+ handleDelete = (id) => {
+ let list = this.state.list.filter((item) => item.id !== id);
+ this.setState({
+ list: list,
+ });
+ };
+
+ totalPrice = () => {
+ let total = 0;
+ for (let i = 0; i < this.state.list.length; i++) {
+ total += this.state.list[i].price * this.state.list[i].number;
+ }
+ return total - this.state.discount + this.state.selectedDelivery.price;
+ };
+
+ render() {
+ const { list, payPrice, payMethods, factorInfo } = this.props;
+ const {
+ description,
+ provinceId,
+ cityId,
+ recieverName,
+ recieverPhone,
+ recieverAddress,
+ recieverPostalCode,
+ } = { ...factorInfo, ...this.state };
+ if (!factorInfo || list.length === 0)
+ return (
+
+
+
+ {window.t("هیچ محصولی در سبد خرید شما وجود ندارد")}{" "}
+
+
+
+ {window.t("فروشگاه")}{" "}
+
+
+ );
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+ list.length > 0 ? (
+ <>
+
+
+ {window.location.search.includes("NOK") ||
+ this.props.isVerified === false ? (
+
+ {window.t(
+ "پرداخت شما با خطا مواجه شد ، لطفا مجدد تلاش نمایید"
+ )}{" "}
+
+ ) : null}
+
+
+
+
+ {window.t("جزئیات صورتحساب")}{" "}
+
+
+ {window.t("مشخصات تحویل گیرنده")}
+
+
+
+
+ {factorInfo.transportId ? (
+
+ ) : null}
+ {/* {factorInfo ? : null} */}
+
+ {factorInfo ? : null}
+ {factorInfo ? (
+
+
+ {window.t("جمع کل")}
+
+ {window.t("صورتحساب")}{" "}
+
+
+
+ {window.tr(factorInfo.payPrice)}
+
+
+ {window.t("تومان")}
+
+
+
+ ) : null}
+
+ {/*
+
+ {window.t("روشهای ارسال")}
+
+
+ {window.t("با توجه به شرایط یکی از دو گزینه زیر را انتخاب کنید")}
+
+ {payMethods.map((item, i) => (
+
+ ))}
+
+
*/}
+
+
+
+
+
+ >
+ ) : (
+
+
+
+ )
+ ) : null}
+ {window.innerWidth < 1000 ? (
+ list.length > 0 ? (
+
+
+ {window.location.search.includes("NOK") ? (
+
+ {window.t(
+ "پرداخت شما با خطا مواجه شد ، لطفا مجدد تلاش نمایید"
+ )}{" "}
+
+ ) : null}
+
{window.t("جزئیات صورتحساب")}
+
+
{window.t("مشخصات تحویل گیرنده")}
+
+
+
+ {factorInfo.transportId ? (
+
+
+ {window.t("روشهای ارسال")}
+
+
+ {window.t(
+ "با توجه به شرایط یکی از دو گزینه زیر را انتخاب کنید"
+ )}{" "}
+
+
+
+ {this.props.payMethods.map((item, i) => (
+
+ ))}
+
+
+ ) : null}
+ {/*
*/}
+ {factorInfo ?
: null}
+
+
+
+ {window.t("جمع کل")}
+
+ {window.t("سبد خرید")}
+
+ {factorInfo ? (
+
+
+ {window.tr(factorInfo.payPrice)}
+ {/* // factorInfo.transportPrice - // factorInfo.offPrice} */}
+
+
+ {window.t("تومان")}
+
+
+ ) : null}
+
+ {/*
+
{window.t("روشهای ارسال")}
+
+ با توجه به شرایط یکی از دو گزینه زیر را انتخاب کنید")}
+
+
+ {this.props.payMethods.map((item, i) => (
+
+ ))}
+
+
*/}
+ {/*
*/}
+
{
+ if (window.lang == "ar" || window.lang == "en") return;
+ this.props.payFactor({
+ provinceId,
+ cityId,
+ recieverName,
+ recieverPhone,
+ recieverAddress,
+ recieverPostalCode,
+ description,
+ });
+ }}
+ >
+ {window.t("پرداخت")}{" "}
+
+
+ ) : (
+
+
+
+ )
+ ) : null}
+ >
+ );
+ }
+}
+
+export default connect(
+ (state) => ({
+ list:
+ state.userFactor.info?.products?.filter((item) => +item.condition < 2) ||
+ [],
+ payPrice: state.userProduct.sum,
+ payMethods: state.transport.list,
+ factorInfo: state.userFactor.info,
+ userId: state.user.status.id,
+ provinceList: state.publicApi.province,
+ cityList: state.publicApi.city,
+ isVerified: state.userFactor.isVerified,
+ }),
+ {
+ // getList: userProduct.list,
+ // getInfo: userProduct.info,
+ getTransportList: transport.list,
+ getFactorInfo: userFactor.info,
+ payFactor: userFactor.payment,
+ getVerify: userFactor.verify,
+ getProvince: publicApi.getProvince,
+ getCity: publicApi.getCity,
+ }
+)(Cart);
diff --git a/src/views/Contact/index.js b/src/views/Contact/index.js
index 5fe035e..4781444 100644
--- a/src/views/Contact/index.js
+++ b/src/views/Contact/index.js
@@ -1,172 +1,172 @@
-import React, { Component } from "react";
-import { connect } from "react-redux";
-import { publicApi } from "~/Redux/actions";
-
-import Navbar from "../Home/Navbar/index";
-import Footer from "../Home/Footer/index";
-
-import location from "../../assets/icons/location.png";
-import home from "../../assets/icons/home.png";
-import contact from "../../assets/icons/contact.png";
-import Location from "./Location/Location";
-import Loader from "~/components/Loader/index";
-import Support from "../Support";
-import "./index.scss";
-
-const maxDesktopSize = 1250;
-const maxMobileSize = 550;
-
-const fontSize = {
- desktop: {
- h1: window.innerWidth > maxDesktopSize ? 30 : window.innerWidth / 40,
- p: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 80,
- span: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 80,
- },
- mobile: {
- h1: window.innerWidth > maxMobileSize ? 25 : window.innerWidth / 16,
- p: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 34,
- span: window.innerWidth > maxMobileSize ? 15 : window.innerWidth / 32,
- },
-};
-
-class Contact extends Component {
- state = {
- name: null,
- cellphone: null,
- unit: null,
- book: null,
- subject: null,
- text: null,
- };
-
- componentDidUpdate() {
- if (!this.props.contactData?.address && !this.props.loading)
- this.props.getContactData();
- }
-
- render() {
- const { contactData, loading } = this.props;
- return (
- <>
- {window.innerWidth > 1000 ? (
- !loading ? (
- <>
-
-
-
-
-
-
-
-
-

-
- {contactData?.address || ""}
-
-
-
-
-
- {contactData?.cellphone || ""}
-
-

-
-
-
- {contactData?.email || ""}
-
-

-
-
-
-
-
-
-
-
-
- >
- ) : (
-
-
-
-
- )
- ) : null}
- {window.innerWidth < 1000 ? (
- !loading ? (
-
-
-
-
-
-
-

-
- {contactData?.address || ""}{" "}
-
-
-
-
-
- {contactData?.cellphone || ""}{" "}
-
-

-
-
-
- {contactData?.email || ""}
-
-

-
-
-
-
-
-
-
- ) : (
-
-
-
-
- )
- ) : null}
- >
- );
- }
-}
-
-export default connect(
- (state) => ({
- loading: state.publicApi.loading,
- contactData: state.publicApi.contactData,
- list: state.userProduct.mylist || [],
- // loading: state.publicApi.loading,
- }),
- { getContactData: publicApi.getContactData }
-)(Contact);
+import React, { Component } from "react";
+import { connect } from "react-redux";
+import { publicApi } from "~/Redux/actions";
+
+import Navbar from "../Home/Navbar/index";
+import Footer from "../Home/Footer/index";
+
+import location from "../../assets/icons/location.png";
+import home from "../../assets/icons/home.png";
+import contact from "../../assets/icons/contact.png";
+import Location from "./Location/Location";
+import Loader from "~/components/Loader/index";
+import Support from "../Support";
+import "./index.scss";
+
+const maxDesktopSize = 1250;
+const maxMobileSize = 550;
+
+const fontSize = {
+ desktop: {
+ h1: window.innerWidth > maxDesktopSize ? 30 : window.innerWidth / 40,
+ p: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 80,
+ span: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 80,
+ },
+ mobile: {
+ h1: window.innerWidth > maxMobileSize ? 25 : window.innerWidth / 16,
+ p: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 34,
+ span: window.innerWidth > maxMobileSize ? 15 : window.innerWidth / 32,
+ },
+};
+
+class Contact extends Component {
+ state = {
+ name: null,
+ cellphone: null,
+ unit: null,
+ book: null,
+ subject: null,
+ text: null,
+ };
+
+ componentDidUpdate() {
+ if (!this.props.contactData?.address && !this.props.loading)
+ this.props.getContactData();
+ }
+
+ render() {
+ const { contactData, loading } = this.props;
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+ !loading ? (
+ <>
+
+
+
+
+
+
+
+
+

+
+ {contactData?.address || ""}
+
+
+
+
+
+ {contactData?.cellphone || ""}
+
+

+
+
+
+ {contactData?.email || ""}
+
+

+
+
+
+
+
+
+
+
+
+ >
+ ) : (
+
+
+
+
+ )
+ ) : null}
+ {window.innerWidth < 1000 ? (
+ !loading ? (
+
+
+
+
+
+
+

+
+ {contactData?.address || ""}{" "}
+
+
+
+
+
+ {contactData?.cellphone || ""}{" "}
+
+

+
+
+
+ {contactData?.email || ""}
+
+

+
+
+
+
+
+
+
+ ) : (
+
+
+
+
+ )
+ ) : null}
+ >
+ );
+ }
+}
+
+export default connect(
+ (state) => ({
+ loading: state.publicApi.loading,
+ contactData: state.publicApi.contactData,
+ list: state.userProduct.mylist || [],
+ // loading: state.publicApi.loading,
+ }),
+ { getContactData: publicApi.getContactData }
+)(Contact);
diff --git a/src/views/Download/Item/index.js b/src/views/Download/Item/index.js
index 0ff324e..e054369 100644
--- a/src/views/Download/Item/index.js
+++ b/src/views/Download/Item/index.js
@@ -1,64 +1,64 @@
-import React, { Component } from "react";
-
-const maxMobileSize = 550;
-const maxDesktopSize = 1250;
-
-const fontSize = {
- mobile: {
- h1: window.innerWidth > maxMobileSize ? 18 : window.innerWidth / 26,
- h2: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 34,
- div: window.innerWidth > maxMobileSize ? 18 : window.innerWidth / 32,
- },
- desktop: {
- h1: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 70,
- div: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 85,
- old: window.innerWidth > maxDesktopSize ? 9 : window.innerWidth / 120,
- },
-};
-
-export default class Item extends Component {
- render() {
- const grades = [
- window.t("پیش دبستان"),
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
- ];
- const { data } = this.props;
- return (
- <>
- {window.innerWidth < 1000 ? (
-
-
-
-
- {data["product.book.name"]}{" "}
- {grades[+data["product.book.gradeId"]]}
-
-
-
- ) : null}
- {window.innerWidth > 1000 ? (
-
- ) : null}
- >
- );
- }
-}
+import React, { Component } from "react";
+
+const maxMobileSize = 550;
+const maxDesktopSize = 1250;
+
+const fontSize = {
+ mobile: {
+ h1: window.innerWidth > maxMobileSize ? 18 : window.innerWidth / 26,
+ h2: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 34,
+ div: window.innerWidth > maxMobileSize ? 18 : window.innerWidth / 32,
+ },
+ desktop: {
+ h1: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 70,
+ div: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 85,
+ old: window.innerWidth > maxDesktopSize ? 9 : window.innerWidth / 120,
+ },
+};
+
+export default class Item extends Component {
+ render() {
+ const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
+ const { data } = this.props;
+ return (
+ <>
+ {window.innerWidth < 1000 ? (
+
+
+
+
+ {data["product.book.name"]}{" "}
+ {grades[+data["product.book.gradeId"]]}
+
+
+
+ ) : null}
+ {window.innerWidth > 1000 ? (
+
+ ) : null}
+ >
+ );
+ }
+}
diff --git a/src/views/Home/Footer/index.js b/src/views/Home/Footer/index.js
index 671cb0a..34bd112 100644
--- a/src/views/Home/Footer/index.js
+++ b/src/views/Home/Footer/index.js
@@ -1,242 +1,268 @@
-import React, { Component } from "react";
-import { Link } from "react-router-dom";
-import location from "../../../assets/icons/location.png";
-import home from "../../../assets/icons/home.png";
-import contact from "../../../assets/icons/contact.png";
-
-import "./index.scss";
-export default class Footer extends Component {
- render() {
- const fastAccess = [
- { name: window.t("صفحه اصلی"), link: "/" },
- { name: window.t("فروشگاه"), link: "/shop" },
- { name: window.t("سوالات متداول"), link: "/faq" },
- { name: window.t("درباره ما"), link: "/about" },
- { name: window.t("تماس با ما"), link: "/call" },
- ];
- return (
- <>
- {window.innerWidth > 1000 ? (
-
- ) : null}
- {window.innerWidth < 1000 ? (
-
- ) : null}
- >
- );
- }
-}
-
-Footer.defaultProps = {};
+import React, { Component } from "react";
+import { Link } from "react-router-dom";
+import location from "../../../assets/icons/location.png";
+import home from "../../../assets/icons/home.png";
+import contact from "../../../assets/icons/contact.png";
+
+import "./index.scss";
+export default class Footer extends Component {
+ render() {
+ const fastAccess = [
+ { name: window.t("صفحه اصلی"), link: "/" },
+ { name: window.t("فروشگاه"), link: "/shop" },
+ { name: window.t("سوالات متداول"), link: "/faq" },
+ { name: window.t("درباره ما"), link: "/about" },
+ { name: window.t("تماس با ما"), link: "/call" },
+ ];
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+
+ ) : null}
+ {window.innerWidth < 1000 ? (
+
+ ) : null}
+ >
+ );
+ }
+}
+
+Footer.defaultProps = {};
diff --git a/src/views/Home/HomeSlider/Header/index.js b/src/views/Home/HomeSlider/Header/index.js
index cd23970..29b8ae7 100644
--- a/src/views/Home/HomeSlider/Header/index.js
+++ b/src/views/Home/HomeSlider/Header/index.js
@@ -1,75 +1,75 @@
-import React, { Component } from "react";
-import { Link } from "react-router-dom";
-
-import "./index.scss";
-export default class Header extends Component {
- render() {
- const { height, data } = this.props;
- return (
- <>
- {window.innerWidth > 1000 ? (
- data.link && window.open(data.link, "_blank")}
- >
-
-

-
-
-
{data.title}
- {data.subTitle}
- {data.buttonText && (
- {data.buttonText}
- )}
-
-
- ) : null}
- {window.innerWidth < 1000 ? (
-
-
data.link && window.open(data.link, "_blank")}
- >
-

-
-
-
{data.title}
- {data.subTitle}
- {data.buttonText}
-
-
- ) : null}
- >
- );
- }
-}
+import React, { Component } from "react";
+import { Link } from "react-router-dom";
+
+import "./index.scss";
+export default class Header extends Component {
+ render() {
+ const { height, data } = this.props;
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+ data.link && window.open(data.link, "_blank")}
+ >
+
+

+
+
+
{data.title}
+ {data.subTitle}
+ {data.buttonText && (
+ {data.buttonText}
+ )}
+
+
+ ) : null}
+ {window.innerWidth < 1000 ? (
+
+
data.link && window.open(data.link, "_blank")}
+ >
+

+
+
+
{data.title}
+ {data.subTitle}
+ {data.buttonText}
+
+
+ ) : null}
+ >
+ );
+ }
+}
diff --git a/src/views/Home/HomeSlider/index.js b/src/views/Home/HomeSlider/index.js
index c98fcfe..c2fed76 100644
--- a/src/views/Home/HomeSlider/index.js
+++ b/src/views/Home/HomeSlider/index.js
@@ -1,201 +1,201 @@
-import React, { Component } from "react";
-import { Link } from "react-router-dom";
-import Carousel from "react-elastic-carousel";
-import Simple from "./Simple/index";
-import Header from "./Header/index";
-import Blog from "./Blog/index";
-
-import dropdown from "../../../assets/icons/dropdown.png";
-
-import "./index.scss";
-
-const maxDesktopSize = 1250;
-
-const fontSize = {
- desktop: {
- h1: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 70,
- span: window.innerWidth > maxDesktopSize ? 18 : window.innerWidth / 75,
- },
-};
-
-const SimpleHeader = (props) => {
- console.log("Simple Header", props.link);
- return (
- <>
- {window.innerWidth > 1000 ? (
-
-
-
{props.title}
-
-
- {props.more ? (
-
-
- {window.t("بیشتر")}
-
-

-
- ) : null}
-
- ) : null}
- {window.innerWidth < 1000 ? (
-
- ) : null}
- >
- );
-};
-
-const TabHeader = (props) => {
- return (
- <>
- {window.innerWidth > 1000 ? (
-
- ) : null}
- {window.innerWidth < 1000 ? (
-
- ) : null}
- >
- );
-};
-
-export default class HomeSlider extends Component {
- render() {
- const { data, title, height, designType, number, link } = this.props;
- let header;
- if (title) {
- if (designType === "simple" || designType === "blog") {
- header = (
- number} />
- );
- } else if (designType === "tab") {
- header = ;
- }
- }
- return (
- <>
- {window.innerWidth > 1000 ? (
-
- {header}
-
-
- {data.map((item, i) => (
-
- ))}
-
-
- ) : null}
- {window.innerWidth < 1000 ? (
-
- {header}
-
-
- {data.map((item, i) => (
-
- ))}
-
-
- ) : null}
- >
- );
- }
-}
-
-const Item = (props) => {
- return (
- <>
- {props.designType === "header" ? (
-
- ) : null}
- {props.designType === "simple" || props.designType === "tab" ? (
-
- ) : null}
- {props.designType === "blog" ? (
-
- ) : null}
- >
- //
- );
-};
+import React, { Component } from "react";
+import { Link } from "react-router-dom";
+import Carousel from "react-elastic-carousel";
+import Simple from "./Simple/index";
+import Header from "./Header/index";
+import Blog from "./Blog/index";
+
+import dropdown from "../../../assets/icons/dropdown.png";
+
+import "./index.scss";
+
+const maxDesktopSize = 1250;
+
+const fontSize = {
+ desktop: {
+ h1: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 70,
+ span: window.innerWidth > maxDesktopSize ? 18 : window.innerWidth / 75,
+ },
+};
+
+const SimpleHeader = (props) => {
+ console.log("Simple Header", props.link);
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+
+
+
{props.title}
+
+
+ {props.more ? (
+
+
+ {window.t("بیشتر")}
+
+

+
+ ) : null}
+
+ ) : null}
+ {window.innerWidth < 1000 ? (
+
+ ) : null}
+ >
+ );
+};
+
+const TabHeader = (props) => {
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+
+ ) : null}
+ {window.innerWidth < 1000 ? (
+
+ ) : null}
+ >
+ );
+};
+
+export default class HomeSlider extends Component {
+ render() {
+ const { data, title, height, designType, number, link } = this.props;
+ let header;
+ if (title) {
+ if (designType === "simple" || designType === "blog") {
+ header = (
+ number} />
+ );
+ } else if (designType === "tab") {
+ header = ;
+ }
+ }
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+
+ {header}
+
+
+ {data.map((item, i) => (
+
+ ))}
+
+
+ ) : null}
+ {window.innerWidth < 1000 ? (
+
+ {header}
+
+
+ {data.map((item, i) => (
+
+ ))}
+
+
+ ) : null}
+ >
+ );
+ }
+}
+
+const Item = (props) => {
+ return (
+ <>
+ {props.designType === "header" ? (
+
+ ) : null}
+ {props.designType === "simple" || props.designType === "tab" ? (
+
+ ) : null}
+ {props.designType === "blog" ? (
+
+ ) : null}
+ >
+ //
+ );
+};
diff --git a/src/views/Home/HomeStatic/index.js b/src/views/Home/HomeStatic/index.js
index e26f728..25348dc 100644
--- a/src/views/Home/HomeStatic/index.js
+++ b/src/views/Home/HomeStatic/index.js
@@ -1,139 +1,139 @@
-import React, { Component } from "react";
-import ChevronLeftIcon from "@material-ui/icons/ChevronLeft";
-import Identifier from "./Identifier/index";
-import proxy from "~/Redux/proxy";
-import "./index.scss";
-
-const maxDesktopSize = 1250;
-
-const fontSize = {
- desktop: {
- h2: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 85,
- },
-};
-
-export default class HomeStatic extends Component {
- render() {
- const status = proxy.status();
- const { data, height, title } = this.props;
- return (
- <>
- {window.innerWidth > 1000 ? (
-
- {title ? (
-
-
{title}
-
- {window.t("موارد بیشتر")}
-
-
-
- ) : null}
-
- {data.map((item, i) => (
-
- ))}
-
-
- ) : null}
- {window.innerWidth < 1000 ? (
-
- {data.map((item, i) =>
- proxy.status() ? (
-
- ) : (
-
- )
- )}
-
- ) : null}
- >
- );
- }
-}
-
-const Item = (props) => {
- return (
- <>
- {window.innerWidth > 1000 ? (
-
- props.data.link && window.open(props.data.link, "_blank")
- }
- >
-
-
- {props.data.topText}
-
-
- {props.data.bottomText}
-
-
-

-
- ) : (
-
- props.data.link && window.open(props.data.link, "_blank")
- }
- style={{
- width: `${props.data.width}%`,
- height: props.height,
- cursor: "pointer",
- }}
- className={`home-static__list2--item ${
- window.lang === "en" ? "d-flex" : ""
- }`}
- >
-

-
-
- {props.data.topText}
-
-
- {props.data.bottomText}
-
-
-
- )}
- >
- );
-};
+import React, { Component } from "react";
+import ChevronLeftIcon from "@material-ui/icons/ChevronLeft";
+import Identifier from "./Identifier/index";
+import proxy from "~/Redux/proxy";
+import "./index.scss";
+
+const maxDesktopSize = 1250;
+
+const fontSize = {
+ desktop: {
+ h2: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 85,
+ },
+};
+
+export default class HomeStatic extends Component {
+ render() {
+ const status = proxy.status();
+ const { data, height, title } = this.props;
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+
+ {title ? (
+
+
{title}
+
+ {window.t("موارد بیشتر")}
+
+
+
+ ) : null}
+
+ {data.map((item, i) => (
+
+ ))}
+
+
+ ) : null}
+ {window.innerWidth < 1000 ? (
+
+ {data.map((item, i) =>
+ proxy.status() ? (
+
+ ) : (
+
+ )
+ )}
+
+ ) : null}
+ >
+ );
+ }
+}
+
+const Item = (props) => {
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+
+ props.data.link && window.open(props.data.link, "_blank")
+ }
+ >
+
+
+ {props.data.topText}
+
+
+ {props.data.bottomText}
+
+
+

+
+ ) : (
+
+ props.data.link && window.open(props.data.link, "_blank")
+ }
+ style={{
+ width: `${props.data.width}%`,
+ height: props.height,
+ cursor: "pointer",
+ }}
+ className={`home-static__list2--item ${
+ window.lang === "en" ? "d-flex" : ""
+ }`}
+ >
+

+
+
+ {props.data.topText}
+
+
+ {props.data.bottomText}
+
+
+
+ )}
+ >
+ );
+};
diff --git a/src/views/Home/Navbar/Laptop/index.js b/src/views/Home/Navbar/Laptop/index.js
index 3555c4c..214e6b9 100644
--- a/src/views/Home/Navbar/Laptop/index.js
+++ b/src/views/Home/Navbar/Laptop/index.js
@@ -1,269 +1,269 @@
-import React, { Component } from "react";
-
-import proxy from "~/Redux/proxy";
-import { Link } from "react-router-dom";
-import Avatar from "@material-ui/core/Avatar";
-import logo from "~/assets/icons/logo.png";
-import basket from "~/assets/icons/basket.png";
-
-import MenuItem from "@material-ui/core/MenuItem";
-import Menu from "@material-ui/core/Menu";
-import { connect } from "react-redux";
-import "./index.scss";
-import { useHistory } from "react-router-dom";
-import { user, publicApi } from "~/Redux/actions";
-function Navigate({ path }) {
- let history = useHistory();
- return <>{history.push(path)}>;
-}
-const maxDesktopSize = 1250;
-
-const fontSize = {
- desktop: {
- li: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 85,
- a: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 85,
- },
-};
-
-// const changeLanguage = (val) => {
-// if (val === "fa") {
-// localStorage.removeItem("language");
-// } else if (val === "en") {
-// localStorage.setItem("language", "en");
-// } else {
-// localStorage.setItem("language", "ar");
-// }
-// window.location.reload();
-// };
-
-class LaptopNavbar extends Component {
- state = {};
-
- render() {
- const { status } = this.props;
- if (this.state.navigatePath)
- return ;
- const links = [
- { name: window.t("صفحه اصلی"), to: "/", page: "home" },
- { name: window.t("فروشگاه"), to: "/products", page: "products" },
- { name: window.t("سوالات متداول"), to: "/faq", page: "faq" },
- { name: window.t("درباره ما"), to: "/about", page: "about" },
- { name: window.t("پشتیبانی"), to: "/contact", page: "contact" },
- ];
- return (
-
- );
- }
-}
-export default connect(
- (state) => ({ status: state.user.status, lang: state.publicApi.lang }),
- {
- changeLanguage: publicApi.changeLanguage,
-
- logout: user.logout,
- }
-)(LaptopNavbar);
-LaptopNavbar.defaultProps = {};
+import React, { Component } from "react";
+
+import proxy from "~/Redux/proxy";
+import { Link } from "react-router-dom";
+import Avatar from "@material-ui/core/Avatar";
+import logo from "~/assets/icons/logo.png";
+import basket from "~/assets/icons/basket.png";
+
+import MenuItem from "@material-ui/core/MenuItem";
+import Menu from "@material-ui/core/Menu";
+import { connect } from "react-redux";
+import "./index.scss";
+import { useHistory } from "react-router-dom";
+import { user, publicApi } from "~/Redux/actions";
+function Navigate({ path }) {
+ let history = useHistory();
+ return <>{history.push(path)}>;
+}
+const maxDesktopSize = 1250;
+
+const fontSize = {
+ desktop: {
+ li: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 85,
+ a: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 85,
+ },
+};
+
+// const changeLanguage = (val) => {
+// if (val === "fa") {
+// localStorage.removeItem("language");
+// } else if (val === "en") {
+// localStorage.setItem("language", "en");
+// } else {
+// localStorage.setItem("language", "ar");
+// }
+// window.location.reload();
+// };
+
+class LaptopNavbar extends Component {
+ state = {};
+
+ render() {
+ const { status } = this.props;
+ if (this.state.navigatePath)
+ return ;
+ const links = [
+ { name: window.t("صفحه اصلی"), to: "/", page: "home" },
+ { name: window.t("فروشگاه"), to: "/products", page: "products" },
+ { name: window.t("سوالات متداول"), to: "/faq", page: "faq" },
+ { name: window.t("درباره ما"), to: "/about", page: "about" },
+ { name: window.t("پشتیبانی"), to: "/contact", page: "contact" },
+ ];
+ return (
+
+ );
+ }
+}
+export default connect(
+ (state) => ({ status: state.user.status, lang: state.publicApi.lang }),
+ {
+ changeLanguage: publicApi.changeLanguage,
+
+ logout: user.logout,
+ }
+)(LaptopNavbar);
+LaptopNavbar.defaultProps = {};
diff --git a/src/views/Home/index.js b/src/views/Home/index.js
index 66b3ae3..879ea71 100644
--- a/src/views/Home/index.js
+++ b/src/views/Home/index.js
@@ -1,174 +1,174 @@
-import React, { Component } from "react";
-import { connect } from "react-redux";
-import { publicApi } from "~/Redux/actions";
-
-import Navbar from "./Navbar";
-import HomeHeader from "./HomeHeader/index";
-import HomeStatic from "./HomeStatic/index";
-import HomeScroll from "./HomeScroll/index";
-import Footer from "./Footer/index";
-import HomeSlider from "./HomeSlider/index";
-import HomeSearch from "./HomeSearch/index";
-import Membership from "./Membership/index";
-import SingleBlog from "./SingleBlog/index";
-import Loader from "~/components/Loader/index";
-import Download from "./Download/index";
-
-// import pic1 from "~/assets/images/pic1.png";
-// import pic from "~/assets/images/pic.png";
-// import online from "~/assets/icons/online-education.png";
-// import chemistry from "~/assets/icons/chemistry.png";
-// import calculator from "~/assets/icons/calculator.png";
-// import homework from "~/assets/icons/homework.png";
-// import sciense_6 from "~/assets/images/sciense-6.png";
-// import chemistry_10 from "~/assets/images/chemistry-10.png";
-// import sciense_8 from "~/assets/images/sciense-8.png";
-// import sciense_9 from "~/assets/images/sciense-9.png";
-// import zist_10 from "~/assets/images/zist-10.png";
-// import blog1 from "~/assets/images/blog1.png";
-// import blog2 from "~/assets/images/blog2.png";
-// import blog3 from "~/assets/images/blog3.png";
-// import ar from "~/assets/icons/qr.svg";
-// import qr from "~/assets/icons/qr.svg";
-// import myBook from "~/assets/images/myBook.png";
-// import homeBlog from "~/assets/images/homeBlog.png";
-// import bookActivation from "~/assets/images/bookActivating.png";
-// import home_chat from "~/assets/icons/home_chat.png";
-// import home_ar from "~/assets/icons/home_ar(2).png";
-
-import "./index.scss";
-
-class Home extends Component {
- componentDidMount() {
- const mobile = window.innerWidth < 1000;
- window.scrollTo(0, 0);
-
- // if (this.props.homeData.length == 0) {
- if (mobile && this.props.userStatus) {
- this.props.getHomeData({ device: 2 });
- } else {
- this.props.getHomeData({ device: 1, mobile: mobile ? 1 : 0 });
- }
- return null;
- // }
- }
- //componentDidupdate = this.componentDidMount();
- render() {
- const { homeData, loading } = this.props;
- if (!loading && this.props.homeData?.length === 0)
- return this.componentDidMount();
- const mobile = window.innerWidth < 1000;
- if (loading && this.props.homeData?.length === 0)
- return (
-
-
-
-
- );
- let scale = Math.max(
- 1,
- mobile ? Math.min(800, window.innerWidth) / 540 : 1
- );
- return (
- <>
- <>
-
-
-
- {homeData?.map((item, i) => (
-
- ))}
- {window.location.host.indexOf("app") > -1 ? null : }
-
-
- {window.innerWidth > 1000 ? : null}
- >
- >
- );
- }
-}
-
-export default connect(
- (state) => ({
- homeData: state.publicApi.homeData,
- loading: state.publicApi.loading,
- userStatus: state.user.status,
- }),
- { getHomeData: publicApi.getHomeData }
-)(Home);
-
-const Identifier = (props) => {
- return (
- <>
- {props.item.type === "header" ? (
-
- ) : null}
- {props.item.type === "static" ? (
-
- ) : null}
- {props.item.type === "scroll" ? (
- props.item.data.length > 0 ? (
-
- ) : null
- ) : null}
- {props.item.type === "slider" ? (
- props.item.data.length > 0 ? (
-
- ) : null
- ) : null}
- {props.item.type === "search" ? (
-
- ) : null}
- {props.item.type === "membership" && window.innerWidth > 1000 ? (
-
- ) : null}
- {props.item.type === "singleBlog" && window.innerWidth > 1000 ? (
-
- ) : null}
- >
- );
-};
+import React, { Component } from "react";
+import { connect } from "react-redux";
+import { publicApi } from "~/Redux/actions";
+
+import Navbar from "./Navbar";
+import HomeHeader from "./HomeHeader/index";
+import HomeStatic from "./HomeStatic/index";
+import HomeScroll from "./HomeScroll/index";
+import Footer from "./Footer/index";
+import HomeSlider from "./HomeSlider/index";
+import HomeSearch from "./HomeSearch/index";
+import Membership from "./Membership/index";
+import SingleBlog from "./SingleBlog/index";
+import Loader from "~/components/Loader/index";
+import Download from "./Download/index";
+
+// import pic1 from "~/assets/images/pic1.png";
+// import pic from "~/assets/images/pic.png";
+// import online from "~/assets/icons/online-education.png";
+// import chemistry from "~/assets/icons/chemistry.png";
+// import calculator from "~/assets/icons/calculator.png";
+// import homework from "~/assets/icons/homework.png";
+// import sciense_6 from "~/assets/images/sciense-6.png";
+// import chemistry_10 from "~/assets/images/chemistry-10.png";
+// import sciense_8 from "~/assets/images/sciense-8.png";
+// import sciense_9 from "~/assets/images/sciense-9.png";
+// import zist_10 from "~/assets/images/zist-10.png";
+// import blog1 from "~/assets/images/blog1.png";
+// import blog2 from "~/assets/images/blog2.png";
+// import blog3 from "~/assets/images/blog3.png";
+// import ar from "~/assets/icons/qr.svg";
+// import qr from "~/assets/icons/qr.svg";
+// import myBook from "~/assets/images/myBook.png";
+// import homeBlog from "~/assets/images/homeBlog.png";
+// import bookActivation from "~/assets/images/bookActivating.png";
+// import home_chat from "~/assets/icons/home_chat.png";
+// import home_ar from "~/assets/icons/home_ar(2).png";
+
+import "./index.scss";
+
+class Home extends Component {
+ componentDidMount() {
+ const mobile = window.innerWidth < 1000;
+ window.scrollTo(0, 0);
+
+ // if (this.props.homeData.length == 0) {
+ if (mobile && this.props.userStatus) {
+ this.props.getHomeData({ device: 2 });
+ } else {
+ this.props.getHomeData({ device: 1, mobile: mobile ? 1 : 0 });
+ }
+ return null;
+ // }
+ }
+ //componentDidupdate = this.componentDidMount();
+ render() {
+ const { homeData, loading } = this.props;
+ if (!loading && this.props.homeData?.length === 0)
+ return this.componentDidMount();
+ const mobile = window.innerWidth < 1000;
+ if (loading && this.props.homeData?.length === 0)
+ return (
+
+
+
+
+ );
+ let scale = Math.max(
+ 1,
+ mobile ? Math.min(800, window.innerWidth) / 540 : 1
+ );
+ return (
+ <>
+ <>
+
+
+
+ {homeData?.map((item, i) => (
+
+ ))}
+ {window.location.host.indexOf("app") > -1 ? null : }
+
+
+ {window.innerWidth > 1000 ? : null}
+ >
+ >
+ );
+ }
+}
+
+export default connect(
+ (state) => ({
+ homeData: state.publicApi.homeData,
+ loading: state.publicApi.loading,
+ userStatus: state.user.status,
+ }),
+ { getHomeData: publicApi.getHomeData }
+)(Home);
+
+const Identifier = (props) => {
+ return (
+ <>
+ {props.item.type === "header" ? (
+
+ ) : null}
+ {props.item.type === "static" ? (
+
+ ) : null}
+ {props.item.type === "scroll" ? (
+ props.item.data.length > 0 ? (
+
+ ) : null
+ ) : null}
+ {props.item.type === "slider" ? (
+ props.item.data.length > 0 ? (
+
+ ) : null
+ ) : null}
+ {props.item.type === "search" ? (
+
+ ) : null}
+ {props.item.type === "membership" && window.innerWidth > 1000 ? (
+
+ ) : null}
+ {props.item.type === "singleBlog" && window.innerWidth > 1000 ? (
+
+ ) : null}
+ >
+ );
+};
diff --git a/src/views/MyBooks/index.js b/src/views/MyBooks/index.js
index 7ed67e5..5f8ec93 100644
--- a/src/views/MyBooks/index.js
+++ b/src/views/MyBooks/index.js
@@ -1,101 +1,101 @@
-import React, { Component } from "react";
-import Navbar from "../Home/Navbar";
-import { connect } from "react-redux";
-import { userProduct } from "~/Redux/actions";
-import moment from "jalali-moment";
-import "./index.scss";
-import { Link } from "react-router-dom";
-
-class MyBooks extends Component {
- componentDidMount() {
- if (!this.props.mylist) this.props.getMyList();
- }
-
- render() {
- const grades = [
- window.t("پیش دبستان"),
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
- ];
- const data = (this.props.myList || []).filter((e) => +e.productType === 3);
- return (
-
-
-
{window.t("کتاب های من")}
-
-
- {window.t("فعال سازی شده")}{" "}
-
-
- {window.t("دیجیتال")}
-
-
-
- {data.map((item) => (
-
-
-
-

-
-
-
- {item.product.book.name} {window.t("پایه")}
- {grades[item.product.book.gradeId]}
-
-
- {window.t("تاریخ فعالسازی:")}{" "}
- {moment(item.updatedAt).format("YYYY/M/D")}
-
-
- {window.t("کد فعالسازی:")} {item.activationCode}
-
-
-
-
-
- ))}
-
-
- );
- }
-}
-export default connect(
- (state) => ({
- myList: state.userProduct.myList,
- loading: state.loading,
- }),
- {
- getMyList: userProduct.myList,
- }
-)(MyBooks);
+import React, { Component } from "react";
+import Navbar from "../Home/Navbar";
+import { connect } from "react-redux";
+import { userProduct } from "~/Redux/actions";
+import moment from "jalali-moment";
+import "./index.scss";
+import { Link } from "react-router-dom";
+
+class MyBooks extends Component {
+ componentDidMount() {
+ if (!this.props.mylist) this.props.getMyList();
+ }
+
+ render() {
+ const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
+ const data = (this.props.myList || []).filter((e) => +e.productType === 3);
+ return (
+
+
+
{window.t("کتاب های من")}
+
+
+ {window.t("فعال سازی شده")}{" "}
+
+
+ {window.t("دیجیتال")}
+
+
+
+ {data.map((item) => (
+
+
+
+

+
+
+
+ {item.product.book.name} {window.t("پایه")}
+ {grades[item.product.book.gradeId]}
+
+
+ {window.t("تاریخ فعالسازی:")}{" "}
+ {moment(item.updatedAt).format("YYYY/M/D")}
+
+
+ {window.t("کد فعالسازی:")} {item.activationCode}
+
+
+
+
+
+ ))}
+
+
+ );
+ }
+}
+export default connect(
+ (state) => ({
+ myList: state.userProduct.myList,
+ loading: state.loading,
+ }),
+ {
+ getMyList: userProduct.myList,
+ }
+)(MyBooks);
diff --git a/src/views/NewProfile/index.js b/src/views/NewProfile/index.js
index 1dd31a6..fef4f51 100644
--- a/src/views/NewProfile/index.js
+++ b/src/views/NewProfile/index.js
@@ -1,543 +1,543 @@
-/* eslint-disable no-useless-escape */
-import React, { Component } from "react";
-import { connect } from "react-redux";
-
-import Select from "../Auth/Profile/Select/index";
-import Input from "../Auth/Profile/Input/index";
-import TextArea from "../Auth/Profile/TextArea/index";
-import Upload from "../Auth/Profile/Upload/index";
-import Gender from "../Auth/Profile/GenderSwitch/index";
-import Birthdate from "../Auth/Profile/Birthdate/index";
-import MultipleSelector from "../Auth/Profile/MultipleSelector/index";
-import Document from "../Auth/Profile/Document/index";
-
-import logo from "~/assets/icons/logo.png";
-import pic from "~/assets/images/pic.png";
-
-import "../Auth/Profile/index.scss";
-
-const maxDesktopSize = 1250;
-const maxMobileSize = 550;
-
-const fontSize = {
- desktop: {
- h1: window.innerWidth > maxDesktopSize ? 25 : window.innerWidth / 55,
- p: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 90,
- },
- mobile: {
- h1: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 18,
- p: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 28,
- },
-};
-
-class NewProfile extends Component {
- state = {
- render: false,
- file: null,
- docFileIds: "",
- firstName: "",
- lastName: "",
- password: "",
- username: "",
- address: "",
- email: "",
- gender: window.t("دختر"),
- userRoleId: window.t("دانش آموز"),
- nationalId: "",
- provinceId: "",
- phone: "",
- cityId: "",
- zoneId: "",
- schoolId: "",
- postalCode: "",
- gradeId: [],
- validation: {
- firstName: "",
- lastName: "",
- username: "",
- email: "",
- postalCode: "",
- nationalId: "",
- schoolId: "",
- },
- };
-
- componentDidMount() {
- // this.props.getProfile();
- }
-
- onChange = (name, value) => {
- if (name === "gardeId" && this.state.userRoleId === window.t("معلم")) {
- this.setState((prevState) => ({
- gradeId: [...prevState.gradeId, value],
- }));
- }
- if (name === "userRoleId") {
- this.setState({
- gradeId: [],
- [name]: value,
- });
- } else {
- this.setState({
- [name]: value,
- });
- }
- };
-
- onSubmit = async (e) => {
- const {
- firstName,
- lastName,
- username,
- password,
- postalCode,
- address,
- email,
- phone,
- } = this.state;
- const { profile, setProfile } = this.props;
- const data = {
- firstName: firstName || profile.firstName,
- lastName: lastName || profile.lastName,
- username: username || profile.username,
- cellphone: profile.cellphone,
- password: password || profile.password,
- postalCode: postalCode || profile.postalCode,
- address: address || profile.address,
- email: email || profile.email,
- phone: phone || profile.phone,
- };
- await setProfile(data);
- };
-
- forcePersian = (txt) => {
- let yas = txt;
- yas = yas.replace(/`/g, "");
- yas = yas.replace(/0/g, "");
- yas = yas.replace(/1/g, "");
- yas = yas.replace(/2/g, "");
- yas = yas.replace(/3/g, "");
- yas = yas.replace(/4/g, "");
- yas = yas.replace(/5/g, "");
- yas = yas.replace(/6/g, "");
- yas = yas.replace(/7/g, "");
- yas = yas.replace(/8/g, "");
- yas = yas.replace(/9/g, "");
- yas = yas.replace(/0/g, "");
- yas = yas.replace(/q/g, "");
- yas = yas.replace(/w/g, "");
- yas = yas.replace(/e/g, "");
- yas = yas.replace(/r/g, "");
- yas = yas.replace(/t/g, "");
- yas = yas.replace(/y/g, "");
- yas = yas.replace(/u/g, "");
- yas = yas.replace(/i/g, "");
- yas = yas.replace(/o/g, "");
- yas = yas.replace(/p/g, "");
- yas = yas.replace(/\[/g, "");
- yas = yas.replace(/\]/g, "");
- yas = yas.replace(/a/g, "");
- yas = yas.replace(/s/g, "");
- yas = yas.replace(/d/g, "");
- yas = yas.replace(/f/g, "");
- yas = yas.replace(/g/g, "");
- yas = yas.replace(/h/g, "");
- yas = yas.replace(/j/g, "");
- yas = yas.replace(/k/g, "");
- yas = yas.replace(/l/g, "");
- yas = yas.replace(/\;/g, "");
- yas = yas.replace(/\'/g, "");
- yas = yas.replace(/z/g, "");
- yas = yas.replace(/x/g, "");
- yas = yas.replace(/c/g, "");
- yas = yas.replace(/v/g, "");
- yas = yas.replace(/b/g, "");
- yas = yas.replace(/n/g, "");
- yas = yas.replace(/m/g, "");
- yas = yas.replace(/\,/g, "");
- yas = yas.replace(/\./g, "");
- yas = yas.replace(/\//g, "");
- yas = yas.replace(/~/g, " ");
- yas = yas.replace(/Q/g, "");
- yas = yas.replace(/W/g, "");
- yas = yas.replace(/E/g, "");
- yas = yas.replace(/R/g, "");
- yas = yas.replace(/T/g, "");
- yas = yas.replace(/Y/g, "");
- yas = yas.replace(/U/g, "");
- yas = yas.replace(/I/g, "");
- yas = yas.replace(/O/g, "");
- yas = yas.replace(/P/g, "");
- yas = yas.replace(/A/g, "");
- yas = yas.replace(/S/g, "");
- yas = yas.replace(/G/g, "");
- yas = yas.replace(/H/g, "");
- yas = yas.replace(/J/g, "");
- yas = yas.replace(/K/g, "");
- yas = yas.replace(/L/g, "");
- yas = yas.replace(/Z/g, "");
- yas = yas.replace(/X/g, "");
- yas = yas.replace(/B/g, "");
- yas = yas.replace(/N/g, "");
- yas = yas.replace(/M/g, "");
- yas = yas.replace(/\?/g, "");
- return yas;
- };
-
- render() {
- const { profile } = this.props;
- const grades = [
- window.t("پیش دبستان"),
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
- ];
- return (
- <>
- {window.innerWidth > 1000 ? (
-
-
-
- {window.t("حساب کاربری")}
-
-
- {window.t("لطفا مشخصات خود را به صورت کامل نمایید.")}
-
-
-
-
- ) : null}
- {window.innerWidth < 1000 ? (
-
-

-
- {window.t("افزودن کاربر جدید")}
-
-
- {window.t("لطفا مشحصات خود را به صورت کامل وارد نمایید")}{" "}
-
-
-
-
-
-
-
-
-
- {this.state.userRoleId === window.t("دانش آموز") ? (
-
- ) : null}
- {this.state.userRoleId === window.t("معلم") ? (
-
- ) : null}
- {this.state.userRoleId === window.t("دانش آموز") &&
- Number(this.state.gradeId) > 9 ? (
-
- ) : null}
-
-
-
-
- {this.state.userRoleId === window.t("دانش آموز") ? (
-
- ) : null}
- {this.state.userRoleId === window.t("معلم") ? (
-
- ) : null}
- {this.state.userRoleId === window.t("معلم") ? (
-
- ) : null}
-
-
-
-
-
-
- ) : null}
- >
- );
- }
-}
-
-export default connect((state) => ({}), {})(NewProfile);
-
-NewProfile.defaultProps = {
- user: {
- name: "اکبر",
- icon: pic,
- description: "",
- },
-};
+/* eslint-disable no-useless-escape */
+import React, { Component } from "react";
+import { connect } from "react-redux";
+
+import Select from "../Auth/Profile/Select/index";
+import Input from "../Auth/Profile/Input/index";
+import TextArea from "../Auth/Profile/TextArea/index";
+import Upload from "../Auth/Profile/Upload/index";
+import Gender from "../Auth/Profile/GenderSwitch/index";
+import Birthdate from "../Auth/Profile/Birthdate/index";
+import MultipleSelector from "../Auth/Profile/MultipleSelector/index";
+import Document from "../Auth/Profile/Document/index";
+
+import logo from "~/assets/icons/logo.png";
+import pic from "~/assets/images/pic.png";
+
+import "../Auth/Profile/index.scss";
+
+const maxDesktopSize = 1250;
+const maxMobileSize = 550;
+
+const fontSize = {
+ desktop: {
+ h1: window.innerWidth > maxDesktopSize ? 25 : window.innerWidth / 55,
+ p: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 90,
+ },
+ mobile: {
+ h1: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 18,
+ p: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 28,
+ },
+};
+
+class NewProfile extends Component {
+ state = {
+ render: false,
+ file: null,
+ docFileIds: "",
+ firstName: "",
+ lastName: "",
+ password: "",
+ username: "",
+ address: "",
+ email: "",
+ gender: window.t("دختر"),
+ userRoleId: window.t("دانش آموز"),
+ nationalId: "",
+ provinceId: "",
+ phone: "",
+ cityId: "",
+ zoneId: "",
+ schoolId: "",
+ postalCode: "",
+ gradeId: [],
+ validation: {
+ firstName: "",
+ lastName: "",
+ username: "",
+ email: "",
+ postalCode: "",
+ nationalId: "",
+ schoolId: "",
+ },
+ };
+
+ componentDidMount() {
+ // this.props.getProfile();
+ }
+
+ onChange = (name, value) => {
+ if (name === "gardeId" && this.state.userRoleId === window.t("معلم")) {
+ this.setState((prevState) => ({
+ gradeId: [...prevState.gradeId, value],
+ }));
+ }
+ if (name === "userRoleId") {
+ this.setState({
+ gradeId: [],
+ [name]: value,
+ });
+ } else {
+ this.setState({
+ [name]: value,
+ });
+ }
+ };
+
+ onSubmit = async (e) => {
+ const {
+ firstName,
+ lastName,
+ username,
+ password,
+ postalCode,
+ address,
+ email,
+ phone,
+ } = this.state;
+ const { profile, setProfile } = this.props;
+ const data = {
+ firstName: firstName || profile.firstName,
+ lastName: lastName || profile.lastName,
+ username: username || profile.username,
+ cellphone: profile.cellphone,
+ password: password || profile.password,
+ postalCode: postalCode || profile.postalCode,
+ address: address || profile.address,
+ email: email || profile.email,
+ phone: phone || profile.phone,
+ };
+ await setProfile(data);
+ };
+
+ forcePersian = (txt) => {
+ let yas = txt;
+ yas = yas.replace(/`/g, "");
+ yas = yas.replace(/0/g, "");
+ yas = yas.replace(/1/g, "");
+ yas = yas.replace(/2/g, "");
+ yas = yas.replace(/3/g, "");
+ yas = yas.replace(/4/g, "");
+ yas = yas.replace(/5/g, "");
+ yas = yas.replace(/6/g, "");
+ yas = yas.replace(/7/g, "");
+ yas = yas.replace(/8/g, "");
+ yas = yas.replace(/9/g, "");
+ yas = yas.replace(/0/g, "");
+ yas = yas.replace(/q/g, "");
+ yas = yas.replace(/w/g, "");
+ yas = yas.replace(/e/g, "");
+ yas = yas.replace(/r/g, "");
+ yas = yas.replace(/t/g, "");
+ yas = yas.replace(/y/g, "");
+ yas = yas.replace(/u/g, "");
+ yas = yas.replace(/i/g, "");
+ yas = yas.replace(/o/g, "");
+ yas = yas.replace(/p/g, "");
+ yas = yas.replace(/\[/g, "");
+ yas = yas.replace(/\]/g, "");
+ yas = yas.replace(/a/g, "");
+ yas = yas.replace(/s/g, "");
+ yas = yas.replace(/d/g, "");
+ yas = yas.replace(/f/g, "");
+ yas = yas.replace(/g/g, "");
+ yas = yas.replace(/h/g, "");
+ yas = yas.replace(/j/g, "");
+ yas = yas.replace(/k/g, "");
+ yas = yas.replace(/l/g, "");
+ yas = yas.replace(/\;/g, "");
+ yas = yas.replace(/\'/g, "");
+ yas = yas.replace(/z/g, "");
+ yas = yas.replace(/x/g, "");
+ yas = yas.replace(/c/g, "");
+ yas = yas.replace(/v/g, "");
+ yas = yas.replace(/b/g, "");
+ yas = yas.replace(/n/g, "");
+ yas = yas.replace(/m/g, "");
+ yas = yas.replace(/\,/g, "");
+ yas = yas.replace(/\./g, "");
+ yas = yas.replace(/\//g, "");
+ yas = yas.replace(/~/g, " ");
+ yas = yas.replace(/Q/g, "");
+ yas = yas.replace(/W/g, "");
+ yas = yas.replace(/E/g, "");
+ yas = yas.replace(/R/g, "");
+ yas = yas.replace(/T/g, "");
+ yas = yas.replace(/Y/g, "");
+ yas = yas.replace(/U/g, "");
+ yas = yas.replace(/I/g, "");
+ yas = yas.replace(/O/g, "");
+ yas = yas.replace(/P/g, "");
+ yas = yas.replace(/A/g, "");
+ yas = yas.replace(/S/g, "");
+ yas = yas.replace(/G/g, "");
+ yas = yas.replace(/H/g, "");
+ yas = yas.replace(/J/g, "");
+ yas = yas.replace(/K/g, "");
+ yas = yas.replace(/L/g, "");
+ yas = yas.replace(/Z/g, "");
+ yas = yas.replace(/X/g, "");
+ yas = yas.replace(/B/g, "");
+ yas = yas.replace(/N/g, "");
+ yas = yas.replace(/M/g, "");
+ yas = yas.replace(/\?/g, "");
+ return yas;
+ };
+
+ render() {
+ const { profile } = this.props;
+ const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+
+
+
+ {window.t("حساب کاربری")}
+
+
+ {window.t("لطفا مشخصات خود را به صورت کامل نمایید.")}
+
+
+
+
+ ) : null}
+ {window.innerWidth < 1000 ? (
+
+

+
+ {window.t("افزودن کاربر جدید")}
+
+
+ {window.t("لطفا مشحصات خود را به صورت کامل وارد نمایید")}{" "}
+
+
+
+
+
+
+
+
+
+ {this.state.userRoleId === window.t("دانش آموز") ? (
+
+ ) : null}
+ {this.state.userRoleId === window.t("معلم") ? (
+
+ ) : null}
+ {this.state.userRoleId === window.t("دانش آموز") &&
+ Number(this.state.gradeId) > 9 ? (
+
+ ) : null}
+
+
+
+
+ {this.state.userRoleId === window.t("دانش آموز") ? (
+
+ ) : null}
+ {this.state.userRoleId === window.t("معلم") ? (
+
+ ) : null}
+ {this.state.userRoleId === window.t("معلم") ? (
+
+ ) : null}
+
+
+
+
+
+
+ ) : null}
+ >
+ );
+ }
+}
+
+export default connect((state) => ({}), {})(NewProfile);
+
+NewProfile.defaultProps = {
+ user: {
+ name: "اکبر",
+ icon: pic,
+ description: "",
+ },
+};
diff --git a/src/views/Orders/index.js b/src/views/Orders/index.js
index 09775f0..afbf91b 100644
--- a/src/views/Orders/index.js
+++ b/src/views/Orders/index.js
@@ -1,145 +1,145 @@
-import React, { Component } from "react";
-import { connect } from "react-redux";
-import Navbar from "../Home/Navbar";
-import { userFactor } from "~/Redux/actions";
-import "./index.css";
-import moment from "jalali-moment";
-
-class Orders extends Component {
- componentDidMount() {
- if (!this.props.list) this.props.getList();
- }
- render() {
- const grades = [
- window.t("پیش دبستان"),
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
- ];
- // props.getList();
- let data = this.props.list;
- return (
-
-
-
- {window.t("سفارشات من")}
-
-
- {data != null &&
- data.map((item, i) => (
-
-
-
- {window.t("شناسه سفارش")}: {item.id}
-
-
-
-
- {
- [
- window.t("پرداخت نشده"),
- window.t("در حال پردازش"),
- window.t("ارسال شد"),
- window.t("لغو شد"),
- ][item.condition]
- }
-
-
-
-
-
- {window.t("شناسه پرداخت")} :{" "}
- {item.transactionId}
-
-
-
- {moment(item.payedAt).format("jYYYY/jMM/jDD hh:mm")}
-
-
-
-
-
-
- {window.t("مبلغ")} : {window.tr(item.payPrice)}{" "}
- {window.t("تومان")}
-
-
-
- {window.t("تخفیف")} :{" "}
- {window.tr(item.offPrice)}{" "}
- {window.t("تومان")}
-
-
-
-
- {item.products.map((item, i) => (
-
-

-
-
- {item.count}{" "}
- ×
-
-
-
- {`${item.book.name} ${grades[item.book.gradeId]}`}
-
-
- ))}
-
-
-
- ))}
- {data == null && (
-
- {window.t("سفارشی برای نماش وجود ندارد")}
-
- )}
-
-
- );
- }
-}
-export default connect(
- (state) => ({
- list: state.userFactor.list,
- }),
- {
- getList: userFactor.list,
- }
-)(Orders);
+import React, { Component } from "react";
+import { connect } from "react-redux";
+import Navbar from "../Home/Navbar";
+import { userFactor } from "~/Redux/actions";
+import "./index.css";
+import moment from "jalali-moment";
+
+class Orders extends Component {
+ componentDidMount() {
+ if (!this.props.list) this.props.getList();
+ }
+ render() {
+ const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
+ // props.getList();
+ let data = this.props.list;
+ return (
+
+
+
+ {window.t("سفارشات من")}
+
+
+ {data != null &&
+ data.map((item, i) => (
+
+
+
+ {window.t("شناسه سفارش")}: {item.id}
+
+
+
+
+ {
+ [
+ window.t("پرداخت نشده"),
+ window.t("در حال پردازش"),
+ window.t("ارسال شد"),
+ window.t("لغو شد"),
+ ][item.condition]
+ }
+
+
+
+
+
+ {window.t("شناسه پرداخت")} :{" "}
+ {item.transactionId}
+
+
+
+ {moment(item.payedAt).format("jYYYY/jMM/jDD hh:mm")}
+
+
+
+
+
+
+ {window.t("مبلغ")} : {window.tr(item.payPrice)}{" "}
+ {window.t("تومان")}
+
+
+
+ {window.t("تخفیف")} :{" "}
+ {window.tr(item.offPrice)}{" "}
+ {window.t("تومان")}
+
+
+
+
+ {item.products.map((item, i) => (
+
+

+
+
+ {item.count}{" "}
+ ×
+
+
+
+ {`${item.book.name} ${grades[item.book.gradeId]}`}
+
+
+ ))}
+
+
+
+ ))}
+ {data == null && (
+
+ {window.t("سفارشی برای نماش وجود ندارد")}
+
+ )}
+
+
+ );
+ }
+}
+export default connect(
+ (state) => ({
+ list: state.userFactor.list,
+ }),
+ {
+ getList: userFactor.list,
+ }
+)(Orders);
diff --git a/src/views/PDF/index.js b/src/views/PDF/index.js
index e751547..dfbba69 100644
--- a/src/views/PDF/index.js
+++ b/src/views/PDF/index.js
@@ -1,25 +1,25 @@
-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];
- console.log(1);
- return (
-
-
-
-
-
-
-
-
- );
- }
-}
+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];
+ console.log(1);
+ return (
+
+
+
+
+
+
+
+
+ );
+ }
+}
diff --git a/src/views/Product/Info/index.js b/src/views/Product/Info/index.js
index 50b6c5f..a0a86d1 100644
--- a/src/views/Product/Info/index.js
+++ b/src/views/Product/Info/index.js
@@ -1,31 +1,31 @@
-import React from "react";
-
-import "./index.scss";
-
-const maxDesktopSize = 1250;
-
-const fontSize = {
- desktop: {
- h1: window.innerWidth > maxDesktopSize ? 22 : window.innerWidth / 55,
- span: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 80,
- p: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 80,
- },
-};
-export default function Info(props) {
- const { title, subTitle, description } = props;
- return (
- <>
- {window.innerWidth > 1000 ? (
-
- {title}
- {subTitle}
- {description}
-
- ) : null}
- >
- );
-}
+import React from "react";
+
+import "./index.scss";
+
+const maxDesktopSize = 1250;
+
+const fontSize = {
+ desktop: {
+ h1: window.innerWidth > maxDesktopSize ? 22 : window.innerWidth / 55,
+ span: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 80,
+ p: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 80,
+ },
+};
+export default function Info(props) {
+ const { title, subTitle, description } = props;
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+
+ {title}
+ {subTitle}
+ {description}
+
+ ) : null}
+ >
+ );
+}
diff --git a/src/views/Product/index.js b/src/views/Product/index.js
index 2129e90..706fbb5 100644
--- a/src/views/Product/index.js
+++ b/src/views/Product/index.js
@@ -1,456 +1,456 @@
-import React, { Component } from "react";
-import { toast } from "react-toastify";
-import proxy from "~/Redux/proxy";
-
-import { Link, useHistory } from "react-router-dom";
-import { connect } from "react-redux";
-import { book } from "~/Redux/actions";
-import { userProduct } from "~/Redux/actions";
-
-import Footer from "../Home/Footer/index";
-import Navbar from "../Home/Navbar/index";
-import Comment from "./Comment/index";
-import Breadcrumbs from "./BreadCrumb/index";
-import Gallery from "./Gallery/index";
-import Info from "./Info/index";
-
-import AddToCart from "./AddToCart/index";
-import HomeScroll from "../Home/HomeScroll/index";
-import HomeSlider from "../Home/HomeSlider/index";
-import Loader from "~/components/Loader/index";
-import MaterialModal from "./MaterialModal/index";
-
-import product_shipping from "~/assets/icons/product-shipping.png";
-import product_cash_back from "~/assets/icons/product-cash-back.png";
-import product_support from "~/assets/icons/product-support.png";
-import send_comment from "~/assets/icons/send-comment.png";
-
-import "./index.scss";
-
-const maxDesktopSize = 1250;
-const maxMobileSize = 550;
-
-const fontSize = {
- desktop: {
- h1: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 70,
- },
- mobile: {
- h1: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 18,
- h2: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 24,
- h3: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 26,
- a: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 26,
- p: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 30,
- li: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 29,
- },
-};
-function Addbutton({ page, info, pushToCart, userId }) {
- let history = useHistory();
- function Navigate({ path }) {
- history.push(path);
- }
- let productId = localStorage.getItem("pushToCart");
- if (productId) {
- toast.info(window.t("جهت ادامه فرآیند خرید وارد حساب خود شوید"));
-
- localStorage.removeItem("pushToCart");
- pushToCart({
- productId,
- userId,
- count: 1,
- });
- setTimeout(() => history.push("/cart"), 2000);
- }
- return (
-
- );
-}
-class Product extends Component {
- state = {
- openComment: false,
- };
-
- handleOpenComment = () => [
- this.setState({
- openComment: !this.state.openComment,
- }),
- ];
-
- componentDidMount() {
- window.scrollTo(0, 0);
- this.props.getInfo({
- id: window.location.pathname.slice(
- window.location.pathname.lastIndexOf("/") + 1,
- window.location.pathname.length
- ),
- });
- this.props.getList();
- }
- componentDidUpdate() {
- if (!this.props.loading && !this.props.list.length) {
- this.props.getInfo({
- id: window.location.pathname.slice(
- window.location.pathname.lastIndexOf("/") + 1,
- window.location.pathname.length
- ),
- });
- this.props.getList();
- }
- }
- render() {
- const grades = [
- window.t("پیش دبستان"),
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
- ];
- const { info, page } = this.props;
- const supportItems = [
- { title: window.t("ارسال سریع"), icon: product_shipping },
- { title: window.t("پشتیبانی 24 ساعته"), icon: product_support },
- { title: window.t("ضمانت بازگشت"), icon: product_cash_back },
- ];
- return (
- <>
- {window.innerWidth > 1000 ? (
- info ? (
- <>
-
-
-
-
-
-
-
- {window.t("نظرات خریداران")}
-
-
-
-
-
- {info.comment.length > 0 ? (
- info.comment.map((item, i) => (
-
- ))
- ) : (
-
- {window.t(
- "از اینکه با نظرات خود ما را در ارتقای کیفیت محصولاتمان"
- )}
- {window.t("یاری کنید ، سپاسگزاریم")}
-
- )}
-
-
- {0 ?
: null}
-
-
-
- >
- ) : (
-
-
-
- )
- ) : null}
- {window.innerWidth < 1000 ? (
- info ? (
- <>
-
-
-
-
-
- {window.t("معرفی کتاب")}
-
-
- {info.description || window.t("توضیحات محصول خالیست")}
-
-
-
-
- {window.t("این کتاب شامل چه مواردی است؟")}
-
-
- {/* {product.modules.map((item, i) => (
-
-
-
- ))} */}
-
-
-
-
-
- {info.description}
-
-
-
-
-
- {window.t("نظرات خریداران")}
-
-
-
-
- {info.comment.length > 0 ? (
- info.comment.map((item, i) => (
-
- ))
- ) : (
-
- {window.t(
- "از اینکه با نظرات خود ما را در ارتقای کیفیت محصولاتمان"
- )}
- {window.t("یاری کنید ، سپاسگزاریم")}
-
- )}
-
-
-
-
-
- {window.t("سبد خرید")}{" "}
-
-
-
- >
- ) : (
-
-
-
- )
- ) : null}
- >
- );
- }
-}
-
-export default connect(
- (state) => ({
- info: state.book.info,
- // status: state.user.status,
- loading: state.book.loading,
- list: state.book.list,
- id: state.user.status.id,
- lang: state.publicApi.lang,
- }),
- { getInfo: book.info, getList: book.list, pushToCart: userProduct.add }
-)(Product);
-
-Product.defaultProps = {};
-
-const Identifier = (props) => {
- return (
- <>
- {window.innerWidth < 1000 ? (
-
- ) : null}
- {window.innerWidth > 1000 ? (
-
- ) : null}
- >
- );
-};
+import React, { Component } from "react";
+import { toast } from "react-toastify";
+import proxy from "~/Redux/proxy";
+
+import { Link, useHistory } from "react-router-dom";
+import { connect } from "react-redux";
+import { book } from "~/Redux/actions";
+import { userProduct } from "~/Redux/actions";
+
+import Footer from "../Home/Footer/index";
+import Navbar from "../Home/Navbar/index";
+import Comment from "./Comment/index";
+import Breadcrumbs from "./BreadCrumb/index";
+import Gallery from "./Gallery/index";
+import Info from "./Info/index";
+
+import AddToCart from "./AddToCart/index";
+import HomeScroll from "../Home/HomeScroll/index";
+import HomeSlider from "../Home/HomeSlider/index";
+import Loader from "~/components/Loader/index";
+import MaterialModal from "./MaterialModal/index";
+
+import product_shipping from "~/assets/icons/product-shipping.png";
+import product_cash_back from "~/assets/icons/product-cash-back.png";
+import product_support from "~/assets/icons/product-support.png";
+import send_comment from "~/assets/icons/send-comment.png";
+
+import "./index.scss";
+
+const maxDesktopSize = 1250;
+const maxMobileSize = 550;
+
+const fontSize = {
+ desktop: {
+ h1: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 70,
+ },
+ mobile: {
+ h1: window.innerWidth > maxMobileSize ? 20 : window.innerWidth / 18,
+ h2: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 24,
+ h3: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 26,
+ a: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 26,
+ p: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 30,
+ li: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 29,
+ },
+};
+function Addbutton({ page, info, pushToCart, userId }) {
+ let history = useHistory();
+ function Navigate({ path }) {
+ history.push(path);
+ }
+ let productId = localStorage.getItem("pushToCart");
+ if (productId) {
+ toast.info(window.t("جهت ادامه فرآیند خرید وارد حساب خود شوید"));
+
+ localStorage.removeItem("pushToCart");
+ pushToCart({
+ productId,
+ userId,
+ count: 1,
+ });
+ setTimeout(() => history.push("/cart"), 2000);
+ }
+ return (
+
+ );
+}
+class Product extends Component {
+ state = {
+ openComment: false,
+ };
+
+ handleOpenComment = () => [
+ this.setState({
+ openComment: !this.state.openComment,
+ }),
+ ];
+
+ componentDidMount() {
+ window.scrollTo(0, 0);
+ this.props.getInfo({
+ id: window.location.pathname.slice(
+ window.location.pathname.lastIndexOf("/") + 1,
+ window.location.pathname.length
+ ),
+ });
+ this.props.getList();
+ }
+ componentDidUpdate() {
+ if (!this.props.loading && !this.props.list.length) {
+ this.props.getInfo({
+ id: window.location.pathname.slice(
+ window.location.pathname.lastIndexOf("/") + 1,
+ window.location.pathname.length
+ ),
+ });
+ this.props.getList();
+ }
+ }
+ render() {
+ const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
+ const { info, page } = this.props;
+ const supportItems = [
+ { title: window.t("ارسال سریع"), icon: product_shipping },
+ { title: window.t("پشتیبانی 24 ساعته"), icon: product_support },
+ { title: window.t("ضمانت بازگشت"), icon: product_cash_back },
+ ];
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+ info ? (
+ <>
+
+
+
+
+
+
+
+ {window.t("نظرات خریداران")}
+
+
+
+
+
+ {info.comment.length > 0 ? (
+ info.comment.map((item, i) => (
+
+ ))
+ ) : (
+
+ {window.t(
+ "از اینکه با نظرات خود ما را در ارتقای کیفیت محصولاتمان"
+ )}
+ {window.t("یاری کنید ، سپاسگزاریم")}
+
+ )}
+
+
+ {0 ?
: null}
+
+
+
+ >
+ ) : (
+
+
+
+ )
+ ) : null}
+ {window.innerWidth < 1000 ? (
+ info ? (
+ <>
+
+
+
+
+
+ {window.t("معرفی کتاب")}
+
+
+ {info.description || window.t("توضیحات محصول خالیست")}
+
+
+
+
+ {window.t("این کتاب شامل چه مواردی است؟")}
+
+
+ {/* {product.modules.map((item, i) => (
+
+
+
+ ))} */}
+
+
+
+
+
+ {info.description}
+
+
+
+
+
+ {window.t("نظرات خریداران")}
+
+
+
+
+ {info.comment.length > 0 ? (
+ info.comment.map((item, i) => (
+
+ ))
+ ) : (
+
+ {window.t(
+ "از اینکه با نظرات خود ما را در ارتقای کیفیت محصولاتمان"
+ )}
+ {window.t("یاری کنید ، سپاسگزاریم")}
+
+ )}
+
+
+
+
+
+ {window.t("سبد خرید")}{" "}
+
+
+
+ >
+ ) : (
+
+
+
+ )
+ ) : null}
+ >
+ );
+ }
+}
+
+export default connect(
+ (state) => ({
+ info: state.book.info,
+ // status: state.user.status,
+ loading: state.book.loading,
+ list: state.book.list,
+ id: state.user.status.id,
+ lang: state.publicApi.lang,
+ }),
+ { getInfo: book.info, getList: book.list, pushToCart: userProduct.add }
+)(Product);
+
+Product.defaultProps = {};
+
+const Identifier = (props) => {
+ return (
+ <>
+ {window.innerWidth < 1000 ? (
+
+ ) : null}
+ {window.innerWidth > 1000 ? (
+
+ ) : null}
+ >
+ );
+};
diff --git a/src/views/Products/Filters/TypicalFilters/index.js b/src/views/Products/Filters/TypicalFilters/index.js
index 93d2905..c03b70d 100644
--- a/src/views/Products/Filters/TypicalFilters/index.js
+++ b/src/views/Products/Filters/TypicalFilters/index.js
@@ -1,118 +1,118 @@
-import React from "react";
-import FormControlLabel from "@material-ui/core/FormControlLabel";
-import Checkbox from "@material-ui/core/Checkbox";
-
-import CheckBoxOutlineBlankIcon from "@material-ui/icons/CheckBoxOutlineBlank";
-import CheckBoxIcon from "@material-ui/icons/CheckBox";
-
-import "./index.scss";
-
-export default class TypicalFilters extends React.Component {
- onChange = (name, data) => {
- if (name === "subject") {
- this.props.parent.setState((prevState) => ({
- selectedFilters: {
- ...prevState.selectedFilters,
- subject:
- prevState.selectedFilters.subject.indexOf(data) !== -1
- ? prevState.selectedFilters.subject.filter(
- (item) => item !== data
- )
- : [...new Set([...prevState.selectedFilters.subject, data])],
- },
- }));
- } else if (name === "level") {
- this.props.parent.setState((prevState) => ({
- selectedFilters: {
- ...prevState.selectedFilters,
- level:
- prevState.selectedFilters.level.indexOf(data) !== -1
- ? prevState.selectedFilters.level.filter((item) => item !== data)
- : [...new Set([...prevState.selectedFilters.level, data])],
- },
- }));
- }
- };
- render() {
- const { data, title, theme } = this.props;
- return (
-
-
-
- {data.map((item, i) => (
-
- ))}
-
-
- );
- }
-}
-
-const Item = (props) => {
- const { data, parent } = props;
- const checkHandler = (data, name) => {
- var available;
- if (name === "subject") {
- available =
- props.parent.props.parent.state.selectedFilters.subject.indexOf(
- data
- ) !== -1
- ? true
- : false;
- } else if (name === "level") {
- available =
- props.parent.props.parent.state.selectedFilters.level.indexOf(data) !==
- -1
- ? true
- : false;
- }
- return available;
- };
- return (
-
- }
- checkedIcon={}
- name="checkedH"
- />
- }
- checked={checkHandler(data, parent.props.name)}
- onChange={() => parent.onChange(parent.props.name, data)}
- />
- {data}
-
- );
-};
+import React from "react";
+import FormControlLabel from "@material-ui/core/FormControlLabel";
+import Checkbox from "@material-ui/core/Checkbox";
+
+import CheckBoxOutlineBlankIcon from "@material-ui/icons/CheckBoxOutlineBlank";
+import CheckBoxIcon from "@material-ui/icons/CheckBox";
+
+import "./index.scss";
+
+export default class TypicalFilters extends React.Component {
+ onChange = (name, data) => {
+ if (name === "subject") {
+ this.props.parent.setState((prevState) => ({
+ selectedFilters: {
+ ...prevState.selectedFilters,
+ subject:
+ prevState.selectedFilters.subject.indexOf(data) !== -1
+ ? prevState.selectedFilters.subject.filter(
+ (item) => item !== data
+ )
+ : [...new Set([...prevState.selectedFilters.subject, data])],
+ },
+ }));
+ } else if (name === "level") {
+ this.props.parent.setState((prevState) => ({
+ selectedFilters: {
+ ...prevState.selectedFilters,
+ level:
+ prevState.selectedFilters.level.indexOf(data) !== -1
+ ? prevState.selectedFilters.level.filter((item) => item !== data)
+ : [...new Set([...prevState.selectedFilters.level, data])],
+ },
+ }));
+ }
+ };
+ render() {
+ const { data, title, theme } = this.props;
+ return (
+
+
+
+ {data.map((item, i) => (
+
+ ))}
+
+
+ );
+ }
+}
+
+const Item = (props) => {
+ const { data, parent } = props;
+ const checkHandler = (data, name) => {
+ var available;
+ if (name === "subject") {
+ available =
+ props.parent.props.parent.state.selectedFilters.subject.indexOf(
+ data
+ ) !== -1
+ ? true
+ : false;
+ } else if (name === "level") {
+ available =
+ props.parent.props.parent.state.selectedFilters.level.indexOf(data) !==
+ -1
+ ? true
+ : false;
+ }
+ return available;
+ };
+ return (
+
+ }
+ checkedIcon={}
+ name="checkedH"
+ />
+ }
+ checked={checkHandler(data, parent.props.name)}
+ onChange={() => parent.onChange(parent.props.name, data)}
+ />
+ {data}
+
+ );
+};
diff --git a/src/views/Products/List/index.js b/src/views/Products/List/index.js
index d719141..4b537e5 100644
--- a/src/views/Products/List/index.js
+++ b/src/views/Products/List/index.js
@@ -1,89 +1,89 @@
-import React from "react";
-import { connect } from "react-redux";
-import { book } from "~/Redux/actions";
-
-import Product from "../Product/index";
-import Loader from "~/components/Loader/index";
-
-import "./index.scss";
-
-class List extends React.Component {
- componentDidMount() {
- if (this.props.list?.length === 0) this.props.getList();
- }
- componentDidUpdate() {
- if (this.props.list?.length === 0 && !this.props.loading)
- this.props.getList();
- }
-
- render() {
- let { filterResult, loading } = this.props;
-
- return window.innerWidth > 1000 ? (
-
- {!loading ? (
- filterResult?.length > 0 ? (
- (Array.isArray(filterResult) ? filterResult : []).map((item, i) => (
-
- ))
- ) : (
-
{window.t("محصولی با این مشخصات یافت نشد")}
-
- // (Array.isArray(list) ? list : []).map((item, i) => (
- //
- // ))
- )
- ) : (
-
-
-
- )}
-
- ) : (
- <>
-
- {!loading ? (
- filterResult.length > 0 ? (
- filterResult.map((item, i) =>
)
- ) : (
- //list.map((item, i) =>
)
-
- {window.t("محصولی با این مشخصات یافت نشد")}{" "}
-
- )
- ) : (
-
-
-
- )}
-
- >
- );
- }
-}
-
-export default connect(
- (state) => ({
- list: state.book.list,
- searchResult: state.book.searchResult,
- loading: state.book.loading,
- filterResult: state.book.filterResult,
- }),
- { getList: book.list }
-)(List);
+import React from "react";
+import { connect } from "react-redux";
+import { book } from "~/Redux/actions";
+
+import Product from "../Product/index";
+import Loader from "~/components/Loader/index";
+
+import "./index.scss";
+
+class List extends React.Component {
+ componentDidMount() {
+ if (this.props.list?.length === 0) this.props.getList();
+ }
+ componentDidUpdate() {
+ if (this.props.list?.length === 0 && !this.props.loading)
+ this.props.getList();
+ }
+
+ render() {
+ let { filterResult, loading } = this.props;
+
+ return window.innerWidth > 1000 ? (
+
+ {!loading ? (
+ filterResult?.length > 0 ? (
+ (Array.isArray(filterResult) ? filterResult : []).map((item, i) => (
+
+ ))
+ ) : (
+
{window.t("محصولی با این مشخصات یافت نشد")}
+
+ // (Array.isArray(list) ? list : []).map((item, i) => (
+ //
+ // ))
+ )
+ ) : (
+
+
+
+ )}
+
+ ) : (
+ <>
+
+ {!loading ? (
+ filterResult.length > 0 ? (
+ filterResult.map((item, i) =>
)
+ ) : (
+ //list.map((item, i) =>
)
+
+ {window.t("محصولی با این مشخصات یافت نشد")}{" "}
+
+ )
+ ) : (
+
+
+
+ )}
+
+ >
+ );
+ }
+}
+
+export default connect(
+ (state) => ({
+ list: state.book.list,
+ searchResult: state.book.searchResult,
+ loading: state.book.loading,
+ filterResult: state.book.filterResult,
+ }),
+ { getList: book.list }
+)(List);
diff --git a/src/views/Products/Product/index.js b/src/views/Products/Product/index.js
index 2ce0970..43f6303 100644
--- a/src/views/Products/Product/index.js
+++ b/src/views/Products/Product/index.js
@@ -1,208 +1,208 @@
-/* eslint-disable jsx-a11y/anchor-is-valid */
-import React from "react";
-import { Link, useHistory } from "react-router-dom";
-import { toast } from "react-toastify";
-import proxy from "~/Redux/proxy";
-// import basket from "../../../assets/icons/basket.png";
-import basket2 from "../../../assets/icons/basket2.png";
-import { connect } from "react-redux";
-
-import { userProduct } from "~/Redux/actions";
-import "./index.scss";
-
-function Product(props) {
- let history = useHistory();
- function Navigate({ path }) {
- history.push(path);
- }
- const { product } = props;
- let productId = localStorage.getItem("pushToCart");
- if (productId) {
- localStorage.removeItem("pushToCart");
- props.pushToCart({
- productId,
- userId: props.id,
- count: 1,
- });
- setTimeout(() => history.push("/cart"), 2000);
- }
- const grades = [
- window.t("پیش دبستان"),
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
- ];
- return (
- <>
- {window.innerWidth < 1000 ? (
-
-
-

-
-
{`${product.name} ${window.t("پایه")} ${
- grades[product.gradeId]
- }`}
-
-
-
-
-
-
-
{window.t("نسخه چاپی")}
-
- {window.tr(product.product[0].price)} {window.t("تومان")}
-
-
-
{
- if (proxy.status())
- props.pushToCart({
- productId: product.product[0].id,
- userId: props.id,
- count: 1,
- });
- else {
- localStorage.setItem(
- "afterLogin",
- window.location.pathname
- );
- localStorage.setItem("pushToCart", product.product[0].id);
- Navigate({ path: "/auth" });
- }
- }}
- >
-

-
-
- {/*
-
- الکترونیکی")}
- {/* {product.product[0].price} تومان")}
-
- به زودی")}
-
-
{
- // proxy.status()
- // ? this.props.pushToCart({
- // productId: product.product[0].id,
- // userId: this.props.id,
- // count: 1,
- // })
- // : toast.info("ابتدا وارد حساب کاربری خود شوید.");
- // }}
- >
-

-
-
*/}
-
-
- ) : null}
- {window.innerWidth > 1000 ? (
-
-
-
-
- {`${product.name} ${window.t("پایه")} ${grades[product.gradeId]}`}
-
-
-
-
-
{window.t("نسخه چاپی")}
-
- {window.tr(product.product[0].price)} {window.t("تومان")}
-
-
-
{
- if (proxy.status())
- props.pushToCart({
- productId: product.product[0].id,
- userId: props.id,
- count: 1,
- });
- else {
- toast.info(
- window.t("جهت ادامه فرآیند خرید وارد حساب خود شوید")
- );
- localStorage.setItem("afterLogin", window.location.pathname);
- localStorage.setItem("pushToCart", product.product[0].id);
- Navigate({ path: "/auth" });
- }
- }}
- >
-

-
-
- {/*
-
-
- {/* {product.product[0].price} تومان
- به زودی")}
-
-
{
- // proxy.status()
- // ? this.props.pushToCart({
- // productId: product.product[0].id,
- // userId: this.props.id,
- // count: 1,
- // })
- // : toast.info("ابتدا وارد حساب کاربری خود شوید.");
- // }}
- >
-

-
-
*/}
-
- ) : null}
- >
- );
-}
-
-export default connect((state) => ({}), {
- pushToCart: userProduct.add,
-})(Product);
+/* eslint-disable jsx-a11y/anchor-is-valid */
+import React from "react";
+import { Link, useHistory } from "react-router-dom";
+import { toast } from "react-toastify";
+import proxy from "~/Redux/proxy";
+// import basket from "../../../assets/icons/basket.png";
+import basket2 from "../../../assets/icons/basket2.png";
+import { connect } from "react-redux";
+
+import { userProduct } from "~/Redux/actions";
+import "./index.scss";
+
+function Product(props) {
+ let history = useHistory();
+ function Navigate({ path }) {
+ history.push(path);
+ }
+ const { product } = props;
+ let productId = localStorage.getItem("pushToCart");
+ if (productId) {
+ localStorage.removeItem("pushToCart");
+ props.pushToCart({
+ productId,
+ userId: props.id,
+ count: 1,
+ });
+ setTimeout(() => history.push("/cart"), 2000);
+ }
+ const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
+ return (
+ <>
+ {window.innerWidth < 1000 ? (
+
+
+

+
+
{`${product.name} ${window.t("پایه")} ${
+ grades[product.gradeId]
+ }`}
+
+
+
+
+
+
+
{window.t("نسخه چاپی")}
+
+ {window.tr(product.product[0].price)} {window.t("تومان")}
+
+
+
{
+ if (proxy.status())
+ props.pushToCart({
+ productId: product.product[0].id,
+ userId: props.id,
+ count: 1,
+ });
+ else {
+ localStorage.setItem(
+ "afterLogin",
+ window.location.pathname
+ );
+ localStorage.setItem("pushToCart", product.product[0].id);
+ Navigate({ path: "/auth" });
+ }
+ }}
+ >
+

+
+
+ {/*
+
+ الکترونیکی")}
+ {/* {product.product[0].price} تومان")}
+
+ به زودی")}
+
+
{
+ // proxy.status()
+ // ? this.props.pushToCart({
+ // productId: product.product[0].id,
+ // userId: this.props.id,
+ // count: 1,
+ // })
+ // : toast.info("ابتدا وارد حساب کاربری خود شوید.");
+ // }}
+ >
+

+
+
*/}
+
+
+ ) : null}
+ {window.innerWidth > 1000 ? (
+
+
+
+
+ {`${product.name} ${window.t("پایه")} ${grades[product.gradeId]}`}
+
+
+
+
+
{window.t("نسخه چاپی")}
+
+ {window.tr(product.product[0].price)} {window.t("تومان")}
+
+
+
{
+ if (proxy.status())
+ props.pushToCart({
+ productId: product.product[0].id,
+ userId: props.id,
+ count: 1,
+ });
+ else {
+ toast.info(
+ window.t("جهت ادامه فرآیند خرید وارد حساب خود شوید")
+ );
+ localStorage.setItem("afterLogin", window.location.pathname);
+ localStorage.setItem("pushToCart", product.product[0].id);
+ Navigate({ path: "/auth" });
+ }
+ }}
+ >
+

+
+
+ {/*
+
+
+ {/* {product.product[0].price} تومان
+ به زودی")}
+
+
{
+ // proxy.status()
+ // ? this.props.pushToCart({
+ // productId: product.product[0].id,
+ // userId: this.props.id,
+ // count: 1,
+ // })
+ // : toast.info("ابتدا وارد حساب کاربری خود شوید.");
+ // }}
+ >
+

+
+
*/}
+
+ ) : null}
+ >
+ );
+}
+
+export default connect((state) => ({}), {
+ pushToCart: userProduct.add,
+})(Product);
diff --git a/src/views/Products/Select/index.js b/src/views/Products/Select/index.js
index 8b94fda..76e92b5 100644
--- a/src/views/Products/Select/index.js
+++ b/src/views/Products/Select/index.js
@@ -1,90 +1,90 @@
-import React from "react";
-import { makeStyles, withStyles } from "@material-ui/core/styles";
-import FormControl from "@material-ui/core/FormControl";
-import NativeSelect from "@material-ui/core/NativeSelect";
-import InputBase from "@material-ui/core/InputBase";
-import KeyboardArrowDownIcon from "@material-ui/icons/KeyboardArrowDown";
-
-const BootstrapInput = withStyles((theme) => ({
- root: {
- "label + &": {
- marginTop: theme.spacing(3),
- },
- },
- input: {
- borderRadius: 4,
- position: "relative",
- backgroundColor: theme.palette.background.paper,
- border: "1px solid #a5a5a5",
- fontSize: 15,
- color: "#a5a5a5",
- // maxWidth : 70,
- minWidth: window.innerWidth > 420 ? 90 : 80,
- height: "35px",
- padding: "5px",
- transition: theme.transitions.create(["border-color", "box-shadow"]),
- // Use the system font instead of the default Roboto font.
- fontFamily: "numeralLight",
- "&:focus": {
- borderRadius: 4,
- },
- },
-}))(InputBase);
-
-const useStyles = makeStyles((theme) => ({
- marginLeft: {
- // margin: theme.spacing(1),
- marginLeft: 8,
- },
-}));
-
-export default function CustomizedSelects(props) {
- const classes = useStyles();
-
- return (
-
-
-
- e.target.value !== window.t("نام کتاب") &&
- e.target.value !== window.t("مرتب سازی") &&
- e.target.value !== window.t("پایه تحصیلی")
- ? props.parent.setState({
- selectedFilters: {
- ...props.parent.state.selectedFilters,
- [props.name]:
- props.name === "sort"
- ? e.target.value
- : new Array(e.target.value),
- },
- })
- : props.parent.setState({
- selectedFilters: {
- ...props.parent.state.selectedFilters,
- [props.name]: props.name === "sort" ? null : [],
- },
- })
- }
- input={}
- >
- {props.options.map((item, i) => (
-
- ))}
-
-
-
-
- );
-}
+import React from "react";
+import { makeStyles, withStyles } from "@material-ui/core/styles";
+import FormControl from "@material-ui/core/FormControl";
+import NativeSelect from "@material-ui/core/NativeSelect";
+import InputBase from "@material-ui/core/InputBase";
+import KeyboardArrowDownIcon from "@material-ui/icons/KeyboardArrowDown";
+
+const BootstrapInput = withStyles((theme) => ({
+ root: {
+ "label + &": {
+ marginTop: theme.spacing(3),
+ },
+ },
+ input: {
+ borderRadius: 4,
+ position: "relative",
+ backgroundColor: theme.palette.background.paper,
+ border: "1px solid #a5a5a5",
+ fontSize: 15,
+ color: "#a5a5a5",
+ // maxWidth : 70,
+ minWidth: window.innerWidth > 420 ? 90 : 80,
+ height: "35px",
+ padding: "5px",
+ transition: theme.transitions.create(["border-color", "box-shadow"]),
+ // Use the system font instead of the default Roboto font.
+ fontFamily: "numeralLight",
+ "&:focus": {
+ borderRadius: 4,
+ },
+ },
+}))(InputBase);
+
+const useStyles = makeStyles((theme) => ({
+ marginLeft: {
+ // margin: theme.spacing(1),
+ marginLeft: 8,
+ },
+}));
+
+export default function CustomizedSelects(props) {
+ const classes = useStyles();
+
+ return (
+
+
+
+ e.target.value !== window.t("نام کتاب") &&
+ e.target.value !== window.t("مرتب سازی") &&
+ e.target.value !== window.t("پایه تحصیلی")
+ ? props.parent.setState({
+ selectedFilters: {
+ ...props.parent.state.selectedFilters,
+ [props.name]:
+ props.name === "sort"
+ ? e.target.value
+ : new Array(e.target.value),
+ },
+ })
+ : props.parent.setState({
+ selectedFilters: {
+ ...props.parent.state.selectedFilters,
+ [props.name]: props.name === "sort" ? null : [],
+ },
+ })
+ }
+ input={}
+ >
+ {props.options.map((item, i) => (
+
+ ))}
+
+
+
+
+ );
+}
diff --git a/src/views/Products/Sort/index.js b/src/views/Products/Sort/index.js
index 2a10ee9..c2b71c4 100644
--- a/src/views/Products/Sort/index.js
+++ b/src/views/Products/Sort/index.js
@@ -1,71 +1,71 @@
-import React from "react";
-import SortIcon from "@material-ui/icons/Sort";
-
-import "./index.scss";
-
-const maxDesktopSize = 1250;
-
-const fontSize = {
- span: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 90,
- li: window.innerWidth > maxDesktopSize ? 13 : window.innerWidth / 95,
-};
-
-export default class Sort extends React.Component {
- render() {
- const { parent, selectedSort } = this.props;
-
- const sortItems = [window.t("پرفروش ترین"), window.t("جدیدترین")];
-
- return (
-
-
-
- {window.t("مرتب سازی بر اساس")}
-
-
- {sortItems.map((item, i) => (
-
- ))}
-
-
- );
- }
-}
-
-const Item = (props) => {
- return (
-
- props.parent.setState({
- selectedFilters: {
- ...props.parent.state.selectedFilters,
- sort: props.data,
- },
- })
- }
- >
- {props.data}
-
- );
-};
+import React from "react";
+import SortIcon from "@material-ui/icons/Sort";
+
+import "./index.scss";
+
+const maxDesktopSize = 1250;
+
+const fontSize = {
+ span: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 90,
+ li: window.innerWidth > maxDesktopSize ? 13 : window.innerWidth / 95,
+};
+
+export default class Sort extends React.Component {
+ render() {
+ const { parent, selectedSort } = this.props;
+
+ const sortItems = [window.t("پرفروش ترین"), window.t("جدیدترین")];
+
+ return (
+
+
+
+ {window.t("مرتب سازی بر اساس")}
+
+
+ {sortItems.map((item, i) => (
+
+ ))}
+
+
+ );
+ }
+}
+
+const Item = (props) => {
+ return (
+
+ props.parent.setState({
+ selectedFilters: {
+ ...props.parent.state.selectedFilters,
+ sort: props.data,
+ },
+ })
+ }
+ >
+ {props.data}
+
+ );
+};
diff --git a/src/views/Products/index.js b/src/views/Products/index.js
index 3b432c8..e912666 100644
--- a/src/views/Products/index.js
+++ b/src/views/Products/index.js
@@ -1,174 +1,174 @@
-import React, { Component } from "react";
-import FilterListIcon from "@material-ui/icons/FilterList";
-import { connect } from "react-redux";
-import { book } from "~/Redux/actions";
-import { Link } from "react-router-dom";
-import Navbar from "../Home/Navbar/index";
-import Footer from "../Home/Footer/index";
-import Select from "./Select/index";
-import Breadcrumbs from "./BreadCrumb/index";
-import List from "./List/index";
-import Sort from "./Sort/index";
-import Filters from "./Filters/index";
-
-import navbarSearch from "../../assets/icons/navbarSearch.png";
-
-import "./index.scss";
-import { toast } from "react-toastify";
-
-class Products extends Component {
- state = {
- search: null,
- selectedFilters: {
- level: [],
- subject: [],
- sort: null,
- },
- };
-
- handleProductSearch = (val) => {
- this.setState({
- search: val,
- });
- // this.props.searchBook(val);
- };
-
- componentDidUpdate(prevProps, prevState) {
- if (
- prevState.selectedFilters !== this.state.selectedFilters ||
- prevState.search !== this.state.search
- ) {
- this.props.filterBook({
- ...this.state.selectedFilters,
- search: this.state.search,
- });
- }
- }
-
- componentDidMount() {
- window.scrollTo(0, 0);
- localStorage.removeItem("filter");
- if (
- window.location.search.slice(
- window.location.search.lastIndexOf("?") + 1,
- window.location.search.length
- ) === "cart"
- ) {
- toast.info(window.t("ابتدا یک محصول به سبد خریدتان اضافه کنید."));
- }
- }
-
- render() {
- const { sortFilters, levels, subjects } = this.props;
- return (
- <>
- {window.innerWidth > 1000 ? (
- <>
-
-
-
-
- {this.props.subjects.length > 0 ? (
-
- ) : null}
-
-
-
-
-
-
-
- >
- ) : null}
- {window.innerWidth < 1000 ? (
- <>
-
-
-
-
-
this.handleProductSearch(e.target.value)}
- />
-

-
-
-
-
-
- {window.t("سبد خرید")}{" "}
-
-
-
- >
- ) : null}
- >
- );
- }
-}
-
-export default connect(
- (state) => ({
- subjects: state.book.subjects,
- levels: state.book.levels,
- sortFilters: state.book.sortFilters,
- }),
- {
- searchBook: book.searchBook,
- filterBook: book.filterBook,
- }
-)(Products);
+import React, { Component } from "react";
+import FilterListIcon from "@material-ui/icons/FilterList";
+import { connect } from "react-redux";
+import { book } from "~/Redux/actions";
+import { Link } from "react-router-dom";
+import Navbar from "../Home/Navbar/index";
+import Footer from "../Home/Footer/index";
+import Select from "./Select/index";
+import Breadcrumbs from "./BreadCrumb/index";
+import List from "./List/index";
+import Sort from "./Sort/index";
+import Filters from "./Filters/index";
+
+import navbarSearch from "../../assets/icons/navbarSearch.png";
+
+import "./index.scss";
+import { toast } from "react-toastify";
+
+class Products extends Component {
+ state = {
+ search: null,
+ selectedFilters: {
+ level: [],
+ subject: [],
+ sort: null,
+ },
+ };
+
+ handleProductSearch = (val) => {
+ this.setState({
+ search: val,
+ });
+ // this.props.searchBook(val);
+ };
+
+ componentDidUpdate(prevProps, prevState) {
+ if (
+ prevState.selectedFilters !== this.state.selectedFilters ||
+ prevState.search !== this.state.search
+ ) {
+ this.props.filterBook({
+ ...this.state.selectedFilters,
+ search: this.state.search,
+ });
+ }
+ }
+
+ componentDidMount() {
+ window.scrollTo(0, 0);
+ localStorage.removeItem("filter");
+ if (
+ window.location.search.slice(
+ window.location.search.lastIndexOf("?") + 1,
+ window.location.search.length
+ ) === "cart"
+ ) {
+ toast.info(window.t("ابتدا یک محصول به سبد خریدتان اضافه کنید."));
+ }
+ }
+
+ render() {
+ const { sortFilters, levels, subjects } = this.props;
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+ <>
+
+
+
+
+ {this.props.subjects.length > 0 ? (
+
+ ) : null}
+
+
+
+
+
+
+
+ >
+ ) : null}
+ {window.innerWidth < 1000 ? (
+ <>
+
+
+
+
+
this.handleProductSearch(e.target.value)}
+ />
+

+
+
+
+
+
+ {window.t("سبد خرید")}{" "}
+
+
+
+ >
+ ) : null}
+ >
+ );
+ }
+}
+
+export default connect(
+ (state) => ({
+ subjects: state.book.subjects,
+ levels: state.book.levels,
+ sortFilters: state.book.sortFilters,
+ }),
+ {
+ searchBook: book.searchBook,
+ filterBook: book.filterBook,
+ }
+)(Products);
diff --git a/src/views/QRScan/LastQr/index.js b/src/views/QRScan/LastQr/index.js
index bde0301..0fdcf8a 100644
--- a/src/views/QRScan/LastQr/index.js
+++ b/src/views/QRScan/LastQr/index.js
@@ -1,47 +1,47 @@
-import React from "react";
-import { Link } from "react-router-dom";
-
-import "./index.scss";
-
-export default function LastQR(props) {
- const grades = [
- "0",
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
- ];
- const { data } = props;
- return (
- <>
- {window.innerWidth > 1000 ? : null}
- {window.innerWidth < 1000 ? (
-
-
-

-
- {data.name}
- {grades[data.gradeId]}
-
-
-
-
-
-
- ) : null}
- >
- );
-}
+import React from "react";
+import { Link } from "react-router-dom";
+
+import "./index.scss";
+
+export default function LastQR(props) {
+ const grades = [
+ "0",
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
+ const { data } = props;
+ return (
+ <>
+ {window.innerWidth > 1000 ? : null}
+ {window.innerWidth < 1000 ? (
+
+
+

+
+ {data.name}
+ {grades[data.gradeId]}
+
+
+
+
+
+
+ ) : null}
+ >
+ );
+}
diff --git a/src/views/QRScan/Scanner/index.js b/src/views/QRScan/Scanner/index.js
index 0a02723..ce8f335 100644
--- a/src/views/QRScan/Scanner/index.js
+++ b/src/views/QRScan/Scanner/index.js
@@ -1,49 +1,49 @@
-import React, { Component } from "react";
-import QrReader from "react-qr-reader";
-
-const facingMode = ["environment", "user"];
-
-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() {
- return (
- <>
- {window.innerWidth < 1000 ? (
-
- ) : null}
- {window.innerWidth > 1000 ? (
-
- ) : null}
- >
- );
- }
-}
+import React, { Component } from "react";
+import QrReader from "react-qr-reader";
+
+const facingMode = ["environment", "user"];
+
+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() {
+ return (
+ <>
+ {window.innerWidth < 1000 ? (
+
+ ) : null}
+ {window.innerWidth > 1000 ? (
+
+ ) : null}
+ >
+ );
+ }
+}
diff --git a/src/views/QRScan/index.js b/src/views/QRScan/index.js
index da17a7e..7809ede 100644
--- a/src/views/QRScan/index.js
+++ b/src/views/QRScan/index.js
@@ -1,179 +1,179 @@
-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, userProduct } 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, //"Zist10-146",
- };
- componentDidMount() {
- console.log(this.props.myList);
- if (!this.props.myList) this.props.getMyList({});
- }
- async componentDidUpdate() {
- if (this.state.value) {
- let tail = this.state.value.slice(
- this.state.value.lastIndexOf("/") + 1,
- this.state.value.length
- );
- // if (tail.length) this.props.info({ tail: tail });
- this.setState({ value: null, tail: tail });
- }
- }
-
- render() {
- const { data } = this.props;
- return (
- <>
- {window.innerWidth > 1000 ? (
- <>
-
-
-
-
-
-
-
-
- {this.state.value !== null ? (
- this.setState({ value: null })}
- >
-
-
- ) : this.state.tail === null ? (
-
- ) : null}
-
- {this.state.tail === null ? null : (
-
- )}
-
-
-
- >
- ) : null}
- {window.innerWidth < 1000 ? (
- <>
-
-
-
-
-
-
-
- this.setState({ facingMode: this.state.facingMode ? 0 : 1 })
- }
- />
- {this.state.value !== null ? (
- this.setState({ value: null })}
- >
-
-
- ) : (
-
- )}
-
- {this.state.tail === null ? null : (
-
- )}
- {localStorage.getItem("latestQr") ? (
-
- {window.t("آخرین مشاهدات")}
- {data.map((item, i) => (
-
- ))}
-
- ) : null}
-
- >
- ) : null}
- >
- );
- }
-}
-
-export default connect(
- (state) => ({ list: state.qr.list, myList: state.userProduct.myList }),
- {
- getMyList: userProduct.myList,
- info: qr.info,
- }
-)(QRScan);
-
-QRScan.defaultProps = {
- data: [
- {
- title: "ریاضیات گسسته خیلی پیشرفته",
- subTitle: "پایه هفتم ابتدایی",
- page: 13,
- image: sciense_6,
- },
- ],
-};
+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, userProduct } 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, //"Zist10-146",
+ };
+ componentDidMount() {
+ console.log(this.props.myList);
+ if (!this.props.myList) this.props.getMyList({});
+ }
+ async componentDidUpdate() {
+ if (this.state.value) {
+ let tail = this.state.value.slice(
+ this.state.value.lastIndexOf("/") + 1,
+ this.state.value.length
+ );
+ // if (tail.length) this.props.info({ tail: tail });
+ this.setState({ value: null, tail: tail });
+ }
+ }
+
+ render() {
+ const { data } = this.props;
+ return (
+ <>
+ {window.innerWidth > 1000 ? (
+ <>
+
+
+
+
+
+
+
+
+ {this.state.value !== null ? (
+ this.setState({ value: null })}
+ >
+
+
+ ) : this.state.tail === null ? (
+
+ ) : null}
+
+ {this.state.tail === null ? null : (
+
+ )}
+
+
+
+ >
+ ) : null}
+ {window.innerWidth < 1000 ? (
+ <>
+
+
+
+
+
+
+
+ this.setState({ facingMode: this.state.facingMode ? 0 : 1 })
+ }
+ />
+ {this.state.value !== null ? (
+ this.setState({ value: null })}
+ >
+
+
+ ) : (
+
+ )}
+
+ {this.state.tail === null ? null : (
+
+ )}
+ {localStorage.getItem("latestQr") ? (
+
+ {window.t("آخرین مشاهدات")}
+ {data.map((item, i) => (
+
+ ))}
+
+ ) : null}
+
+ >
+ ) : null}
+ >
+ );
+ }
+}
+
+export default connect(
+ (state) => ({ list: state.qr.list, myList: state.userProduct.myList }),
+ {
+ getMyList: userProduct.myList,
+ info: qr.info,
+ }
+)(QRScan);
+
+QRScan.defaultProps = {
+ data: [
+ {
+ title: "ریاضیات گسسته خیلی پیشرفته",
+ subTitle: "پایه هفتم ابتدایی",
+ page: 13,
+ image: sciense_6,
+ },
+ ],
+};
diff --git a/src/views/Support/index.js b/src/views/Support/index.js
index f7b402e..a14d2ae 100644
--- a/src/views/Support/index.js
+++ b/src/views/Support/index.js
@@ -1,193 +1,193 @@
-import React, { Component } from "react";
-import { userProduct, comment, file } from "~/Redux/actions";
-
-import Navbar from "../Home/Navbar/index";
-
-import Input from "../Contact/Input/index";
-import Select from "../Contact/Select/index";
-import Upload from "./Upload";
-import "./index.scss";
-import { connect } from "react-redux";
-const maxDesktopSize = 1250;
-const maxMobileSize = 550;
-
-const fontSize = {
- desktop: {
- h1: window.innerWidth > maxDesktopSize ? 30 : window.innerWidth / 40,
- p: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 80,
- span: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 80,
- },
- mobile: {
- h1: window.innerWidth > maxMobileSize ? 25 : window.innerWidth / 16,
- p: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 34,
- span: window.innerWidth > maxMobileSize ? 15 : window.innerWidth / 32,
- },
-};
-
-class Support extends Component {
- state = {
- name: null,
- cellphone: null,
- unit: null,
- bookId: null,
- subject: null,
- text: null,
- file: null,
- fileId: null,
- };
- componentDidMount() {
- if (!this.props.myProductList && this.props.status)
- this.props.getUserProductList({});
- }
- onChange = (name, value, type) => {
- if (type === "file") {
- this.props.upload({ file: value, target: name });
- }
- this.setState({
- [name]: value,
- });
- };
- async send() {
- const {
- submit,
- status: { userId },
- } = this.props;
- const { text, fileId, name, cellphone, unit, bookId, subject } = this.state;
- await submit({
- fileId,
- text,
- name,
- cellphone,
- unit,
- bookId,
- subject,
- userId,
- });
- //todo redirectHome
- }
- render() {
- const grades = [
- window.t("پیش دبستان"),
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
- ];
- let { status } = this.props;
- let opt = [
- window.t("واحد مورد نظر"),
- window.t("واحد فروش"),
- window.t("واحد فنی"),
- window.t("واحد محتوایی"),
- ];
- opt = opt.map((e) => [e, e]);
- return (
- <>
-
- >
- );
- }
-}
-
-export default connect(
- (state) => ({
- myProductList: state.userProduct.myList,
- status: state.user.status,
- uploadFileId: state.file.supportFileId,
- lang: state.publicApi.lang,
- }),
- {
- getUserProductList: userProduct.myList,
- submit: comment.add,
- upload: file.upload,
- }
-)(Support);
+import React, { Component } from "react";
+import { userProduct, comment, file } from "~/Redux/actions";
+
+import Navbar from "../Home/Navbar/index";
+
+import Input from "../Contact/Input/index";
+import Select from "../Contact/Select/index";
+import Upload from "./Upload";
+import "./index.scss";
+import { connect } from "react-redux";
+const maxDesktopSize = 1250;
+const maxMobileSize = 550;
+
+const fontSize = {
+ desktop: {
+ h1: window.innerWidth > maxDesktopSize ? 30 : window.innerWidth / 40,
+ p: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 80,
+ span: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 80,
+ },
+ mobile: {
+ h1: window.innerWidth > maxMobileSize ? 25 : window.innerWidth / 16,
+ p: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 34,
+ span: window.innerWidth > maxMobileSize ? 15 : window.innerWidth / 32,
+ },
+};
+
+class Support extends Component {
+ state = {
+ name: null,
+ cellphone: null,
+ unit: null,
+ bookId: null,
+ subject: null,
+ text: null,
+ file: null,
+ fileId: null,
+ };
+ componentDidMount() {
+ if (!this.props.myProductList && this.props.status)
+ this.props.getUserProductList({});
+ }
+ onChange = (name, value, type) => {
+ if (type === "file") {
+ this.props.upload({ file: value, target: name });
+ }
+ this.setState({
+ [name]: value,
+ });
+ };
+ async send() {
+ const {
+ submit,
+ status: { userId },
+ } = this.props;
+ const { text, fileId, name, cellphone, unit, bookId, subject } = this.state;
+ await submit({
+ fileId,
+ text,
+ name,
+ cellphone,
+ unit,
+ bookId,
+ subject,
+ userId,
+ });
+ //todo redirectHome
+ }
+ render() {
+ const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
+ let { status } = this.props;
+ let opt = [
+ window.t("واحد مورد نظر"),
+ window.t("واحد فروش"),
+ window.t("واحد فنی"),
+ window.t("واحد محتوایی"),
+ ];
+ opt = opt.map((e) => [e, e]);
+ return (
+ <>
+
+ >
+ );
+ }
+}
+
+export default connect(
+ (state) => ({
+ myProductList: state.userProduct.myList,
+ status: state.user.status,
+ uploadFileId: state.file.supportFileId,
+ lang: state.publicApi.lang,
+ }),
+ {
+ getUserProductList: userProduct.myList,
+ submit: comment.add,
+ upload: file.upload,
+ }
+)(Support);