You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

100 lines
3.5 KiB

import React, { Component } from "react";
import Navbar from "../Home/Navbar";
import { connect } from "react-redux";
import { userProduct } from "~/Redux/actions";
import moment from "jalali-moment";
import "./index.scss";
import { Link } from "react-router-dom";
const grades = [
window.t("پیش دبستان"),
window.t("اول"),
window.t("دوم"),
window.t("سوم"),
window.t("چهارم"),
window.t("پنجم"),
window.t("ششم"),
window.t("هفتم"),
window.t("هشتم"),
window.t("نهم"),
window.t("دهم"),
window.t("یازدهم"),
window.t("دوازدهم"),
];
class MyBooks extends Component {
componentDidMount() {
if (!this.props.mylist) this.props.getMyList();
}
render() {
const data = (this.props.myList || []).filter((e) => +e.productType === 3);
return (
<div className="mybooks">
<Navbar />
<div className="mybooks-title">{window.t("کتاب های من")}</div>
<div className="mybooks-tabs">
<div className="mybooks-tabs-item mybooks-tabs-item1 mybooks-tabs-active">
{window.t("فعال سازی شده")}{" "}
</div>
<div
className="mybooks-tabs-item mybooks-tabs-item2"
style={{ opacity: 0.2 }}
>
{window.t("دیجیتال")}
</div>
</div>
<div className="mybooks-main-content">
{data.map((item) => (
<div key={item.id} className="mybooks-main-content-item">
<div className="mybooks-main-content-row1">
<div className="mybooks-main-content-row1-img-container">
<img
src={`https://dnvn.ir/api/v1/file/${
item.product.book.fileIds.split(",")[0]
}`}
className="mybooks-main-content-row1-img"
alt="mybook-img"
/>
</div>
<div className="mybooks-main-content-row1-text d-flex justify-content-between flex-column">
<div className="mybooks-main-content-row1-text-name">
{item.product.book.name} {window.t("پایه")}
{grades[item.product.book.gradeId]}
</div>
<div className="mybooks-main-content-row1-text-activation-date">
{window.t("تاریخ فعالسازی:")}{" "}
{moment(item.updatedAt).format("YYYY/M/D")}
</div>
<div className="mybooks-main-content-row1-text-activation-code">
{window.t("کد فعالسازی:")} {item.activationCode}
</div>
<div className="d-flex justify-content-around mybooks-main-content_bottoms">
<Link to="/qr-scan"> {window.t("اسکن بارکد")}</Link>
{window.innerWidth < 1000 ? (
<a
href={`https://ar.dnvn.ir/lunch?id=${item.product?.ARId}`}
target="_blank"
rel="noreferrer"
className=""
>
{window.t("واقعیت افزوده")}{" "}
</a>
) : null}
</div>
</div>
</div>
</div>
))}
</div>
</div>
);
}
}
export default connect(
(state) => ({
myList: state.userProduct.myList,
loading: state.loading,
}),
{
getMyList: userProduct.myList,
}
)(MyBooks);