Skip to content

Commit

Permalink
updating CreateAccount and CreateEncryptionKey to tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
MikesGlitch committed Oct 4, 2023
1 parent 510f635 commit 9c1e5ed
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React, { useState } from 'react';
import React, { type ChangeEvent, useState } from 'react';

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 = {},
}) {
options,
}: CreateEncryptionKeyProps) {
let [password, setPassword] = useState('');
let [loading, setLoading] = useState(false);
let [error, setError] = useState('');
Expand Down Expand Up @@ -142,7 +152,9 @@ export default function CreateEncryptionKey({
<Input
type={showPassword ? 'text' : 'password'}
style={{ width: 300 }}
onChange={e => setPassword(e.target.value)}
onChange={(e: ChangeEvent<HTMLInputElement>) =>
setPassword(e.target.value)
}
/>
</InitialFocus>
<Text style={{ marginTop: 5 }}>
Expand Down
2 changes: 1 addition & 1 deletion packages/loot-core/src/shared/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const FIELD_TYPES = new Map(
}),
);

export function mapField(field, opts) {
export function mapField(field, opts = undefined) {
opts = opts || {};

switch (field) {
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

0 comments on commit 9c1e5ed

Please sign in to comment.