From 42c9883831e7c1b929b3b7a5614a81dc422934d9 Mon Sep 17 00:00:00 2001 From: Gorbachev Egor <7gorbachevm@gmail.com> Date: Fri, 17 Nov 2023 16:32:56 +0700 Subject: [PATCH] optimize inputs --- .../keyboard}/useMacTabNavigationFix.tsx | 6 +++++- src/screens/deck-form/card-form-view.tsx | 6 +++--- src/screens/deck-form/deck-form.tsx | 6 +++--- src/screens/deck-form/quick-add-card-form.tsx | 2 +- src/screens/shared/version-warning.tsx | 2 +- src/screens/user-settings/settings-row.tsx | 2 +- .../user-settings/user-settings-main.tsx | 10 ++++++---- src/store/deck-form-store.test.ts | 2 +- src/store/deck-form-store.ts | 2 +- src/store/quick-add-card-form-store.ts | 10 +++++++--- src/ui/input.tsx | 17 ++++++++--------- 11 files changed, 37 insertions(+), 28 deletions(-) rename src/{screens => lib/keyboard}/useMacTabNavigationFix.tsx (90%) diff --git a/src/screens/useMacTabNavigationFix.tsx b/src/lib/keyboard/useMacTabNavigationFix.tsx similarity index 90% rename from src/screens/useMacTabNavigationFix.tsx rename to src/lib/keyboard/useMacTabNavigationFix.tsx index 2e146795..56a0057d 100644 --- a/src/screens/useMacTabNavigationFix.tsx +++ b/src/lib/keyboard/useMacTabNavigationFix.tsx @@ -28,7 +28,11 @@ export const useMacTabNavigationFix = () => { // Shift + Tab was pressed // @ts-expect-error inputs[currentIndex - 1].focus(); - } else if (!event.shiftKey && currentIndex >= 0 && currentIndex < inputs.length - 1) { + } else if ( + !event.shiftKey && + currentIndex >= 0 && + currentIndex < inputs.length - 1 + ) { // Only Tab was pressed // @ts-expect-error inputs[currentIndex + 1].focus(); diff --git a/src/screens/deck-form/card-form-view.tsx b/src/screens/deck-form/card-form-view.tsx index d1447b1f..ff1ef0c1 100644 --- a/src/screens/deck-form/card-form-view.tsx +++ b/src/screens/deck-form/card-form-view.tsx @@ -24,15 +24,15 @@ export const CardFormView = observer((props: Props) => { >

Add card

); diff --git a/src/screens/deck-form/deck-form.tsx b/src/screens/deck-form/deck-form.tsx index dc81b3f9..a32c90f0 100644 --- a/src/screens/deck-form/deck-form.tsx +++ b/src/screens/deck-form/deck-form.tsx @@ -12,7 +12,7 @@ import { useMount } from "../../lib/react/use-mount.ts"; import { useBackButton } from "../../lib/telegram/use-back-button.tsx"; import { useTelegramProgress } from "../../lib/telegram/use-telegram-progress.tsx"; import { assert } from "../../lib/typescript/assert.ts"; -import { useMacTabNavigationFix } from "../useMacTabNavigationFix.tsx"; +import { useMacTabNavigationFix } from "../../lib/keyboard/useMacTabNavigationFix.tsx"; export const DeckForm = observer(() => { const deckFormStore = useDeckFormStore(); @@ -49,12 +49,12 @@ export const DeckForm = observer(() => { {screen.deckId ? "Edit deck" : "Add deck"}