[READ-ONLY] One Calendar is a privacy-first calendar web app built with Next.js. It has modern security features, including e2ee, password-protected sharing, and self-destructing share links ๐Ÿ“… calendar.xyehr.cn
nextjs
0

Configure Feed

Select the types of activity you want to include in your feed.

fix: run type check and fix typescript errors

+37 -18
+4 -7
components/app/analytics/import-export.tsx
··· 254 254 255 255 setExportDialogOpen(false) 256 256 } catch (error) { 257 - toast(t.exportError, { 257 + toast.error(t.exportError, { 258 258 description: t.exportError, 259 - variant: 'destructive', 260 259 }) 261 260 console.error('Export error:', error) 262 261 } finally { ··· 338 337 } 339 338 340 339 if (importedEvents.length === 0) { 341 - toast(t.importWarning, { 340 + toast.error(t.importWarning, { 342 341 description: t.importWarning, 343 - variant: 'destructive', 344 342 }) 345 343 return 346 344 } ··· 379 377 error instanceof Error 380 378 ? error.message 381 379 : t.unknownError || 'Unknown error' 382 - toast(t.importError.replace('{error}', errorMessage), { 380 + toast.error(t.importError.replace('{error}', errorMessage), { 383 381 description: errorMessage, 384 - variant: 'destructive', 385 382 }) 386 383 console.error('Import error:', error) 387 384 ··· 1118 1115 </Select> 1119 1116 </div> 1120 1117 1121 - <Alert variant="outline"> 1118 + <Alert variant="default"> 1122 1119 <AlertCircle className="h-4 w-4" /> 1123 1120 <AlertDescription>{t.googleCalendarGuideText}</AlertDescription> 1124 1121 </Alert>
+3 -1
components/app/analytics/time-analytics.tsx
··· 273 273 }) 274 274 275 275 const data = weekdayLabels.map((label) => { 276 - const row: Record<string, string | number> = { day: label } 276 + const row: { day: string; [category: string]: string | number } = { 277 + day: label, 278 + } 277 279 const values = buckets[label] ?? {} 278 280 categoryColors.forEach((_, category) => { 279 281 row[category] = Number((values[category]?.hours ?? 0).toFixed(1))
+9 -2
components/app/calendar.tsx
··· 71 71 AlertDialogTitle, 72 72 } from '@/components/ui/alert-dialog' 73 73 74 + import { useRouter } from 'next/navigation' 75 + 74 76 const loadDayView = () => import('@/components/app/views/day-view') 75 77 const loadWeekView = () => import('@/components/app/views/week-view') 76 78 const loadMonthView = () => import('@/components/app/views/month-view') ··· 114 116 description?: string 115 117 color: string 116 118 calendarId: string 119 + } 120 + 121 + interface CalendarProps { 122 + className?: string 117 123 } 118 124 119 125 export default function Calendar({ className, ...props }: CalendarProps) { 126 + const router = useRouter() 120 127 const [openShareImmediately, setOpenShareImmediately] = useState(false) 121 128 const [isSidebarCollapsed, setIsSidebarCollapsed] = useState(false) 122 129 const [isSidebarExpanding, setIsSidebarExpanding] = useState(false) ··· 147 154 Intl.DateTimeFormat().resolvedOptions().timeZone, 148 155 ) 149 156 const [notificationSound, setNotificationSound] = useLocalStorage< 150 - keyof typeof NOTIFICATION_SOUNDS 157 + NOTIFICATION_SOUNDS 151 158 >('notification-sound', 'telegram') 152 159 const notificationIntervalRef = useRef<NodeJS.Timeout | null>(null) 153 160 const notificationsInitializedRef = useRef(false) ··· 168 175 >(null) 169 176 const [shareOnlyMode, setShareOnlyMode] = useState(false) 170 177 171 - const updateEvent = (updatedEvent) => { 178 + const updateEvent = (updatedEvent: CalendarEvent) => { 172 179 setEvents((prevEvents) => 173 180 prevEvents.map((event) => 174 181 event.id === updatedEvent.id ? updatedEvent : event,
+3 -3
components/app/profile/settings.tsx
··· 19 19 import ShareManagement from '@/components/app/analytics/share-management' 20 20 import BuildInfoCard from '@/components/app/analytics/build-info-card' 21 21 import ImportExport from '@/components/app/analytics/import-export' 22 - import type { NOTIFICATION_SOUNDS } from '@/utils/notifications' 22 + import type { NOTIFICATION_SOUNDS } from '@/lib/notifications' 23 23 import type { CalendarEvent } from '@/components/app/calendar' 24 24 import { Switch } from '@/components/ui/switch' 25 25 import { Label } from '@/components/ui/label' ··· 33 33 setFirstDayOfWeek: (day: number) => void 34 34 timezone: string 35 35 setTimezone: (timezone: string) => void 36 - notificationSound: keyof typeof NOTIFICATION_SOUNDS 37 - setNotificationSound: (sound: keyof typeof NOTIFICATION_SOUNDS) => void 36 + notificationSound: NOTIFICATION_SOUNDS 37 + setNotificationSound: (sound: NOTIFICATION_SOUNDS) => void 38 38 defaultView: string 39 39 setDefaultView: (view: string) => void 40 40 enableShortcuts: boolean
+7 -1
components/app/views/day-view.tsx
··· 17 17 children: React.ReactNode 18 18 asChild?: boolean 19 19 }) => <>{children}</> 20 - const ContextMenuContent = () => null 20 + const ContextMenuContent = ({ 21 + children, 22 + className, 23 + }: { 24 + children: React.ReactNode 25 + className?: string 26 + }) => <>{children}</> 21 27 const ContextMenuItem = (_props: any) => null 22 28 23 29 interface DayViewProps {
+9 -2
components/app/views/week-view.tsx
··· 16 16 } from 'date-fns' 17 17 import { cn } from '@/lib/utils' 18 18 import { translations, type Language } from '@/lib/i18n' 19 + import type { CalendarEvent } from '../calendar' 19 20 20 21 const ContextMenu = ({ children }: { children: React.ReactNode }) => ( 21 22 <>{children}</> ··· 26 27 children: React.ReactNode 27 28 asChild?: boolean 28 29 }) => <>{children}</> 29 - const ContextMenuContent = () => null 30 + const ContextMenuContent = ({ 31 + children, 32 + className, 33 + }: { 34 + children: React.ReactNode 35 + className?: string 36 + }) => <>{children}</> 30 37 const ContextMenuItem = (_props: any) => null 31 38 32 39 interface WeekViewProps { 33 40 date: Date 34 - events: any[] 41 + events: CalendarEvent[] 35 42 onEventClick: (event: CalendarEvent, anchorEl?: HTMLElement | null) => void 36 43 onTimeSlotClick: (startDate: Date, endDate?: Date) => void 37 44 language: Language
+2 -2
next.config.ts
··· 24 24 NEXT_PUBLIC_APP_VERSION: packageJson.version, 25 25 NEXT_PUBLIC_GIT_COMMIT: getGitCommit(), 26 26 NEXT_PUBLIC_BUILD_TIME: new Date().toISOString(), 27 - } 27 + }, 28 28 } 29 29 30 - export default nextConfig 30 + export default nextConfig