From a46f210486be2b07ab9ffb9be301281f40685dba Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 16:20:42 +0000 Subject: [PATCH 01/25] feat: add calendar cache status dropdown - Add updatedAt field to CalendarCache schema with migration - Create tRPC cacheStatus endpoint for fetching cache timestamps - Add action dropdown to CalendarSwitch for Google Calendar entries - Display formatted last updated timestamp in dropdown - Add placeholder for cache deletion functionality - Include translation strings for dropdown content The dropdown only appears for Google Calendar integrations that have active cache entries and provides cache management options for future extensibility. Co-Authored-By: zomars@cal.com --- apps/web/public/static/locales/en/common.json | 8 +++ .../features/calendars/CalendarSwitch.tsx | 58 ++++++++++++++++--- .../SelectedCalendarsSettingsWebWrapper.tsx | 12 +++- .../migration.sql | 8 +++ packages/prisma/schema.prisma | 1 + .../routers/viewer/calendars/_router.tsx | 15 +++++ .../viewer/calendars/cacheStatus.handler.ts | 36 ++++++++++++ 7 files changed, 130 insertions(+), 8 deletions(-) create mode 100644 packages/prisma/migrations/20250715160635_add_calendar_cache_updated_at/migration.sql create mode 100644 packages/trpc/server/routers/viewer/calendars/cacheStatus.handler.ts diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 9cc19f8650e91c..f766500dda807f 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -48,6 +48,10 @@ "calvideo_settings_description": "Configure video meeting preferences including recording permissions for hosts and attendees.", "disable_recording_for_guests": "Disable recording for guests", "enable_automatic_transcription": "Enable automatic transcription after joining the meeting", + "cache_status": "Cache Status", + "last_updated": "Last updated: {{timestamp}}", + "delete_cached_data": "Delete cached data", + "cache_deletion_placeholder": "Cache deletion will be implemented in future update", "enable_automatic_recording": "Enable automatic recording after organizer joins the meeting", "video_options": "Video Options", "get_meeting_session_details": "Get Meeting Session Details", @@ -3364,5 +3368,9 @@ "license_key_saved": "License key saved successfully", "timezone_mismatch_tooltip": "You are viewing the report based on your profile timezone ({{userTimezone}}), while your browser is set to timezone ({{browserTimezone}})", "event_type_no_hosts": "No hosts are assigned to event type", + "cache_status": "Cache Status", + "last_updated": "Last updated: {{timestamp}}", + "delete_cached_data": "Delete cached data", + "cache_deletion_placeholder": "Cache deletion will be implemented in future update", "ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑" } diff --git a/packages/features/calendars/CalendarSwitch.tsx b/packages/features/calendars/CalendarSwitch.tsx index 462feda8cc5875..2b341ef7139d02 100644 --- a/packages/features/calendars/CalendarSwitch.tsx +++ b/packages/features/calendars/CalendarSwitch.tsx @@ -6,6 +6,14 @@ import { useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import classNames from "@calcom/ui/classNames"; +import { Button } from "@calcom/ui/components/button"; +import { + Dropdown, + DropdownItem, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@calcom/ui/components/dropdown"; import { Switch } from "@calcom/ui/components/form"; import { Icon } from "@calcom/ui/components/icon"; import { showToast } from "@calcom/ui/components/toast"; @@ -22,6 +30,7 @@ export type ICalendarSwitchProps = { delegationCredentialId: string | null; eventTypeId: number | null; disabled?: boolean; + cacheUpdatedAt?: Date | null; }; type UserCalendarSwitchProps = Omit; @@ -103,14 +112,49 @@ const CalendarSwitch = (props: ICalendarSwitchProps) => { }} /> -