fix prettier

This commit is contained in:
lenhanphung
2025-09-25 17:16:12 +07:00
parent ca0fe4a4a8
commit 7b8a2e74a5
3 changed files with 27 additions and 22 deletions
+15 -6
View File
@@ -48,22 +48,23 @@ const updateSlotLabelVisibility = (currentTime: Date) => {
const timeText = labelElement.textContent?.trim(); const timeText = labelElement.textContent?.trim();
if (timeText && timeText.match(/^\d{1,2}:\d{2}$/)) { if (timeText && timeText.match(/^\d{1,2}:\d{2}$/)) {
const [hours, minutes] = timeText.split(':').map(Number); const [hours, minutes] = timeText.split(":").map(Number);
const labelMinutes = hours * 60 + minutes; const labelMinutes = hours * 60 + minutes;
// Calculate time difference in minutes // Calculate time difference in minutes
let timeDiff = Math.abs(currentMinutes - labelMinutes); let timeDiff = Math.abs(currentMinutes - labelMinutes);
// Handle edge case around midnight (00:00) // Handle edge case around midnight (00:00)
if (timeDiff > 12 * 60) { // More than 12 hours difference if (timeDiff > 12 * 60) {
// More than 12 hours difference
timeDiff = 24 * 60 - timeDiff; // Wrap around timeDiff = 24 * 60 - timeDiff; // Wrap around
} }
// Dim if within 15 minutes (before or after) // Dim if within 15 minutes (before or after)
if (timeDiff <= 15) { if (timeDiff <= 15) {
labelElement.style.opacity = '0.2'; labelElement.style.opacity = "0.2";
} else { } else {
labelElement.style.opacity = '1'; labelElement.style.opacity = "1";
} }
} }
}); });
@@ -700,7 +701,11 @@ export default function CalendarApp({
return true; return true;
}} }}
eventDrop={(arg) => { eventDrop={(arg) => {
if (!arg.event || !arg.event._def || !arg.event._def.extendedProps) { if (
!arg.event ||
!arg.event._def ||
!arg.event._def.extendedProps
) {
return; return;
} }
@@ -732,7 +737,11 @@ export default function CalendarApp({
); );
}} }}
eventResize={(arg) => { eventResize={(arg) => {
if (!arg.event || !arg.event._def || !arg.event._def.extendedProps) { if (
!arg.event ||
!arg.event._def ||
!arg.event._def.extendedProps
) {
return; return;
} }
+2 -6
View File
@@ -70,12 +70,8 @@ function EventPopover({
const [description, setDescription] = useState(event?.description ?? ""); const [description, setDescription] = useState(event?.description ?? "");
const [location, setLocation] = useState(event?.location ?? ""); const [location, setLocation] = useState(event?.location ?? "");
const [start, setStart] = useState( const [start, setStart] = useState(event?.start ? event.start : "");
event?.start ? event.start : "" const [end, setEnd] = useState(event?.end ? event.end : "");
);
const [end, setEnd] = useState(
event?.end ? event.end : ""
);
const [calendarid, setCalendarid] = useState( const [calendarid, setCalendarid] = useState(
event?.calId event?.calId
? userPersonnalCalendars.findIndex((e) => e.id === event?.calId) ? userPersonnalCalendars.findIndex((e) => e.id === event?.calId)