advent22/ui/src/components/calendar/CalendarDoor.vue

41 lines
815 B
Vue
Raw Normal View History

2022-10-30 01:27:46 +00:00
<template>
2023-09-07 02:12:17 +00:00
<SVGRect :rectangle="door.position" :focused="false" @click.left="on_click" />
2022-10-30 01:27:46 +00:00
</template>
<script lang="ts">
2023-09-07 02:08:56 +00:00
import { Door } from "@/lib/door";
2023-09-06 16:25:35 +00:00
import { Options, Vue } from "vue-class-component";
2023-09-07 00:41:38 +00:00
2023-09-07 02:08:56 +00:00
import SVGRect from "./SVGRect.vue";
2022-10-30 01:27:46 +00:00
@Options({
2023-09-07 00:41:38 +00:00
components: {
SVGRect,
},
2022-10-30 01:27:46 +00:00
props: {
2023-09-07 00:41:38 +00:00
door: Door,
2022-10-30 01:27:46 +00:00
},
2023-09-07 01:17:14 +00:00
emits: ["doorClick", "doorSuccess", "doorFailure"],
2022-10-30 01:27:46 +00:00
})
2023-01-24 23:18:09 +00:00
export default class extends Vue {
2023-09-07 00:41:38 +00:00
public door!: Door;
2022-10-30 03:10:07 +00:00
2023-09-06 16:25:35 +00:00
public on_click() {
2023-09-07 00:41:38 +00:00
this.$emit("doorClick");
2023-09-06 18:44:19 +00:00
2023-09-07 15:12:46 +00:00
this.$advent22
2023-09-12 20:51:26 +00:00
.api_get_blob(`user/image_${this.door.day}`)
2023-09-12 17:42:02 +00:00
.then((data) => this.$emit("doorSuccess", this.door.day, data))
2023-09-13 15:24:25 +00:00
.catch((error) => {
this.$emit("doorFailure", this.$advent22.format_user_error(error));
2023-09-07 15:12:46 +00:00
});
}
2022-10-30 01:27:46 +00:00
}
</script>
2023-09-07 00:41:38 +00:00
2023-09-09 21:41:06 +00:00
<style scoped>
2023-09-07 00:41:38 +00:00
rect {
cursor: pointer;
}
2023-09-07 01:17:14 +00:00
</style>