Merged PR 2377: added enlarge map view on dnsapplication list

added enlarge map view on dnsapplication list

Related work items: #23774
This commit is contained in:
Robert Bond
2026-06-09 10:04:32 +00:00
parent c39e4bcc9a
commit 7e47340326
6 changed files with 72 additions and 43 deletions
+2
View File
@@ -11,6 +11,7 @@ export default function Search(props) {
watchedCases, watchedCases,
showMap, showMap,
showLoginCheck, showLoginCheck,
mapTarget
} = props; } = props;
let { t } = useTranslation(); let { t } = useTranslation();
@@ -48,6 +49,7 @@ export default function Search(props) {
watchedCases={watchedCases} watchedCases={watchedCases}
showMap={showMap} showMap={showMap}
showLoginCheck={showLoginCheck} showLoginCheck={showLoginCheck}
mapTarget={mapTarget}
/> />
</div> </div>
</div> </div>
+42 -39
View File
@@ -53,7 +53,8 @@ const DNSSearchResults = (props) => {
setWatchedCases, setWatchedCases,
setWatchedCasesDetails, setWatchedCasesDetails,
showMap, showMap,
showLoginCheck showLoginCheck,
mapTarget
} = props; } = props;
let { t } = useTranslation(); let { t } = useTranslation();
@@ -65,6 +66,7 @@ const DNSSearchResults = (props) => {
const [searchLoaded, setSearchLoaded] = useState(false); const [searchLoaded, setSearchLoaded] = useState(false);
const [showSpinnerState, setShowSpinnerState] = useState(false); const [showSpinnerState, setShowSpinnerState] = useState(false);
const [isMapExpanded, setIsMapExpanded] = useState(false);
// let dataArray = []; // let dataArray = [];
// //push your Json Data in the array // //push your Json Data in the array
@@ -907,9 +909,30 @@ const DNSSearchResults = (props) => {
<> <>
<div className="govuk-grid-row"> <div className="govuk-grid-row">
<div className="flex-container grid-row govuk-body case"> <div className="flex-container grid-row govuk-body case">
{showMap == "true" && isMapExpanded && (
<div className="govuk-grid-column-full">
<div className="map-container map-container--expanded">
<iframe
src={`https://datamap.gov.wales/maps/${mapTarget}/embed?center=-3.6553189192727347,52.214962933659415&zoom=2#/`}
width="100%"
height="600"
frameBorder="0"
title="Map"
/>
<button
type="button"
className="govuk-link map-expand-link"
onClick={() => setIsMapExpanded(false)}
>
Reduce map
</button>
</div>
</div>
)}
<div <div
className={ className={
showMap == "true" showMap == "true" && !isMapExpanded
? "govuk-grid-column-one-half" ? "govuk-grid-column-one-half"
: "govuk-grid-column-two-thirds" : "govuk-grid-column-two-thirds"
} }
@@ -965,50 +988,30 @@ const DNSSearchResults = (props) => {
</p> </p>
</div> </div>
{showMap == "true" && ( {showMap == "true" && !isMapExpanded && (
<div className="govuk-grid-column-one-half"> <div className="govuk-grid-column-one-half">
<div <div className="map-container">
// style={{
// height: "45vh",
// width: "100%",
// }}
>
{/* <GoogleMapReact
options={function (maps) {
return {
overviewMapControl: true,
mapTypeControl: true,
};
}}
bootstrapURLKeys={{
key: "AIzaSyCzeVrHt544bp_72YCFkw21eDsmI2JEsQo",
}}
defaultCenter={{
id: "",
lat: 52.412272,
lng: -3.437989,
}}
defaultZoom={7}
onGoogleApiLoaded={({ map, maps }) =>
ModelsMap(map, maps)
}
/> */}
<iframe <iframe
src={ src={`https://datamap.gov.wales/maps/${mapTarget}/embed?center=-3.6553189192727347,52.214962933659415&zoom=2#/`}
"https://datamap.gov.wales/maps/pedw-dev/embed?center=-3.6553189192727347,52.214962933659415&zoom=2#/" width="100%"
} height="500"
//src={"https://datamap.gov.wales/maps/pedw-dev/embed#/"} frameBorder="0"
width={"100%"} title="Map"
style={{ maxHeight: "400px" }} />
height={"500px"}
className={"mappingFrame"}
></iframe>
</div> </div>
<button
type="button "
className="govuk-link map-expand-link mapSizeButton"
onClick={() => setIsMapExpanded(true)}
>
Enlarge map
</button>
</div> </div>
)} )}
</div> </div>
</div> </div>
{searchResultsObj["@odata.count"] > 5 && ( {searchResultsObj["@odata.count"] > 5 && (
<div id="recordCountSelect" className="govuk-grid-row"> <div id="recordCountSelect" className="govuk-grid-row">
<div className="govuk-form-group"> <div className="govuk-form-group">
@@ -28,6 +28,8 @@ export function isRepresentationWindowClosed(
} }
export function resolveRepresentationWindow(caseDetails, DateCtor = Date) { export function resolveRepresentationWindow(caseDetails, DateCtor = Date) {
caseDetails = caseDetails || {};
const hasStartDate = const hasStartDate =
Object.prototype.hasOwnProperty.call(caseDetails, "pinswg_startdate") || Object.prototype.hasOwnProperty.call(caseDetails, "pinswg_startdate") ||
Object.prototype.hasOwnProperty.call( Object.prototype.hasOwnProperty.call(
+5 -2
View File
@@ -23,7 +23,7 @@ import { wrapper } from "../store/store";
import ServiceBanner from "../components/servicebanner"; import ServiceBanner from "../components/servicebanner";
const Home = (props) => { const Home = (props) => {
const { footerLinks, pages, showMap, showLoginCheck } = props; const { footerLinks, pages, showMap, showLoginCheck, mapTarget } = props;
let { t, lang } = useTranslation(); let { t, lang } = useTranslation();
const router = useRouter(); const router = useRouter();
@@ -109,6 +109,7 @@ const Home = (props) => {
searchString="DNS" searchString="DNS"
searchResultsObj={props.searchResultsObj} searchResultsObj={props.searchResultsObj}
showLoginCheck={showLoginCheck} showLoginCheck={showLoginCheck}
mapTarget={mapTarget}
/> />
</div> </div>
<Footer footerLinks={footerLinks} ticketnumber={props} /> <Footer footerLinks={footerLinks} ticketnumber={props} />
@@ -140,6 +141,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
const showLoginCheck = process.env.SHOWLOGIN || false; const showLoginCheck = process.env.SHOWLOGIN || false;
const showMapCheck = process.env.SHOWMAPS || false; const showMapCheck = process.env.SHOWMAPS || false;
const mapTarget = process.env.MAP_TARGET || "pedw-dev";
// if (_.has(searchResultsObj, "status") == true) { // if (_.has(searchResultsObj, "status") == true) {
// return { // return {
@@ -166,7 +168,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
return { return {
props: { props: {
showMap: showMapCheck, showMap: showMapCheck,
showLoginCheck: showLoginCheck showLoginCheck: showLoginCheck,
mapTarget: mapTarget
} }
}; };
} }
+4 -2
View File
@@ -40,7 +40,7 @@ import { getSession } from "next-auth/react";
import ServiceBanner from "../../components/myportal/servicebanner"; import ServiceBanner from "../../components/myportal/servicebanner";
const Home = (props) => { const Home = (props) => {
const { footerLinks, pages, watchedCases, showMap } = props; const { footerLinks, pages, watchedCases, showMap, mapTarget } = props;
let { t, lang } = useTranslation(); let { t, lang } = useTranslation();
const router = useRouter(); const router = useRouter();
@@ -127,6 +127,7 @@ const Home = (props) => {
searchResultsObj={props.searchResultsObj} searchResultsObj={props.searchResultsObj}
myportal={true} myportal={true}
watchedCases={watchedCases} watchedCases={watchedCases}
mapTarget={mapTarget}
/> />
</div> </div>
<Footer footerLinks={footerLinks} ticketnumber={props} /> <Footer footerLinks={footerLinks} ticketnumber={props} />
@@ -174,6 +175,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
// : searchResultsObj; // : searchResultsObj;
const showMapCheck = process.env.SHOWMAPS || false; const showMapCheck = process.env.SHOWMAPS || false;
const mapTarget = process.env.MAP_TARGET || "pedw-dev";
const watchedCasesDetails = await getDetails( const watchedCasesDetails = await getDetails(
watchedCases, watchedCases,
@@ -190,7 +192,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
store.dispatch(setAccountDetails(accountDetails)); store.dispatch(setAccountDetails(accountDetails));
return { return {
props: { showMap: showMapCheck } props: { showMap: showMapCheck, mapTarget: mapTarget }
}; };
} }
} }
+17
View File
@@ -3543,4 +3543,21 @@ ul.subFieldList {
font-weight: normal; font-weight: normal;
text-decoration: none; text-decoration: none;
white-space: nowrap; white-space: nowrap;
}
.map-container {
width: 100%;
}
.map-container--expanded {
margin-bottom: 30px;
}
.map-expand-link {
background: none;
border: 0;
padding: 0;
cursor: pointer;
} }