From 620394c224b489eb5918ab120e9499cc56e7eefa Mon Sep 17 00:00:00 2001 From: O3H Date: Wed, 23 Oct 2024 03:29:21 +0100 Subject: [PATCH] Pressing ESC to open overlay now works across the app. Pressing the 'Escape' key now closes all open dialogs (though there should only ever be 1). Due to this, the logic in `AppInfoOverlay` has been removed. --- frontend/src/App.vue | 31 ++++++++++++++++++- .../src/components/general/AppInfoOverlay.vue | 16 ---------- frontend/src/composables/dialog.ts | 17 ++++------ frontend/src/types/primevue.ts | 10 +++--- 4 files changed, 41 insertions(+), 33 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 38aec34..dcea524 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,5 +1,5 @@ diff --git a/frontend/src/components/general/AppInfoOverlay.vue b/frontend/src/components/general/AppInfoOverlay.vue index a405767..a2c2841 100644 --- a/frontend/src/components/general/AppInfoOverlay.vue +++ b/frontend/src/components/general/AppInfoOverlay.vue @@ -3,27 +3,11 @@ import { version } from "@frontend/package.json" with { type: "json" } import { CardOverlay } from "@components" import { useDialog } from "@composables" -import { onMounted, onUnmounted } from "vue" const { setVisible, visible, closable, draggable } = useDialog('app-info') - -const onEscape = (e: KeyboardEvent) => { - if (!visible.value) return - if (e.key == "Escape") setVisible(false) - - console.log(e) -} - -onMounted(() => { - window.addEventListener("keydown", onEscape) -}) - -onUnmounted(() => { - window.removeEventListener("keydown", onEscape) -})