Skip to content

Commit

Permalink
Merge pull request #249 from bcgov/revert-246-revert-244-FEATURE/iden…
Browse files Browse the repository at this point in the history
…tify-new-location-on-map

Revert "Revert "add blue icon for new locations on the map""
  • Loading branch information
alateefah authored Jan 11, 2023
2 parents 54c2e2a + 004915c commit 20c14be
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/bcer-api/app/src/notification/textService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export class TextService {
reference: this.reference,
},
);

Logger.log(`Status: ${response.status} ${response.status}`)
Logger.log(`ConfigData: ${response.config.data}`)
}

async sendMessage(
Expand Down
15 changes: 14 additions & 1 deletion packages/bcer-data-portal/app/src/hooks/useLeaflet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { useAxiosPost } from './axios';
import sanitizeHtml from 'sanitize-html';
import iconShadow from 'leaflet/dist/images/marker-shadow.png';
import { useHistory } from 'react-router';
import moment from 'moment';

// Map layer for Health Authority Boundaries
const haLayer = createHealthAuthorityLayer();
Expand Down Expand Up @@ -370,9 +371,21 @@ function useLeaflet(locationIds: string, config: LocationConfig) {
shadowSize: [41, 41]
});

var blueIcon = new L.Icon({
iconUrl: 'https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-blue.png',
shadowUrl: iconShadow,
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowSize: [41, 41]
});

let hasMissingReport = Object.values(l.reportStatus).includes("missing");
const isLocationCreatedLessThanThreeMonthAgo = moment().diff(l.created_at, "days") < 90;

if (hasMissingReport)
if (isLocationCreatedLessThanThreeMonthAgo) {
mkr.setIcon(blueIcon)
} else if (hasMissingReport)
mkr.setIcon(redIcon)
else
mkr.setIcon(greenIcon)
Expand Down

0 comments on commit 20c14be

Please sign in to comment.