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

Ajoute une icone représentant le service sur la carte #23

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions src/components/MapView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import L from 'leaflet';
import { useMapStore } from '../stores/map';
import { Feature } from 'geojson';
import { AreaProperties } from '../models/area_properties';
import { AmenityType } from '../models/amenity_type';
import { AmenityType, amenityIconClasses } from '../models/amenity_type';
import { useI18n } from 'vue-i18n';

const areaStyle: L.PathOptions = {
Expand All @@ -73,7 +73,6 @@ const travelTimeToColour = {
10: '#abedab', //Light green
5: '#5aabac', //Teal
0: '#0868ac', //Blue

};

export default defineComponent({
Expand Down Expand Up @@ -144,10 +143,18 @@ export default defineComponent({
const properties = feature.properties as AreaProperties;
const distances = properties.distances[type];
if(distances) {
const marker = L.marker({
const pos: L.LatLngLiteral = {
lng: distances.pt.coordinates[0],
lat: distances.pt.coordinates[1]
}).bindPopup('<a href="https://docs.google.com/forms/d/e/1FAIpQLSdAW14AmmplUH8iNPzhTJZ4UY-DW9OY9TR78C6_OIPYy2L7_g/viewform?usp=pp_url&entry.919457431=' + distances.pt.coordinates[1] + ',' + distances.pt.coordinates[0] + '">' + i18n.t('correction') + '</a>');
};
const options: L.MarkerOptions = {
icon: L.divIcon({
html: `<i class="fa-solid fa-${amenityIconClasses[type]} mapicon"></i>`,
iconSize: [36, 36],
})
};
const marker = L.marker(pos, options);
marker.bindPopup(`<a href="https://docs.google.com/forms/d/e/1FAIpQLSdAW14AmmplUH8iNPzhTJZ4UY-DW9OY9TR78C6_OIPYy2L7_g/viewform?usp=pp_url&entry.919457431=${distances.pt.coordinates[1]},${distances.pt.coordinates[0]}">${i18n.t('correction')}</a>`);
markers.value.leafletObject.addLayer(marker);
}
}
Expand Down Expand Up @@ -264,4 +271,19 @@ path.leaflet-interactive:focus {
text-decoration: none;
}

.leaflet-marker-icon {
background-color: rgba(0, 0, 0, 0.4);
border: none;
display: flex;
justify-content: center;
align-items: center;
border-radius: 18px;
}

.mapicon {
color: white;
display: block;
font-size: 20px;
}

</style>
15 changes: 1 addition & 14 deletions src/components/TypeFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

<script lang="ts">
import { computed, defineComponent, PropType } from 'vue';
import { AmenityType, defaultAmenityType } from '../models/amenity_type';
import { AmenityType, defaultAmenityType, amenityIconClasses } from '../models/amenity_type';
import vSelect from 'vue-select';
import { useI18n } from 'vue-i18n';

Expand Down Expand Up @@ -70,19 +70,6 @@ export default defineComponent({
}
});

const amenityIconClasses: { [type in AmenityType]: string } = {
[AmenityType.Clinic]: 'house-medical',
[AmenityType.Daycare]: 'child-reaching',
[AmenityType.FoodStore]: 'carrot',
[AmenityType.Library]: 'book',
[AmenityType.MetroStation]: 'train-subway',
[AmenityType.Park]: 'tree',
[AmenityType.Pharmacy]: 'pills',
[AmenityType.Restaurant]: 'mug-saucer',
[AmenityType.PrimarySchool]: 'school',
[AmenityType.SecondarySchool]: 'graduation-cap'
};

</script>

<style scoped>
Expand Down
13 changes: 13 additions & 0 deletions src/models/amenity_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,17 @@ export enum AmenityType {
SecondarySchool= 'secondary_school'
}

export const amenityIconClasses: { [type in AmenityType]: string } = {
[AmenityType.Clinic]: 'house-medical',
[AmenityType.Daycare]: 'child-reaching',
[AmenityType.FoodStore]: 'carrot',
[AmenityType.Library]: 'book',
[AmenityType.MetroStation]: 'train-subway',
[AmenityType.Park]: 'tree',
[AmenityType.Pharmacy]: 'pills',
[AmenityType.Restaurant]: 'mug-saucer',
[AmenityType.PrimarySchool]: 'school',
[AmenityType.SecondarySchool]: 'graduation-cap'
};

export const defaultAmenityType = AmenityType.FoodStore;