diff --git a/public/index.html b/public/index.html index 6c17468..2b0023c 100644 --- a/public/index.html +++ b/public/index.html @@ -3,35 +3,43 @@ - + - + - + - - Danovin + + دانوین
- + diff --git a/public/manifest.json b/public/manifest.json index 5dee3bb..972e6e0 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,6 +1,6 @@ { - "short_name": "React App", - "name": "Create React App Sample", + "short_name": "دانوین", + "name": "فروشگاه کتاب دانوین", "icons": [ { "src": "favicon.ico", diff --git a/src/AppRouter.js b/src/AppRouter.js index 7e25efc..a669cbc 100644 --- a/src/AppRouter.js +++ b/src/AppRouter.js @@ -43,12 +43,12 @@ class AppRouter extends Component { const mobile = window.innerWidth < 1000 ? true : false; let home = mobile ? ( - {proxy.status ? ( - this.props.profile ? ( + {proxy.status() ? ( + this.props.profile.status ? ( ) : ( - - // + // + ) ) : ( diff --git a/src/Redux/actions/activation.js b/src/Redux/actions/activation.js new file mode 100644 index 0000000..3c64c5d --- /dev/null +++ b/src/Redux/actions/activation.js @@ -0,0 +1,26 @@ +import proxy from "../proxy"; +const activation = { + list: + (data = {}) => + async (dispatch) => + await proxy.get("activation/list", data, { dispatch }), + update: + (data = {}, data2 = {}) => + async (dispatch) => { + await proxy.put("activation/update", data); + await proxy.get("activation/list", data2, { dispatch }); + }, + add: + (data = {}) => + async (dispatch) => { + await proxy.post("activation/add", data); + }, + del: + (data = {}, data2 = {}) => + async (dispatch) => { + await proxy.delete("activation/delete", data); + await proxy.get("activation/list", data2, { dispatch }); + }, +}; + +export default activation; diff --git a/src/Redux/actions/index.js b/src/Redux/actions/index.js index 14d1016..d4f95ac 100644 --- a/src/Redux/actions/index.js +++ b/src/Redux/actions/index.js @@ -10,3 +10,4 @@ export { default as userProduct } from "./userProduct.js"; export { default as userFactor } from "./userFactor.js"; export { default as transport } from "./transport.js"; export { default as comment } from "./comment.js"; +export { default as activation } from "./activation.js"; diff --git a/src/Redux/actions/transport.js b/src/Redux/actions/transport.js index 671cc9f..d75ad2d 100644 --- a/src/Redux/actions/transport.js +++ b/src/Redux/actions/transport.js @@ -20,6 +20,14 @@ const transport = { await proxy.post("transport/add", data); await proxy.get("transport/list", data2, { dispatch }); }, + setTransport: + (data = {}, data2 = {}, data3 = {}) => + async (dispatch) => { + await proxy.post("transport/setTransport", data); + await proxy.get("userFactor/info", data3, { dispatch }); + await proxy.get("transport/list", data2, { dispatch }); + console.log(data); + }, del: (data = {}, data2 = {}) => async (dispatch) => { diff --git a/src/Redux/reducers/activation.js b/src/Redux/reducers/activation.js new file mode 100644 index 0000000..8fa38cb --- /dev/null +++ b/src/Redux/reducers/activation.js @@ -0,0 +1,27 @@ +import { toast } from "react-toastify"; + +const initialState = { + loading: false, + error: null, + list: [], +}; +export default function activation(state = initialState, action) { + let { type, data } = action; + switch (type) { + case "activation/list": + return { ...state, loading: false, list: data, error: null }; + case "activation/update": + return { ...state, loading: false, error: null }; + case "activation/add": + toast.sucess("کتاب شما با موفقیت فعال گردید."); + return { ...state, loading: false, error: null }; + case "activation/delete": + return { ...state, loading: false, error: null }; + case "loading": + return { ...state, loading: true }; + case "error": + return { ...state, loading: false, error: data.message }; + default: + return state; + } +} diff --git a/src/Redux/reducers/index.js b/src/Redux/reducers/index.js index f1e8812..9bc1d52 100644 --- a/src/Redux/reducers/index.js +++ b/src/Redux/reducers/index.js @@ -10,3 +10,4 @@ export { default as userProduct } from "./userProduct.js"; export { default as userFactor } from "./userFactor.js"; export { default as transport } from "./transport.js"; export { default as comment } from "./comment.js"; +export { default as activation } from "./activation.js"; diff --git a/src/Redux/reducers/transport.js b/src/Redux/reducers/transport.js index f5fbbec..95125dd 100644 --- a/src/Redux/reducers/transport.js +++ b/src/Redux/reducers/transport.js @@ -1,3 +1,4 @@ +import { toast } from "react-toastify"; const initialState = { loading: true, error: null, @@ -15,6 +16,9 @@ export default function transport(state = initialState, action) { return { ...state, loading: false, error: null }; case "transport/add": return { ...state, loading: false, error: null }; + case "transport/setTransport": + toast.success("روش ارسال با موفقیت تغییر یافت!"); + return { ...state, loading: false, error: null }; case "transport/delete": return { ...state, loading: false, error: null }; case "loading": diff --git a/src/assets/images/film.jpg b/src/assets/images/film.jpg new file mode 100644 index 0000000..96b4abb Binary files /dev/null and b/src/assets/images/film.jpg differ diff --git a/src/assets/images/music.jpg b/src/assets/images/music.jpg new file mode 100644 index 0000000..97bee1d Binary files /dev/null and b/src/assets/images/music.jpg differ diff --git a/src/views/Activation/index.js b/src/views/Activation/index.js index cbf1336..8380450 100644 --- a/src/views/Activation/index.js +++ b/src/views/Activation/index.js @@ -1,12 +1,11 @@ import React, { Component } from "react"; +import { connect } from "react-redux"; +import { activation } from "~/Redux/actions"; import Navbar from "../Home/Navbar/index"; import Footer from "../Home/Footer/index"; import { Link } from "react-router-dom"; -import History from "./History/index"; -import sciense_6 from "../../assets/images/sciense-6.png"; import analytics from "../../assets/icons/analytics.svg"; -import danger from "../../assets/icons/danger.svg"; import "./index.scss"; @@ -29,10 +28,15 @@ const fontSize = { }, }; -export default class Activation extends Component { +class Activation extends Component { state = { value: null, }; + + componentDidMount() { + this.props.add({}); + } + render() { const { data } = this.props; return ( @@ -154,13 +158,4 @@ export default class Activation extends Component { } } -Activation.defaultProps = { - data: [ - { - title: "ریاضیات گسسته خیلی پیشرفته", - subTitle: "پایه هفتم ابتدایی", - status: "انجام شد", - image: sciense_6, - }, - ], -}; +export default connect((state) => ({}), { add: activation.add })(Activation); diff --git a/src/views/Auth/Login/Cellphone/index.scss b/src/views/Auth/Login/Cellphone/index.scss index 6086bd6..b3d4915 100644 --- a/src/views/Auth/Login/Cellphone/index.scss +++ b/src/views/Auth/Login/Cellphone/index.scss @@ -21,6 +21,7 @@ width: 100%; position: relative; padding: 10px 40px; + height: 130px; img { position: absolute; left: 50px; @@ -31,7 +32,7 @@ text-align: right; position: absolute; left: 108px; - top: 18px; + top: 22px; direction: ltr; color: #a5a5a5; font-family: numeralLight; @@ -46,7 +47,7 @@ text-align: left; background-color: #f2f2f2; border: none; - padding: 8px 5px 8px 85px; + padding: 8px 5px 8px 80px; border-radius: 5px; &:focus { outline: 0px; @@ -94,6 +95,7 @@ margin-bottom: 30px; position: relative; bottom: 40px; + width: 250px; } h1 { font-family: numeralBold; diff --git a/src/views/Auth/Login/Code/index.scss b/src/views/Auth/Login/Code/index.scss index 1fb357d..5d0a394 100644 --- a/src/views/Auth/Login/Code/index.scss +++ b/src/views/Auth/Login/Code/index.scss @@ -70,6 +70,7 @@ img { margin-bottom: 30px; position: relative; + width: 250px; } h1 { width: 100%; diff --git a/src/views/Auth/Login/index.js b/src/views/Auth/Login/index.js index a0c7b8b..d8c0500 100644 --- a/src/views/Auth/Login/index.js +++ b/src/views/Auth/Login/index.js @@ -23,8 +23,8 @@ class Login extends Component { this.props.otp_login({ cellphone, otp, - userToken: "1", - applicationToken: "11", + userToken: "2", + applicationToken: "22", }); } diff --git a/src/views/Blogs/BreadCrumb/index.js b/src/views/Blogs/BreadCrumb/index.js index 89b35db..c23689f 100644 --- a/src/views/Blogs/BreadCrumb/index.js +++ b/src/views/Blogs/BreadCrumb/index.js @@ -19,7 +19,7 @@ const fontSize = { export default function ActiveLastBreadcrumb() { return ( - + { {window.innerWidth > 1000 ? (
- {item.id} + {item.type === "image" ? ( + {item.title} + ) : null} + {item.type === "video" ? ( + {item.title} + ) : null} + {item.type === "audio" ? ( + {item.title} + ) : null}

{item.title}

@@ -89,10 +103,14 @@ const Item = (props) => { to={"/blogs/" + item.id} className="portrait-blogs-item d-flex flex-column" > - {item.title} + {item.type === "image" ? ( + {item.title} + ) : null} + {item.type === "video" ? {item.title} : null} + {item.type === "audio" ? {item.title} : null}

{item.title}

{/*

{item.text}

*/} مطالعه کامل diff --git a/src/views/Blogs/index.scss b/src/views/Blogs/index.scss index e3ce955..5666a11 100644 --- a/src/views/Blogs/index.scss +++ b/src/views/Blogs/index.scss @@ -117,29 +117,33 @@ position: relative; margin: 20px 4px 0px; transform: translateY(-10px); - height: 330px; + // height: 330px; & img { width: 100%; height: 220px; border-radius: 10px; + max-width: 300px; + margin: 0px auto; } h1 { + width: 100%; padding-right: 2px; - font-size: 28px; - margin-bottom: 0px; - margin-top: 10px; + font-size: 24px; // color: $smalt; text-decoration: none; color: #4e4e4e; + max-width: 300px; + text-align: right; + margin: 10px auto 0px; } span { - position: absolute; - font-size: 18px; - bottom: 5px; - left: 10px; - margin-bottom: 0px; + width: 100%; + max-width: 300px; + font-size: 14px; + margin: 10px auto 0px; border-radius: 10px; color: #6cbe44; + text-align: left; } } } diff --git a/src/views/Cart/DeliveryMethod/index.js b/src/views/Cart/DeliveryMethod/index.js index 9f22f7f..9ca6aee 100644 --- a/src/views/Cart/DeliveryMethod/index.js +++ b/src/views/Cart/DeliveryMethod/index.js @@ -1,4 +1,7 @@ +import React, { Component } from "react"; import "./index.scss"; +import { connect } from "react-redux"; +import { transport } from "~/Redux/actions"; const maxDesktopSize = 1250; const maxMobileSize = 550; @@ -22,54 +25,66 @@ const fontSize = { input: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 20, }, }; -const DeliveryMethod = (props) => { - return ( - <> - {window.innerWidth > 1000 ? ( -
- props.parent.setState({ selectedDelivery: props.data }) - } - > - - {props.data.name} - -
-

- {props.data.price} -

- تومان +class DeliveryMethod extends Component { + render() { + const { data, setTransport, factorInfo, parent, transportId, list } = + this.props; + return ( + <> + {window.innerWidth > 1000 ? ( +
parent.setState({ selectedDelivery: data })} + > + + {data.name} + +
+

{data.price}

+ تومان +
-
- ) : null} - {window.innerWidth < 1000 ? ( -
- props.parent.setState({ selectedDelivery: props.data }) - } - > - - {props.data.name} - -
-

{props.data.price}

- تومان + ) : null} + {window.innerWidth < 1000 ? ( +
+ setTransport( + { + factorId: factorInfo.id, + transportId: data.id, + }, + {}, + { id: list[0].factorId } + ) + } + > + + {data.name} + +
+

{data.price}

+ تومان +
-
- ) : null} - - ); -}; + ) : null} + + ); + } +} -export default DeliveryMethod; +export default connect( + (state) => ({ + factorInfo: state.userFactor.info, + list: state.userProduct.list, + }), + { + setTransport: transport.setTransport, + } +)(DeliveryMethod); diff --git a/src/views/Cart/Discount/index.js b/src/views/Cart/Discount/index.js index dd6d406..66885da 100644 --- a/src/views/Cart/Discount/index.js +++ b/src/views/Cart/Discount/index.js @@ -38,6 +38,7 @@ const DiscoutCode = ({ codeId, setCodeId }) => { setValue(e.target.value)} />
@@ -263,10 +271,12 @@ export default connect( list: state.userProduct.list, payPrice: state.userProduct.sum, payMethods: state.transport.list, + factorInfo: state.userFactor.info, }), { getList: userProduct.list, getInfo: userProduct.info, getTransportList: transport.list, + getFactorInfo: userFactor.info, } )(Cart); diff --git a/src/views/Home/HomeScroll/index.scss b/src/views/Home/HomeScroll/index.scss index 52162bc..77401ac 100644 --- a/src/views/Home/HomeScroll/index.scss +++ b/src/views/Home/HomeScroll/index.scss @@ -15,7 +15,7 @@ } span { position: absolute; - width: 40%; + width: 100%; height: 3px; border-radius: 10px; background-color: #7dc241; @@ -26,12 +26,15 @@ &--more { cursor: pointer; + text-decoration: none; + padding-left: 20px; span { color: #7dc241; font-family: numeralMedium; + padding-left: 3px; } img { - width: 15px; + width: 12px; height: 12px; transform: rotate(90deg); } @@ -78,10 +81,12 @@ } &--more { + text-decoration: none; span { font-size: calc(100vw / 35); color: #7dc241; font-family: numeralMedium; + padding-left: 3px; } img { width: 15px; diff --git a/src/views/Home/HomeSlider/Blog/index.js b/src/views/Home/HomeSlider/Blog/index.js index 4cb03a7..f662cbb 100644 --- a/src/views/Home/HomeSlider/Blog/index.js +++ b/src/views/Home/HomeSlider/Blog/index.js @@ -1,5 +1,8 @@ import React, { Component } from "react"; import { Link } from "react-router-dom"; +import music from "~/assets/images/music.jpg"; +import video from "~/assets/images/film.jpg"; +import moment from "jalali-moment"; import "./index.scss"; @@ -13,6 +16,13 @@ const fontSize = { a: window.innerWidth > maxDesktopSize ? 15 : window.innerWidth / 90, }, }; + +const colors = [ + { name: "علمی تخیلی", color: "red" }, + { name: "سیاسی", color: "blue" }, + { name: "تاریخی", color: "orange" }, + { name: "ورزشی", color: "yellow" }, +]; export default class Simple extends Component { render() { const { height, data } = this.props; @@ -26,36 +36,51 @@ export default class Simple extends Component { }} > - {data.title} + {data.type === "image" ? ( + {data.title} + ) : null} + {data.type === "video" ? ( + {data.title} + ) : null} + {data.type === "audio" ? ( + {data.title} + ) : null}

{data.title}

-

{data.subTitle}

+

+ {data.text.slice(0, 100)} ... +

{/* */}
- مطالعه کامل در {data.duration} + مطالعه کامل در {data.duration} دقیقه - تاریخ انتشار {data.data} + تاریخ انتشار {moment(data.createdAt).format("YYYY/MM/DD")}
- - {data.buttonText} + + ادامه مطلب
item.name === data.tag + )[0].color, fontSize: fontSize.desktop.span, }} > - {data.category.name} + {data.tag} @@ -67,25 +92,38 @@ export default class Simple extends Component { height: height, }} > - - {data.title} + + {data.type === "image" ? ( + {data.title} + ) : null} + {data.type === "video" ? ( + {data.title} + ) : null} + {data.type === "audio" ? ( + {data.title} + ) : null}

