Door opening logic into Calendar component
This commit is contained in:
parent
ce29116e88
commit
6f09010d0d
2 changed files with 11 additions and 27 deletions
|
@ -25,9 +25,7 @@
|
||||||
:key="`door-${index}`"
|
:key="`door-${index}`"
|
||||||
:door="door"
|
:door="door"
|
||||||
:visible="show_doors"
|
:visible="show_doors"
|
||||||
@doorClick="door_click"
|
@click="door_click(door.day)"
|
||||||
@doorSuccess="door_success"
|
|
||||||
@doorFailure="door_failure"
|
|
||||||
@touch="door_hover(door.day)"
|
@touch="door_hover(door.day)"
|
||||||
@mouseover="door_hover(door.day)"
|
@mouseover="door_hover(door.day)"
|
||||||
@touchend="door_unhover"
|
@touchend="door_unhover"
|
||||||
|
@ -78,20 +76,19 @@ export default class extends Vue {
|
||||||
this.figure_caption = this.idle_caption;
|
this.figure_caption = this.idle_caption;
|
||||||
}
|
}
|
||||||
|
|
||||||
public door_click() {
|
public door_click(day: number) {
|
||||||
if (this.multi_modal === undefined) return;
|
if (this.multi_modal === undefined) return;
|
||||||
this.multi_modal.show_progress();
|
this.multi_modal.show_progress();
|
||||||
}
|
|
||||||
|
|
||||||
public door_success(day: number, image_src: string) {
|
this.$advent22
|
||||||
if (this.multi_modal === undefined) return;
|
.api_get_blob(`user/image_${day}`)
|
||||||
this.multi_modal.show_image(image_src, this.$advent22.name_door(day));
|
.then((image_src) => {
|
||||||
}
|
this.multi_modal!.show_image(image_src, this.$advent22.name_door(day));
|
||||||
|
})
|
||||||
public door_failure(msg: string) {
|
.catch((error) => {
|
||||||
alert(msg);
|
alert(error);
|
||||||
if (this.multi_modal === undefined) return;
|
this.multi_modal!.set_active(false);
|
||||||
this.multi_modal.set_active(false);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
style="cursor: pointer"
|
style="cursor: pointer"
|
||||||
:variant="visible ? 'primary' : undefined"
|
:variant="visible ? 'primary' : undefined"
|
||||||
:rectangle="door.position"
|
:rectangle="door.position"
|
||||||
@click.left="on_click"
|
|
||||||
>
|
>
|
||||||
<div class="has-text-danger">{{ door.day }}</div>
|
<div class="has-text-danger">{{ door.day }}</div>
|
||||||
</SVGRect>
|
</SVGRect>
|
||||||
|
@ -26,21 +25,9 @@ import SVGRect from "./SVGRect.vue";
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
emits: ["doorClick", "doorSuccess", "doorFailure"],
|
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
public door!: Door;
|
public door!: Door;
|
||||||
public visible!: boolean;
|
public visible!: boolean;
|
||||||
|
|
||||||
public on_click() {
|
|
||||||
this.$emit("doorClick");
|
|
||||||
|
|
||||||
this.$advent22
|
|
||||||
.api_get_blob(`user/image_${this.door.day}`)
|
|
||||||
.then((data) => this.$emit("doorSuccess", this.door.day, data))
|
|
||||||
.catch((error) => {
|
|
||||||
this.$emit("doorFailure", this.$advent22.format_user_error(error));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue