Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: SRS-681: Add Map showing the specific location for the site id on Summary tab #233

Merged
merged 9 commits into from
Dec 12, 2024
2 changes: 2 additions & 0 deletions frontend/src/app/features/details/SummaryForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const SummaryForm: FC<SummaryFormProps> = ({
label: 'Latitude (D, M, S)',
value: '',
isChildLabel: true,
customLabelCss: 'custom-summary-lbl-text',
children: [
{
type: FormFieldType.Text,
Expand Down Expand Up @@ -109,6 +110,7 @@ const SummaryForm: FC<SummaryFormProps> = ({
label: 'Longitude (D, M, S)',
value: '',
isChildLabel: true,
customLabelCss: 'custom-summary-lbl-text',
children: [
{
type: FormFieldType.Text,
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/app/features/details/srUpdates/srUpdates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,6 @@ const SRUpdates = () => {
dispatch(updateSiteDetailsForApproval(saveDTO));
};

const [location] = useState([48.46762, -123.25458]);

return (
<div data-testid="srreviewtab-component">
{siteSummaryData && (
Expand All @@ -634,7 +632,6 @@ const SRUpdates = () => {
>
<SummaryInfo
siteData={siteSummaryData}
location={location}
edit={false}
srMode={false}
handleInputChange={handleChange}
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/app/features/details/summary/Summary.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,9 @@
align-items: center; /* Center items */
}
}

.map-container {
width: 100%;
height: 100%;
z-index: 1;
}
3 changes: 0 additions & 3 deletions frontend/src/app/features/details/summary/Summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ const Summary = () => {
// State Initializations
const initialParcelIds = [0];

const [location, setLocation] = useState([48.46762, -123.25458]);

useEffect(() => {
console.log('Change in details');
let address = document.getElementsByTagName('h3');
Expand Down Expand Up @@ -447,7 +445,6 @@ const Summary = () => {
<div className="summary-section-details">
<SummaryInfo
siteData={editSiteDetailsObject}
location={location}
edit={edit}
srMode={srMode}
handleInputChange={handleInputChange}
Expand Down
33 changes: 27 additions & 6 deletions frontend/src/app/features/details/summary/SummaryInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from 'react';
import React, { useContext, useEffect, useRef } from 'react';
import PanelWithUpDown from '../../../components/simple/PanelWithUpDown';
// const Map: any = require('../../../../../node_modules/react-parcelmap-bc/dist/Map').default;
// @ts-ignore
import Map from '../../../../../node_modules/react-parcelmap-bc/dist/Map';
import SummaryForm from '../SummaryForm';
import { ApproveRejectButtons } from '../../../components/approve/ApproveReject';
import { MapContainer, useMap } from 'react-leaflet';
import { TileLayer } from 'react-leaflet';
import { SiteMarker } from '../../map/siteMarkers/SiteMarker';
import './Summary.css';
import 'leaflet/dist/leaflet.css';

export interface ISummaryInfo {
location: any;
siteData: any;
edit: boolean;
srMode: boolean;
Expand All @@ -17,7 +19,6 @@ export interface ISummaryInfo {
}

const SummaryInfo: React.FC<ISummaryInfo> = ({
location,
siteData,
edit,
srMode,
Expand All @@ -39,8 +40,28 @@ const SummaryInfo: React.FC<ISummaryInfo> = ({
secondChild={
<div className="row w-100">
<div className="col-12 col-lg-6">
{/* <Map callback={() => {}} initLocation={location} readOnly={true} /> */}
<MapContainer
center={{
lat: siteData.latdeg,
lng: siteData.longdeg,
}}
zoom={14}
zoomControl={false}
className="map-container"
>
<TileLayer
attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
<SiteMarker
position={{
lat: siteData.latdeg,
lng: siteData.longdeg,
}}
/>
</MapContainer>
</div>

<div className="col-12 col-lg-6">
{siteData != null && (
<SummaryForm
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/features/site/graphql/Site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export const graphqlSiteDetailsQuery = () => {
latDegrees
latMinutes
latSeconds
latdeg
longdeg
city
generalDescription
siteRiskCode
Expand Down
Loading