diff --git a/package.json b/package.json index 440dd23..ac24344 100644 --- a/package.json +++ b/package.json @@ -12,11 +12,13 @@ "axios": "^0.24.0", "jalali-moment": "^3.3.10", "jol-player": "^2.5.0", + "leaflet": "^1.8.0", "lodash": "^4.17.21", "mapir-react-component": "^2.0.1", - "react": "^17.0.2", - "react-dom": "^17.0.2", + "react": "^18.2.0", + "react-dom": "^18.2.0", "react-indiana-drag-scroll": "^2.1.0", + "react-leaflet": ">=3.1.0 <3.2.0 || ^3.2.1", "react-modern-drawer": "^1.0.1", "react-qr-reader": "^2.2.1", "react-redux": "^7.2.6", @@ -45,21 +47,14 @@ "react-app/jest" ] }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" + "browserslist":[ + ">0.2%", + "not dead", + "not op_mini all" ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] - }, "devDependencies": { "autoprefixer": "^9.8.8", "postcss": "^7.0.39", "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17" } -} \ No newline at end of file +} diff --git a/src/App.scss b/src/App.scss index b58ed11..bef4cfb 100644 --- a/src/App.scss +++ b/src/App.scss @@ -1,4 +1,3 @@ - @import "./constants/size.scss"; @import "./constants/colors.scss"; @import "./views/Home/Landscape/Page1/index.scss"; diff --git a/src/assets/icons/filter-icon.svg b/src/assets/icons/filter-icon.svg new file mode 100644 index 0000000..cc27428 --- /dev/null +++ b/src/assets/icons/filter-icon.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/components/LeafletMap/index.js b/src/components/LeafletMap/index.js new file mode 100644 index 0000000..343eb15 --- /dev/null +++ b/src/components/LeafletMap/index.js @@ -0,0 +1,42 @@ +import React from "react"; + +import { MapContainer, TileLayer, Popup, Marker } from "react-leaflet"; +import "leaflet/dist/leaflet.css"; +import L from "leaflet"; +import icon from "leaflet/dist/images/marker-icon.png"; +import iconShadow from "leaflet/dist/images/marker-shadow.png"; + +const bounds = [ + [35.7020226, 51.4281064], + [35.7020226, 51.4281064], +]; + +let DefaultIcon = L.icon({ + iconUrl: icon, + shadowUrl: iconShadow, +}); + +L.Marker.prototype.options.icon = DefaultIcon; + +const LeafletMap = () => { + return ( + + + + + A pretty CSS3 popup.
Easily customizable. +
+
+
+ ); +}; + +export default LeafletMap; diff --git a/src/components/Map/index.js b/src/components/Map/index.js index 33c16a0..091dbd7 100644 --- a/src/components/Map/index.js +++ b/src/components/Map/index.js @@ -15,21 +15,23 @@ const Map = Mapir.setToken({ export default function location() { return ( - - + {" "} + - + apiKey={ + "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjliNzIxYmZhZDZlMGI3MzYxMzFiMTMyNjEyZDQ1M2E3ZDg4YTEzMjc2ZDUyYTA5ZDNmOThiNWFjZTM1NDZlMmMwZDU2M2Y5YzY3N2U0NGFhIn0.eyJhdWQiOiIxNDc1OSIsImp0aSI6IjliNzIxYmZhZDZlMGI3MzYxMzFiMTMyNjEyZDQ1M2E3ZDg4YTEzMjc2ZDUyYTA5ZDNmOThiNWFjZTM1NDZlMmMwZDU2M2Y5YzY3N2U0NGFhIiwiaWF0IjoxNjI1NjY2NzI2LCJuYmYiOjE2MjU2NjY3MjYsImV4cCI6MTYyODI1ODcyNiwic3ViIjoiIiwic2NvcGVzIjpbImJhc2ljIl19.OIjSLWyNCGALY2C0EFDGPEEUbPqOxL6GxCDkeX1B5C218eTk0qkmlGs8z4E87Y-qL7_PG814UZwcngjdRybVwabMtgfHsJj7DRDtrdBzCW7HRlJXqrSRG7xOuJmFhcn4-HtXRQUOEUn8quQukXPek8zvMtRBoMNsefS5s6es2oAg7Fmv0o5T2uZyDzMnRAfrTb1SKtv52Q_yXWYPtQNZdZcwe9Ed-ZkGeAXuTY2tafow92Oq8mmRxrzaq9Ne3gtu98UqXA3rwzRaQ1ToXU_Tcjh5UCVS6hZAzhI-GQk7KfrLbOOyDCxfd9v7_qXnIkRR6dd3bZ69H-jvlytaxMl51Q" + } + center={[51.401464, 35.700815]} + > + + {" "} + ); -} \ No newline at end of file +} diff --git a/src/views/Blog/index.js b/src/views/Blog/index.js index 11b1bc9..562707c 100644 --- a/src/views/Blog/index.js +++ b/src/views/Blog/index.js @@ -9,6 +9,7 @@ import Header from "../Blogs/layouts/Header"; import Suggest from "../Blogs/layouts/Suggest"; import New from "../Blogs/layouts/New"; import Avatar from "../../components/Avatar"; +import moment from "jalali-moment"; //assets import arrow from "../../assets/icons/dropdown-blue.svg"; @@ -30,6 +31,8 @@ export const Blog = ({ getInfo({ id }); }, [id]); + console.log(blog); + return blogs?.length ? (
- - {/* {!blog?.author.picFileId && } + {!blog?.author.picFileId && } {blog?.author.picFileId && ( author - )} */} + )}
- - {window.t("نوشته از:" + " " + "کامران ایزدی")} + + {window.t("نوشته از:") + " " + blog?.author?.name}

