Expand calendar event icon options

This commit is contained in:
Rafael Foster
2026-04-27 22:22:30 -03:00
parent 33e4afc009
commit b4d74f239b
5 changed files with 137 additions and 27 deletions
+18 -5
View File
@@ -22,10 +22,22 @@ const router = express.Router();
const VALID_SOURCES = ['local', 'google', 'apple', 'ics'];
const ICS_COLOR_RE = /^#[0-9a-fA-F]{6}$/;
const VALID_EVENT_ICONS = new Set([
'calendar', 'tooth', 'stethoscope', 'heart-pulse', 'briefcase', 'plane',
'utensils', 'cake', 'car', 'graduation-cap', 'dumbbell', 'home',
'shopping-bag', 'music', 'party-popper', 'paw-print', 'scissors',
'book-open', 'users', 'bell',
'calendar', 'drill', 'alarm-clock', 'clock', 'bell', 'map-pin', 'home',
'house', 'building', 'hospital', 'stethoscope', 'syringe', 'pill',
'tablets', 'bandage', 'ambulance', 'heart-pulse', 'activity', 'cross',
'scissors', 'shower-head', 'dumbbell', 'trophy', 'car', 'bus', 'train',
'tram-front', 'plane', 'plane-takeoff', 'fuel', 'parking-meter',
'traffic-cone', 'navigation', 'route', 'briefcase', 'laptop', 'monitor',
'presentation', 'school', 'graduation-cap', 'book-open', 'library',
'pencil', 'notebook-pen', 'calculator', 'utensils', 'cooking-pot',
'coffee', 'cake', 'croissant', 'pizza', 'ice-cream', 'beer', 'wine',
'popcorn', 'sandwich', 'salad', 'shopping-bag', 'shopping-cart', 'gift',
'package', 'shirt', 'tag', 'credit-card', 'wallet', 'banknote', 'coins',
'piggy-bank', 'receipt', 'landmark', 'music', 'guitar', 'film', 'theater',
'ticket', 'gamepad-2', 'camera', 'party-popper', 'users', 'baby', 'dog',
'cat', 'paw-print', 'wrench', 'hammer', 'paintbrush', 'lightbulb', 'sofa',
'bed', 'bath', 'washing-machine', 'refrigerator', 'star', 'flag', 'target',
'flame', 'leaf', 'tree-pine', 'flower', 'sun', 'moon', 'cloud-sun',
]);
function getUserId(req) {
@@ -42,7 +54,8 @@ function isAdminUser(req) {
}
function eventIcon(value) {
const icon = typeof value === 'string' && value.trim() ? value.trim() : 'calendar';
const raw = typeof value === 'string' && value.trim() ? value.trim() : 'calendar';
const icon = raw === 'tooth' ? 'drill' : raw;
return VALID_EVENT_ICONS.has(icon) ? icon : null;
}