feat(common): implement buttons and confirmation modal

This commit is contained in:
2025-12-19 19:15:24 +01:00
parent 0c40597b04
commit 303b8e8790
9 changed files with 229 additions and 0 deletions

View File

@@ -20,12 +20,16 @@ export const useButtonNavigation = <T extends Record<string, ButtonConfig>>({
}
>;
}) => {
const { state: modalState } = useConfirmationModal();
const selectedButton = ref(initialButton);
const selectorPosition = computed(() => buttons[selectedButton.value]!);
const nextButton = ref<keyof T | undefined>();
useScreenClick((x: number, y: number) => {
if (modalState.value.isOpen) return;
for (const [buttonName, config] of Object.entries(buttons) as [
keyof T,
ButtonConfig,
@@ -52,6 +56,8 @@ export const useButtonNavigation = <T extends Record<string, ButtonConfig>>({
});
useKeyDown((key) => {
if (modalState.value.isOpen) return;
const currentButton = selectedButton.value as keyof T;
const currentNav = navigation[currentButton];