Skip to content

A local-first personal finance app

Maintenance: CreateAccount and CreateEncryptionKey to tsx (#1755)

Michael Clarkf6e2d3b1f3dc
diff --git a/packages/desktop-client/src/components/autocomplete/Autocomplete.tsx b/packages/desktop-client/src/components/autocomplete/Autocomplete.tsx
index 7f8365474f..8a903955df 100644
--- a/packages/desktop-client/src/components/autocomplete/Autocomplete.tsx
+++ b/packages/desktop-client/src/components/autocomplete/Autocomplete.tsx
@@ -398,7 +398,7 @@ function SingleAutocomplete({
},
onBlur: e => {
// Should this be e.nativeEvent
- e.preventDownshiftDefault = true;
+ e['preventDownshiftDefault'] = true;
inputProps.onBlur?.(e);
if (!closeOnBlur) return;
diff --git a/packages/desktop-client/src/components/common/Input.tsx b/packages/desktop-client/src/components/common/Input.tsx
index 6e0cbbcda9..c02b9bd86c 100644
--- a/packages/desktop-client/src/components/common/Input.tsx
+++ b/packages/desktop-client/src/components/common/Input.tsx
@@ -2,7 +2,7 @@ import React, {
useRef,
type KeyboardEvent,
type Ref,
- type HTMLProps,
+ type InputHTMLAttributes,
} from 'react';
import mergeRefs from 'react-merge-refs';
@@ -21,7 +21,7 @@ export const defaultInputStyle = {
border: '1px solid ' + theme.formInputBorder,
};
-type InputProps = HTMLProps<HTMLInputElement> & {
+type InputProps = InputHTMLAttributes<HTMLInputElement> & {
style?: CSSProperties;
inputRef?: Ref<HTMLInputElement>;
onEnter?: (event: KeyboardEvent<HTMLInputElement>) => void;
diff --git a/packages/desktop-client/src/components/modals/CreateAccount.js b/packages/desktop-client/src/components/modals/CreateAccount.tsx
similarity index 100%
rename from packages/desktop-client/src/components/modals/CreateAccount.js
rename to packages/desktop-client/src/components/modals/CreateAccount.tsx
diff --git a/packages/desktop-client/src/components/modals/CreateEncryptionKey.js b/packages/desktop-client/src/components/modals/CreateEncryptionKey.tsx
similarity index 95%
rename from packages/desktop-client/src/components/modals/CreateEncryptionKey.js
rename to packages/desktop-client/src/components/modals/CreateEncryptionKey.tsx
index 9ead88f342..eb1f647183 100644
--- a/packages/desktop-client/src/components/modals/CreateEncryptionKey.js
+++ b/packages/desktop-client/src/components/modals/CreateEncryptionKey.tsx
@@ -5,7 +5,9 @@ import { css } from 'glamor';
import { send } from 'loot-core/src/platform/client/fetch';
import { getCreateKeyError } from 'loot-core/src/shared/errors';
+import { type BoundActions } from '../../hooks/useActions';
import { theme } from '../../style';
+import { type CommonModalProps } from '../../types/modals';
import { ButtonWithLoading } from '../common/Button';
import ExternalLink from '../common/ExternalLink';
import InitialFocus from '../common/InitialFocus';
@@ -15,11 +17,19 @@ import Paragraph from '../common/Paragraph';
import Text from '../common/Text';
import View from '../common/View';
+type CreateEncryptionKeyProps = {
+ modalProps: CommonModalProps;
+ actions: BoundActions;
+ options: {
+ recreate?: boolean;
+ };
+};
+
export default function CreateEncryptionKey({
modalProps,
actions,
options = {},
-}) {
+}: CreateEncryptionKeyProps) {
let [password, setPassword] = useState('');
let [loading, setLoading] = useState(false);
let [error, setError] = useState('');
diff --git a/packages/desktop-client/src/components/modals/countries.js b/packages/desktop-client/src/components/modals/countries.ts
similarity index 100%
rename from packages/desktop-client/src/components/modals/countries.js
rename to packages/desktop-client/src/components/modals/countries.ts
diff --git a/packages/loot-core/src/types/handlers.d.ts b/packages/loot-core/src/types/handlers.d.ts
index 802e0d3bec..2537c02796 100644
--- a/packages/loot-core/src/types/handlers.d.ts
+++ b/packages/loot-core/src/types/handlers.d.ts
@@ -1,6 +1,7 @@
import type { BudgetHandlers } from '../server/budget/types/handlers';
import type { FiltersHandlers } from '../server/filters/types/handlers';
import type { NotesHandlers } from '../server/notes/types/handlers';
+import type { RulesHandlers } from '../server/rules/types/handlers';
import type { SchedulesHandlers } from '../server/schedules/types/handlers';
import type { ToolsHandlers } from '../server/tools/types/handlers';
@@ -13,5 +14,6 @@ export interface Handlers
BudgetHandlers,
FiltersHandlers,
NotesHandlers,
+ RulesHandlers,
SchedulesHandlers,
ToolsHandlers {}
diff --git a/packages/loot-core/src/types/server-handlers.d.ts b/packages/loot-core/src/types/server-handlers.d.ts
index 6d67305435..ceaa91df30 100644
--- a/packages/loot-core/src/types/server-handlers.d.ts
+++ b/packages/loot-core/src/types/server-handlers.d.ts
@@ -233,7 +233,9 @@ export interface ServerHandlers {
'sync-repair': () => Promise<unknown>;
- 'key-make': (arg: { password }) => Promise<unknown>;
+ 'key-make': (arg: {
+ password;
+ }) => Promise<{ error?: { reason: string; meta?: unknown } }>;
'key-test': (arg: {
fileId;
diff --git a/upcoming-release-notes/1755.md b/upcoming-release-notes/1755.md
new file mode 100644
index 0000000000..9a27e1ed88
--- /dev/null
+++ b/upcoming-release-notes/1755.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [MikesGlitch]
+---
+
+Convert CreateAccount and CreateEncryptionKey components to TypeScript.