first commit after refactor to vite

This commit is contained in:
Sockenklaus
2021-10-03 00:35:05 +02:00
commit 59d5d15702
18 changed files with 3193 additions and 0 deletions

40
src/views/Home.vue Normal file
View File

@@ -0,0 +1,40 @@
<template lang="pug">
p SelectedMonth: {{selectedMonth}}, SelectedYear: {{selectedYear}}
MonthPicker(:selectedMonth="selectedMonth" :selectedYear="selectedYear" state="closed")
div(class="mt-5" v-for="(month, index) in months" :key="index")
Schedule( :startDate="month" :initialOffset="iOffsets[index]")
</template>
<script lang="ts" setup>
import { ref, computed } from 'vue'
import { getYear, getMonth, eachMonthOfInterval, getDaysInMonth, getISODay } from 'date-fns'
import Schedule from '/src/components/Schedule.vue'
import MonthPicker from '/src/components/MonthPicker.vue'
const selectedMonth = ref(getMonth(new Date()))
const selectedYear = ref(getYear(new Date()))
const months = computed(() => {
return eachMonthOfInterval({
start: new Date(selectedYear.value, selectedMonth.value - 1),
end : new Date(selectedYear.value, selectedMonth.value + 1)
})
})
const iOffsets = computed(() => {
let arr : number[] = []
arr.push(0)
months.value.forEach(month => {
if ( getDaysInMonth(month) + getISODay(month) - 1 + arr[arr.length - 1] > 34) {
arr.push(7)
}
else arr.push(0)
})
return arr
})
</script>