reza added payment

master
Reza_ashrafi 3 years ago
parent 506e95e44a
commit e90cea120d
  1. 14
      src/components/GradeFilter/index.tsx
  2. 13
      src/components/HomeSearchBox/index.scss
  3. 2
      src/components/HomeSearchBox/index.tsx
  4. 1
      src/components/Navbar/index.scss
  5. 13
      src/components/NavbarDrawer/NavbarDrawer.scss
  6. 1
      src/redux/actions-type/index.tsx
  7. 4
      src/redux/actions-type/userFactor.tsx
  8. 20
      src/redux/actions-type/userProduct.tsx
  9. 10
      src/redux/actions/userFactor.tsx
  10. 2
      src/redux/reducers/index.tsx
  11. 5
      src/redux/reducers/public.tsx
  12. 4
      src/redux/reducers/userFactor.tsx
  13. 20
      src/redux/reducers/userProduct.tsx
  14. 24
      src/views/Home/index.tsx
  15. 38
      src/views/Subscription/SubscribeRadio/index.tsx
  16. 15
      src/views/Subscription/index.tsx
  17. 2
      src/views/VideoTube/AddComment/index.tsx
  18. 28
      src/views/VideoTube/index.tsx

@ -6,15 +6,20 @@ import "./index.scss";
import dropdown from "../../assets/icons/dropdown.png"; import dropdown from "../../assets/icons/dropdown.png";
function GradeFilter({selectedGrade, gradeFilter, grades}: any) { function GradeFilter({selectedGrade, gradeFilter, grades, gradeDropdown, setGradeDropdown}: any) {
const [arrowTop, setArrowTop] = useState(false); const [arrowTop, setArrowTop] = useState(false);
useEffect(() => { useEffect(() => {
setArrowTop(false); setGradeDropdown(false);
}, [selectedGrade]); }, [selectedGrade]);
const mobileList = useRef<HTMLUListElement>(null); const mobileList = useRef<HTMLUListElement>(null);
const setDropdown = (e : any) => {
e.stopPropagation();
setGradeDropdown(!gradeDropdown);
}
return ( return (
<section className="grade-filter d-flex align-items-center"> <section className="grade-filter d-flex align-items-center">
<h1 className="d-flex align-items-center"> <h1 className="d-flex align-items-center">
@ -23,7 +28,7 @@ function GradeFilter({selectedGrade, gradeFilter, grades}: any) {
</h1> </h1>
<div <div
className="grade-filter__box d-flex" className="grade-filter__box d-flex"
onClick={() => setArrowTop(!arrowTop)} onClick={(e : any) => setDropdown(e)}
> >
{selectedGrade ? ( {selectedGrade ? (
<h2>{grades[selectedGrade - 1].name}</h2> <h2>{grades[selectedGrade - 1].name}</h2>
@ -33,9 +38,10 @@ function GradeFilter({selectedGrade, gradeFilter, grades}: any) {
<img <img
src={dropdown} src={dropdown}
style={{ transform: !arrowTop ? "rotate(180deg)" : "rotate(0deg)" }} style={{ transform: !arrowTop ? "rotate(180deg)" : "rotate(0deg)" }}
alt=""
/> />
</div> </div>
{arrowTop ? ( {gradeDropdown ? (
<ul className="grade-filter__list d-flex flex-wrap"> <ul className="grade-filter__list d-flex flex-wrap">
{grades.map((item: any, i: any) => ( {grades.map((item: any, i: any) => (
<li <li

@ -2,6 +2,9 @@
width: 100%; width: 100%;
font-family: numeralLight; font-family: numeralLight;
margin: 0px auto; margin: 0px auto;
* {
transition: all 0.5s;
}
form { form {
button { button {
background-color: #39383d; background-color: #39383d;
@ -168,7 +171,7 @@
width: 55px; width: 55px;
background : inherit !important; background : inherit !important;
& img{ & img{
width: 35px; width: 28px;
} }
} }
&__searchIcon { &__searchIcon {
@ -176,7 +179,7 @@
left: 62px; left: 62px;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
width: 27px; width: 20px;
} }
form { form {
width: 100%; width: 100%;
@ -185,13 +188,13 @@
border-radius: 8px; border-radius: 8px;
input { input {
width: 100%; width: 100%;
padding: 10px 10px; padding: 5px 10px;
font-size: calc(100vw / 25); font-size: calc(100vw / 30);
padding-right: 20px; padding-right: 20px;
border-radius: 8px; border-radius: 8px;
background: #383838; background: #383838;
&::placeholder { &::placeholder {
font-size: calc(100vw / 30); font-size: calc(100vw / 34);
color: white !important; color: white !important;
} }
} }

@ -51,7 +51,7 @@ function HomeSearchBox({
<img src={voice} alt="" /> <img src={voice} alt="" />
</button> </button>
</form> </form>
<footer className="d-flex"> <footer className="desktop">
<strong>جدیدترینها</strong> <strong>جدیدترینها</strong>
<ul className="d-flex"> <ul className="d-flex">
{lastItems.map((item: any, i: any) => ( {lastItems.map((item: any, i: any) => (

@ -7,6 +7,7 @@
top: 0px !important; top: 0px !important;
left: 0px; left: 0px;
z-index: 150; z-index: 150;
&__container{ &__container{
width: 100%; width: 100%;
font-family: numeralLight; font-family: numeralLight;

@ -1,8 +1,8 @@
.MuiDrawer-paperAnchorRight { .MuiDrawer-paperAnchorRight {
background: rgb(28, 28, 28) !important; background: rgb(28, 28, 28) !important;
&::-webkit-scrollbar { &::-webkit-scrollbar {
display: none; display: none !important;
width: 0px; width: 0px !important;
} }
} }
.navbar-drawer { .navbar-drawer {
@ -127,6 +127,15 @@
} }
} }
.PrivateSwipeArea-root{
width: 0px !important;
}
.MuiPaper-root{
transform: translateX(0px) !important;
transition: all 0.5s !important;
}
.navbar-drawer__bottom a { .navbar-drawer__bottom a {
width: 100%; width: 100%;
height: 100px; height: 100px;

@ -7,6 +7,7 @@ export type { default as productAction } from "./product";
export type { default as FaqAction } from "./faq"; export type { default as FaqAction } from "./faq";
export type { default as FileAction } from "./file"; export type { default as FileAction } from "./file";
export type { default as UserFactorAction } from "./userFactor"; export type { default as UserFactorAction } from "./userFactor";
export type { default as UserProductAction } from "./userProduct";

@ -14,12 +14,12 @@ interface update {
} }
interface payment { interface payment {
type: "userFactor/payment"; type: "userFactor/paymentVOD";
data: any; data: any;
} }
interface verify { interface verify {
type: "userFactor/verify"; type: "userFactor/verifyVOD";
data: any; data: any;
} }

@ -0,0 +1,20 @@
interface addVOD {
type: "userProduct/addVOD";
data: any;
}
interface error{
type : "userProduct/error"
data : undefined
}
interface loading{
type : "userProduct/loading"
data : undefined
}
type UserProductAction = addVOD | error | loading;
export default UserProductAction;

@ -2,13 +2,15 @@ import proxy from "../proxy";
import { Dispatch } from "redux"; import { Dispatch } from "redux";
const userFactor = { const userFactor = {
payment: payment:
(data = {}) => (data1 = {}, data2 = {}) =>
async (dispatch: Dispatch) => async (dispatch: Dispatch) => {
await proxy.get("userFactor/payment", data, { dispatch }), await proxy.post("userProduct/addVOD", data1, { dispatch });
await proxy.post("userFactor/paymentVOD", data2, { dispatch });
},
verify: verify:
(data = {}) => (data = {}) =>
async (dispatch: Dispatch) => async (dispatch: Dispatch) =>
await proxy.get("userFactor/verify", data, { dispatch }), await proxy.post("userFactor/verifyVOD", data, { dispatch }),
info: info:
(data = {}) => (data = {}) =>
async (dispatch: Dispatch) => async (dispatch: Dispatch) =>

@ -7,5 +7,7 @@ export { default as product } from "./product";
export { default as faq } from "./faq"; export { default as faq } from "./faq";
export { default as file } from "./file"; export { default as file } from "./file";
export { default as userFactor } from "./userFactor"; export { default as userFactor } from "./userFactor";
export { default as userProduct } from "./userProduct";

@ -75,7 +75,9 @@ export default function publicApi(state = initialState, action: PublicAction) {
loading: false, loading: false,
bookSection: data, bookSection: data,
error: null, error: null,
selectedVideo: data?.vods?.filter((item: any) => item.name === videoId)[0], selectedVideo: videoId
? data?.vods?.filter((item: any) => item.name === videoId)[0]
: data?.vods[0],
}; };
case "public/vod/bookCourse": case "public/vod/bookCourse":
@ -98,6 +100,7 @@ export default function publicApi(state = initialState, action: PublicAction) {
categories: allCats.map((item: any) => categories: allCats.map((item: any) =>
data.vods.filter((item1: any) => item1.categoryId === item) data.vods.filter((item1: any) => item1.categoryId === item)
), ),
selectedVideo: data?.vods[0],
}; };
case "public/homePage": case "public/homePage":
let itemsLevel; let itemsLevel;

@ -24,10 +24,10 @@ export default function userFactor(state = initialState, action : UserFactorActi
// return { ...state, loading: false, error: null, sum: data.payPrice }; // return { ...state, loading: false, error: null, sum: data.payPrice };
case "userFactor/deleteUserOffCode": case "userFactor/deleteUserOffCode":
return { ...state, loading: false, error: null }; return { ...state, loading: false, error: null };
case "userFactor/payment": case "userFactor/paymentVOD":
window.location.replace(data); window.location.replace(data);
return { ...state, loading: false, error: null, isVerified: false }; return { ...state, loading: false, error: null, isVerified: false };
case "userFactor/verify": case "userFactor/verifyVOD":
return { ...state, loading: false, error: null, isVerified: true }; return { ...state, loading: false, error: null, isVerified: true };
case "userFactor/loading": case "userFactor/loading":
return { ...state, loading: true }; return { ...state, loading: true };

@ -0,0 +1,20 @@
import { toast } from "react-toastify";
import {UserProductAction} from '../actions-type';
const initialState = {
loading: false,
error: null,
};
export default function userFactor(state = initialState, action : UserProductAction) {
let { type, data } = action;
switch (type) {
case "userProduct/addVOD":
return { ...state, loading: false, error: null };
case "userProduct/loading":
return { ...state, loading: true };
case "userProduct/error":
toast.error(data.message);
return { ...state, loading: false, error: data.message };
default:
return state;
}
}

@ -32,6 +32,7 @@ function Home({
const [grade, setGrade] = useState(null); const [grade, setGrade] = useState(null);
const [vocal, setVocal] = useState(false); const [vocal, setVocal] = useState(false);
const [inputValue, setInputValue] = useState(""); const [inputValue, setInputValue] = useState("");
const [gradeDropdown, setGradeDropdown] = useState(false);
useEffect(() => { useEffect(() => {
if (inputValue) { if (inputValue) {
@ -42,13 +43,16 @@ function Home({
useEffect(() => { useEffect(() => {
getCourseList(); getCourseList();
scroll.goToTop(); scroll.goToTop();
getHeader({device : 1}); getHeader({ device: 1 });
}, []); }, []);
return ( return (
<> <>
<div <div
className="home main d-flex flex-column" className="home main d-flex flex-column"
style={{ filter: (vocal || bookLoading || publicLoading) ? "blur(8px)" : "" }} style={{
filter: vocal || bookLoading || publicLoading ? "blur(8px)" : "",
}}
onClick={() => setGradeDropdown(false)}
> >
<Navbar /> <Navbar />
<div className="desktop"> <div className="desktop">
@ -60,7 +64,13 @@ function Home({
setInputValue={setInputValue} setInputValue={setInputValue}
/> />
<Courses courses={sortFilterCourse ? sortFilterCourse : courseList} /> <Courses courses={sortFilterCourse ? sortFilterCourse : courseList} />
<GradeFilter grades={grades} grade={grade} setGrade={setGrade} /> <GradeFilter
grades={grades}
grade={grade}
setGrade={setGrade}
gradeDropdown={gradeDropdown}
setGradeDropdown={setGradeDropdown}
/>
<Books list={gradeFilterBooks ? gradeFilterBooks : courseList} /> <Books list={gradeFilterBooks ? gradeFilterBooks : courseList} />
<Blogs /> <Blogs />
<AppDownload /> <AppDownload />
@ -69,11 +79,11 @@ function Home({
{vocal ? ( {vocal ? (
<Vocal setVocal={setVocal} setInputValue={setInputValue} /> <Vocal setVocal={setVocal} setInputValue={setInputValue} />
) : null} ) : null}
{ {(bookLoading || publicLoading) && (
(bookLoading || publicLoading ) && <div className="full-loader"> <div className="full-loader">
<Loader size={50} /> <Loader size={50} />
</div> </div>
} )}
</> </>
); );
} }
@ -86,7 +96,7 @@ export default connect(
selectedSort: state.book.selectedSort, selectedSort: state.book.selectedSort,
headerData: state.publicApi.header, headerData: state.publicApi.header,
bookLoading: state.book.loading, bookLoading: state.book.loading,
publicLoading : state.publicApi.loading, publicLoading: state.publicApi.loading,
}), }),
{ {
getCourseList: book.list, getCourseList: book.list,

@ -4,9 +4,16 @@ import CustomCheckbox from "../../../components/CustomCheckbox";
import CircleRoundedIcon from "@mui/icons-material/CircleRounded"; import CircleRoundedIcon from "@mui/icons-material/CircleRounded";
import RadioButtonUncheckedRoundedIcon from "@mui/icons-material/RadioButtonUncheckedRounded"; import RadioButtonUncheckedRoundedIcon from "@mui/icons-material/RadioButtonUncheckedRounded";
import { connect } from "react-redux"; import { connect } from "react-redux";
import {product } from "../../../redux/actions"; import { product, userProduct } from "../../../redux/actions";
function SubscribeRadio({ data, selectedVOD, selectVOD }: any) { function SubscribeRadio({ data, selectedVOD, selectVOD }: any) {
const submitVOD = (value : any) => {
if(selectedVOD?.id === data.id){
selectVOD(null);
}else{
selectVOD(data)
}
}
return ( return (
<div <div
className={ className={
@ -15,9 +22,7 @@ function SubscribeRadio({ data, selectedVOD, selectVOD }: any) {
(selectedVOD?.id === data.id ? "subscribe-radio-active" : "") (selectedVOD?.id === data.id ? "subscribe-radio-active" : "")
} }
onClick={() => onClick={() =>
selectedVOD?.id === data.id submitVOD(data)
? selectVOD(null)
: selectVOD(data)
} }
> >
<div className="subscribe-radio__name d-flex align-items-center"> <div className="subscribe-radio__name d-flex align-items-center">
@ -29,7 +34,12 @@ function SubscribeRadio({ data, selectedVOD, selectVOD }: any) {
} }
checkedIcon={ checkedIcon={
<CircleRoundedIcon <CircleRoundedIcon
style={{ color: "white", fontSize: 37, padding: 0, margin : '6px 3px 3px' }} style={{
color: "white",
fontSize: 37,
padding: 0,
margin: "6px 3px 3px",
}}
/> />
} }
checked={selectedVOD?.id === data.id} checked={selectedVOD?.id === data.id}
@ -38,20 +48,20 @@ function SubscribeRadio({ data, selectedVOD, selectVOD }: any) {
</div> </div>
<div className="subscribe-radio__factor d-flex flex-column justify-content-center align-items-center"> <div className="subscribe-radio__factor d-flex flex-column justify-content-center align-items-center">
{/* {data.offPercent !== 0 && ( */} {/* {data.offPercent !== 0 && ( */}
<div className="subscribe-radio__factor--off d-flex align-items-center"> <div className="subscribe-radio__factor--off d-flex align-items-center">
<b> <b>
{data.offerPrice} {data.offerPrice}
<span></span> <span></span>
</b> </b>
<i>تومان</i> <i>تومان</i>
</div> </div>
{/* )} */} {/* )} */}
<div className="subscribe-radio__factor--finalPrice d-flex align-items-center"> <div className="subscribe-radio__factor--finalPrice d-flex align-items-center">
<strong>{data.price}</strong> <strong>{data.price}</strong>
<i>تومان</i> <i>تومان</i>
</div> </div>
{/* {data.offPercent !== 0 && ( */} {/* {data.offPercent !== 0 && ( */}
{/* <span className="subscribe-radio__factor--tag">{`${30}% تخفیف ویژه`}</span> */} {/* <span className="subscribe-radio__factor--tag">{`${30}% تخفیف ویژه`}</span> */}
{/* )} */} {/* )} */}
</div> </div>
</div> </div>
@ -62,5 +72,5 @@ export default connect(
(state: any) => ({ (state: any) => ({
selectedVOD: state.product.selectedVOD, selectedVOD: state.product.selectedVOD,
}), }),
{ selectVOD: product.selectVOD } { selectVOD: product.selectVOD, addVOD: userProduct.addVOD }
)(SubscribeRadio); )(SubscribeRadio);

@ -4,12 +4,12 @@ import Footer from "../Home/Footer";
import SubscribeRadio from "./SubscribeRadio"; import SubscribeRadio from "./SubscribeRadio";
import DiscountCode from "./DiscountCode"; import DiscountCode from "./DiscountCode";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { product } from "../../redux/actions"; import { product, userFactor } from "../../redux/actions";
import scroll from "../../util/scroll"; import scroll from "../../util/scroll";
import Loader from "../../components/Loader"; import Loader from "../../components/Loader";
import "./index.scss"; import "./index.scss";
function Subscription({ listVOD, getList, loading }: any) { function Subscription({ listVOD, getList, loading, selectedVOD, payment, verify }: any) {
useEffect(() => { useEffect(() => {
getList(); getList();
scroll.goToTop(); scroll.goToTop();
@ -17,7 +17,7 @@ function Subscription({ listVOD, getList, loading }: any) {
return ( return (
<div className={"subscription main d-flex flex-column"}> <div className={"subscription main d-flex flex-column"}>
<Navbar /> <Navbar />
<main className={"d-flex flex-column" + ' ' + (loading && 'blur')}> <main className={"d-flex flex-column" + " " + (loading && "blur")}>
<h1>خرید اشتراک دانوین</h1> <h1>خرید اشتراک دانوین</h1>
<p> <p>
لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده
@ -29,7 +29,7 @@ function Subscription({ listVOD, getList, loading }: any) {
))} ))}
<DiscountCode /> <DiscountCode />
<div className="d-flex justify-content-end py-4"> <div className="d-flex justify-content-end py-4">
<button className="submit submit-large">تایید و پرداخت</button> <button className="submit submit-large" onClick={() => payment({productId : selectedVOD.id }, {}) }>تایید و پرداخت</button>
</div> </div>
</main> </main>
<Footer /> <Footer />
@ -46,6 +46,11 @@ export default connect(
(state: any) => ({ (state: any) => ({
listVOD: state.product.listVOD, listVOD: state.product.listVOD,
loading: state.product.loading, loading: state.product.loading,
selectedVOD: state.product.selectedVOD
}), }),
{ getList: product.listVOD } {
getList: product.listVOD,
payment: userFactor.payment,
verify: userFactor.verify,
}
)(Subscription); )(Subscription);

@ -5,7 +5,7 @@ import user3 from "../../../assets/images/user3.png";
export default function AddComment() { export default function AddComment() {
return ( return (
<> <>
<Avatar src={user3} style={{ width: 65, height: 65, marginLeft: 10 }} /> <Avatar style={{ width: 60, height: 60, marginLeft: 10 }} />
<div className="d-flex flex-column" style={{width : '100%'}}> <div className="d-flex flex-column" style={{width : '100%'}}>
<textarea rows={5} placeholder="نظر خود را در این قسمت بنویسید " /> <textarea rows={5} placeholder="نظر خود را در این قسمت بنویسید " />
<div className="d-flex justify-content-end"> <div className="d-flex justify-content-end">

@ -1,4 +1,4 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect, useRef } from "react";
import Navbar from "../../components/Navbar"; import Navbar from "../../components/Navbar";
import Footer from "../Home/Footer"; import Footer from "../Home/Footer";
import LessonPlayList from "./LessonPlayList"; import LessonPlayList from "./LessonPlayList";
@ -24,6 +24,7 @@ function VodTube({
categories, categories,
setVideoActive, setVideoActive,
}: any) { }: any) {
const videoListTag = useRef(null);
useEffect(() => { useEffect(() => {
scroll.goToTop(); scroll.goToTop();
// getInfo({ // getInfo({
@ -37,13 +38,12 @@ function VodTube({
}, []); }, []);
useEffect(() => { useEffect(() => {
if (localStorage.getItem("bookId")) { if (!info && localStorage.getItem("category")) {
setVideoActive(categories[0][0]); const cat: any = localStorage.getItem("category")?.split(",");
} else { bookSection({ bookId: cat[0], categoryId: cat[1] });
if (!info) { }
const cat: any = localStorage.getItem("category")?.split(","); if(info && localStorage.getItem("category")){
bookSection({ bookId: cat[0], categoryId: cat[1] }); // document.getElementsByClassName('video-tube__sidebar--playlist___list').scrollTo(0,)
}
} }
}, [info]); }, [info]);
return ( return (
@ -86,18 +86,20 @@ function VodTube({
<section className="video-tube__sidebar--playlist d-flex flex-column"> <section className="video-tube__sidebar--playlist d-flex flex-column">
<header className="d-flex justify-content-between align-items-center"> <header className="d-flex justify-content-between align-items-center">
<div className="d-flex flex-column"> <div className="d-flex flex-column">
<h2>{localStorage.getItem("category")?.split(',')[1] || 'لیست فیلمها' }</h2> <h2>
{localStorage.getItem("category")?.split(",")[1] ||
"لیست فیلمها"}
</h2>
<p>در این قسمت توضیحی کوتاه قرار می گیرد</p> <p>در این قسمت توضیحی کوتاه قرار می گیرد</p>
</div> </div>
<img src={listIcon} alt="" /> <img src={listIcon} alt="" />
</header> </header>
<div className="video-tube__sidebar--playlist___list d-flex flex-column"> <div ref={videoListTag} className="video-tube__sidebar--playlist___list d-flex flex-column">
{ localStorage.getItem("bookId") {localStorage.getItem("bookId")
? categories?.map((video: any, i: any) => ( ? categories?.map((video: any, i: any) => (
<LessonPlayList category={video} key={i} /> <LessonPlayList category={video} key={i} />
)) ))
: : info?.vods?.map((video: any, i: any) => (
info?.vods?.map((video: any, i: any) => (
<LessonPlayList category={video} key={i} /> <LessonPlayList category={video} key={i} />
))} ))}
</div> </div>

Loading…
Cancel
Save