{data.title}

-

{data.subTitle}

+

{data.text.slice(0, 100)}...

{/* */}
- مطالعه کامل در {data.duration} - تاریخ انتشار {data.data} + مطالعه کامل در {data.duration} دقیقه + + تاریخ انتشار {moment(data.createdAt).format("YYYY/MM/DD")} +
- {data.buttonText} + {data.buttonText}
- {data.category.name} + {data.tag} diff --git a/src/views/Home/HomeSlider/index.js b/src/views/Home/HomeSlider/index.js index 9f50005..5cdfa6d 100644 --- a/src/views/Home/HomeSlider/index.js +++ b/src/views/Home/HomeSlider/index.js @@ -1,4 +1,5 @@ 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"; @@ -12,7 +13,7 @@ const maxDesktopSize = 1250; const fontSize = { desktop: { - h1: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 65, + h1: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 70, span: window.innerWidth > maxDesktopSize ? 18 : window.innerWidth / 75, }, }; @@ -26,10 +27,13 @@ const SimpleHeader = (props) => {

{props.title}

-
- ادامه لیست + + بیشتر فلش -
+
) : null} {window.innerWidth < 1000 ? ( @@ -38,10 +42,13 @@ const SimpleHeader = (props) => {

{props.title}

-
- ادامه لیست + + بیشتر فلش -
+ ) : null} @@ -57,10 +64,13 @@ const TabHeader = (props) => {

{props.title}

-
- ادامه لیست + + بیشتر فلش -
+ ) : null} {window.innerWidth < 1000 ? ( @@ -69,8 +79,8 @@ const TabHeader = (props) => {

{props.title}

-
- ادامه لیست +
+ بیشتر فلش
@@ -81,13 +91,13 @@ const TabHeader = (props) => { export default class HomeSlider extends Component { render() { - const { data, title, height, designType, number } = this.props; + const { data, title, height, designType, number, link } = this.props; let header; if (title) { if (designType === "simple" || designType === "blog") { - header = ; + header = ; } else if (designType === "tab") { - header = ; + header = ; } } return ( diff --git a/src/views/Home/Membership/Input/index.js b/src/views/Home/Membership/Input/index.js index 8be79ab..624aeba 100644 --- a/src/views/Home/Membership/Input/index.js +++ b/src/views/Home/Membership/Input/index.js @@ -8,9 +8,11 @@ const useStyles = makeStyles((theme) => ({ width: "200px", position: "relative", marginRight: 30, + fontFamily: "numeralLight", }, input: { border: "0px", + fontFamily: "numeralLight", }, }, })); diff --git a/src/views/Home/Membership/index.scss b/src/views/Home/Membership/index.scss index d1c587a..f45ec7f 100644 --- a/src/views/Home/Membership/index.scss +++ b/src/views/Home/Membership/index.scss @@ -33,6 +33,11 @@ .MuiOutlinedInput-input { padding: 20px 14px !important; + font-family: numeralLight !important; + color: #4e4e4e !important; + &:focus { + outline: none !important; + } } .MuiInputLabel-outlined { font-family: numeralLight !important; diff --git a/src/views/Home/SingleBlog/index.scss b/src/views/Home/SingleBlog/index.scss index c7bfa28..b34a3f7 100644 --- a/src/views/Home/SingleBlog/index.scss +++ b/src/views/Home/SingleBlog/index.scss @@ -1,23 +1,23 @@ -.single-blog{ +.single-blog { width: 100%; margin: 75px 0px; - &__right{ + &__right { width: 50%; height: 100%; align-items: flex-start; - padding-left: 15%; - h1{ + padding-left: 40px; + h1 { font-family: numeralBold; color: #1bbc6e; text-align: justify; } - p{ + p { font-family: numeralLight; text-align: justify; margin-top: 15px; color: #a5a5a5; } - a{ + a { font-family: numeralMedium; align-self: flex-end; padding: 8px 12px; @@ -26,18 +26,18 @@ border-radius: 5px; border: 1px solid #1bbc6e; margin-top: 20px; - &:hover{ + &:hover { color: #1bbc6e; } } } - &__left{ + &__left { width: 50%; height: 100%; - img{ + img { width: 100%; height: 100%; border-radius: 20px; } } -} \ No newline at end of file +} diff --git a/src/views/Home/index.js b/src/views/Home/index.js index 87af888..76477c0 100644 --- a/src/views/Home/index.js +++ b/src/views/Home/index.js @@ -120,23 +120,28 @@ const Identifier = (props) => { /> ) : 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" && window.innerWidth > 1000 ? (