90 lines
3.1 KiB
JavaScript
90 lines
3.1 KiB
JavaScript
import _ from "lodash";
|
|
import Head from "next/head";
|
|
import Header from "../../components/header";
|
|
import Banner from "../../components/banner";
|
|
import CookieBanner from "../../components/cookieBanner";
|
|
import Breadcrumbs from "../../components/breadcrumbs";
|
|
import ViewAll from "../../components/myportal/viewall";
|
|
import Footer from "../../components/footer";
|
|
import Errorpage from "../../components/errorpage";
|
|
import styles from "../../styles/Home.module.css";
|
|
import { useSelector, shallowEqual, connect } from "react-redux";
|
|
import { wrapper } from "../../store/store";
|
|
import Cookies from "cookies";
|
|
import { useRouter } from "next/router";
|
|
import useTranslation from "next-translate/useTranslation";
|
|
|
|
import { setSearch, getSearchObj } from "../../store/search/action";
|
|
import {
|
|
setSearchResults,
|
|
getSearchResultsObj,
|
|
} from "../../store/searchOutput/action";
|
|
import { getBasicSearch } from "../../actions";
|
|
|
|
const Home = (props) => {
|
|
const { footerLinks, pages } = props;
|
|
let { t, lang } = useTranslation();
|
|
|
|
const router = useRouter();
|
|
const { locale } = router;
|
|
const { appealtypes } = router.query;
|
|
|
|
return (
|
|
<div>
|
|
<Head>
|
|
<title>
|
|
{t("search:page-title")} - {t("common:service-name")}
|
|
</title>
|
|
</Head>
|
|
<div id="page_wrapper">
|
|
<CookieBanner />
|
|
<Header courseName={t("common:service-name")} />
|
|
<div className="govuk-width-container">
|
|
<Banner />
|
|
<Breadcrumbs
|
|
slug={appealtypes}
|
|
currentView={props.currentView.currentView}
|
|
/>
|
|
<ViewAll
|
|
searchString={"View All"}
|
|
searchResultsObj={props.searchResultsObj}
|
|
currentView={props.currentView.currentView}
|
|
myCases={props.myCases}
|
|
watchedCases={props.watchedCases}
|
|
myRepresentations={props.myRepresentations}
|
|
awaitingSubmission={props.awaitingSubmission}
|
|
/>
|
|
</div>
|
|
<Footer footerLinks={footerLinks} />
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
// export const getServerSideProps = wrapper.getServerSideProps(
|
|
// (store) =>
|
|
// async ({ req, res }) => {
|
|
// const searchResultsObj = (await getBasicSearch("View All")) || null;
|
|
// store.dispatch(setSearchResults(searchResultsObj));
|
|
// store.dispatch(setSearch("View All"));
|
|
// }
|
|
// );
|
|
|
|
const mapStateToProps = (state) => {
|
|
return {
|
|
accountDetails: state.accountDetails,
|
|
search: state.search,
|
|
searchResultsObj: state.searchResultsObj,
|
|
formData: state.formData,
|
|
appealType: state.appealType,
|
|
form: state.form,
|
|
myCases: state.myCases,
|
|
watchedCases: state.watchedCases,
|
|
myRepresentations: state.myRepresentations,
|
|
awaitingSubmission: state.awaitingSubmission,
|
|
currentView: state.currentView,
|
|
};
|
|
};
|
|
|
|
export default connect(mapStateToProps)(Home);
|