reza added some change

master
Reza_ashrafi 3 years ago
parent 11dbca78b6
commit 0651eaf99b
  1. 4
      src/App.tsx
  2. 9
      src/components/Loader/index.js
  3. 7
      src/components/PrivateRouter/index.js
  4. 26
      src/custom.scss
  5. 2
      src/redux/actions-type/index.tsx
  6. 51
      src/redux/actions-type/userFactor.tsx
  7. 16
      src/redux/actions/userFactor.tsx
  8. 2
      src/redux/reducers/index.tsx
  9. 40
      src/redux/reducers/userFactor.tsx
  10. 41
      src/router.js
  11. 2
      src/views/Courses/Course/index.scss
  12. 2
      src/views/Courses/index.scss
  13. 12
      src/views/Home/index.tsx
  14. 19
      src/views/Subscription/DiscountCode/index.scss
  15. 59
      src/views/Subscription/DiscountCode/index.tsx
  16. 7
      src/views/Subscription/SubscribeRadio/index.scss
  17. 10
      src/views/Subscription/index.scss
  18. 15
      src/views/Subscription/index.tsx

@ -11,8 +11,8 @@ function App() {
<Provider store={store}> <Provider store={store}>
<Router /> <Router />
<ToastContainer <ToastContainer
position="top-right" position="bottom-left"
autoClose={2000} autoClose={3000}
hideProgressBar={true} hideProgressBar={true}
newestOnTop={true} newestOnTop={true}
closeOnClick closeOnClick

@ -0,0 +1,9 @@
import React from "react";
import CircularProgress from "@mui/material/CircularProgress";
export default function CircularIndeterminate({size}) {
return (
<CircularProgress size={size} />
);
}

@ -12,10 +12,11 @@ const PrivateRouter = ({
<Route <Route
{...rest} {...rest}
render={(props) => render={(props) =>
true ? ( status ? (
<Component {...props} />
) : (
<Redirect to="/" /> <Redirect to="/" />
) : (
<Component {...props} />
) )
} }
/> />

@ -261,6 +261,32 @@ p {
} }
//Toastify
.Toastify{
*{
font-family: numeralLight !important;
}
}
//Loader
.full-loader{
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100vh;
z-index: 1000;
background-color: rgba(0, 0, 0, 0.261);
position: fixed;
top: 0px;
left: 0px;
}
//blur filter
.blur{
filter: blur(8px);
}
@media screen and (min-width: 1441px) { @media screen and (min-width: 1441px) {
.submit { .submit {

@ -6,6 +6,8 @@ export type { default as BlogAction } from "./blog";
export type { default as productAction } from "./product"; 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";

@ -0,0 +1,51 @@
interface list {
type: "userFactor/myList";
data: any;
}
interface info {
type: "userFactor/info";
data: any;
}
interface update {
type: "userFactor/update";
data: any;
}
interface payment {
type: "userFactor/payment";
data: any;
}
interface verify {
type: "userFactor/verify";
data: any;
}
interface deleteUserOffCode {
type: "userFactor/deleteUserOffCode";
data: any;
}
interface error {
type: "userFactor/error";
data: undefined;
}
interface loading {
type: "userFactor/loading";
data: undefined;
}
type UserFactorAction =
| list
| info
| update
| payment
| verify
| deleteUserOffCode
| loading
| error;
export default UserFactorAction;

@ -9,6 +9,22 @@ const userFactor = {
(data = {}) => (data = {}) =>
async (dispatch: Dispatch) => async (dispatch: Dispatch) =>
await proxy.get("userFactor/verify", data, { dispatch }), await proxy.get("userFactor/verify", data, { dispatch }),
info:
(data = {}) =>
async (dispatch: Dispatch) =>
await proxy.get("userFactor/info", data, { dispatch }),
update:
(data = {}, data2 = {}) =>
async (dispatch: Dispatch) => {
await proxy.put("userFactor/update", data, { dispatch });
await proxy.get("userFactor/info", data2, { dispatch });
},
deleteUserOffCode:
(data = {}, data2 = {}) =>
async (dispatch: Dispatch) => {
await proxy.delete("userFactor/deleteUserOffCode", data, { dispatch });
await proxy.get("userFactor/info", data2, { dispatch });
},
}; };
export default userFactor; export default userFactor;

@ -6,4 +6,6 @@ export { default as blog } from "./blog";
export { default as product } from "./product"; 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";

@ -0,0 +1,40 @@
import { toast } from "react-toastify";
import {UserFactorAction} from '../actions-type';
const initialState = {
loading: false,
error: null,
list: null,
info: null,
sum: null,
checkEmpty: false,
isVerified: null,
};
export default function userFactor(state = initialState, action : UserFactorAction) {
let { type, data } = action;
switch (type) {
case "userFactor/myList":
return { ...state, loading: false, list: data, error: null };
case "userFactor/info":
return { ...state, loading: false, info: data, error: null };
case "userFactor/update":
toast.success("درخواست شما با موفقیت انجام شد.");
return { ...state, loading: false, error: null };
// case "userFactor/add":
// toast.success("درخواست شما با موفقیت انجام شد.");
// return { ...state, loading: false, error: null, sum: data.payPrice };
case "userFactor/deleteUserOffCode":
return { ...state, loading: false, error: null };
case "userFactor/payment":
window.location.replace(data);
return { ...state, loading: false, error: null, isVerified: false };
case "userFactor/verify":
return { ...state, loading: false, error: null, isVerified: true };
case "userFactor/loading":
return { ...state, loading: true };
case "userFactor/error":
toast.error(data.message);
return { ...state, loading: false, error: data.message };
default:
return state;
}
}

@ -19,47 +19,32 @@ import About from './views/About';
// import proxy from "./redux/proxy"; // import proxy from "./redux/proxy";
function router({ status }) { function router({ status }) {
const home = (
<Route exact path="/">{1 ? <Home /> : <Auth page="signup" />}</Route>
);
return ( return (
<Router> <Router>
<Switch> <Switch>
{home} <Route exact path="/">
<PrivateRouter restricted={false} component={Home} path="/" exact /> <Home />
<Route exact path={"/sign-up"}>
<Auth page="signup" />
</Route> </Route>
<PrivateRouter restricted={false} component={Auth} path="/signup" exact />
<PrivateRouter restricted={false} component={Auth} path="/login" exact />
<Route exact path={"/profile"}> <Route exact path={"/profile"}>
<Auth page="profile" /> <Auth page="profile" />
</Route> </Route>
<Route exact path={"/login"}>
<Auth page="login" />
</Route>
<Route exact path={"/grades/:id"}> <Route exact path={"/grades/:id"}>
<Courses /> <Courses />
</Route> </Route>
<Route exact path={"/about"}> <Route exact path={"/about"}>
<About /> <About />
</Route> </Route>
<PrivateRouter <Route exact path={"/courses/:id"}>
restricted={false} <Course />
component={Course} </Route>
path="/courses/:id" <Route exact path={"/video-tube"}>
exact <VideoTube />
/> </Route>
<PrivateRouter <Route exact path={"/subscribe"}>
restricted={false} <Subscription />
component={VideoTube} </Route>
path="/video-tube"
exact
/>
<PrivateRouter
restricted={false}
component={Subscription}
path="/subscribe"
exact
/>
<Route exact path={"/contact"}> <Route exact path={"/contact"}>
<Contact /> <Contact />
</Route> </Route>

@ -47,7 +47,7 @@
} }
} }
@media screen and (min-width: 1008px) and (max-width: 1400px) { @media screen and (min-width: 1008px) and (max-width: 1440px) {
.courses-course { .courses-course {
&:hover { &:hover {
background-color: #dddddd21; background-color: #dddddd21;

@ -14,7 +14,7 @@
} }
} }
@media screen and (min-width: 1008px) and (max-width: 1400px) { @media screen and (min-width: 1008px) and (max-width: 1440px) {
.courses { .courses {
main { main {
max-width: 700px; max-width: 700px;

@ -11,6 +11,7 @@ import Header from "./Header";
import AppDownload from "./AppDownload"; import AppDownload from "./AppDownload";
import Vocal from "../../components/Vocal/Vocal"; import Vocal from "../../components/Vocal/Vocal";
import scroll from "../../util/scroll"; import scroll from "../../util/scroll";
import Loader from "../../components/Loader";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { book, publicApi } from "../../redux/actions"; import { book, publicApi } from "../../redux/actions";
@ -25,6 +26,8 @@ function Home({
selectedSort, selectedSort,
sortFilter, sortFilter,
getHeader, getHeader,
bookLoading,
publicLoading,
}: any) { }: any) {
const [grade, setGrade] = useState(null); const [grade, setGrade] = useState(null);
const [vocal, setVocal] = useState(false); const [vocal, setVocal] = useState(false);
@ -45,7 +48,7 @@ function Home({
<> <>
<div <div
className="home main d-flex flex-column" className="home main d-flex flex-column"
style={{ filter: vocal ? "blur(8px)" : "" }} style={{ filter: (vocal || bookLoading || publicLoading) ? "blur(8px)" : "" }}
> >
<Navbar /> <Navbar />
<div className="desktop"> <div className="desktop">
@ -66,6 +69,11 @@ function Home({
{vocal ? ( {vocal ? (
<Vocal setVocal={setVocal} setInputValue={setInputValue} /> <Vocal setVocal={setVocal} setInputValue={setInputValue} />
) : null} ) : null}
{
(bookLoading || publicLoading ) && <div className="full-loader">
<Loader size={50} />
</div>
}
</> </>
); );
} }
@ -77,6 +85,8 @@ export default connect(
sortFilterCourse: state.book.sortFilterCourse, sortFilterCourse: state.book.sortFilterCourse,
selectedSort: state.book.selectedSort, selectedSort: state.book.selectedSort,
headerData: state.publicApi.header, headerData: state.publicApi.header,
bookLoading: state.book.loading,
publicLoading : state.publicApi.loading,
}), }),
{ {
getCourseList: book.list, getCourseList: book.list,

@ -3,8 +3,15 @@
border: 1px solid #707070; border: 1px solid #707070;
border-radius: 10px; border-radius: 10px;
padding: 10px 30px; padding: 10px 30px;
h3{ &__cancel{
background-color: orange;
color: white; color: white;
}
p{
color: orange;
}
h3{
color: #aaa;
margin: 0px; margin: 0px;
} }
input{ input{
@ -12,9 +19,9 @@
border-top-right-radius: 10px; border-top-right-radius: 10px;
border-bottom-right-radius: 10px; border-bottom-right-radius: 10px;
border: 0px; border: 0px;
color: white; color: #aaa;
&::placeholder{ &::placeholder{
color: white; color: #aaa;
} }
} }
button{ button{
@ -70,20 +77,20 @@
.discount-code{ .discount-code{
padding: 10px; padding: 10px;
h3{ h3{
font-size: calc(100vw / 40); font-size: calc(100vw / 45);
} }
input{ input{
padding: 10px; padding: 10px;
width: 300px; width: 300px;
font-size: calc(100vw / 45); font-size: calc(100vw / 45);
&::placeholder{ &::placeholder{
font-size: calc(100vw / 50); font-size: calc(100vw / 55);
} }
margin-right: 5px; margin-right: 5px;
} }
button{ button{
width : 90px; width : 90px;
font-size: calc(100vw / 40); font-size: calc(100vw / 45);
} }
} }
} }

@ -1,16 +1,63 @@
import React from 'react'; import React, { useState } from "react";
import './index.scss'; import { connect } from "react-redux";
import { userFactor } from "../../../redux/actions";
import "./index.scss";
export default function DiscountCode() { function DiscountCode({
codeId,
setCodeId,
delCodeId,
userId,
factorId,
code,
}: any) {
const [value, setValue] = React.useState(code || "");
const setOff = () => {
setCodeId({ offCodeValue: value, userId: userId, id: Number(factorId) || null });
};
return ( return (
<div className="discount-code d-flex align-items-center justify-content-between"> <div className="discount-code d-flex align-items-center justify-content-between">
<h3>کارت هدیه یا کد تخفیف دارید؟ </h3> <h3>کارت هدیه یا کد تخفیف دارید؟ </h3>
<div className="d-flex flex-column"> <div className="d-flex flex-column">
<div className="d-flex"> <div className="d-flex">
<input type="text" placeholder="کد خود را در این قسمت وارد نمائید" /> {!code ? (
<button>تایید کد</button> <>
<input
type="text"
placeholder="کد خود را در این قسمت وارد نمائید"
defaultValue={codeId}
onChange={(e) => setValue(e.target.value)}
/>
<button onClick={setOff}>تایید کد</button>
</>
) : (
<>
<p>
کد تخفیف برای شما ثبت شده است
</p>
<button
onClick={() => delCodeId({})}
className="discount-code__cancel"
>
x{" "}
</button>
</>
)}
</div> </div>
</div> </div>
</div> </div>
) );
} }
export default connect(
(state: any) => ({
codeId: state.userFactor.info?.codeId,
code: state.userFactor.info?.offCode?.code,
userId: state.user.status.id,
factorId: state.userFactor.info?.id,
}),
{
setCodeId: userFactor.update,
delCodeId: userFactor.deleteUserOffCode,
}
)(DiscountCode);

@ -1,6 +1,6 @@
.subscribe-radio{ .subscribe-radio{
width: 100%; width: 100%;
border : 1px solid #DFDFDF; border : 1px solid #777;
margin-bottom: 15px; margin-bottom: 15px;
border-radius: 10px; border-radius: 10px;
cursor: pointer; cursor: pointer;
@ -8,6 +8,7 @@
border-top-right-radius: 10px; border-top-right-radius: 10px;
border-bottom-right-radius: 10px; border-bottom-right-radius: 10px;
h2{ h2{
color: white !important;
margin-bottom: 0px; margin-bottom: 0px;
} }
} }
@ -143,7 +144,7 @@
&__name{ &__name{
flex: 7; flex: 7;
h2{ h2{
font-size: calc(100vw / 35); font-size: calc(100vw / 40);
margin-right: 10px; margin-right: 10px;
} }
} }
@ -165,7 +166,7 @@
font-size: calc(100vw / 45); font-size: calc(100vw / 45);
} }
strong{ strong{
font-size: calc(100vw / 30); font-size: calc(100vw / 38);
} }
} }
} }

@ -1,11 +1,11 @@
.subscription { .subscription {
main { main {
h1,h2{ h1,h2{
color: white; color: #aaa;
} }
p{ p{
color : #969696; color : #aaa;
margin : 5px 0px 35px; margin : 10px 0px 35px;
} }
} }
} }
@ -49,10 +49,10 @@
margin-top: 0px; margin-top: 0px;
max-width: 900px; max-width: 900px;
h1{ h1{
font-size: calc(100vw / 30); font-size: calc(100vw / 35);
} }
p{ p{
font-size: calc(100vw / 40); font-size: calc(100vw / 55);
} }
} }
} }

@ -6,17 +6,18 @@ import DiscountCode from "./DiscountCode";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { product } from "../../redux/actions"; import { product } from "../../redux/actions";
import scroll from "../../util/scroll"; import scroll from "../../util/scroll";
import Loader from "../../components/Loader";
import "./index.scss"; import "./index.scss";
function Subscription({ listVOD, getList }: any) { function Subscription({ listVOD, getList, loading }: any) {
useEffect(() => { useEffect(() => {
getList(); getList();
scroll.goToTop(); scroll.goToTop();
}, []); }, []);
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"> <main className={"d-flex flex-column" + ' ' + (loading && 'blur')}>
<h1>خرید اشتراک دانوین</h1> <h1>خرید اشتراک دانوین</h1>
<p> <p>
لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده
@ -24,7 +25,7 @@ function Subscription({ listVOD, getList }: any) {
سطرآنچنان که لازم است و برای شرایط{" "} سطرآنچنان که لازم است و برای شرایط{" "}
</p> </p>
{listVOD?.map((subscribe: any, i: any) => ( {listVOD?.map((subscribe: any, i: any) => (
<SubscribeRadio data={subscribe} /> <SubscribeRadio data={subscribe} key={i} />
))} ))}
<DiscountCode /> <DiscountCode />
<div className="d-flex justify-content-end py-4"> <div className="d-flex justify-content-end py-4">
@ -32,6 +33,11 @@ function Subscription({ listVOD, getList }: any) {
</div> </div>
</main> </main>
<Footer /> <Footer />
{loading ? (
<div className="full-loader">
<Loader size={50} />
</div>
) : null}
</div> </div>
); );
} }
@ -39,6 +45,7 @@ function Subscription({ listVOD, getList }: any) {
export default connect( export default connect(
(state: any) => ({ (state: any) => ({
listVOD: state.product.listVOD, listVOD: state.product.listVOD,
loading: state.product.loading,
}), }),
{ getList: product.listVOD } { getList: product.listVOD }
)(Subscription); )(Subscription);

Loading…
Cancel
Save