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-11-11 01:22:30 +00:00
|
|
|
<BulmaToast @handle="toast_handle" class="content">
|
|
|
|
<p>
|
|
|
|
Du hast noch keine Türchen geöffnet, vielleicht gibt es ein Anzeigeproblem
|
|
|
|
in Deinem Webbrowser?
|
|
|
|
</p>
|
|
|
|
<div class="level">
|
|
|
|
<div class="level-item">
|
|
|
|
<BulmaButton
|
|
|
|
class="is-success"
|
|
|
|
text="Türchen anzeigen"
|
|
|
|
@click.left="
|
|
|
|
store.is_touch_device = true;
|
|
|
|
toast?.hide();
|
|
|
|
"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div class="level-item">
|
|
|
|
<BulmaButton
|
|
|
|
class="is-danger"
|
|
|
|
text="Ich möchte selbst suchen"
|
|
|
|
@click.left="toast?.hide()"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</BulmaToast>
|
|
|
|
|
2023-09-09 23:52:58 +00:00
|
|
|
<figure>
|
|
|
|
<div class="image is-unselectable">
|
2023-11-11 01:44:13 +00:00
|
|
|
<img :src="store.calendar_background_image" />
|
2023-09-09 23:52:58 +00:00
|
|
|
<ThouCanvas>
|
|
|
|
<CalendarDoor
|
|
|
|
v-for="(door, index) in doors"
|
|
|
|
:key="`door-${index}`"
|
|
|
|
:door="door"
|
2023-11-01 23:58:09 +00:00
|
|
|
:visible="store.is_touch_device"
|
2023-11-09 18:48:13 +00:00
|
|
|
:title="$advent22.name_door(door.day)"
|
2023-10-27 15:37:21 +00:00
|
|
|
@click="door_click(door.day)"
|
2023-09-09 23:52:58 +00:00
|
|
|
/>
|
|
|
|
</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-11-01 23:58:09 +00:00
|
|
|
import { advent22Store } from "@/plugins/store";
|
2023-09-07 00:41:38 +00:00
|
|
|
import { Options, Vue } from "vue-class-component";
|
|
|
|
|
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-11-11 01:22:30 +00:00
|
|
|
import BulmaToast from "./bulma/Toast.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: {
|
|
|
|
MultiModal,
|
2023-10-27 14:40:25 +00:00
|
|
|
BulmaButton,
|
2023-11-11 01:22:30 +00:00
|
|
|
BulmaToast,
|
2023-09-07 00:41:38 +00:00
|
|
|
ThouCanvas,
|
|
|
|
CalendarDoor,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
doors: Array,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
export default class extends Vue {
|
|
|
|
public readonly doors!: Door[];
|
2023-11-01 23:58:09 +00:00
|
|
|
public readonly store = advent22Store();
|
2023-09-14 14:20:21 +00:00
|
|
|
|
|
|
|
private multi_modal?: MultiModal;
|
2023-09-07 00:41:38 +00:00
|
|
|
|
2023-11-11 01:22:30 +00:00
|
|
|
public toast?: BulmaToast;
|
|
|
|
private toast_timeout?: number;
|
|
|
|
|
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-11-11 01:22:30 +00:00
|
|
|
public toast_handle(toast: BulmaToast) {
|
|
|
|
this.toast = toast;
|
|
|
|
|
|
|
|
if (this.store.is_touch_device) return;
|
|
|
|
|
|
|
|
this.toast_timeout = setTimeout(() => {
|
|
|
|
if (this.store.user_doors.length === 0) return;
|
|
|
|
|
|
|
|
this.toast!.show({ duration: 600000, type: "is-warning" });
|
|
|
|
}, 10000);
|
|
|
|
}
|
|
|
|
|
2023-10-27 15:37:21 +00:00
|
|
|
public door_click(day: number) {
|
2023-11-11 01:22:30 +00:00
|
|
|
if (this.toast_timeout !== undefined) clearTimeout(this.toast_timeout);
|
|
|
|
this.toast?.hide();
|
|
|
|
|
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);
|
2023-11-01 02:00:23 +00:00
|
|
|
this.multi_modal!.hide();
|
2023-10-27 15:37:21 +00:00
|
|
|
});
|
2023-09-07 00:41:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|