import React, { Component } from "react";
import "./App.css";
import {
BrowserRouter as Router,
Route,
Switch,
Redirect,
} from "react-router-dom";
import { connect } from "react-redux";
import { user } from "~/Redux/actions";
import { userProduct } from "~/Redux/actions";
import proxy from "./Redux/proxy";
import Home from "./views/Home/index";
import Faq from "./views/Faq/index";
import Contact from "./views/Contact/index";
import About from "./views/About/index";
import Products from "./views/Products/index";
import Product from "./views/Product/index";
import QR from "./views/QR/index";
import Auth from "./views/Auth/index";
import QRScan from "./views/QRScan/index";
import Activation from "./views/Activation/index";
import ChatList from "./views/ChatList/index";
import Chatroom from "./views/ChatRoom/index";
import Cart from "./views/Cart/index";
import MyBooks from "./views/MyBooks/index";
import AR from "./views/AR/index";
import Download from "./views/Download/index";
import Support from "./views/Support/index";
import NewProfile from "./views/NewProfile/index";
import Blogs from "./views/Blogs/index";
import Blog from "./views/Blog/index";
// import Sample from "./views/Sample/index";
import PDF from "./views/PDF/index";
import Orders from "./views/Orders";
import MyBooks2 from "./views/MyBook2";
class AppRouter extends Component {
constructor(props) {
super(props);
window.router = this;
this.state = {
cartControll: false,
};
}
state = {};
componentDidUpdate(prevProps, prevState) {
if (this.props.userProductList > 0) {
if (!this.state.cartControll) {
this.setState({
cartControll: true,
});
}
} else {
if (!this.state.cartControll) {
this.setState({
cartControll: true,
});
}
}
}
componentDidMount() {
// if (proxy.status() && this.props.userProductList == null)
// this.props.getUserProductList();
}
render() {
const mobile = window.innerWidth < 1000 ? true : false;
let status = proxy.status();
console.log({ status, s: this.props.profile });
let home = (
{status && status.status === 0 ? (
) : (
)}
);
return (
{home}
{/*
*/}
{mobile ? (
status ? (
) : (
)
) : (
)}
{mobile ? (
status ? (
) : (
)
) : (
)}
{proxy.status() ? (
) : (
)}
{mobile ? (
status ? (
) : (
)
) : status ? (
) : (
)}
{mobile ? (
status ? (
) : (
)
) : status ? (
) : (
)}
{mobile ? (
status ? (
) : (
)
) : status ? (
) : (
)}
{mobile ? (
status ? (
) : (
)
) : status ? (
) : (
)}
{status ? (
) : (
)}
{/*
{mobile ? (
status ? (
) : (
)
) : status ? (
) : (
)}
*/}
{mobile ? (
status ? (
) : (
)
) : status ? (
) : (
)}
{mobile ? (
status ? (
) : (
)
) : status ? (
) : (
)}
);
}
}
export default connect(
(state) => ({
profile: state.user.status,
userProductList: state.userProduct.list,
// status: state.user.status,
}),
{ getProfile: user.getProfile, getUserProductList: userProduct.list }
)(AppRouter);