|
|
@ -1,6 +1,5 @@ |
|
|
|
import React, { useState, useEffect } from "react"; |
|
|
|
import React, { useState, useEffect } from "react"; |
|
|
|
import Navbar from "../../components/Navbar"; |
|
|
|
import Navbar from "../../components/Navbar"; |
|
|
|
import HomeSearchBox from "../../components/HomeSearchBox"; |
|
|
|
|
|
|
|
import Courses from "./Courses"; |
|
|
|
import Courses from "./Courses"; |
|
|
|
import GradeFilter from "../../components/GradeFilter"; |
|
|
|
import GradeFilter from "../../components/GradeFilter"; |
|
|
|
import Books from "./Books"; |
|
|
|
import Books from "./Books"; |
|
|
@ -22,25 +21,14 @@ function Home({ |
|
|
|
headerData, |
|
|
|
headerData, |
|
|
|
blogs, |
|
|
|
blogs, |
|
|
|
gradeFilterBooks, |
|
|
|
gradeFilterBooks, |
|
|
|
sortFilterCourse, |
|
|
|
|
|
|
|
selectedSort, |
|
|
|
|
|
|
|
sortFilter, |
|
|
|
|
|
|
|
getHeader, |
|
|
|
getHeader, |
|
|
|
bookLoading, |
|
|
|
bookLoading, |
|
|
|
publicLoading, |
|
|
|
publicLoading, |
|
|
|
theme, |
|
|
|
theme, |
|
|
|
}: any) { |
|
|
|
}: any) { |
|
|
|
const [grade, setGrade] = useState(null); |
|
|
|
const [grade, setGrade] = useState(null); |
|
|
|
const [vocal, setVocal] = useState(false); |
|
|
|
|
|
|
|
const [inputValue, setInputValue] = useState(""); |
|
|
|
|
|
|
|
const [gradeDropdown, setGradeDropdown] = useState(false); |
|
|
|
const [gradeDropdown, setGradeDropdown] = useState(false); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
if (inputValue) { |
|
|
|
|
|
|
|
sortFilter({ search: inputValue, sort: selectedSort }); |
|
|
|
|
|
|
|
setVocal(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, [inputValue]); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
getCourseList(); |
|
|
|
getCourseList(); |
|
|
|
scroll.goToTop(); |
|
|
|
scroll.goToTop(); |
|
|
@ -57,7 +45,7 @@ function Home({ |
|
|
|
" " |
|
|
|
" " |
|
|
|
)} |
|
|
|
)} |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
|
filter: vocal || bookLoading || publicLoading ? "blur(8px)" : "", |
|
|
|
filter: bookLoading || publicLoading ? "blur(8px)" : "", |
|
|
|
}} |
|
|
|
}} |
|
|
|
onClick={() => setGradeDropdown(false)} |
|
|
|
onClick={() => setGradeDropdown(false)} |
|
|
|
> |
|
|
|
> |
|
|
@ -65,14 +53,8 @@ function Home({ |
|
|
|
<div className="desktop"> |
|
|
|
<div className="desktop"> |
|
|
|
<Header headerData={headerData} theme={theme} /> |
|
|
|
<Header headerData={headerData} theme={theme} /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<HomeSearchBox |
|
|
|
|
|
|
|
setVocal={setVocal} |
|
|
|
|
|
|
|
inputValue={inputValue} |
|
|
|
|
|
|
|
setInputValue={setInputValue} |
|
|
|
|
|
|
|
theme={theme} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<Courses |
|
|
|
<Courses |
|
|
|
courses={sortFilterCourse ? sortFilterCourse : courseList} |
|
|
|
courses={courseList} |
|
|
|
theme={theme} |
|
|
|
theme={theme} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<GradeFilter |
|
|
|
<GradeFilter |
|
|
@ -91,9 +73,7 @@ function Home({ |
|
|
|
<AppDownload theme={theme} /> |
|
|
|
<AppDownload theme={theme} /> |
|
|
|
<Footer /> |
|
|
|
<Footer /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{vocal ? ( |
|
|
|
|
|
|
|
<Vocal setVocal={setVocal} setInputValue={setInputValue} /> |
|
|
|
|
|
|
|
) : null} |
|
|
|
|
|
|
|
{(bookLoading || publicLoading) && ( |
|
|
|
{(bookLoading || publicLoading) && ( |
|
|
|
<div className="full-loader"> |
|
|
|
<div className="full-loader"> |
|
|
|
<Loader size={50} /> |
|
|
|
<Loader size={50} /> |
|
|
@ -107,8 +87,6 @@ export default connect( |
|
|
|
(state: any) => ({ |
|
|
|
(state: any) => ({ |
|
|
|
courseList: state.book.list, |
|
|
|
courseList: state.book.list, |
|
|
|
gradeFilterBooks: state.book.gradeFilterBooks, |
|
|
|
gradeFilterBooks: state.book.gradeFilterBooks, |
|
|
|
sortFilterCourse: state.book.sortFilterCourse, |
|
|
|
|
|
|
|
selectedSort: state.book.selectedSort, |
|
|
|
|
|
|
|
headerData: state.publicApi.header, |
|
|
|
headerData: state.publicApi.header, |
|
|
|
bookLoading: state.book.loading, |
|
|
|
bookLoading: state.book.loading, |
|
|
|
publicLoading: state.publicApi.loading, |
|
|
|
publicLoading: state.publicApi.loading, |
|
|
@ -116,7 +94,6 @@ export default connect( |
|
|
|
}), |
|
|
|
}), |
|
|
|
{ |
|
|
|
{ |
|
|
|
getCourseList: book.list, |
|
|
|
getCourseList: book.list, |
|
|
|
sortFilter: book.sortFilter, |
|
|
|
|
|
|
|
getHeader: publicApi.getHeader, |
|
|
|
getHeader: publicApi.getHeader, |
|
|
|
} |
|
|
|
} |
|
|
|
)(Home); |
|
|
|
)(Home); |
|
|
|