Skip to content

Commit

Permalink
Maintenance: CreateAccount and CreateEncryptionKey to tsx (actualbudg…
Browse files Browse the repository at this point in the history
  • Loading branch information
MikesGlitch authored Oct 4, 2023
1 parent 7ba97ce commit bedfa08
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/common/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, {
useRef,
type KeyboardEvent,
type Ref,
type HTMLProps,
type InputHTMLAttributes,
} from 'react';
import mergeRefs from 'react-merge-refs';

Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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('');
Expand Down
2 changes: 2 additions & 0 deletions packages/loot-core/src/types/handlers.d.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -13,5 +14,6 @@ export interface Handlers
BudgetHandlers,
FiltersHandlers,
NotesHandlers,
RulesHandlers,
SchedulesHandlers,
ToolsHandlers {}
4 changes: 3 additions & 1 deletion packages/loot-core/src/types/server-handlers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/1755.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [MikesGlitch]
---

Convert CreateAccount and CreateEncryptionKey components to TypeScript.

0 comments on commit bedfa08

Please sign in to comment.