From 2b14eaaf1f70abb08118450e12a8f23c470ae0cb Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Thu, 29 Jul 2021 14:46:09 +0100 Subject: [PATCH] add mock api calls for modules viewall component --- actions/index.js | 49 ++++++++++ components/breadcrumbs.js | 27 ++++-- components/myportal.js | 18 ++-- components/myportal/awaitingsubmission.js | 37 ++++++- components/myportal/mycases.js | 33 ++++++- components/myportal/myrepresentations.js | 36 ++++++- components/myportal/topthree.js | 53 +++------- components/myportal/viewall.js | 113 ++++++++++++++++++++++ components/myportal/watchedcases.js | 35 ++++++- components/newappeal/createCase.js | 4 +- i18n.json | 3 + pages/api/lookups/awaitingSubmission.js | 48 +++++++++ pages/api/lookups/myCases.js | 72 ++++++++++++++ pages/api/lookups/myRepresentations.js | 48 +++++++++ pages/api/lookups/watchedCases.js | 48 +++++++++ pages/myportal/index.js | 85 ++++++++++------ pages/myportal/viewall.js | 88 +++++++++++++++++ pages/viewall.js | 2 + store/appealType/action.js | 2 - store/awaitingSubmission/action.js | 18 ++++ store/awaitingSubmission/reducer.js | 19 ++++ store/currentView/action.js | 17 ++++ store/currentView/reducer.js | 17 ++++ store/myCases/action.js | 18 ++++ store/myCases/reducer.js | 16 +++ store/myRepresentations/action.js | 18 ++++ store/myRepresentations/reducer.js | 16 +++ store/store.js | 22 ++++- store/watchedCases/action.js | 18 ++++ store/watchedCases/reducer.js | 16 +++ 30 files changed, 884 insertions(+), 112 deletions(-) create mode 100644 components/myportal/viewall.js create mode 100644 pages/api/lookups/awaitingSubmission.js create mode 100644 pages/api/lookups/myCases.js create mode 100644 pages/api/lookups/myRepresentations.js create mode 100644 pages/api/lookups/watchedCases.js create mode 100644 pages/myportal/viewall.js create mode 100644 store/awaitingSubmission/action.js create mode 100644 store/awaitingSubmission/reducer.js create mode 100644 store/currentView/action.js create mode 100644 store/currentView/reducer.js create mode 100644 store/myCases/action.js create mode 100644 store/myCases/reducer.js create mode 100644 store/myRepresentations/action.js create mode 100644 store/myRepresentations/reducer.js create mode 100644 store/watchedCases/action.js create mode 100644 store/watchedCases/reducer.js diff --git a/actions/index.js b/actions/index.js index 89f544b9..015e296e 100644 --- a/actions/index.js +++ b/actions/index.js @@ -303,3 +303,52 @@ export const createCase = (lpaType, appealType) => { // Xrm.Utility.alertDialog(textStatus + " " + errorThrown); // } // }); + +export const getMyCases = () => { + return axios + + .get(BASE_URL + "/api/lookups/myCases", { + httpsAgent: new https.Agent({ rejectUnauthorized: false }), + }) + .then((res) => res.data) + .catch((error) => { + console.log("thi serror", error); + }); +}; + +export const getMyRepresentations = () => { + return axios + + .get(BASE_URL + "/api/lookups/myRepresentations", { + httpsAgent: new https.Agent({ rejectUnauthorized: false }), + }) + .then((res) => res.data) + .catch((error) => { + console.log("thi serror", error); + }); +}; + +export const getWatchedCases = () => { + return axios + + .get(BASE_URL + "/api/lookups/watchedCases", { + httpsAgent: new https.Agent({ rejectUnauthorized: false }), + }) + .then((res) => res.data) + .catch((error) => { + w; + console.log("thi serror", error); + }); +}; + +export const getAwaitingSubmission = () => { + return axios + + .get(BASE_URL + "/api/lookups/awaitingSubmission", { + httpsAgent: new https.Agent({ rejectUnauthorized: false }), + }) + .then((res) => res.data) + .catch((error) => { + console.log("thi serror", error); + }); +}; diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js index ceaf71aa..7252cf66 100644 --- a/components/breadcrumbs.js +++ b/components/breadcrumbs.js @@ -5,16 +5,7 @@ import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; const Breadcrumbs = (props) => { - const { - courseContent, - slug, - formTitle, - activitysub, - activity, - applicant_id, - course_id, - applicant_ref, - } = props; + const { courseContent, slug, currentView } = props; const router = useRouter(); const { appealType, section } = router.query; @@ -143,6 +134,22 @@ const Breadcrumbs = (props) => { ) : ( "" )} + {router.pathname == "/myportal/viewall" ? ( + <> +
  • + + + My Portal + + +
  • +
  • + {currentView.viewName} +
  • + + ) : ( + "" + )} {router.pathname == "/case" ? ( <>
  • diff --git a/components/myportal.js b/components/myportal.js index 3f65ea8e..3ab63d77 100644 --- a/components/myportal.js +++ b/components/myportal.js @@ -10,7 +10,7 @@ import MyRepresentations from "./myportal/myrepresentations"; import WatchedCases from "./myportal/watchedcases"; import YourAccount from "./myportal/youraccount"; -export default function MyPortal({ children, pages }) { +const MyPortal = (props) => { let { t } = useTranslation(); const router = useRouter(); @@ -26,11 +26,15 @@ export default function MyPortal({ children, pages }) {
    - + - - - + + +
    @@ -39,4 +43,6 @@ export default function MyPortal({ children, pages }) {
    ); -} +}; + +export default MyPortal; diff --git a/components/myportal/awaitingsubmission.js b/components/myportal/awaitingsubmission.js index 83eb3244..6116d652 100644 --- a/components/myportal/awaitingsubmission.js +++ b/components/myportal/awaitingsubmission.js @@ -2,12 +2,16 @@ import Link from "next/link"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; import TopThree from "./topthree"; +import { connect } from "react-redux"; +import { setCurrentView } from "../../store/currentView/action"; -export default function AwaitingSubmission() { +const AwaitingSubmission = (props) => { let { t } = useTranslation(); const router = useRouter(); const { locale } = router; + const { setCurrentView } = props; + return (
    @@ -15,14 +19,37 @@ export default function AwaitingSubmission() { {t("myportal:awatitingsubmission-card-title")}
    - +
    ); -} +}; + +const mapDispatchToProps = (dispatch) => { + return { + setCurrentView: (currentView) => { + dispatch(setCurrentView(currentView)); + }, + }; +}; + +export default connect(null, mapDispatchToProps)(AwaitingSubmission); diff --git a/components/myportal/mycases.js b/components/myportal/mycases.js index 73774de8..3bb6f969 100644 --- a/components/myportal/mycases.js +++ b/components/myportal/mycases.js @@ -2,11 +2,15 @@ import Link from "next/link"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; import TopThree from "./topthree"; -export default function MyCases() { +import { connect } from "react-redux"; +import { setCurrentView } from "../../store/currentView/action"; + +const MyCases = (props) => { let { t } = useTranslation(); const router = useRouter(); const { locale } = router; + const { setCurrentView } = props; return (
    @@ -14,15 +18,34 @@ export default function MyCases() { {t("myportal:mycases-card-title")}
    - +
    ); -} +}; + +const mapDispatchToProps = (dispatch) => { + return { + setCurrentView: (currentView) => { + dispatch(setCurrentView(currentView)); + }, + }; +}; + +export default connect(null, mapDispatchToProps)(MyCases); diff --git a/components/myportal/myrepresentations.js b/components/myportal/myrepresentations.js index 4b39a92e..213cc402 100644 --- a/components/myportal/myrepresentations.js +++ b/components/myportal/myrepresentations.js @@ -2,11 +2,16 @@ import Link from "next/link"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; import TopThree from "./topthree"; -export default function MyRepresentations() { +import { connect } from "react-redux"; +import { setCurrentView } from "../../store/currentView/action"; + +const MyRepresentations = (props) => { let { t } = useTranslation(); const router = useRouter(); const { locale } = router; + const { setCurrentView } = props; + return (
    @@ -14,15 +19,36 @@ export default function MyRepresentations() { {t("myportal:myrepresentations-card-title")}
    - {" "} +
    ); -} +}; + +const mapDispatchToProps = (dispatch) => { + return { + setCurrentView: (currentView) => { + dispatch(setCurrentView(currentView)); + }, + }; +}; + +export default connect(null, mapDispatchToProps)(MyRepresentations); diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js index 109d2748..a5dc42b2 100644 --- a/components/myportal/topthree.js +++ b/components/myportal/topthree.js @@ -2,55 +2,34 @@ import Link from "next/link"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; -export default function TopThree() { +const TopThree = (props) => { let { t } = useTranslation(); + const { showTopThree } = props; const router = useRouter(); const { locale } = router; - return ( - <> -
    + + let topthreeRow = []; + + for (var i = 0; i < 3; i++) + topthreeRow.push( +
    - Address: Beggars Lane + Address: {props.showTopThree.value[i].address}
    -
    -
    -
    - Case reference:{" "} - - CAS-00010-J9W6L5 - -
    -
    - Address: Beggars Lane -
    -
    -
    -
    -
    -
    -
    - Case reference:{" "} - - CAS-00010-J9W6L5 - -
    -
    - Address: Beggars Lane -
    -
    -
    -
    - - ); -} + ); + + return <>{topthreeRow}; +}; + +export default TopThree; diff --git a/components/myportal/viewall.js b/components/myportal/viewall.js new file mode 100644 index 00000000..a7245150 --- /dev/null +++ b/components/myportal/viewall.js @@ -0,0 +1,113 @@ +import Link from "next/link"; +import { useRouter } from "next/router"; +import useTranslation from "next-translate/useTranslation"; + +export default function ViewAllResults(props) { + const { searchString, searchResultsObj, currentView } = props; + let { t } = useTranslation(); + + const router = useRouter(); + const { locale } = router; + + var resultsArr = props[currentView.viewKey][currentView.viewKey].value || [ + {}, + ]; + let resultsRowArr = []; + Object.keys(resultsArr).map((key, index) => { + resultsRowArr.push( +
    +
    + + + + Case Reference: + + {resultsArr[index].reference} + + +
    +
    + + Site Address:{" "} + + {resultsArr[index].address1} +
    {resultsArr[index].town} +
    + {resultsArr[index].postcode} +
    +
    + + Appellant/Applicant: + + {resultsArr[index].appellantApplicant} +
    +
    + Authority: + {resultsArr[index].lpaname} +
    +
    + Case Type: + { + resultsArr[index][ + "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" + ] + } +
    +
    + Status: + { + resultsArr[index][ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] + } +
    +
    + ); + }); + + return ( + <> +
    +
    +

    + {currentView.viewName} +

    + +
    +
    +
    + {t("search:searchresults-case-reference-label")} +
    +
    + {t("search:searchresults-site-address-label")} +
    +
    + {t("search:searchresults-applicant-label")} +
    +
    + {t("search:searchresults-authority-label")} +
    +
    + {t("search:searchresults-case-type-label")} +
    +
    + {t("search:searchresults-status-label")} +
    +
    + + {resultsRowArr} +
    +
    +
    +
    +
    +
    + + Back + +
    +
    +
    + + ); +} diff --git a/components/myportal/watchedcases.js b/components/myportal/watchedcases.js index 7ca84b66..84978e3f 100644 --- a/components/myportal/watchedcases.js +++ b/components/myportal/watchedcases.js @@ -2,11 +2,16 @@ import Link from "next/link"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; import TopThree from "./topthree"; -export default function WatchedCases() { +import { connect } from "react-redux"; +import { setCurrentView } from "../../store/currentView/action"; + +const WatchedCases = (props) => { let { t } = useTranslation(); const router = useRouter(); const { locale } = router; + const { setCurrentView } = props; + return (
    @@ -14,15 +19,35 @@ export default function WatchedCases() { {t("myportal:watchedcases-card-title")}
    - +
    ); -} +}; + +const mapDispatchToProps = (dispatch) => { + return { + setCurrentView: (currentView) => { + console.log(currentView); + dispatch(setCurrentView(currentView)); + }, + }; +}; + +export default connect(null, mapDispatchToProps)(WatchedCases); diff --git a/components/newappeal/createCase.js b/components/newappeal/createCase.js index db727b74..f80c367e 100644 --- a/components/newappeal/createCase.js +++ b/components/newappeal/createCase.js @@ -82,7 +82,7 @@ let CreateCase = (props) => {
    props.onChangeSelectAppealType(e)} diff --git a/i18n.json b/i18n.json index 757c62e0..3f1e7543 100644 --- a/i18n.json +++ b/i18n.json @@ -14,6 +14,9 @@ "/myportal": [ "myportal" ], + "/myportal/viewall": [ + "search" + ], "/advancedsearch": [ "search" ], diff --git a/pages/api/lookups/awaitingSubmission.js b/pages/api/lookups/awaitingSubmission.js new file mode 100644 index 00000000..05f2b1d2 --- /dev/null +++ b/pages/api/lookups/awaitingSubmission.js @@ -0,0 +1,48 @@ +const ApiResponse = (req, res) => { + res.statusCode = 200; + res.json({ + "value": [ + { + "@odata.etag": 'W/"547952"', + "lpaname": "Vale of Glamorgan Council", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "21 Courtenay Road", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00017-B8X7N0", + "appellantApplicant": "Mrs Denise Williams", + }, + { + "@odata.etag": 'W/"547952"', + "lpaname": "Bridgend CBC", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "17 Colin Way", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00016-Y9K9Q0", + "appellantApplicant": "Mrs Denise Williams", + }, + { + "@odata.etag": 'W/"547952"', + "lpaname": "Cardiff County Council Planning (A)", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "120 Severn Grove", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00011-K1N0J8", + "appellantApplicant": "Mrs Denise Williams", + }, + { + "@odata.etag": 'W/"547952"', + "lpaname": "Cardiff County Council Planning", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "25 Merches Gardens", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00015-L7J9H1", + "appellantApplicant": "Mrs Denise Williams", + }, + ], + }); +}; +export default ApiResponse; diff --git a/pages/api/lookups/myCases.js b/pages/api/lookups/myCases.js new file mode 100644 index 00000000..ba500274 --- /dev/null +++ b/pages/api/lookups/myCases.js @@ -0,0 +1,72 @@ +const ApiResponse = (req, res) => { + res.statusCode = 200; + res.json({ + "value": [ + { + "@odata.etag": 'W/"547952"', + "lpaname": "Vale of Glamorgan Council", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "21 Courtenay Road", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00009-W8N6W4", + "appellantApplicant": "Mrs Denise Williams", + "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue": + "Planning Appeal - S78", + "pinswg_appealcasetype": "846040000", + "statuscode@OData.Community.Display.V1.FormattedValue": + "In Progress", + "statuscode": "1", + }, + { + "@odata.etag": 'W/"547952"', + "lpaname": "Bridgend CBC", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "17 Colin Way", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00010-J9W6L5", + "appellantApplicant": "Mrs Denise Williams", + "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue": + "Planning Appeal - S78", + "pinswg_appealcasetype": "846040000", + "statuscode@OData.Community.Display.V1.FormattedValue": + "In Progress", + "statuscode": "1", + }, + { + "@odata.etag": 'W/"547952"', + "lpaname": "Cardiff County Council Planning (A)", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "120 Severn Grove", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00011-K1N0J8", + "appellantApplicant": "Mrs Denise Williams", + "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue": + "Planning Conditions - S73 + S79", + "pinswg_appealcasetype": "846040001", + "statuscode@OData.Community.Display.V1.FormattedValue": + "In Progress", + "statuscode": "1", + }, + { + "@odata.etag": 'W/"547952"', + "lpaname": "Cardiff County Council Planning", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "25 Merches Gardens", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00012-D9W6S8", + "appellantApplicant": "Mrs Denise Williams", + "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue": + "Planning Appeal - S78", + "pinswg_appealcasetype": "846040000", + "statuscode@OData.Community.Display.V1.FormattedValue": + "In Progress", + "statuscode": "1", + }, + ], + }); +}; +export default ApiResponse; diff --git a/pages/api/lookups/myRepresentations.js b/pages/api/lookups/myRepresentations.js new file mode 100644 index 00000000..2aeecb07 --- /dev/null +++ b/pages/api/lookups/myRepresentations.js @@ -0,0 +1,48 @@ +const ApiResponse = (req, res) => { + res.statusCode = 200; + res.json({ + "value": [ + { + "@odata.etag": 'W/"547952"', + "lpaname": "Vale of Glamorgan Council", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "21 Courtenay Road", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00009-W8N6W4", + "appellantApplicant": "Mrs Denise Williams", + }, + { + "@odata.etag": 'W/"547952"', + "lpaname": "Bridgend CBC", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "17 Colin Way", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00010-J9W6L5", + "appellantApplicant": "Mrs Denise Williams", + }, + { + "@odata.etag": 'W/"547952"', + "lpaname": "Cardiff County Council Planning (A)", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "120 Severn Grove", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00011-K1N0J8", + "appellantApplicant": "Mrs Denise Williams", + }, + { + "@odata.etag": 'W/"547952"', + "lpaname": "Cardiff County Council Planning", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "25 Merches Gardens", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00012-D9W6S8", + "appellantApplicant": "Mrs Denise Williams", + }, + ], + }); +}; +export default ApiResponse; diff --git a/pages/api/lookups/watchedCases.js b/pages/api/lookups/watchedCases.js new file mode 100644 index 00000000..2aeecb07 --- /dev/null +++ b/pages/api/lookups/watchedCases.js @@ -0,0 +1,48 @@ +const ApiResponse = (req, res) => { + res.statusCode = 200; + res.json({ + "value": [ + { + "@odata.etag": 'W/"547952"', + "lpaname": "Vale of Glamorgan Council", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "21 Courtenay Road", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00009-W8N6W4", + "appellantApplicant": "Mrs Denise Williams", + }, + { + "@odata.etag": 'W/"547952"', + "lpaname": "Bridgend CBC", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "17 Colin Way", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00010-J9W6L5", + "appellantApplicant": "Mrs Denise Williams", + }, + { + "@odata.etag": 'W/"547952"', + "lpaname": "Cardiff County Council Planning (A)", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "120 Severn Grove", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00011-K1N0J8", + "appellantApplicant": "Mrs Denise Williams", + }, + { + "@odata.etag": 'W/"547952"', + "lpaname": "Cardiff County Council Planning", + "accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c", + "address1": "25 Merches Gardens", + "town": "Cardiff", + "postcode": "CF24 0JL", + "reference": "CAS-00012-D9W6S8", + "appellantApplicant": "Mrs Denise Williams", + }, + ], + }); +}; +export default ApiResponse; diff --git a/pages/myportal/index.js b/pages/myportal/index.js index df7b2d22..192bf766 100644 --- a/pages/myportal/index.js +++ b/pages/myportal/index.js @@ -13,9 +13,26 @@ import { wrapper } from "../../store/store"; import Cookies from "cookies"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; +import { setMyCases } from "../../store/myCases/action"; +import { setMyRepresentations } from "../../store/myRepresentations/action"; +import { setWatchedCases } from "../../store/watchedCases/action"; +import { setAwaitingSubmission } from "../../store/awaitingSubmission/action"; +import { + getMyCases, + getMyRepresentations, + getWatchedCases, + getAwaitingSubmission, +} from "../../actions"; const Home = (props) => { - const { footerLinks, pages } = props; + const { + footerLinks, + pages, + myCases, + myRepresentations, + watchedCases, + awaitingSubmission, + } = props; let { t, lang } = useTranslation(); const router = useRouter(); @@ -35,7 +52,12 @@ const Home = (props) => {
    - +
    @@ -43,38 +65,37 @@ const Home = (props) => { ); }; -// export const getServerSideProps = wrapper.getServerSideProps( -// async ({ locale, store, req, res }) => { -// const token = await getToken(); -// let accessToken = token.access_token; +export const getServerSideProps = wrapper.getServerSideProps( + (store) => + async ({ query, req, res }) => { + //console.log("the query", query); -// const apiRoot = process.browser ? window.API_ROOT : process.env.API_ROOT; + const myCases = await getMyCases(); + const myRepresentations = await getMyRepresentations(); + const watchedCases = await getWatchedCases(); + const awaitingSubmission = await getAwaitingSubmission(); -// const [pages, footerLinks, courseListContent] = await Promise.all([ -// await getPages(accessToken, locale), -// await getFooterLinks(accessToken, locale), -// await getCourseList(accessToken, locale), -// ]); -// //const courseID = await getCourseID -// store.dispatch(setApiRoot(apiRoot)); -// store.dispatch(setPages(pages)); -// store.dispatch(setFooterLinks(footerLinks)); -// store.dispatch(setCourseListContent(courseListContent)); -// } -// ); + store.dispatch(setMyCases(myCases)); + store.dispatch(setMyRepresentations(myRepresentations)); + store.dispatch(setWatchedCases(watchedCases)); + store.dispatch(setAwaitingSubmission(awaitingSubmission)); + } +); -// const mapStateToProps = (state) => { -// //console.log(state); +const mapStateToProps = (state) => { + //console.log(state); -// return { -// apiroot: state.apiroot, -// courseListContent: state.courseListContent.courseListContent, -// pages: state.pages.pages, -// footerLinks: state.footerLinks.footerLinks, -// regions: state.regions, -// sectors: state.sectors, -// form: state.form, -// }; -// }; + return { + 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, + }; +}; -export default Home; //connect(mapStateToProps)(Home); +export default connect(mapStateToProps)(Home); diff --git a/pages/myportal/viewall.js b/pages/myportal/viewall.js new file mode 100644 index 00000000..a8927000 --- /dev/null +++ b/pages/myportal/viewall.js @@ -0,0 +1,88 @@ +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 ( +
    + + + {t("search:page-title")} - {t("common:service-name")} + + +
    + +
    +
    + + + +
    +
    +
    +
    + ); +}; + +// 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 { + 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); diff --git a/pages/viewall.js b/pages/viewall.js index 53aefc6d..ffdeba8a 100644 --- a/pages/viewall.js +++ b/pages/viewall.js @@ -45,6 +45,7 @@ const Home = (props) => {