Skip to content

Commit

Permalink
Maintenance: Convert FixEncryptionKey, Loading, AnimatedLoading compo…
Browse files Browse the repository at this point in the history
…nents to TypeScript (#1784)
  • Loading branch information
MikesGlitch authored Oct 19, 2023
1 parent 5cc6bad commit eb54487
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/common/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Text from './Text';
import View from './View';

export type ModalProps = {
title: string;
title?: string;
isCurrent?: boolean;
isHidden?: boolean;
children: ReactNode | (() => ReactNode);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import React, { useState } from 'react';

import { type FinanceModals } from 'loot-core/src/client/state-types/modals';
import { send } from 'loot-core/src/platform/client/fetch';
import { getTestKeyError } from 'loot-core/src/shared/errors';

import { type BoundActions } from '../../hooks/useActions';
import { theme } from '../../style';
import { type CommonModalProps } from '../../types/modals';
import Button, { ButtonWithLoading } from '../common/Button';
import ExternalLink from '../common/ExternalLink';
import InitialFocus from '../common/InitialFocus';
Expand All @@ -13,11 +16,17 @@ import Paragraph from '../common/Paragraph';
import Text from '../common/Text';
import View from '../common/View';

type FixEncryptionKeyProps = {
modalProps: CommonModalProps;
actions: BoundActions;
options: FinanceModals['fix-encryption-key'];
};

export default function FixEncryptionKey({
modalProps,
actions,
options = {},
}) {
}: FixEncryptionKeyProps) {
let { hasExistingKey, cloudFileId, onSuccess } = options;

let [password, setPassword] = useState('');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'react';
import React, { type SVGProps } from 'react';

import { css } from 'glamor';
import { css, keyframes } from 'glamor';

import Loading from './Loading';

const rotation = css.keyframes({
const rotation = keyframes({
'0%': { transform: 'rotate(-90deg)' },
'100%': { transform: 'rotate(666deg)' },
});

function AnimatedLoading(props) {
function AnimatedLoading(props: SVGProps<SVGSVGElement>) {
return (
<span
className={`${css({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import React, { type SVGProps, useState } from 'react';

const SvgLoading = props => {
const SvgLoading = (props: SVGProps<SVGSVGElement>) => {
let { color = 'currentColor' } = props;
let [gradientId] = useState('gradient-' + Math.random());

Expand Down
4 changes: 2 additions & 2 deletions packages/loot-core/src/client/state-types/queries.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type QueriesState = {
updatedAccounts: string[];
accounts: AccountEntity[];
categories: Awaited<ReturnType<Handlers['get-categories']>>;
payees: unknown[];
payees: Awaited<ReturnType<Handlers['payees-get']>>;
earliestTransaction: unknown | null;
};

Expand Down Expand Up @@ -51,7 +51,7 @@ type LoadCategoriesAction = {

type LoadPayeesAction = {
type: typeof constants.LOAD_PAYEES;
payees: unknown[];
payees: State['payees'];
};

export type QueriesActions =
Expand Down
4 changes: 2 additions & 2 deletions packages/loot-core/src/types/server-handlers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Backup } from '../server/backups';
import { RemoteFile } from '../server/cloud-storage';
import { Message } from '../server/sync';

import { AccountEntity } from './models';
import { AccountEntity, PayeeEntity } from './models';
import { EmptyObject } from './util';

export interface ServerHandlers {
Expand Down Expand Up @@ -95,7 +95,7 @@ export interface ServerHandlers {

'payee-create': (arg: { name }) => Promise<unknown>;

'payees-get': () => Promise<unknown[]>;
'payees-get': () => Promise<PayeeEntity[]>;

'payees-get-rule-counts': () => Promise<unknown>;

Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/1784.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [MikesGlitch]
---

Convert FixEncryptionKey, Loading, AnimatedLoading components to TypeScript and update get-payee query type.

0 comments on commit eb54487

Please sign in to comment.