From f482fd4ec1683d6e6659a51576de290b06d31288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Sun, 30 Nov 2025 18:09:08 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20wip=20on=20ui:=20rework=20for=20?= =?UTF-8?q?vue=203=20composition=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/components/Calendar.vue | 3 +- ui/src/components/admin/AdminView.vue | 13 +- ui/src/components/admin/CalendarAssistant.vue | 96 +++++------ ui/src/components/admin/ConfigView.vue | 153 +++++++++--------- ui/src/components/bulma/Breadcrumbs.vue | 2 +- ui/src/components/bulma/Drawer.vue | 16 +- ui/src/components/bulma/Secret.vue | 2 +- ui/src/components/bulma/Toast.vue | 20 +-- ui/src/components/calendar/SVGRect.vue | 3 + ui/src/lib/model.ts | 3 +- 10 files changed, 140 insertions(+), 171 deletions(-) diff --git a/ui/src/components/Calendar.vue b/ui/src/components/Calendar.vue index 40e4043..52c7bff 100644 --- a/ui/src/components/Calendar.vue +++ b/ui/src/components/Calendar.vue @@ -45,14 +45,13 @@ - diff --git a/ui/src/components/admin/CalendarAssistant.vue b/ui/src/components/admin/CalendarAssistant.vue index 2bf9297..2d30b25 100644 --- a/ui/src/components/admin/CalendarAssistant.vue +++ b/ui/src/components/admin/CalendarAssistant.vue @@ -36,7 +36,7 @@ :key="`btn-${day}`" :class="'tag is-' + (data.part === '' ? 'warning' : 'info')" icon="fa-solid fa-door-open" - :text="day" + :text="day.toString()" @click.left="door_click(day)" /> @@ -45,74 +45,64 @@ - diff --git a/ui/src/components/admin/ConfigView.vue b/ui/src/components/admin/ConfigView.vue index ea4372f..b91722b 100644 --- a/ui/src/components/admin/ConfigView.vue +++ b/ui/src/components/admin/ConfigView.vue @@ -183,105 +183,96 @@ - diff --git a/ui/src/components/bulma/Breadcrumbs.vue b/ui/src/components/bulma/Breadcrumbs.vue index 57f32e3..dd0f192 100644 --- a/ui/src/components/bulma/Breadcrumbs.vue +++ b/ui/src/components/bulma/Breadcrumbs.vue @@ -28,7 +28,7 @@ const props = defineProps<{ }>(); const emit = defineEmits<{ - "update:modelValue": [number]; + (event: "update:modelValue", value: number): void; }>(); function change_step(next_step: number) { diff --git a/ui/src/components/bulma/Drawer.vue b/ui/src/components/bulma/Drawer.vue index 6250e0e..7d2e586 100644 --- a/ui/src/components/bulma/Drawer.vue +++ b/ui/src/components/bulma/Drawer.vue @@ -53,12 +53,7 @@ withDefaults( ); const emit = defineEmits<{ - open: [ - { - ready(): void; - fail(): void; - }, - ]; + (event: "open", ready: () => void, fail: () => void): void; }>(); const is_open = ref(false); @@ -70,10 +65,11 @@ function toggle() { if (is_open.value) { state.value = "loading"; - emit("open", { - ready: () => (state.value = "ready"), - fail: () => (state.value = "failed"), - }); + emit( + "open", + () => (state.value = "ready"), + () => (state.value = "failed"), + ); } } diff --git a/ui/src/components/bulma/Secret.vue b/ui/src/components/bulma/Secret.vue index 845c685..a691b54 100644 --- a/ui/src/components/bulma/Secret.vue +++ b/ui/src/components/bulma/Secret.vue @@ -16,7 +16,7 @@ import { ref } from "vue"; import BulmaButton from "./Button.vue"; const emit = defineEmits<{ - load: []; + (event: "load"): void; }>(); const state = ref<"start" | "click" | "show">("start"); diff --git a/ui/src/components/bulma/Toast.vue b/ui/src/components/bulma/Toast.vue index 3e9dcf4..86d9ec2 100644 --- a/ui/src/components/bulma/Toast.vue +++ b/ui/src/components/bulma/Toast.vue @@ -12,19 +12,19 @@ import * as bulmaToast from "bulma-toast"; import { onMounted, ref } from "vue"; const emit = defineEmits<{ - handle: [ - { - show(options: bulmaToast.Options): void; - hide(): void; - }, - ]; + ( + event: "handle", + show: (options: bulmaToast.Options) => void, + hide: () => void, + ): void; }>(); const message = ref(null); onMounted(() => - emit("handle", { - show(options: bulmaToast.Options = {}) { + emit( + "handle", + (options: bulmaToast.Options = {}) => { if (!(message.value instanceof HTMLElement)) return; bulmaToast.toast({ @@ -33,7 +33,7 @@ onMounted(() => message: message.value, }); }, - hide() { + () => { if (!(message.value instanceof HTMLElement)) return; const toast_div = message.value.parentElement; @@ -44,6 +44,6 @@ onMounted(() => dbutton.click(); }, - }), + ), ); diff --git a/ui/src/components/calendar/SVGRect.vue b/ui/src/components/calendar/SVGRect.vue index 7350a51..d167abc 100644 --- a/ui/src/components/calendar/SVGRect.vue +++ b/ui/src/components/calendar/SVGRect.vue @@ -49,6 +49,9 @@ function get_bg_aspect_ratio(): number { if (!loading_success(store.background_image)) return 1; return store.background_image.height / store.background_image.width; + + // aspect_ratio is width/height! + // return store.background_image.aspect_ratio; } diff --git a/ui/src/lib/model.ts b/ui/src/lib/model.ts index 2a0b0e9..6f24170 100644 --- a/ui/src/lib/model.ts +++ b/ui/src/lib/model.ts @@ -58,8 +58,9 @@ export interface DoorSaved { } export interface ImageData { - height: number; width: number; + height: number; + aspect_ratio: number; data_url: string; }