diff --git a/availabili.tf/src/components/AvailabilityGrid.vue b/availabili.tf/src/components/AvailabilityGrid.vue index 22b2183..cd1b763 100644 --- a/availabili.tf/src/components/AvailabilityGrid.vue +++ b/availabili.tf/src/components/AvailabilityGrid.vue @@ -9,6 +9,8 @@ const model = defineModel(); const selectedTime = defineModel("selectedTime"); +const selectedIndex = defineModel("selectedIndex"); + const hoveredIndex = defineModel("hoveredIndex"); const props = defineProps({ @@ -156,6 +158,7 @@ function onSlotClick(dayIndex, hour) { } selectedTime.value = getTimeAtCell(dayIndex, hour); + scheduleStore.selectIndex(24 * dayIndex + hour); } function onKeyUp($event) { diff --git a/availabili.tf/src/components/EventList.vue b/availabili.tf/src/components/EventList.vue index 803b17e..b7bb694 100644 --- a/availabili.tf/src/components/EventList.vue +++ b/availabili.tf/src/components/EventList.vue @@ -1,9 +1,10 @@ @@ -12,7 +13,20 @@ const props = defineProps<{
- No upcoming events. + + No upcoming events. Create one in the + + schedule + + page. +
diff --git a/availabili.tf/src/components/LogsTfIntegrationForm.vue b/availabili.tf/src/components/LogsTfIntegrationForm.vue index 832894c..cdba23d 100644 --- a/availabili.tf/src/components/LogsTfIntegrationForm.vue +++ b/availabili.tf/src/components/LogsTfIntegrationForm.vue @@ -28,7 +28,7 @@ function disableIntegration() { diff --git a/availabili.tf/src/components/SchedulePlayerListItem.vue b/availabili.tf/src/components/SchedulePlayerListItem.vue index 7bd9a0a..13d7c83 100644 --- a/availabili.tf/src/components/SchedulePlayerListItem.vue +++ b/availabili.tf/src/components/SchedulePlayerListItem.vue @@ -7,9 +7,16 @@ const scheduleStore = useScheduleStore(); const hoveredIndex = computed(() => scheduleStore.hoveredIndex); +const selectedIndex = computed(() => scheduleStore.selectedIndex); + const availabilityAtHoveredIndex = computed(() => { - if (hoveredIndex.value && props.player?.availability) { - return props.player.availability[hoveredIndex.value] ?? 0; + if (props.player?.availability) { + if (hoveredIndex.value) { + return props.player.availability[hoveredIndex.value] ?? 0; + } + if (scheduleStore.selectedIndexAvailability[props.player.steamId] != undefined) { + return scheduleStore.selectedIndexAvailability[props.player.steamId] ?? 0; + } } return undefined; }); diff --git a/availabili.tf/src/stores/schedule.ts b/availabili.tf/src/stores/schedule.ts index d047981..b212e23 100644 --- a/availabili.tf/src/stores/schedule.ts +++ b/availabili.tf/src/stores/schedule.ts @@ -60,7 +60,16 @@ export const useScheduleStore = defineStore("schedule", () => { const selectedMembers = reactive<{ [id: string]: boolean }>({ }); - const hoveredIndex: Ref = ref(); + const hoveredIndex = ref(); + const selectedIndexAvailability = ref<{ [id: string]: number; }>({ }); + + function selectIndex(index: number) { + playerAvailability.value.forEach((value) => { + if (value.availability) { + selectedIndexAvailability.value[value.steamId] = value.availability[index] ?? 0; + } + }); + } const team = ref(); @@ -83,10 +92,12 @@ export const useScheduleStore = defineStore("schedule", () => { } watch(dateStart, () => { + selectedIndexAvailability.value = { }; fetchTeamSchedule(); }); watch(team, () => { + selectedIndexAvailability.value = { }; dateStart.value = getWindowStart(team.value); console.log(dateStart.value); }); @@ -145,6 +156,8 @@ export const useScheduleStore = defineStore("schedule", () => { hoveredMember, selectedMembers, hoveredIndex, + selectedIndexAvailability, + selectIndex, fetchSchedule, fetchTeamSchedule, saveSchedule, diff --git a/availabili.tf/src/views/ScheduleView.vue b/availabili.tf/src/views/ScheduleView.vue index 4a89faa..046f186 100644 --- a/availabili.tf/src/views/ScheduleView.vue +++ b/availabili.tf/src/views/ScheduleView.vue @@ -27,6 +27,7 @@ const availability = schedule.availability; const selectionMode = ref(1); const selectedTime = ref(undefined); +const selectedIndex = ref(undefined); const availabilityOverlay = computed(() => schedule.overlay);