up emoji on demo map
This commit is contained in:
parent
65956ff6be
commit
dea71fc6b3
7 changed files with 565 additions and 35 deletions
|
@ -30,6 +30,28 @@ window.EMOJI_CRITERIA = {
|
|||
criteria: (name, description, what) => {
|
||||
return (what || '').toLowerCase().includes('bike');
|
||||
}
|
||||
},
|
||||
// Emoji casque de chantier pour les travaux
|
||||
construction: {
|
||||
emoji: '🏗️️',
|
||||
criteria: (name, description, what) => {
|
||||
const text = (name + ' ' + description + ' ' + what).toLowerCase();
|
||||
return text.includes('travaux');
|
||||
}
|
||||
},
|
||||
// Emoji soleil pour les types contenant "daylight"
|
||||
daylight: {
|
||||
emoji: '☀️',
|
||||
criteria: (name, description, what) => {
|
||||
return (what || '').toLowerCase().includes('daylight');
|
||||
}
|
||||
},
|
||||
// Emoji carte pour les types contenant "community.osm"
|
||||
osm_community: {
|
||||
emoji: '🗺️',
|
||||
criteria: (name, description, what) => {
|
||||
return (what || '').toLowerCase().includes('community.osm');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -39,6 +61,11 @@ function getEventEmoji(properties) {
|
|||
const description = properties.description || '';
|
||||
const what = properties.what || '';
|
||||
|
||||
|
||||
if (what.includes('accident')) return 'PAF!';
|
||||
if (what.includes('incident')) return '⚠️';
|
||||
if (what.includes('traffic')) return '🚗';
|
||||
|
||||
// Parcourir les critères dans l'ordre de priorité
|
||||
for (const [key, config] of Object.entries(window.EMOJI_CRITERIA)) {
|
||||
if (config.criteria(name, description, what)) {
|
||||
|
@ -47,10 +74,8 @@ function getEventEmoji(properties) {
|
|||
}
|
||||
|
||||
// Emoji par défaut selon le type d'événement
|
||||
if (what.includes('traffic')) return '🚗';
|
||||
if (what.includes('weather')) return '🌤️';
|
||||
if (what.includes('gathering')) return '👥';
|
||||
if (what.includes('incident')) return '⚠️';
|
||||
|
||||
return ' '; // Emoji par défaut
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue