-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.js
43 lines (41 loc) · 1.22 KB
/
helpers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
export function getIcon(title) {
const iconMap = {
// People
'person': 'mdi:walk',
'people': 'mdi:walk',
'child': 'mdi:walk',
'woman': 'mdi:walk',
'man': 'mdi:walk',
'human': 'mdi:walk',
'courier': 'mdi:truck-delivery',
'mailman': 'mdi:truck-delivery',
// Vehicles
'bike': 'mdi:bike',
'bicycle': 'mdi:bike',
'motorcycle': 'mdi:motorbike',
'motorbike': 'mdi:motorbike',
'bus': 'mdi:bus',
'car': 'mdi:car',
'van': 'mdi:car',
'suv': 'mdi:car',
'vehicle': 'mdi:car',
'truck': 'mdi:truck',
// Objects
'box': 'mdi:package-variant-closed',
'package': 'mdi:package-variant-closed',
'parcel': 'mdi:package-variant-closed',
'letter': 'mdi:email',
// Garden
'garden': 'mdi:flower',
'plant': 'mdi:flower',
'flower': 'mdi:flower',
'tree': 'mdi:tree',
};
for (const [key, icon] of Object.entries(iconMap)) {
const regex = new RegExp(`\\b${key}\\b`, 'i');
if (regex.test(title)) {
return icon;
}
}
return 'mdi:cube-scan'; // Default icon if no keyword is found
}