Skip to content

Commit

Permalink
feat(activities): improve reminder activity configuration and detection
Browse files Browse the repository at this point in the history
- change reminder emoji from 🎯 to ⏰ for better visual representation
- add 'reminder' keyword to english variants
- add findMatchingActivity helper function for consistent activity detection
  • Loading branch information
dgokcin committed Jan 27, 2025
1 parent 09d636a commit b02c196
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Code.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ const activities = {
category: "wellness",
},
action: {
emoji: "🎯",
variants: { en: [], tr: ["aksiyon al"] },
emoji: "",
variants: { en: ["reminder"], tr: ["aksiyon al"] },
category: "reminders",
},
dinner: {
Expand Down Expand Up @@ -217,6 +217,18 @@ function getEventColor(input) {
return activity ? categoryColors[activity.category] : null;
}

const findMatchingActivity = (input) => {
const lowerInput = input.toLowerCase();
return Object.values(activities).find((activity) =>
Object.entries(activity.variants).some(([lang, variants]) =>
variants.some(
(variant) =>
variant && new RegExp(`\\b${variant}\\b`, "i").test(lowerInput)
)
)
);
};

// ==============================================
// CALENDAR EVENT PROCESSOR
// ==============================================
Expand All @@ -236,7 +248,6 @@ function ColorEvents() {
? [new Date("2025-01-26"), new Date("2025-01-28")]
: [today, nextThreeMonths];


CalendarApp.getCalendarsByName("main").forEach((calendar) => {
calendar.getEvents(startDate, endDate).forEach((event) => {
const originalTitle = event.getTitle();
Expand Down

0 comments on commit b02c196

Please sign in to comment.