From 3a96d0e2593c92aa846a6303f8c09b2d25927d9d Mon Sep 17 00:00:00 2001 From: Dominik Stahl Date: Mon, 16 Jun 2025 19:44:09 +0200 Subject: [PATCH] style: format code --- src/components/calendar.tsx | 15 +- src/components/custom-toolbar.css | 4 +- src/components/custom-toolbar.tsx | 43 ++-- src/components/react-big-calendar.css | 273 ++++++++++++++------------ 4 files changed, 187 insertions(+), 148 deletions(-) diff --git a/src/components/calendar.tsx b/src/components/calendar.tsx index defedab..6e10dab 100644 --- a/src/components/calendar.tsx +++ b/src/components/calendar.tsx @@ -1,4 +1,4 @@ -"use client"; +'use client'; import { Calendar, momentLocalizer } from 'react-big-calendar'; import moment from 'moment'; @@ -13,26 +13,25 @@ moment.updateLocale('en', { }, }); -const localizer = momentLocalizer(moment) +const localizer = momentLocalizer(moment); const MyCalendar = (props) => (
-) +); export default MyCalendar; diff --git a/src/components/custom-toolbar.css b/src/components/custom-toolbar.css index e16a8e4..55e9b77 100644 --- a/src/components/custom-toolbar.css +++ b/src/components/custom-toolbar.css @@ -75,11 +75,11 @@ } .custom-toolbar .navigation-controls button:hover { - background-color: #1976D2; + background-color: #1976d2; } .custom-toolbar .navigation-controls button:active { - background-color: #1565C0; + background-color: #1565c0; } /* Dropdown-Bereich für Woche und Jahr */ diff --git a/src/components/custom-toolbar.tsx b/src/components/custom-toolbar.tsx index 5f9a2cf..bcbb9f9 100644 --- a/src/components/custom-toolbar.tsx +++ b/src/components/custom-toolbar.tsx @@ -16,15 +16,21 @@ interface CustomToolbarProps { onView: (newView: 'month' | 'week' | 'day' | 'agenda') => void; } -const CustomToolbar: React.FC = ({ date, view, onNavigate, onView }) => { - +const CustomToolbar: React.FC = ({ + date, + view, + onNavigate, + onView, +}) => { //ISO-Wochennummer eines Datums ermitteln const getISOWeek = (date: Date): number => { const tmp = new Date(date.getTime()); //Datum so verschieben, dass der nächste Donnerstag erreicht wird (ISO: Woche beginnt am Montag) tmp.setDate(tmp.getDate() + 4 - (tmp.getDay() || 7)); const yearStart = new Date(tmp.getFullYear(), 0, 1); - const weekNo = Math.ceil((((tmp.getTime() - yearStart.getTime()) / 86400000) + 1) / 7); + const weekNo = Math.ceil( + ((tmp.getTime() - yearStart.getTime()) / 86400000 + 1) / 7, + ); return weekNo; }; @@ -60,7 +66,9 @@ const CustomToolbar: React.FC = ({ date, view, onNavigate, o //Lokaler State für Woche und ISO-Wochenjahr (statt des reinen Kalenderjahrs) const [selectedWeek, setSelectedWeek] = useState(getISOWeek(date)); - const [selectedYear, setSelectedYear] = useState(getISOWeekYear(date)); + const [selectedYear, setSelectedYear] = useState( + getISOWeekYear(date), + ); //Auswahl aktualisieren, wenn sich die Prop "date" ändert useEffect(() => { @@ -73,7 +81,10 @@ const CustomToolbar: React.FC = ({ date, view, onNavigate, o const weekOptions = Array.from({ length: totalWeeks }, (_, i) => i + 1); //Jahresliste - const yearOptions = Array.from({ length: 21 }, (_, i) => selectedYear - 10 + i); + const yearOptions = Array.from( + { length: 21 }, + (_, i) => selectedYear - 10 + i, + ); //Start (Montag) und Ende (Sonntag) der aktuell angezeigten Woche berechnen const weekStartDate = getDateOfISOWeek(selectedWeek, selectedYear); @@ -175,11 +186,13 @@ const CustomToolbar: React.FC = ({ date, view, onNavigate, o } }; - return ( -
+
-
+
-
-
-
+
+
+
-
+