This commit is contained in:
despiegk 2024-10-31 09:20:49 +01:00
parent 4b2440b521
commit f652269ea7
2 changed files with 9 additions and 2 deletions

View File

@ -3,11 +3,9 @@ import { addDays, format, startOfWeek, endOfWeek, startOfMonth, endOfMonth, each
import { ChevronLeft, ChevronRight, Plus, Moon, Sun, Clock, X } from 'lucide-react' import { ChevronLeft, ChevronRight, Plus, Moon, Sun, Clock, X } from 'lucide-react'
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd' import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd'
import ReactMarkdown from 'react-markdown' import ReactMarkdown from 'react-markdown'
import { v4 as uuidv4 } from 'uuid'
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Card, CardContent } from "@/components/ui/card"
import { import {
Dialog, Dialog,
DialogContent, DialogContent,
@ -157,6 +155,7 @@ export function OurCalendar({ webdavConfig, calendarFile, circleFile }: Calendar
const handlePrevMonth = () => setCurrentDate(addDays(startDate, -7)) const handlePrevMonth = () => setCurrentDate(addDays(startDate, -7))
const handleNextMonth = () => 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 () => { const fetchCalendarData = async () => {
setIsLoading(true) setIsLoading(true)
setError(null) 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 }: { function EventDetailsDialog({ event, onClose, onEdit, onDelete, isDarkMode }: {
event: Event event: Event
onClose: () => void onClose: () => void

View File

@ -82,8 +82,15 @@ export class CalendarDataManager {
setConfig(config: WebDAVConfig, calendarFile: string) { setConfig(config: WebDAVConfig, calendarFile: string) {
this.webdavConfig = config; this.webdavConfig = config;
this.calendarFile = calendarFile; 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 { private calculateHash(events: Event[]): string {
// Sort events by ID to ensure consistent hash // Sort events by ID to ensure consistent hash
const sortedEvents = [...events].sort((a, b) => a.id.localeCompare(b.id)); const sortedEvents = [...events].sort((a, b) => a.id.localeCompare(b.id));