Calendar: Use BulmaToast

This commit is contained in:
Jörn-Michael Miehe 2023-11-11 01:22:30 +00:00
parent 4cb17c1b6e
commit 835bc6d2d0

View file

@ -1,6 +1,32 @@
<template> <template>
<MultiModal @handle="modal_handle" /> <MultiModal @handle="modal_handle" />
<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>
<figure> <figure>
<div class="image is-unselectable"> <div class="image is-unselectable">
<img :src="$advent22.api_url('user/background_image')" /> <img :src="$advent22.api_url('user/background_image')" />
@ -25,6 +51,7 @@ import { Options, Vue } from "vue-class-component";
import MultiModal from "./MultiModal.vue"; import MultiModal from "./MultiModal.vue";
import BulmaButton from "./bulma/Button.vue"; import BulmaButton from "./bulma/Button.vue";
import BulmaToast from "./bulma/Toast.vue";
import CalendarDoor from "./calendar/CalendarDoor.vue"; import CalendarDoor from "./calendar/CalendarDoor.vue";
import ThouCanvas from "./calendar/ThouCanvas.vue"; import ThouCanvas from "./calendar/ThouCanvas.vue";
@ -32,6 +59,7 @@ import ThouCanvas from "./calendar/ThouCanvas.vue";
components: { components: {
MultiModal, MultiModal,
BulmaButton, BulmaButton,
BulmaToast,
ThouCanvas, ThouCanvas,
CalendarDoor, CalendarDoor,
}, },
@ -45,11 +73,29 @@ export default class extends Vue {
private multi_modal?: MultiModal; private multi_modal?: MultiModal;
public toast?: BulmaToast;
private toast_timeout?: number;
public modal_handle(modal: MultiModal) { public modal_handle(modal: MultiModal) {
this.multi_modal = modal; this.multi_modal = modal;
} }
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);
}
public door_click(day: number) { public door_click(day: number) {
if (this.toast_timeout !== undefined) clearTimeout(this.toast_timeout);
this.toast?.hide();
if (this.multi_modal === undefined) return; if (this.multi_modal === undefined) return;
this.multi_modal.show_progress(); this.multi_modal.show_progress();