information banner from api with date range

This commit is contained in:
2022-09-22 11:12:04 +01:00
parent f9cdaafd7c
commit 38e70b1ec1
17 changed files with 548 additions and 119 deletions
+22 -13
View File
@@ -5,6 +5,7 @@ import { useState } from "react";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import LoadingOverlay from "react-loading-overlay";
import { getSession, useSession } from "next-auth/react";
const Breadcrumbs = (props) => {
const { courseContent, slug, currentView } = props;
@@ -45,6 +46,9 @@ const Breadcrumbs = (props) => {
// ? setShowSpinnerState(false)
// : setShowSpinnerState(true);
// };
const { data: session, status } = useSession();
return (
<>
<nav
@@ -494,19 +498,24 @@ const Breadcrumbs = (props) => {
)}
{router.pathname == "/myportal/representation" ? (
<>
<li className="govuk-breadcrumbs__list-item">
<Link
href={
router.locale != "en"
? router.locale + "/myportal"
: "/myportal"
}
>
<a className="govuk-breadcrumbs__link">
{t("common:breadcrumb-my-portal")}
</a>
</Link>
</li>
{session != null && (
<li className="govuk-breadcrumbs__list-item">
<Link
href={
router.locale != "en"
? router.locale +
"/myportal"
: "/myportal"
}
>
<a className="govuk-breadcrumbs__link">
{t(
"common:breadcrumb-my-portal"
)}
</a>
</Link>
</li>
)}
<li className="govuk-breadcrumbs__list-item">
Make representation for:{" "}
{
+4 -5
View File
@@ -15,6 +15,7 @@ import {
} from "../../store/currentView/action";
import { getFormCollectionByID } from "../utils";
import { getSession, useSession } from "next-auth/react";
import Pinswg_advertsid from "./summaryTypes/pinswg_advertsid";
import Pinswg_callinss77id from "./summaryTypes/pinswg_callinss77id";
@@ -64,11 +65,7 @@ const CaseSummary = (props) => {
showMap,
} = props;
const noRepresentationLink = [
"/case",
"/dnsdetails",
"/dns/[developmentName]",
];
const noRepresentationLink = ["/dnsdetails", "/dns/[developmentName]"];
let setCaseQueryObj = props[currentType];
let setCaseDetailsObj = props[currentType + "Details"];
@@ -709,6 +706,8 @@ const CaseSummary = (props) => {
);
}
const { data: session, status } = useSession();
console.log("session status:", status, session);
return (
<>
{showDetailsBlock}
+65
View File
@@ -0,0 +1,65 @@
import Link from "next/link";
import Image from "next/image";
import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router";
import { useState } from "react";
import cookie from "cookie-cutter";
export default function NoticeBanner(props) {
let { t, lang } = useTranslation();
const router = useRouter();
const [bannerOpen, setBannerOpen] = useState(true);
const { noticeContent } = props;
const hideNotice = () => {
let now = new Date();
let expDate = new Date(now);
expDate.setDate(now.getDate() + 365);
cookie.set("pedwNotice", "true", {
expires: expDate,
path: "/",
});
setBannerOpen(false);
};
const bannerOpenCookie = typeof cookie.get("pedwNotice") == "undefined";
return (
<>
{bannerOpenCookie ? (
<div className="govuk-warning-text noticebanner">
<span
className="govuk-warning-text__icon"
aria-hidden="true"
>
!
</span>
<strong className="govuk-warning-text__text">
<span className="govuk-warning-text__assistive">
Warning
</span>
{router.locale != "en"
? noticeContent.value[0].notice_cy
: noticeContent.value[0].notice_en}
</strong>
<div className="hideNotice">
<span
className="govuk-link"
onClick={() => {
hideNotice();
}}
>
Hide
</span>
</div>
</div>
) : (
""
)}
</>
);
}
+24
View File
@@ -44,6 +44,7 @@ import {
getPortalModuleDetailsProxy,
deleteWatchedCases,
} from "../../actions";
import { useSession, signIn, signOut } from "next-auth/react";
const SearchResults = (props) => {
const {
@@ -65,6 +66,7 @@ const SearchResults = (props) => {
const router = useRouter();
const { locale } = router;
const { data: session } = useSession();
var resultsArr = searchResultsObj.value || [];
@@ -531,6 +533,28 @@ const SearchResults = (props) => {
)}
</dd>
)}
{!session && (
<dd>
<span
className="govuk-summary-list__actionLink"
onClick={() => {
signIn("email");
// selectWatchedCase(
// cookies.pinsUser,
// item.incidentid,
// item.pinswg_appealcasetype
// );
alert(
"Trying to watch case " +
item.title
);
}}
title="Watch this case"
>
+
</span>
</dd>
)}
</div>
);
})