mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-24 06:28:34 +01:00
ProductBarcode: architecture: move to strongly typed DialogID and parameters
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { DialogID } from "@/components/ui/dialog-provider/utils";
|
||||
import {
|
||||
CommandDialog,
|
||||
CommandInput,
|
||||
@@ -14,7 +15,7 @@
|
||||
|
||||
export type QuickMenuAction =
|
||||
| { text: string; href: string; type: "navigate" }
|
||||
| { text: string; dialogId: string; shortcut: string; type: "create" };
|
||||
| { text: string; dialogId: DialogID; shortcut: string; type: "create" };
|
||||
|
||||
const props = defineProps({
|
||||
actions: {
|
||||
@@ -27,11 +28,11 @@
|
||||
const { t } = useI18n();
|
||||
const { closeDialog, openDialog } = useDialog();
|
||||
|
||||
useDialogHotkey("quick-menu", { code: "Backquote", ctrl: true });
|
||||
useDialogHotkey(DialogID.QuickMenu, { code: "Backquote", ctrl: true });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CommandDialog dialog-id="quick-menu">
|
||||
<CommandDialog :dialog-id="DialogID.QuickMenu">
|
||||
<CommandInput
|
||||
:placeholder="t('components.quick_menu.shortcut_hint')"
|
||||
@keydown="
|
||||
@@ -44,7 +45,7 @@
|
||||
// if esc is pressed, close the dialog
|
||||
if (e.key === 'Escape') {
|
||||
e.preventDefault();
|
||||
closeDialog('quick-menu');
|
||||
closeDialog(DialogID.QuickMenu);
|
||||
}
|
||||
}
|
||||
"
|
||||
@@ -76,7 +77,7 @@
|
||||
:value="`global.navigate_${i + 1}`"
|
||||
@select="
|
||||
() => {
|
||||
closeDialog('quick-menu');
|
||||
closeDialog(DialogID.QuickMenu);
|
||||
navigateTo(navigate.href);
|
||||
}
|
||||
"
|
||||
@@ -87,8 +88,8 @@
|
||||
value="scanner"
|
||||
@select="
|
||||
() => {
|
||||
closeDialog('quick-menu');
|
||||
openDialog('scanner');
|
||||
closeDialog(DialogID.QuickMenu);
|
||||
openDialog(DialogID.Scanner);
|
||||
}
|
||||
"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user