Clean up all kinds of typescript issues

This commit is contained in:
2024-05-05 15:58:58 -04:00
parent 634cff507c
commit 8e73650462
21 changed files with 380 additions and 159 deletions

View File

@@ -15,7 +15,6 @@
:short-interval-label="true"
v-model="selectedDate"
:column-count="boatData.length"
@change="changeEvent"
v-touch-swipe.left.right="handleSwipe"
>
<template #head-day="{ scope }">
@@ -71,15 +70,13 @@ import {
parseTimestamp,
parseDate,
addToDate,
makeDateTime,
} from '@quasar/quasar-ui-qcalendar';
import CalendarHeaderComponent from './CalendarHeaderComponent.vue';
import { ref, computed, onMounted } from 'vue';
import { Boat, useBoatStore } from 'src/stores/boat';
import { useBoatStore } from 'src/stores/boat';
import { useScheduleStore } from 'src/stores/schedule';
import { Reservation, Timeblock } from 'src/stores/schedule.types';
import { date } from 'quasar';
import { Timeblock } from 'src/stores/schedule.types';
const scheduleStore = useScheduleStore();
const boatStore = useBoatStore();
@@ -98,18 +95,18 @@ onMounted(async () => {
function handleSwipe({ ...event }) {
event.direction === 'right' ? calendar.value?.prev() : calendar.value?.next();
}
function reservationStyles(
reservation: Reservation,
timeStartPos: (t: string) => string,
timeDurationHeight: (d: number) => string
) {
return genericBlockStyle(
parseDate(reservation.start) as Timestamp,
parseDate(reservation.end) as Timestamp,
timeStartPos,
timeDurationHeight
);
}
// function reservationStyles(
// reservation: Reservation,
// timeStartPos: (t: string) => string,
// timeDurationHeight: (d: number) => string
// ) {
// return genericBlockStyle(
// parseDate(reservation.start) as Timestamp,
// parseDate(reservation.end) as Timestamp,
// timeStartPos,
// timeDurationHeight
// );
// }
function blockStyles(
block: Timeblock,
@@ -190,33 +187,33 @@ function getBoatBlocks(scope: DayBodyScope): Timeblock[] {
: [];
}
function changeEvent({ start }: { start: string }) {
// const newBlocks = scheduleStore.getTimeblocksForDate(start);
// const reservations = scheduleStore.getBoatReservations(
// parsed(start) as Timestamp
// );
// boatData.value.map((boat) => {
// boat.reservations = reservations.filter(
// (reservation) => reservation.resource === boat
// );
// boat.blocks = newBlocks.filter(
// (block) =>
// block.boatId === boat.$id &&
// boat.reservations?.filter(
// (r: Reservation) =>
// r.start <
// date.addToDate(makeDateTime(parsed(block.end) as Timestamp), {
// hours: 4,
// }) &&
// r.end >
// date.addToDate(makeDateTime(parsed(block.start) as Timestamp), {
// hours: 4,
// })
// ).length == 0
// );
// });
// setTimeout(() => calendar.value?.scrollToTime('09:00'), 100); // Should figure out why we need this setTimeout...
}
// function changeEvent({ start }: { start: string }) {
// const newBlocks = scheduleStore.getTimeblocksForDate(start);
// const reservations = scheduleStore.getBoatReservations(
// parsed(start) as Timestamp
// );
// boatData.value.map((boat) => {
// boat.reservations = reservations.filter(
// (reservation) => reservation.resource === boat
// );
// boat.blocks = newBlocks.filter(
// (block) =>
// block.boatId === boat.$id &&
// boat.reservations?.filter(
// (r: Reservation) =>
// r.start <
// date.addToDate(makeDateTime(parsed(block.end) as Timestamp), {
// hours: 4,
// }) &&
// r.end >
// date.addToDate(makeDateTime(parsed(block.start) as Timestamp), {
// hours: 4,
// })
// ).length == 0
// );
// });
// setTimeout(() => calendar.value?.scrollToTime('09:00'), 100); // Should figure out why we need this setTimeout...
// }
const disabledBefore = computed(() => {
const todayTs = parseTimestamp(today()) as Timestamp;