diff --git a/ui/src/components/LoginModal.vue b/ui/src/components/LoginModal.vue
index 3dbe89b..8f537a5 100644
--- a/ui/src/components/LoginModal.vue
+++ b/ui/src/components/LoginModal.vue
@@ -16,7 +16,7 @@
ref="username_input"
class="input"
type="text"
- v-model="username"
+ v-model="creds[0]"
/>
@@ -24,7 +24,7 @@
@@ -33,13 +33,13 @@
@@ -60,11 +60,10 @@ const emit = defineEmits<{
(event: "cancel"): void;
}>();
-const username = ref("");
-const password = ref("");
+const creds = ref(["", ""]);
function submit(): void {
- emit("submit", [username.value, password.value]);
+ emit("submit", creds.value);
}
function cancel(): void {
diff --git a/ui/src/components/MultiModal.vue b/ui/src/components/MultiModal.vue
index 904bf69..b3102bb 100644
--- a/ui/src/components/MultiModal.vue
+++ b/ui/src/components/MultiModal.vue
@@ -39,7 +39,6 @@ export type HMultiModal = {
show_image(src: string, caption: string): void;
show_loading(): void;
hide(): void;
- dismiss(): void;
};
const emit = defineEmits<{
@@ -65,7 +64,6 @@ onMounted(() => {
state.value = { show: "loading" };
},
hide,
- dismiss,
});
const on_keydown = (e: KeyboardEvent) => {
diff --git a/ui/src/components/admin/ConfigView.vue b/ui/src/components/admin/ConfigView.vue
index f69b25e..6681246 100644
--- a/ui/src/components/admin/ConfigView.vue
+++ b/ui/src/components/admin/ConfigView.vue
@@ -254,7 +254,7 @@ async function on_open(): Promise {
API.request("admin/doors"),
]);
- void store_update;
+ void store_update; // discard value
admin_config_model.value = new_admin_config_model;
doors.value = new_doors;
}
diff --git a/ui/src/components/editor/DoorCanvas.vue b/ui/src/components/editor/DoorCanvas.vue
index 58ddc5f..a049285 100644
--- a/ui/src/components/editor/DoorCanvas.vue
+++ b/ui/src/components/editor/DoorCanvas.vue
@@ -50,26 +50,20 @@ const preview_visible = computed(() => state.value.kind !== "idle");
function pop_door(point: Vector2D): VueLike | undefined {
const idx = model.value.findIndex((rect) => rect.position.contains(point));
- if (idx === -1) {
- return;
- }
+ if (idx === -1) return;
return model.value.splice(idx, 1)[0];
}
function draw_start(event: MouseEvent, point: Vector2D): void {
- if (preview_visible.value) {
- return;
- }
+ if (preview_visible.value) return;
preview.value = new Rectangle(point, point);
state.value = { kind: "drawing" };
}
function draw_finish(): void {
- if (state.value.kind !== "drawing") {
- return;
- }
+ if (state.value.kind !== "drawing") return;
if (preview.value.area >= MIN_RECT_AREA) {
model.value.push(new Door(preview.value));
@@ -79,15 +73,11 @@ function draw_finish(): void {
}
function drag_start(event: MouseEvent, point: Vector2D): void {
- if (preview_visible.value) {
- return;
- }
+ if (preview_visible.value) return;
const drag_door = pop_door(point);
- if (drag_door === undefined) {
- return;
- }
+ if (drag_door === undefined) return;
preview.value = drag_door.position;
@@ -95,9 +85,7 @@ function drag_start(event: MouseEvent, point: Vector2D): void {
}
function drag_finish(): void {
- if (state.value.kind !== "dragging") {
- return;
- }
+ if (state.value.kind !== "dragging") return;
model.value.push(new Door(preview.value, state.value.door.day));
@@ -114,9 +102,7 @@ function on_mousemove(event: MouseEvent, point: Vector2D): void {
}
function remove_rect(event: MouseEvent, point: Vector2D): void {
- if (preview_visible.value) {
- return;
- }
+ if (preview_visible.value) return;
pop_door(point);
}
diff --git a/ui/src/components/editor/PreviewDoor.vue b/ui/src/components/editor/PreviewDoor.vue
index 0c7ef61..b709c46 100644
--- a/ui/src/components/editor/PreviewDoor.vue
+++ b/ui/src/components/editor/PreviewDoor.vue
@@ -41,9 +41,7 @@ function toggle_editing(): void {
}
function on_click(event: MouseEvent): void {
- if (!(event.target instanceof HTMLDivElement)) {
- return;
- }
+ if (!(event.target instanceof HTMLDivElement)) return;
if (editing.value) {
unwrap_vuelike(model.value).day = day_str.value;
@@ -58,9 +56,7 @@ function on_click(event: MouseEvent): void {
}
function on_keydown(event: KeyboardEvent): void {
- if (!editing.value) {
- return;
- }
+ if (!editing.value) return;
if (event.key === "Enter") {
unwrap_vuelike(model.value).day = day_str.value;
diff --git a/ui/src/lib/store.ts b/ui/src/lib/store.ts
index be98bf7..c1150d1 100644
--- a/ui/src/lib/store.ts
+++ b/ui/src/lib/store.ts
@@ -76,7 +76,7 @@ export const advent22Store = defineStore({
API.request("user/doors"),
API.request("user/next_door"),
]);
- is_admin; // discard value
+ void is_admin; // discard value
document.title = site_config.title;
@@ -116,7 +116,8 @@ export const advent22Store = defineStore({
},
logout() {
- return this.login(["", ""]);
+ API.creds = { username: "", password: "" };
+ this.is_admin = false;
},
toggle_touch_device(): void {