reza fixed login and search box

master
Reza_ashrafi 3 years ago
parent dbb6ad203a
commit 506e95e44a
  1. 29
      src/components/HomeSearchBox/index.scss
  2. 39
      src/components/HomeSearchBox/index.tsx
  3. 2
      src/components/Navbar/index.scss
  4. 5
      src/components/PrivateRouter/index.js
  5. 3
      src/custom.scss
  6. 3
      src/redux/reducers/user.tsx
  7. 27
      src/router.js
  8. 2
      src/views/Auth/Login/index.scss
  9. 2
      src/views/Auth/SignUp/index.scss
  10. 14
      src/views/Auth/SignUp/index.tsx
  11. 2
      src/views/Home/Courses/index.tsx
  12. 8
      src/views/Subscription/DiscountCode/index.scss
  13. 4
      src/views/Subscription/SubscribeRadio/index.scss
  14. 2
      src/views/Subscription/SubscribeRadio/index.tsx
  15. 2
      src/views/Subscription/index.scss

@ -27,6 +27,18 @@
} }
} }
} }
footer{
ul{
li{
cursor: pointer;
}
}
strong{
color: #9cdf52;
font-weight: 300;
margin-left: 20px;
}
}
} }
@media screen and (min-width: 1441px) { @media screen and (min-width: 1441px) {
@ -39,7 +51,7 @@
} }
form { form {
width: 1000px; width: 900px;
input { input {
font-size: 16px; font-size: 16px;
padding-right: 20px; padding-right: 20px;
@ -55,14 +67,19 @@
} }
} }
} }
ul { footer {
width: 1000px; width: 900px;
padding: 10px 0px !important; padding: 10px 0px !important;
li { strong{
color: #a2b4cb;
margin-left: 25px;
font-size: 14px; font-size: 14px;
} }
ul{
li {
color: #a2b4cb;
margin-left: 25px;
font-size: 14px;
}
}
} }
} }
} }

