Skip to content

Commit

Permalink
Maintenance: BudgetSummary & CreateLocalAccount to tsx (actualbudget#…
Browse files Browse the repository at this point in the history
  • Loading branch information
MikesGlitch authored Oct 9, 2023
1 parent a35b6f3 commit 4d5d3d7
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ type SingleAutocompleteProps = {
openOnFocus?: boolean;
getHighlightedIndex?: (suggestions) => number | null;
highlightFirst?: boolean;
onUpdate: (id: unknown, value: string) => void;
onUpdate?: (id: unknown, value: string) => void;
strict?: boolean;
onSelect: (id: unknown, value: string) => void;
tableBehavior?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type InlineFieldProps = {
label: ReactNode;
labelWidth?: number;
children?: ReactNode;
width: number;
width: number | string;
style?: CSSProperties;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';

import { rolloverBudget } from 'loot-core/src/client/queries';
import * as monthUtils from 'loot-core/src/shared/months';
import { format, sheetForMonth, prevMonth } from 'loot-core/src/shared/months';

import { theme, styles } from '../../style';
import { type CommonModalProps } from '../../types/modals';
import Button from '../common/Button';
import Modal from '../common/Modal';
import Text from '../common/Text';
Expand Down Expand Up @@ -35,13 +36,18 @@ function ToBudget({ toBudget }) {
);
}

function BudgetSummary({ month, modalProps }) {
const prevMonthName = monthUtils.format(monthUtils.prevMonth(month), 'MMM');
type BudgetSummaryProps = {
modalProps: CommonModalProps;
month: string;
};

function BudgetSummary({ month, modalProps }: BudgetSummaryProps) {
const prevMonthName = format(prevMonth(month), 'MMM');

return (
<Modal title="Budget Details" {...modalProps} animate>
<Modal title="Budget Details" {...modalProps}>
{() => (
<NamespaceContext.Provider value={monthUtils.sheetForMonth(month)}>
<NamespaceContext.Provider value={sheetForMonth(month)}>
<View
style={{
flexDirection: 'row',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { useNavigate } from 'react-router-dom';

import { toRelaxedNumber } from 'loot-core/src/shared/util';

import { type BoundActions } from '../../hooks/useActions';
import { theme } from '../../style';
import { type CommonModalProps } from '../../types/modals';
import Button from '../common/Button';
import ExternalLink from '../common/ExternalLink';
import FormError from '../common/FormError';
Expand All @@ -14,7 +16,12 @@ import Modal, { ModalButtons } from '../common/Modal';
import Text from '../common/Text';
import View from '../common/View';

function CreateLocalAccount({ modalProps, actions }) {
type CreateLocalAccountProps = {
modalProps: CommonModalProps;
actions: BoundActions;
};

function CreateLocalAccount({ modalProps, actions }: CreateLocalAccountProps) {
let navigate = useNavigate();
let [name, setName] = useState('');
let [offbudget, setOffbudget] = useState(false);
Expand All @@ -26,7 +33,7 @@ function CreateLocalAccount({ modalProps, actions }) {
let validateBalance = balance => !isNaN(parseFloat(balance));

return (
<Modal title="Create Local Account" {...modalProps} showBack={false}>
<Modal title="Create Local Account" {...modalProps}>
{() => (
<View>
<form
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/1768.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [MikesGlitch]
---

Convert BudgetSummary modal(mobile) and CreateLocalAccounts components to TypeScript.

0 comments on commit 4d5d3d7

Please sign in to comment.