Merged PR 2274: case deadline and watch stream on results
case deadline and wat Related work items: #22423, #22783
This commit is contained in:
@@ -30,6 +30,7 @@ import {
|
||||
getWatchedCasesProxy
|
||||
} from "../../actions/services/portalService";
|
||||
import RepsOnResults from "./repsonresults";
|
||||
import LiveLink from "./liveLink";
|
||||
|
||||
const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
|
||||
@@ -394,6 +395,12 @@ const SearchResults = (props) => {
|
||||
<RepsOnResults
|
||||
detailsObj={detailsObj}
|
||||
/>
|
||||
<LiveLink
|
||||
detailsObj={detailsObj}
|
||||
appealType={
|
||||
item.pinswg_appealcasetype
|
||||
}
|
||||
/>
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
|
||||
@@ -8,6 +8,7 @@ import { connect } from "react-redux";
|
||||
import transLookup from "../../data/lookuptranslations.json";
|
||||
import PaginationControl from "./pagination";
|
||||
import RepsOnResults from "./repsonresults";
|
||||
import LiveLink from "./liveLink";
|
||||
|
||||
import {
|
||||
getBasicDNSSearchPaged,
|
||||
@@ -468,6 +469,12 @@ const DNSSearchResults = (props) => {
|
||||
item.pinswg_appealcasetype
|
||||
}
|
||||
/>
|
||||
<LiveLink
|
||||
detailsObj={detailsObj}
|
||||
appealType={
|
||||
item.pinswg_appealcasetype
|
||||
}
|
||||
/>
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import Link from "next/link";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
|
||||
const isSameDay = (dateA, dateB) =>
|
||||
dateA.getFullYear() === dateB.getFullYear() &&
|
||||
dateA.getMonth() === dateB.getMonth() &&
|
||||
dateA.getDate() === dateB.getDate();
|
||||
|
||||
const getLiveEvent = (detailsObj) => {
|
||||
const events = detailsObj?.pinswg_sips_pinswg_sipsevent || [];
|
||||
|
||||
if (!Array.isArray(events) || events.length === 0) return null;
|
||||
|
||||
const now = new Date();
|
||||
|
||||
return events.find((event) => {
|
||||
if (!event?.pinswg_dateeventrequested) return false;
|
||||
|
||||
const eventDate = new Date(event.pinswg_dateeventrequested);
|
||||
|
||||
return isSameDay(eventDate, now);
|
||||
});
|
||||
};
|
||||
|
||||
const LiveLink = ({ detailsObj }) => {
|
||||
let { t } = useTranslation();
|
||||
const liveEvent = getLiveEvent(detailsObj);
|
||||
|
||||
if (!liveEvent || !liveEvent.pinswg_linktotheevent) return null;
|
||||
|
||||
return (
|
||||
<div className="govuk-!-margin-top-3">
|
||||
<a
|
||||
href={liveEvent.pinswg_linktotheevent}
|
||||
className="govuk-link"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{t("case:live-event-link")}
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default LiveLink;
|
||||
@@ -39,6 +39,7 @@ import {
|
||||
|
||||
import { sendGAEvent } from "@next/third-parties/google";
|
||||
import RepsOnResults from "./repsonresults";
|
||||
import LiveLink from "./liveLink";
|
||||
import { query } from "jsonpath";
|
||||
|
||||
const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
@@ -478,6 +479,12 @@ const SearchResults = (props) => {
|
||||
item.pinswg_appealcasetype
|
||||
}
|
||||
/>
|
||||
<LiveLink
|
||||
detailsObj={detailsObj}
|
||||
appealType={
|
||||
item.pinswg_appealcasetype
|
||||
}
|
||||
/>
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
|
||||
Reference in New Issue
Block a user