2023-09-07 00:41:38 +00:00
|
|
|
<template>
|
2023-09-14 14:20:21 +00:00
|
|
|
<MultiModal @handle="modal_handle" />
|
2023-09-07 00:41:38 +00:00
|
|
|
|
2023-09-09 23:52:58 +00:00
|
|
|
<figure>
|
2023-10-27 20:52:06 +00:00
|
|
|
<div class="level">
|
2023-10-27 14:40:25 +00:00
|
|
|
<div class="level-left">
|
|
|
|
<figcaption class="level-item has-text-primary-dark">
|
|
|
|
{{ figure_caption }}
|
2023-11-01 01:29:37 +00:00
|
|
|
<template v-if="next_door !== null">
|
|
|
|
<br />
|
|
|
|
Zeit zum nächsten Türchen: <CountDown :millis="next_door" />
|
|
|
|
</template>
|
2023-10-27 14:40:25 +00:00
|
|
|
</figcaption>
|
|
|
|
</div>
|
|
|
|
<div class="level-right">
|
2023-10-27 20:52:06 +00:00
|
|
|
<div class="level-item">
|
|
|
|
<BulmaButton
|
|
|
|
class="tag is-warning is-outlined"
|
|
|
|
text="Türchen anzeigen"
|
|
|
|
:icon="'fa-solid fa-toggle-' + (show_doors ? 'on' : 'off')"
|
|
|
|
@click.left="show_doors = !show_doors"
|
|
|
|
/>
|
|
|
|
</div>
|
2023-10-27 14:40:25 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-09-09 23:52:58 +00:00
|
|
|
<div class="image is-unselectable">
|
2023-09-12 20:51:26 +00:00
|
|
|
<img :src="$advent22.api_url('user/background_image')" />
|
2023-09-09 23:52:58 +00:00
|
|
|
<ThouCanvas>
|
|
|
|
<CalendarDoor
|
|
|
|
v-for="(door, index) in doors"
|
|
|
|
:key="`door-${index}`"
|
|
|
|
:door="door"
|
2023-10-27 14:40:25 +00:00
|
|
|
:visible="show_doors"
|
2023-10-27 15:37:21 +00:00
|
|
|
@click="door_click(door.day)"
|
2023-09-09 23:52:58 +00:00
|
|
|
@touch="door_hover(door.day)"
|
|
|
|
@mouseover="door_hover(door.day)"
|
|
|
|
@touchend="door_unhover"
|
|
|
|
@mouseout="door_unhover"
|
|
|
|
/>
|
|
|
|
</ThouCanvas>
|
|
|
|
</div>
|
2023-09-09 23:08:43 +00:00
|
|
|
</figure>
|
2023-09-07 00:41:38 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2023-09-07 02:08:56 +00:00
|
|
|
import { Door } from "@/lib/door";
|
2023-09-07 00:41:38 +00:00
|
|
|
import { Options, Vue } from "vue-class-component";
|
|
|
|
|
2023-11-01 01:29:37 +00:00
|
|
|
import CountDown from "./CountDown.vue";
|
2023-09-13 16:08:05 +00:00
|
|
|
import MultiModal from "./MultiModal.vue";
|
2023-10-27 14:40:25 +00:00
|
|
|
import BulmaButton from "./bulma/Button.vue";
|
2023-09-07 02:08:56 +00:00
|
|
|
import CalendarDoor from "./calendar/CalendarDoor.vue";
|
|
|
|
import ThouCanvas from "./calendar/ThouCanvas.vue";
|
2023-09-07 00:41:38 +00:00
|
|
|
|
|
|
|
@Options({
|
|
|
|
components: {
|
2023-11-01 01:29:37 +00:00
|
|
|
CountDown,
|
2023-09-07 00:41:38 +00:00
|
|
|
MultiModal,
|
2023-10-27 14:40:25 +00:00
|
|
|
BulmaButton,
|
2023-09-07 00:41:38 +00:00
|
|
|
ThouCanvas,
|
|
|
|
CalendarDoor,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
doors: Array,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
export default class extends Vue {
|
|
|
|
public readonly doors!: Door[];
|
2023-09-09 23:52:58 +00:00
|
|
|
private readonly idle_caption = "Finde die Türchen auf dem Adventskalender!";
|
2023-09-14 14:20:21 +00:00
|
|
|
|
2023-10-27 14:40:25 +00:00
|
|
|
public show_doors = false;
|
2023-09-14 14:20:21 +00:00
|
|
|
private multi_modal?: MultiModal;
|
2023-09-09 23:52:58 +00:00
|
|
|
public figure_caption = this.idle_caption;
|
2023-11-01 01:29:37 +00:00
|
|
|
public next_door: number | null = null;
|
|
|
|
|
|
|
|
public mounted(): void {
|
|
|
|
this.$advent22
|
|
|
|
.api_get<number | null>("user/next_door")
|
|
|
|
.then((next_door) => (this.next_door = next_door))
|
|
|
|
.catch((error) => alert(this.$advent22.format_user_error(error)));
|
|
|
|
}
|
2023-09-07 00:41:38 +00:00
|
|
|
|
2023-09-14 14:20:21 +00:00
|
|
|
public modal_handle(modal: MultiModal) {
|
|
|
|
this.multi_modal = modal;
|
|
|
|
}
|
2023-09-07 00:41:38 +00:00
|
|
|
|
2023-09-12 14:55:08 +00:00
|
|
|
public door_hover(day: number) {
|
2023-09-12 17:46:09 +00:00
|
|
|
this.figure_caption = this.$advent22.name_door(day);
|
2023-09-09 23:52:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public door_unhover() {
|
|
|
|
this.figure_caption = this.idle_caption;
|
|
|
|
}
|
|
|
|
|
2023-10-27 15:37:21 +00:00
|
|
|
public door_click(day: number) {
|
2023-09-14 14:20:21 +00:00
|
|
|
if (this.multi_modal === undefined) return;
|
|
|
|
this.multi_modal.show_progress();
|
2023-09-07 00:41:38 +00:00
|
|
|
|
2023-10-27 15:37:21 +00:00
|
|
|
this.$advent22
|
|
|
|
.api_get_blob(`user/image_${day}`)
|
|
|
|
.then((image_src) => {
|
|
|
|
this.multi_modal!.show_image(image_src, this.$advent22.name_door(day));
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
alert(error);
|
|
|
|
this.multi_modal!.set_active(false);
|
|
|
|
});
|
2023-09-07 00:41:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|