-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maintenance: BudgetSummary & CreateLocalAccount to tsx #1768
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ type InlineFieldProps = { | |
label: ReactNode; | ||
labelWidth?: number; | ||
children?: ReactNode; | ||
width: number; | ||
width: number | string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. width is being used as a string like:
numbers are also valid. width: 100 would mean 100px |
||
style?: CSSProperties; | ||
}; | ||
|
||
|
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'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only importing what's needed |
||
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'; | ||
|
@@ -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}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
{() => ( | ||
<NamespaceContext.Provider value={monthUtils.sheetForMonth(month)}> | ||
<NamespaceContext.Provider value={sheetForMonth(month)}> | ||
<View | ||
style={{ | ||
flexDirection: 'row', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'; | ||
|
@@ -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); | ||
|
@@ -26,7 +33,7 @@ function CreateLocalAccount({ modalProps, actions }) { | |
let validateBalance = balance => !isNaN(parseFloat(balance)); | ||
|
||
return ( | ||
<Modal title="Create Local Account" {...modalProps} showBack={false}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
<Modal title="Create Local Account" {...modalProps}> | ||
{() => ( | ||
<View> | ||
<form | ||
|
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is optional - it's rarely specified - found it when looking in another area.