Skip to content

Commit e6d11e4

Browse files
Merge pull request #836 from bcgov/813-add-map-marker-to-map-on-search-result-selection
Search Bar Updates
2 parents bbcc9db + ed50ac8 commit e6d11e4

21 files changed

+523
-350
lines changed

client/package-lock.json

Lines changed: 234 additions & 125 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"html2pdf.js": "^0.14.0",
2020
"jspdf": "^4.1.0",
2121
"mapbox-gl": "^3.20.0",
22+
"proj4": "^2.20.4",
2223
"quasar": "^2.18.1",
2324
"reductio": "^1.0.0",
2425
"vue": "^3.5.13",

client/src/components/Map.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ onMounted(() => {
7979
</a>`,
8080
})
8181
);
82-
if(props.scaleControl){
82+
if (props.scaleControl) {
8383
map.value.addControl(new mapboxgl.ScaleControl(), "bottom-right");
8484
}
8585
// Map Style Control (street || satellite)
@@ -136,11 +136,11 @@ onMounted(() => {
136136
return;
137137
}
138138
};
139-
if(props.styleControl){
139+
if (props.styleControl) {
140140
map.value.addControl(mapStyleControl, 'bottom-right');
141141
}
142142
143-
if(props.navControl){
143+
if (props.navControl) {
144144
map.value.addControl(new mapboxgl.NavigationControl({ showCompass: true }), 'bottom-right');
145145
}
146146
map.value.on("load", () => {

client/src/components/MapFilters.vue

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</div>
77
<p>{{ props.paragraph }}</p>
88
<q-card
9-
v-if="activePoint && Object.keys(activePoint.properties).length"
9+
v-if="activePoint?.properties && Object.keys(activePoint.properties).length"
1010
class="selected-point q-pa-sm q-ma-sm"
1111
flat
1212
bordered
@@ -276,8 +276,8 @@
276276
outlined
277277
@update:model-value="(newval) => {
278278
localFilters.uniqueFilters.yearRange.min = newval;
279-
if(newval && newval.toString().length === 4){
280-
if(newval && newval.toString().length === 4){
279+
if (newval && newval.toString().length === 4) {
280+
if (newval && newval.toString().length === 4) {
281281
emit('update-filter', localFilters)
282282
}
283283
}
@@ -291,7 +291,7 @@
291291
outlined
292292
@update:model-value="(newval) => {
293293
localFilters.uniqueFilters.yearRange.max = newval;
294-
if(newval && newval.toString().length === 4){
294+
if (newval && newval.toString().length === 4) {
295295
emit('update-filter', localFilters)
296296
}
297297
}"
@@ -578,7 +578,7 @@ watch(() => props.selectedPointFromMap, (newval) => {
578578
});
579579
580580
watch(() => props.filterableProperties, () => {
581-
if(!props.filterableProperties || !('matchFilters' in props.filterableProperties) && !('uniqueFilters' in props.filterableProperties)) return;
581+
if (!props.filterableProperties || !('matchFilters' in props.filterableProperties) && !('uniqueFilters' in props.filterableProperties)) return;
582582
localFilters.value = props.filterableProperties;
583583
584584
// add a toggle-able model for the matching-type boolean filters
@@ -594,7 +594,7 @@ watch(() => props.filterableProperties, () => {
594594
if (props.filterableProperties.uniqueFilters.hasQuantity) {
595595
localFilters.value.uniqueFilters.quantity = JSON.parse(JSON.stringify(flowRangeDefault));
596596
}
597-
if(props.filterableProperties.uniqueFilters.hasYearRange){
597+
if (props.filterableProperties.uniqueFilters.hasYearRange) {
598598
yearRangeDefault.value = JSON.parse(JSON.stringify(props.filterableProperties.uniqueFilters.yearRange));
599599
}
600600
});
@@ -612,23 +612,23 @@ const selectPoint = (item) => {
612612
613613
// search term filtering in sidebar
614614
const filteredPoints = computed(() => {
615-
if(textFilter.value === '' || textFilter.value === null) return props.pointsToShow;
615+
if (textFilter.value === '' || textFilter.value === null) return props.pointsToShow;
616616
return props.pointsToShow.filter((point) => {
617-
if(props.page === 'water-portal'){
617+
if (props.page === 'water-portal') {
618618
return (
619619
point.properties.id.toString().includes(textFilter.value) ||
620620
('net' in point.properties && point.properties.net.toString().toLowerCase().includes(textFilter.value.toLowerCase())) ||
621621
('area' in point.properties && point.properties.area !== null && point.properties.area.toString().toLowerCase().includes(textFilter.value.toLowerCase())) ||
622622
('name' in point.properties && point.properties.name.toString().toLowerCase().includes(textFilter.value.toLowerCase()))
623623
)
624624
}
625-
if(props.page === 'groundwater'){
625+
if (props.page === 'groundwater') {
626626
return (
627627
('id' in point.properties && point.properties.id.toString().toLowerCase().includes(textFilter.value.toLowerCase())) ||
628628
('well_tag_no' in point.properties && point.properties.well_tag_no.toString().toLowerCase().includes(textFilter.value.toLowerCase()))
629629
)
630630
}
631-
if(props.page === 'watershed'){
631+
if (props.page === 'watershed') {
632632
return (
633633
point.properties.id.toString().includes(textFilter.value) ||
634634
('lic' in point.properties && point.properties.lic.toString().toLowerCase().includes(textFilter.value.toLowerCase())) ||
@@ -642,45 +642,45 @@ const filteredPoints = computed(() => {
642642
});
643643
644644
const resetFilters = () => {
645-
if(!Object.keys(localFilters.value).length) return;
645+
if (!Object.keys(localFilters.value).length) return;
646646
localFilters.value.matchFilters.forEach(category => {
647647
category.filters.forEach(filter => {
648648
filter.model = true;
649649
});
650650
});
651651
652652
// special handling for the uniqueFilters categories
653-
if(localFilters.value.uniqueFilters.hasArea){
653+
if (localFilters.value.uniqueFilters.hasArea) {
654654
localFilters.value.uniqueFilters.areaRange = areaRangeDefaults;
655655
}
656-
if(localFilters.value.uniqueFilters.hasQuantity){
656+
if (localFilters.value.uniqueFilters.hasQuantity) {
657657
localFilters.value.uniqueFilters.quantity.forEach(el => {
658658
el.value = true;
659659
})
660660
}
661-
if(localFilters.value.uniqueFilters.hasYearRange){
661+
if (localFilters.value.uniqueFilters.hasYearRange) {
662662
localFilters.value.uniqueFilters.yearRange = yearRangeDefault.value;
663663
}
664664
665665
emit('update-filter', localFilters.value);
666666
};
667667
668668
const clearFilters = () => {
669-
if(!Object.keys(localFilters.value).length) return;
669+
if (!Object.keys(localFilters.value).length) return;
670670
localFilters.value.matchFilters.forEach(category => {
671671
category.filters.forEach(filter => {
672672
filter.model = false;
673673
});
674674
});
675-
if(localFilters.value.uniqueFilters.hasQuantity){
675+
if (localFilters.value.uniqueFilters.hasQuantity) {
676676
localFilters.value.uniqueFilters.quantity.forEach(el => {
677677
el.value = false;
678678
});
679679
}
680-
if(localFilters.value.uniqueFilters.hasArea){
680+
if (localFilters.value.uniqueFilters.hasArea) {
681681
localFilters.value.uniqueFilters.areaRange = areaRangeDefaults;
682682
}
683-
if(localFilters.value.uniqueFilters.hasYearRange){
683+
if (localFilters.value.uniqueFilters.hasYearRange) {
684684
localFilters.value.uniqueFilters.yearRange = {
685685
min: '',
686686
max: ''

0 commit comments

Comments
 (0)