import React, { useState } from "react";
import { connect } from "react-redux";
//components
import PDF from "./PDF";
import Link from "./Link";
import Voice from "./Voice";
// import WaveAudio from "../../../../../components/Wave";
//assets
import olum2Image from "../../../../../../assets/images/olum-2.svg";
const Identifier = ({ item, activeType }) => {
return (
<>
{activeType === "all" ? (
<>
{item.type === "voice" ? : null}
{item.type === "link" ? : null}
{item.type === "pdf" ? : null}
>
) : (
<>
{item.type === "voice" && item.type === activeType ? (
) : null}
{item.type === "link" && item.type === activeType ? (
) : null}
{item.type === "pdf" && item.type === activeType ? (
) : null}
>
)}
>
);
};
function QrResult({ book, grades, checked, dataTypes, list }) {
const [activeType, setActivetType] = useState("all");
return (
e.stopPropagation()}
>
{book.name}
{book?.grade ? (
{"پایه" + " " + grades[book.grade]}
) : null}
{book?.page ? (
{"شما در حال مطالعه صفحه" + " " + book.page + " " + "هستید."}
) : null}
{dataTypes.map((item, index) => (
- setActivetType(item.type)}
className={`w-1/5 text-xs text-center text-blueC0 cursor-pointer py-3 transition-all duration-300
${
activeType === item.type
? "font-bold bg-blueFF"
: "font-light bg-white"
}
`}
style={{
borderBottom:
activeType === item.type
? "1px solid #E8FCFF"
: "1px solid #C1E0FE",
}}
>
{item.name}
))}
{list.map((item, index) => (
))}
);
}
export default connect((state) => ({
grades: state.publicApi.grades,
}))(QrResult);
QrResult.defaultProps = {
book: {
name: "علوم اجتماعی",
page: 67,
grade: 2,
imageUrl: olum2Image,
},
dataTypes: [
{
name: "تمامی محتواها",
type: "all",
},
{
name: "صوت",
type: "voice",
},
{
name: "ویدئو",
type: "video",
},
{
name: "پی دی اف",
type: "pdf",
},
{
name: "پاورپوینت",
type: "ppt",
},
{
name: "لینکها",
type: "link",
},
],
list: [
{
name: "استاد رضایی فصل پنجم",
type: "voice",
value:
"https://assets.mixkit.co/sfx/preview/mixkit-fast-rocket-whoosh-1714.mp3",
},
{
name: "فایل پی دی اف تمارین مربوط به درس چهاردهم",
type: "pdf",
value:
"https://smallpdf.com/handle-widget#url=https://assets.ctfassets.net/l3l0sjr15nav/29D2yYGKlHNm0fB2YM1uW4/8e638080a0603252b1a50f35ae8762fd/Get_Started_With_Smallpdf.pdf",
},
{
name: "لینک مربوط به محتوای یک چیز نامعلوم است",
type: "link",
value: "https://www.aparat.com/",
},
],
};