From f652269ea7b871aa08701f95cdc896f854e2fe22 Mon Sep 17 00:00:00 2001 From: despiegk Date: Thu, 31 Oct 2024 09:20:49 +0100 Subject: [PATCH] ... --- react-shadcn-starter/src/components/calendar/calendar.tsx | 4 ++-- react-shadcn-starter/src/lib/calendar-data.ts | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/react-shadcn-starter/src/components/calendar/calendar.tsx b/react-shadcn-starter/src/components/calendar/calendar.tsx index 792e071..44ada91 100644 --- a/react-shadcn-starter/src/components/calendar/calendar.tsx +++ b/react-shadcn-starter/src/components/calendar/calendar.tsx @@ -3,11 +3,9 @@ import { addDays, format, startOfWeek, endOfWeek, startOfMonth, endOfMonth, each import { ChevronLeft, ChevronRight, Plus, Moon, Sun, Clock, X } from 'lucide-react' import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd' import ReactMarkdown from 'react-markdown' -import { v4 as uuidv4 } from 'uuid' import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" -import { Card, CardContent } from "@/components/ui/card" import { Dialog, DialogContent, @@ -157,6 +155,7 @@ export function OurCalendar({ webdavConfig, calendarFile, circleFile }: Calendar const handlePrevMonth = () => setCurrentDate(addDays(startDate, -7)) const handleNextMonth = () => setCurrentDate(addDays(startDate, 7)) + //us double, we should re-use the const fetchedEvents = await dataManager.fetchEvents(); const fetchCalendarData = async () => { setIsLoading(true) setError(null) @@ -412,6 +411,7 @@ export function OurCalendar({ webdavConfig, calendarFile, circleFile }: Calendar ) } +//TODO: how does this relate to eventform.tsx isn't this double? function EventDetailsDialog({ event, onClose, onEdit, onDelete, isDarkMode }: { event: Event onClose: () => void diff --git a/react-shadcn-starter/src/lib/calendar-data.ts b/react-shadcn-starter/src/lib/calendar-data.ts index a52c2dd..c72d3d4 100644 --- a/react-shadcn-starter/src/lib/calendar-data.ts +++ b/react-shadcn-starter/src/lib/calendar-data.ts @@ -82,8 +82,15 @@ export class CalendarDataManager { setConfig(config: WebDAVConfig, calendarFile: string) { this.webdavConfig = config; this.calendarFile = calendarFile; + if (!this.webdavConfig || !this.calendarFile) { + throw new Error('WebDAV configuration or calendar file not set'); + } + if (!this.webdavConfig.url || !this.webdavConfig.username || !this.webdavConfig.password) { + throw new Error('WebDAV configuration incomplete: url, username, and password are required'); + } } + private calculateHash(events: Event[]): string { // Sort events by ID to ensure consistent hash const sortedEvents = [...events].sort((a, b) => a.id.localeCompare(b.id));