feat(common): move confirmation modal to his own store, and add 'onClosed' event
This commit is contained in:
@@ -22,7 +22,7 @@ export const useButtonNavigation = <T extends Record<string, ButtonConfig>>({
|
||||
>;
|
||||
disabled?: Ref<boolean>;
|
||||
}) => {
|
||||
const { state: modalState } = useConfirmationModal();
|
||||
const confirmationModal = useConfirmationModal();
|
||||
|
||||
const selectedButton = ref(initialButton);
|
||||
const selectorPosition = computed(() => buttons[selectedButton.value]!);
|
||||
@@ -32,7 +32,7 @@ export const useButtonNavigation = <T extends Record<string, ButtonConfig>>({
|
||||
const { onClick } = useScreen();
|
||||
|
||||
onClick((x: number, y: number) => {
|
||||
if (modalState.value.isOpen || disabled?.value) return;
|
||||
if (confirmationModal.isOpen || disabled?.value) return;
|
||||
|
||||
for (const [buttonName, config] of Object.entries(buttons) as [
|
||||
keyof T,
|
||||
@@ -60,7 +60,7 @@ export const useButtonNavigation = <T extends Record<string, ButtonConfig>>({
|
||||
});
|
||||
|
||||
useKeyDown((key) => {
|
||||
if (modalState.value.isOpen || disabled?.value) return;
|
||||
if (confirmationModal.isOpen || disabled?.value) return;
|
||||
|
||||
const currentButton = selectedButton.value as keyof T;
|
||||
const currentNav = navigation[currentButton];
|
||||
|
||||
Reference in New Issue
Block a user