- {window.t("سردبیر بخش وبلاگ دانوین")} + {blog?.author.role}

- {window.t("زمان مطالعه" + " " + "۳۰ دقیقه")} + {window.t("زمان مطالعه:") + + " " + + `${blog?.duration}` + + " " + + window.t("دقیقه")} - {window.t("1400/11/24")} + {moment(blog?.updatedAt).locale("fa").format("YYYY/MM/DD")}
@@ -98,19 +104,23 @@ export const Blog = ({
- {window.t("نوشته از:" + " " + "کامران ایزدی")} + {window.t("نوشته از:") + " " + blog?.author?.name}

- {window.t("سردبیر بخش وبلاگ دانوین")} + {blog?.author.role}

- {window.t("زمان مطالعه" + " " + "۳۰ دقیقه")} + {window.t("زمان مطالعه:") + + " " + + `${blog?.duration}` + + " " + + window.t("دقیقه")} - {window.t("1400/11/24")} + {moment(blog?.updatedAt).locale("fa").format("YYYY/MM/DD")}
diff --git a/src/views/Blogs/layouts/New.js b/src/views/Blogs/layouts/New.js index 9a3a12d..83029fa 100644 --- a/src/views/Blogs/layouts/New.js +++ b/src/views/Blogs/layouts/New.js @@ -29,7 +29,7 @@ export const New = ({ blog, isMobile, setActive }) => {
diff --git a/src/views/Blogs/layouts/Single.js b/src/views/Blogs/layouts/Single.js index 9698f8d..c3994bf 100644 --- a/src/views/Blogs/layouts/Single.js +++ b/src/views/Blogs/layouts/Single.js @@ -60,7 +60,6 @@ export const Single = ({ blog, isMobile }) => {

{blog?.title}

-
{ const Large = ({ blog }) => { return isMobile ? ( -
+
{
- + {!blog?.author.picFileId && } + {blog?.author.picFileId && ( + author + )}
- {window.t("نوشته از:" + " " + "کامران ایزدی")} + {window.t("نوشته از:" + " " + `${blog?.author.name}`)}

- {window.t("سردبیر بخش وبلاگ دانوین")} + {blog?.author.role}

- - {window.t("زمان مطالعه" + " " + "۳۰ دقیقه")} + + {window.t("زمان مطالعه:") + + " " + + `${blog?.duration}` + + " " + + window.t("دقیقه")} - - {window.t("1400/11/24")} + + {moment(blog?.updatedAt).locale("fa").format("YYYY/MM/DD")}
@@ -60,13 +72,20 @@ export const Target = ({ blogs, isMobile }) => {
- + {!blog?.author.picFileId && } + {blog?.author.picFileId && ( + author + )}
- - {window.t("نوشته از:" + " " + "کامران ایزدی")} + + {window.t("نوشته از:" + " " + `${blog?.author.name}`)}

- {window.t("سردبیر بخش وبلاگ دانوین")} + {blog?.author.role}

@@ -103,11 +122,11 @@ export const Target = ({ blogs, isMobile }) => { {blog?.title} -

- {window.t( - "هر نفسی که فرو می‌ بریم، مرگی را که مدام به ما دست‌ اندازی می‌کند پس می‌زند در نهایت این مرگ" - )} -

+ +
))} diff --git a/src/views/Contact/index.js b/src/views/Contact/index.js index df61315..377a8d5 100644 --- a/src/views/Contact/index.js +++ b/src/views/Contact/index.js @@ -6,7 +6,7 @@ import Ticket from "./layouts/Ticket"; import Header from "../Activation/components/Header"; import NotFound from "../Faq/components/NotFound"; import Info from "./layouts/Info"; -import Map from "../../components/Map"; +import LeafletMap from "../../components/LeafletMap"; import Divider from "../../components/Divider"; //assets @@ -26,10 +26,7 @@ function Contact({ headerOptions, setHeaderOptions, info, isMobile, isDark }) { }, []); return ( -
+
- +
)} @@ -96,13 +93,14 @@ Contact.defaultProps = { text: window.t( "همکاران ما در قسمت فروش و پشتیبانی، پاسخگوی شما هستند هر سوالی در مورد کتاب‌های ما داشتید بپرسید" ), + tel: null, color: "#766600", }, - link: { - title: window.t("ارتباط با بخش پشتیبانی"), - link: "/support", - color: "#766600", - }, + // link: { + // title: window.t("ارتباط با بخش پشتیبانی"), + // link: "/support", + // color: "#766600", + // }, bg: "#D3B70222", borderColor: "#D3B70255", }, @@ -111,8 +109,9 @@ Contact.defaultProps = { title: { text: window.t("شماره تماس"), color: "#06A02A" }, description: { text: window.t( - "در صورت هرگونه سوال شما می‌توانید در ساعات اداری 9 الی 17 با شماره ۰۲۱۸۸۸۱۴۶۳۷ تماس حاصل فرمایید" + "در صورت هرگونه سوال شما می‌توانید در ساعات اداری 9 الی 17 با شماره 58795 تماس حاصل فرمایید" ), + tel: "58795", color: "#025816", }, link: null, @@ -126,13 +125,14 @@ Contact.defaultProps = { text: window.t( "نشانی دفتر مرکزی: تهران میدان فردوسی خیابان عباس موسوی پلاک 30" ), + tel: null, color: "#066A5C", }, - link: { - title: window.t("لیست نمایندگی‌های فروش"), - link: "/sell", - color: "#0A7769", - }, + // link: { + // title: window.t("لیست نمایندگی‌های فروش"), + // link: "/sell", + // color: "#0A7769", + // }, bg: "#0A776922", borderColor: "#0A776955", }, diff --git a/src/views/Contact/layouts/Info.js b/src/views/Contact/layouts/Info.js index e062d56..1cfd730 100644 --- a/src/views/Contact/layouts/Info.js +++ b/src/views/Contact/layouts/Info.js @@ -11,7 +11,16 @@ function Info({ info, isDark }) { border: `1px solid ${info.borderColor}`, }} > - + {info.description.tel !== null ? ( + + + + ) : ( + + )}
{info.title.text} diff --git a/src/views/Dashboard/layouts/Main/Addresses/index.js b/src/views/Dashboard/layouts/Main/Addresses/index.js index 9cd3f8c..322380a 100644 --- a/src/views/Dashboard/layouts/Main/Addresses/index.js +++ b/src/views/Dashboard/layouts/Main/Addresses/index.js @@ -69,7 +69,7 @@ const ProfileAddress = ({ }} >   - {window.t("یک آدرس جدید اضافه کنید")} + {window.t("یک آدرس جfdsدید اضافه کنید")} +
diff --git a/src/views/Products/layouts/Desktop/Main.js b/src/views/Products/layouts/Desktop/Main.js index 1c71a71..3078784 100644 --- a/src/views/Products/layouts/Desktop/Main.js +++ b/src/views/Products/layouts/Desktop/Main.js @@ -12,6 +12,7 @@ import { book, publicApi } from "../../../../redux/actions"; import moment from "jalali-moment"; import dropdownIcon from "../../../../assets/icons/dropdown-blue.svg"; +import filter from "../../../../assets/icons/filter-icon.svg"; const num = 6; export const Main = ({ @@ -20,7 +21,7 @@ export const Main = ({ sortMethods, filterOptions, setFilterOptions, - useless + useless, }) => { const [filterLoading, setFilterLoading] = useState(false); const [page, setPage] = useState(1); @@ -31,82 +32,91 @@ export const Main = ({ }, [filterOptions]); useEffect(() => { - if(books?.length){ + if (books?.length) { setTotal(books.length); + window.scroll({ top: 0, behavior: "smooth" }); } }, [books]); - const Items = React.useCallback((type) => { - const { grade, subject, available, sort, productType } = filterOptions; - let byGradeFilter; - let bySubjectFilter; - let byAvailableFilter; - let bySortFilter; - if (grade) { - byGradeFilter = books?.filter((book) => grades[book?.gradeId] === grade); - } else { - byGradeFilter = books; - } - if (subject) { - bySubjectFilter = byGradeFilter?.filter( - (book) => - book?.product - ?.find((product) => product?.productType === type) - ?.name?.indexOf(subject) !== -1 || - book?.name.indexOf(subject) !== -1 - ); - } else { - bySubjectFilter = byGradeFilter; - } - if (available) { - byAvailableFilter = bySubjectFilter?.filter( - (book) => - book.product?.find((product) => product?.productType === type)?.price - ); - } else { - byAvailableFilter = bySubjectFilter; - } - if (sort) { - if (sort === window.t("ارزان ترین")) { - bySortFilter = byAvailableFilter?.sort( - (a, b) => - a.product?.find((product) => product?.productType === type)?.price - - b.product?.find((product) => product?.productType === type)?.price + const Items = React.useCallback( + (type) => { + const { grade, subject, available, sort, productType } = filterOptions; + let byGradeFilter; + let bySubjectFilter; + let byAvailableFilter; + let bySortFilter; + if (grade) { + byGradeFilter = books?.filter( + (book) => grades[book?.gradeId] === grade ); - } else if (sort === window.t("محبوب ترین")) { - bySortFilter = byAvailableFilter?.sort( - (a, b) => - a.product?.find((product) => product?.productType === type)?.rate - - b.product?.find((product) => product?.productType === type)?.rate + } else { + byGradeFilter = books; + } + if (subject) { + bySubjectFilter = byGradeFilter?.filter( + (book) => + book?.product + ?.find((product) => product?.productType === type) + ?.name?.indexOf(subject) !== -1 || + book?.name.indexOf(subject) !== -1 ); - } else if (sort === window.t("جدیدترین")) { - bySortFilter = byAvailableFilter?.sort( - (a, b) => moment(a.createdAt) - moment(b.createdAt) + } else { + bySubjectFilter = byGradeFilter; + } + if (available) { + byAvailableFilter = bySubjectFilter?.filter( + (book) => + book.product?.find((product) => product?.productType === type) + ?.price ); + } else { + byAvailableFilter = bySubjectFilter; + } + if (sort) { + if (sort === window.t("ارزان ترین")) { + bySortFilter = byAvailableFilter?.sort( + (a, b) => + a.product?.find((product) => product?.productType === type) + ?.price - + b.product?.find((product) => product?.productType === type)?.price + ); + } else if (sort === window.t("محبوب ترین")) { + bySortFilter = byAvailableFilter?.sort( + (a, b) => + a.product?.find((product) => product?.productType === type) + ?.rate - + b.product?.find((product) => product?.productType === type)?.rate + ); + } else if (sort === window.t("جدیدترین")) { + bySortFilter = byAvailableFilter?.sort( + (a, b) => moment(a.createdAt) - moment(b.createdAt) + ); + } else { + bySortFilter = byAvailableFilter; + } } else { bySortFilter = byAvailableFilter; } - } else { - bySortFilter = byAvailableFilter; - } - return bySortFilter; - },[books, filterOptions, grades]); + return bySortFilter; + }, + [books, filterOptions, grades] + ); const elements = React.useMemo(() => { return Items(2); - },[books, filterOptions]); + }, [books, filterOptions]); const vods = React.useMemo(() => { return Items(4); - },[books, filterOptions]); + }, [books, filterOptions]); const lastPage = React.useMemo(() => { - return Math.floor((elements.length - 1) / num) + 1; - },[books, filterOptions]); + return Math.floor((elements.length - 1) / num) + 1; + }, [books, filterOptions]); const pages = React.useMemo(() => { return lastPage > 1 ? [...Array(lastPage)].map((e, i) => i + 1) : []; - },[books, filterOptions]); + }, [books, filterOptions]); return (
- - - - - - - - - - - - + filter {window.t("مرتب سازی") + "" + ":"} diff --git a/tailwind.config.js b/tailwind.config.js index 336b07a..e480731 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,7 +1,5 @@ module.exports = { - content: [ - "./src/**/*.{js,jsx,ts,tsx}", - ], + content: ["./src/**/*.{js,jsx,ts,tsx}"], darkMode: "class", // or 'media' or 'class' theme: { backgroundColor: (theme) => ({ @@ -71,14 +69,12 @@ module.exports = { gray45: "#454545", red19: "#C01919", greenB9: "#80B918", - }), fill: (theme) => ({ ...theme("colors"), blueC0: "#196EC0", grayDF: "#DFDFDF", greenBA: "#06BACE", - }), fontSize: { xs: "clamp(9px, 2.78vw, 11px)", diff --git a/yarn.lock b/yarn.lock index dd58c96..4d16b67 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1520,6 +1520,11 @@ schema-utils "^2.6.5" source-map "^0.7.3" +"@react-leaflet/core@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@react-leaflet/core/-/core-1.1.1.tgz#827fd05bb542cf874116176d8ef48d5b12163f81" + integrity sha512-7PGLWa9MZ5x/cWy8EH2VzI4T8q5WpuHbixzCDXqixP/WyqwIrg5NDUPgYuFnB4IEIZF+6nA265mYzswFo/h1Pw== + "@rollup/plugin-node-resolve@^7.1.1": version "7.1.3" resolved "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz" @@ -7305,6 +7310,11 @@ last-call-webpack-plugin@^3.0.0: lodash "^4.17.5" webpack-sources "^1.1.0" +leaflet@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/leaflet/-/leaflet-1.8.0.tgz#4615db4a22a304e8e692cae9270b983b38a2055e" + integrity sha512-gwhMjFCQiYs3x/Sf+d49f10ERXaEFCPr+nVTryhAW8DWbMGqJqt9G4XuIaHmFW08zYvhgdzqXGr8AlW8v8dQkA== + leven@^3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz" @@ -9681,6 +9691,14 @@ react-dom@^17.0.2: object-assign "^4.1.1" scheduler "^0.20.2" +react-dom@^18.2.0: + version "18.2.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d" + integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== + dependencies: + loose-envify "^1.1.0" + scheduler "^0.23.0" + react-error-overlay@^6.0.9: version "6.0.10" resolved "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.10.tgz" @@ -9705,6 +9723,13 @@ react-is@^17.0.1, react-is@^17.0.2: resolved "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== +"react-leaflet@>=3.1.0 <3.2.0 || ^3.2.1": + version "3.2.5" + resolved "https://registry.yarnpkg.com/react-leaflet/-/react-leaflet-3.2.5.tgz#bec0bfab9dd8c2b030ea630f7a0687a60322ca7d" + integrity sha512-Z3KZ+4SijsRbbrt2I1a3ZDY6+V6Pm91eYTdxTN18G6IOkFRsJo1BuSPLFnyFrlF3WDjQFPEcTPkEgD1VEeAoBg== + dependencies: + "@react-leaflet/core" "^1.1.1" + react-mapbox-gl-draw@^2.0.4: version "2.0.4" resolved "https://registry.npmjs.org/react-mapbox-gl-draw/-/react-mapbox-gl-draw-2.0.4.tgz" @@ -9874,6 +9899,13 @@ react@^17.0.2: loose-envify "^1.1.0" object-assign "^4.1.1" +react@^18.2.0: + version "18.2.0" + resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5" + integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== + dependencies: + loose-envify "^1.1.0" + read-pkg-up@^7.0.1: version "7.0.1" resolved "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz" @@ -10416,6 +10448,13 @@ scheduler@^0.20.2: loose-envify "^1.1.0" object-assign "^4.1.1" +scheduler@^0.23.0: + version "0.23.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe" + integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw== + dependencies: + loose-envify "^1.1.0" + schema-utils@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz"