-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Invoicing balance section #46813
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
Merged
madmax330
merged 48 commits into
Expensify:main
from
rezkiy37:feature/45179-invoice-balance-section
Oct 7, 2024
Merged
Invoicing balance section #46813
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
0fa3d34
create Balance component
rezkiy37 0107f87
add translations
rezkiy37 bfefb1c
integrate raw WorkspaceInvoiceBalanceSection
rezkiy37 69fc85c
integrate Balance in CurrentWalletBalance
rezkiy37 12f2d16
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 0b6c487
add invoice types
rezkiy37 cac61f8
integrate raw WorkspaceTransferInvoiceBalance
rezkiy37 efa7d46
fix nav types
rezkiy37 3cf870b
integrate raw WorkspaceTransferInvoiceBalance
rezkiy37 3308014
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 d6d4cdd
fix styles
rezkiy37 c4024d9
improve TransferInvoiceBalance
rezkiy37 118f9f7
integrate payment methods
rezkiy37 2349f40
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 98a0b8a
fix optional chain
rezkiy37 4637092
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 e21a9a2
integrate success view
rezkiy37 8e59717
remove debug log
rezkiy37 5340ac6
remove debug condition
rezkiy37 b923b34
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 8034af8
do not use bankAccountID for request
rezkiy37 451e139
simplify the logic for selecting the payment account
rezkiy37 ddd6ca3
update transfer button title
rezkiy37 e274b8f
clear redundant press
rezkiy37 52cc88b
update comment
rezkiy37 f8e7928
add empty lines
rezkiy37 72ca222
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 a24da4d
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 7710a77
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 e248286
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 002d9d3
uncomment enabling feature line
rezkiy37 d5801a2
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 1e30fce
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 069e632
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 af65cd7
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 a187445
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 a85c17e
revert transfer balance
rezkiy37 cda95f1
use hooks and remove withOnyx
rezkiy37 0970c51
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 ba1d7b3
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 14d26c4
Refactor willBlurTextInputOnTapOutside to use getIsNarrowLayout
rezkiy37 d7535c3
Revert "Refactor willBlurTextInputOnTapOutside to use getIsNarrowLayout"
rezkiy37 9e6ab22
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 cb31a55
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 98a04c9
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 96167c0
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 157bc5b
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 d20a84b
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import React from 'react'; | ||
| import type {StyleProp, TextStyle} from 'react-native'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import * as CurrencyUtils from '@libs/CurrencyUtils'; | ||
| import Text from './Text'; | ||
|
|
||
| type BalanceProps = { | ||
| textStyles?: StyleProp<TextStyle>; | ||
| balance: number; | ||
| }; | ||
|
|
||
| function Balance({textStyles, balance}: BalanceProps) { | ||
| const styles = useThemeStyles(); | ||
| const formattedBalance = CurrencyUtils.convertToDisplayString(balance); | ||
|
|
||
| return <Text style={[styles.textHeadline, styles.textXXXLarge, textStyles]}>{formattedBalance}</Text>; | ||
| } | ||
|
|
||
| Balance.displayName = 'Balance'; | ||
|
|
||
| export default Balance; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,26 @@ | ||
| import React from 'react'; | ||
| import type {StyleProp, TextStyle} from 'react-native'; | ||
| import type {OnyxEntry} from 'react-native-onyx'; | ||
| import {withOnyx} from 'react-native-onyx'; | ||
| import {useOnyx} from 'react-native-onyx'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import * as CurrencyUtils from '@libs/CurrencyUtils'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import type UserWallet from '@src/types/onyx/UserWallet'; | ||
| import Text from './Text'; | ||
| import Balance from './Balance'; | ||
|
|
||
| type CurrentWalletBalanceOnyxProps = { | ||
| /** The user's wallet account */ | ||
| userWallet: OnyxEntry<UserWallet>; | ||
| }; | ||
|
|
||
| type CurrentWalletBalanceProps = CurrentWalletBalanceOnyxProps & { | ||
| type CurrentWalletBalanceProps = { | ||
| balanceStyles?: StyleProp<TextStyle>; | ||
| }; | ||
|
|
||
| function CurrentWalletBalance({userWallet, balanceStyles}: CurrentWalletBalanceProps) { | ||
| function CurrentWalletBalance({balanceStyles}: CurrentWalletBalanceProps) { | ||
| const styles = useThemeStyles(); | ||
rezkiy37 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const formattedBalance = CurrencyUtils.convertToDisplayString(userWallet?.currentBalance ?? 0); | ||
| return <Text style={[styles.pv5, styles.alignSelfCenter, styles.textHeadline, styles.textXXXLarge, balanceStyles]}>{formattedBalance}</Text>; | ||
| const [userWallet] = useOnyx(ONYXKEYS.USER_WALLET); | ||
|
|
||
| return ( | ||
| <Balance | ||
| textStyles={[styles.pv5, styles.alignSelfCenter, balanceStyles]} | ||
| balance={userWallet?.currentBalance ?? 0} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| CurrentWalletBalance.displayName = 'CurrentWalletBalance'; | ||
|
|
||
| export default withOnyx<CurrentWalletBalanceProps, CurrentWalletBalanceOnyxProps>({ | ||
| userWallet: { | ||
| key: ONYXKEYS.USER_WALLET, | ||
| }, | ||
| })(CurrentWalletBalance); | ||
| export default CurrentWalletBalance; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/pages/workspace/invoices/WorkspaceInvoiceBalanceSection.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import React from 'react'; | ||
| import {useOnyx} from 'react-native-onyx'; | ||
| import Balance from '@components/Balance'; | ||
| import Section from '@components/Section'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
|
|
||
| type WorkspaceInvoiceBalanceSectionProps = { | ||
| /** The policy ID currently being configured */ | ||
| policyID: string; | ||
| }; | ||
|
|
||
| function WorkspaceInvoiceBalanceSection({policyID}: WorkspaceInvoiceBalanceSectionProps) { | ||
| const styles = useThemeStyles(); | ||
| const {translate} = useLocalize(); | ||
| const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`); | ||
|
|
||
| return ( | ||
| <Section | ||
| title={translate('workspace.invoices.invoiceBalance')} | ||
| subtitle={translate('workspace.invoices.invoiceBalanceSubtitle')} | ||
| isCentralPane | ||
| titleStyles={styles.textStrong} | ||
| childrenStyles={styles.pt5} | ||
| subtitleMuted | ||
| > | ||
| <Balance balance={policy?.invoice?.bankAccount?.stripeConnectAccountBalance ?? 0} /> | ||
| </Section> | ||
| ); | ||
| } | ||
|
|
||
| export default WorkspaceInvoiceBalanceSection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.