Skip to content

Commit

Permalink
Update marker colors
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineAugusti committed Sep 26, 2019
1 parent d604e1c commit 4cc7d8a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/components/AVURNAVs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<l-tile-layer :url="seaUrl" :attribution="seaAttribution"></l-tile-layer>
<l-marker v-for="marker in markers" :key="marker.id"
:visible="marker.visible"
:icon="marker.icon"
:lat-lng="marker.position">
<l-popup :content="marker.tooltip" />
</l-marker>
Expand Down Expand Up @@ -42,6 +43,25 @@ export default {
return 'Inconnue'
}
return date
},
iconColor: function(date) {
if (date === null) {
return 'blue'
}
date = new Date(date)
const today = new Date()
if (today <= this.addDays(date, 2)) {
return 'red'
}
if (today <= this.addDays(date, 8)) {
return 'orange'
}
return 'blue'
},
addDays: function(date, days) {
let result = new Date(date)
result.setDate(result.getDate() + days)
return result
}
},
created() {
Expand All @@ -54,6 +74,12 @@ export default {
lat: el['latitude']
},
visible: true,
icon: L.icon({
iconRetinaUrl: `static/images/markers-${this.iconColor(el['valid_from'])}@2x.png`,
shadowRetinaUrl: 'static/images/[email protected]',
iconSize: [36, 46],
shadowSize: [34, 16],
}),
tooltip: `
<div class="title">
${el['title']}
Expand Down
Binary file added static/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4cc7d8a

Please sign in to comment.