1
0
Fork 0
forked from TWS/kalkutago

UI laid out and started

This commit is contained in:
D. Scott Boggs 2023-06-14 11:39:00 -04:00
parent 1438ab6d24
commit 441d3c28ec
7 changed files with 241 additions and 3 deletions

View file

@ -0,0 +1,40 @@
<template>
<table class="table">
<thead>
<th>Date</th>
<th v-for="track in tracks" :key="track.id">{{ track.icon }}</th>
</thead>
<tbody>
<tr v-for="date in dates" :key="date.valueOf()">
<th>{{ dateString(date) }}</th>
<td v-for="track in tracks" :key="track.id">
<TickComponent :isSet="track.isSetOn(date)" />
</td>
</tr>
</tbody>
</table>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { Track } from '../track'
import TickComponent from "./TickComponent.vue";
const tracks = ref(new Array<Track>())
const today = new Date()
const ONE_DAY_MS = 86_400_000
// A list of the past 60 days
const dates = [...Array(60).keys()]
.map(n => new Date(today.valueOf() - (n * ONE_DAY_MS)))
console.log(dates)
// The date as a string like 2023-06-11
function dateString(date: Date) {
return date.toISOString().substring(0, 10)
}
Track.fetchAll().then(result => tracks.value = result)
</script>

View file

@ -0,0 +1,18 @@
<template>
<tr>
<td>{{dateString()}}</td>
<td v-for="tick in ticks" :key="tick.id">{{tick.name}}</td>
</tr>
</template>
<script setup lang="ts">
const props = defineProps<{date: Date}>();
const ticks = [{id: 1, name: 'test'}]
// The date as a string like 2023-06-11
function dateString() {
return props.date.toISOString().substring(0, 10)
}
</script>

View file

@ -0,0 +1,9 @@
<template>
<button :class="className()">{{ props.isSet ? "x" : "\u{A0}" }}</button>
</template>
<script setup lang="ts">
const props = defineProps<{ isSet: boolean }>()
const className = () => props.isSet ? "is-rounded is-info" : "is-rounded"
</script>