@ -34,34 +34,39 @@ function HomeSearchBox({
type="submit" type="submit"
onClick={() => sortFilter({ search: inputValue, sort: selectedSort })} onClick={() => sortFilter({ search: inputValue, sort: selectedSort })}
> >
<img src={search} /> <img src={search} alt="" />
</button> </button>
<img <img
className="mobile home-search-box__searchIcon" className="mobile home-search-box__searchIcon"
src={search} src={search}
onClick={() => sortFilter({ search: inputValue, sort: selectedSort })} onClick={() => sortFilter({ search: inputValue, sort: selectedSort })}
alt=""
/> />
<button <button
className="home-search-box__voice" className="home-search-box__voice"
onClick={() => setVocal(true)} onClick={() => setVocal(true)}
> >
<img src={voice} /> <img src={voice} alt="" />
</button> </button>
</form> </form>
<footer className="d-flex">
<ul className="d-flex"> <strong>جدیدترینها</strong>
{lastItems.map((item: any, i: any) => ( <ul className="d-flex">
<li {lastItems.map((item: any, i: any) => (
key={i} <li
style={{ color: selectedSort === item.name ? "#9CDF52" : "" }} key={i}
onClick={() => sortFilter({ search: inputValue, sort: item.name })} onClick={() =>
> // sortFilter({ search: inputValue, sort: item.name })
{item.name} setInputValue(item.name)
</li> }
))} >
</ul> {item.name}
</li>
))}
</ul>
</footer>
</section> </section>
); );
} }
@ -76,12 +81,10 @@ export default connect(
HomeSearchBox.defaultProps = { HomeSearchBox.defaultProps = {
lastItems: [ lastItems: [
{ {
name: "تمامی دورهها", name: "علوم",
icon: "",
}, },
{ {
name: "جدیدترینها", name: "ریاضی",
icon: "",
}, },
], ],
}; };

@ -28,7 +28,7 @@
} }
} }
&___share{ &___share{
background-color: #46454A; border: 2px solid #46454A;
} }
&___login{ &___login{
background-color: #81C342; background-color: #81C342;

@ -6,16 +6,17 @@ const PrivateRouter = ({
component: Component, component: Component,
restricted, restricted,
status, status,
customPage,
...rest ...rest
}) => { }) => {
return ( return (
<Route <Route
{...rest} {...rest}
render={(props) => render={(props) =>
status ? ( restricted ? (
<Redirect to="/" /> <Redirect to="/" />
) : ( ) : (
<Component {...props} /> <Component page={customPage} />
) )
} }

@ -1,8 +1,9 @@
.submit { .submit {
background-color: #4dd35b; background-color: #4dd35b;
color: white; color: white;
border-radius: 10px; border-radius: 6px;
border: 0px; border: 0px;
font-weight: 300;
} }
.mobile, .mobile,

@ -1,6 +1,7 @@
import proxy from "../proxy"; import proxy from "../proxy";
import { toast } from "react-toastify"; import { toast } from "react-toastify";
import { UserAction} from '../actions-type' import { UserAction} from '../actions-type'
import { error } from "console";
const initialState = { const initialState = {
status: proxy.status(), status: proxy.status(),
loading: false, loading: false,
@ -10,6 +11,7 @@ const initialState = {
mothers: [], mothers: [],
profileStatus: false, profileStatus: false,
setDone: false, setDone: false,
setLogin : false,
}; };
export default function user(state = initialState, action : UserAction) { export default function user(state = initialState, action : UserAction) {
let { type, data } = action; let { type, data } = action;
@ -26,6 +28,7 @@ export default function user(state = initialState, action : UserAction) {
loading: false, loading: false,
status: data.profile, status: data.profile,
error: null, error: null,
setLogin: !state.setLogin,
}; };
case "user/getProfile": case "user/getProfile":
localStorage.setItem("userData", JSON.stringify(data)); localStorage.setItem("userData", JSON.stringify(data));

@ -1,9 +1,5 @@
import "./App.css"; import "./App.css";
import { import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
BrowserRouter as Router,
Route,
Switch,
} from "react-router-dom";
import { connect } from "react-redux"; import { connect } from "react-redux";
import Auth from "./views/Auth"; import Auth from "./views/Auth";
@ -15,7 +11,7 @@ import Contact from "./views/Contact";
import Faq from "./views/Faq"; import Faq from "./views/Faq";
import PrivateRouter from "./components/PrivateRouter"; import PrivateRouter from "./components/PrivateRouter";
import Courses from "./views/Courses"; import Courses from "./views/Courses";
import About from './views/About'; import About from "./views/About";
// import proxy from "./redux/proxy"; // import proxy from "./redux/proxy";
function router({ status }) { function router({ status }) {
@ -25,8 +21,20 @@ function router({ status }) {
<Route exact path="/"> <Route exact path="/">
<Home /> <Home />
</Route> </Route>
<PrivateRouter restricted={false} component={Auth} path="/signup" exact /> <PrivateRouter
<PrivateRouter restricted={false} component={Auth} path="/login" exact /> restricted={false}
component={Auth}
path="/sign-up"
exact
customPage="signup"
/>
<PrivateRouter
restricted={false}
component={Auth}
path="/login"
exact
customPage="login"
/>
<Route exact path={"/profile"}> <Route exact path={"/profile"}>
<Auth page="profile" /> <Auth page="profile" />
</Route> </Route>
@ -51,6 +59,9 @@ function router({ status }) {
<Route exact path={"/faq"}> <Route exact path={"/faq"}>
<Faq /> <Faq />
</Route> </Route>
{/* <Route exact path={"/login"}>
<Auth page="login" />
</Route> */}
</Switch> </Switch>
</Router> </Router>
); );

@ -9,7 +9,7 @@
color: #84de56; color: #84de56;
} }
} }
button { button[type="submit"] {
margin-top: 25px; margin-top: 25px;
background-color: #84de56; background-color: #84de56;
color: white; color: white;

@ -12,7 +12,7 @@
bottom: 0px; bottom: 0px;
left: 0px; left: 0px;
} }
button { button[type="submit"] {
margin-top: 25px; margin-top: 25px;
background-color: #84de56; background-color: #84de56;
color: white; color: white;

@ -1,4 +1,5 @@
import React, { useState, useRef, useEffect } from "react"; import React, { useState, useRef, useEffect } from "react";
import {useHistory} from 'react-router-dom';
import Navbar from "../../../components/Navbar"; import Navbar from "../../../components/Navbar";
import Footer from "../../Home/Footer"; import Footer from "../../Home/Footer";
import Timer from "../../../components/Timer"; import Timer from "../../../components/Timer";
@ -17,13 +18,14 @@ interface SignUpFields {
otp?: String; otp?: String;
} }
function SignUp({ sendOtp, sendPhoneNumber }: any) { function SignUp({ sendOtp, sendPhoneNumber, loginFlag }: any) {
const [level, setLevel] = useState("phonenumber"); const [level, setLevel] = useState("phonenumber");
const [signUpFields, setSignUpFiels] = useState<SignUpFields | undefined>( const [signUpFields, setSignUpFiels] = useState<SignUpFields | undefined>(
undefined undefined
); );
const [error, setError] = useState<string | undefined>(undefined); const [error, setError] = useState<string | undefined>(undefined);
const [resend, setResend] = useState(false); const [resend, setResend] = useState(false);
const history = useHistory();
const onChange = (name: string, value: string) => { const onChange = (name: string, value: string) => {
setSignUpFiels({ ...signUpFields, [name]: value }); setSignUpFiels({ ...signUpFields, [name]: value });
@ -83,6 +85,12 @@ function SignUp({ sendOtp, sendPhoneNumber }: any) {
} }
}, [level]); }, [level]);
useEffect(() => {
if(loginFlag){
history.push('/');
}
},[loginFlag]);
return ( return (
<div className="signup d-flex flex-column align-items-center justify-content-center"> <div className="signup d-flex flex-column align-items-center justify-content-center">
<Navbar /> <Navbar />
@ -171,7 +179,9 @@ function SignUp({ sendOtp, sendPhoneNumber }: any) {
); );
} }
export default connect(() => ({}), { export default connect((state : any) => ({
loginFlag : state.user.setLogin,
}), {
sendOtp: user.otp_login, sendOtp: user.otp_login,
sendPhoneNumber: user.otp, sendPhoneNumber: user.otp,
})(SignUp); })(SignUp);

@ -11,7 +11,7 @@ function Courses({number, courses, selectedSort} : any) {
if (window.innerWidth >= 1440) { if (window.innerWidth >= 1440) {
return 5; return 5;
} else if (window.innerWidth >= 1008 && window.innerWidth < 1440) { } else if (window.innerWidth >= 1008 && window.innerWidth < 1440) {
return 5; return 4;
} else if (window.innerWidth > 640 && window.innerWidth < 1008) { } else if (window.innerWidth > 640 && window.innerWidth < 1008) {
return 3; return 3;
} else { } else {

@ -16,8 +16,8 @@
} }
input{ input{
background-color : rgba(255, 255, 255, 0.06); background-color : rgba(255, 255, 255, 0.06);
border-top-right-radius: 10px; border-top-right-radius: 6px;
border-bottom-right-radius: 10px; border-bottom-right-radius: 6px;
border: 0px; border: 0px;
color: #aaa; color: #aaa;
&::placeholder{ &::placeholder{
@ -26,9 +26,9 @@
} }
button{ button{
background-color : #81C342; background-color : #81C342;
border-top-left-radius: 10px; border-top-left-radius: 6px;
color: white; color: white;
border-bottom-left-radius: 10px; border-bottom-left-radius: 6px;
border: none; border: none;
} }
} }

@ -4,6 +4,7 @@
margin-bottom: 15px; margin-bottom: 15px;
border-radius: 10px; border-radius: 10px;
cursor: pointer; cursor: pointer;
transition: all 0.5s;
&__name{ &__name{
border-top-right-radius: 10px; border-top-right-radius: 10px;
border-bottom-right-radius: 10px; border-bottom-right-radius: 10px;
@ -16,7 +17,6 @@
border-top-left-radius: 10px; border-top-left-radius: 10px;
border-bottom-left-radius: 10px; border-bottom-left-radius: 10px;
background-color: rgba(255, 255, 255, 0.18); background-color: rgba(255, 255, 255, 0.18);
padding : 10px 20px 10px 0px;
strong, b{ strong, b{
color: white; color: white;
@ -78,7 +78,6 @@
} }
&__factor{ &__factor{
flex: 3; flex: 3;
padding-right: 65px;
&--tag{ &--tag{
font-size: 11px; font-size: 11px;
} }
@ -114,7 +113,6 @@
} }
&__factor{ &__factor{
flex: 3; flex: 3;
padding-right: 70px;
&--tag{ &--tag{
font-size: calc(100vw / 130); font-size: calc(100vw / 130);
} }

@ -36,7 +36,7 @@ function SubscribeRadio({ data, selectedVOD, selectVOD }: any) {
/> />
<h2>{data.name}</h2> <h2>{data.name}</h2>
</div> </div>
<div className="subscribe-radio__factor d-flex flex-column justify-content-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>

@ -19,7 +19,7 @@
font-size: 24px; font-size: 24px;
} }
p{ p{
font-size: 16px; font-size: 14px;
} }
} }
} }

Loading…
Cancel
Save