Expand calendar event icon options
This commit is contained in:
@@ -327,6 +327,9 @@ const MIGRATIONS_SQL = {
|
||||
14: `
|
||||
ALTER TABLE calendar_events ADD COLUMN icon TEXT NOT NULL DEFAULT 'calendar';
|
||||
`,
|
||||
15: `
|
||||
UPDATE calendar_events SET icon = 'drill' WHERE icon = 'tooth';
|
||||
`,
|
||||
};
|
||||
|
||||
export { MIGRATIONS_SQL };
|
||||
|
||||
@@ -741,6 +741,13 @@ const MIGRATIONS = [
|
||||
ALTER TABLE calendar_events ADD COLUMN icon TEXT NOT NULL DEFAULT 'calendar';
|
||||
`,
|
||||
},
|
||||
{
|
||||
version: 22,
|
||||
description: 'Normalize calendar dentist icon',
|
||||
up: `
|
||||
UPDATE calendar_events SET icon = 'drill' WHERE icon = 'tooth';
|
||||
`,
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user