-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34967 from VickyStash/ts-migration/workspaceBills…
…-page [TS migration] Migrate 'WorkspaceBills' page to TypeScript
- Loading branch information
Showing
8 changed files
with
106 additions
and
129 deletions.
There are no files selected for viewing
This file contains 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 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
30 changes: 14 additions & 16 deletions
30
...orkspace/bills/WorkspaceBillsNoVBAView.js → ...rkspace/bills/WorkspaceBillsNoVBAView.tsx
This file contains 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,45 +1,43 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import ConnectBankAccountButton from '@components/ConnectBankAccountButton'; | ||
import * as Illustrations from '@components/Icon/Illustrations'; | ||
import Section from '@components/Section'; | ||
import Text from '@components/Text'; | ||
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import WorkspaceBillsFirstSection from './WorkspaceBillsFirstSection'; | ||
|
||
const propTypes = { | ||
type WorkspaceBillsNoVBAViewProps = { | ||
/** The policy ID currently being configured */ | ||
policyID: PropTypes.string.isRequired, | ||
|
||
...withLocalizePropTypes, | ||
policyID: string; | ||
}; | ||
|
||
function WorkspaceBillsNoVBAView(props) { | ||
function WorkspaceBillsNoVBAView({policyID}: WorkspaceBillsNoVBAViewProps) { | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
|
||
return ( | ||
<> | ||
<WorkspaceBillsFirstSection policyID={props.policyID} /> | ||
<WorkspaceBillsFirstSection policyID={policyID} /> | ||
|
||
<Section | ||
title={props.translate('workspace.bills.unlockOnlineBillPayment')} | ||
title={translate('workspace.bills.unlockOnlineBillPayment')} | ||
icon={Illustrations.LockOpen} | ||
containerStyles={[styles.cardSection]} | ||
containerStyles={styles.cardSection} | ||
> | ||
<View style={[styles.mv3]}> | ||
<Text>{props.translate('workspace.bills.unlockNoVBACopy')}</Text> | ||
<View style={styles.mv3}> | ||
<Text>{translate('workspace.bills.unlockNoVBACopy')}</Text> | ||
</View> | ||
<ConnectBankAccountButton | ||
policyID={props.policyID} | ||
style={[styles.mt4]} | ||
policyID={policyID} | ||
style={styles.mt4} | ||
/> | ||
</Section> | ||
</> | ||
); | ||
} | ||
|
||
WorkspaceBillsNoVBAView.propTypes = propTypes; | ||
WorkspaceBillsNoVBAView.displayName = 'WorkspaceBillsNoVBAView'; | ||
|
||
export default withLocalize(WorkspaceBillsNoVBAView); | ||
export default WorkspaceBillsNoVBAView; |
This file was deleted.
Oops, something went wrong.
This file contains 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,35 @@ | ||
import type {StackScreenProps} from '@react-navigation/stack'; | ||
import React from 'react'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import type {SettingsNavigatorParamList} from '@navigation/types'; | ||
import WorkspacePageWithSections from '@pages/workspace/WorkspacePageWithSections'; | ||
import CONST from '@src/CONST'; | ||
import type SCREENS from '@src/SCREENS'; | ||
import WorkspaceBillsNoVBAView from './WorkspaceBillsNoVBAView'; | ||
import WorkspaceBillsVBAView from './WorkspaceBillsVBAView'; | ||
|
||
type WorkspaceBillsPageProps = StackScreenProps<SettingsNavigatorParamList, typeof SCREENS.WORKSPACE.BILLS>; | ||
|
||
function WorkspaceBillsPage({route}: WorkspaceBillsPageProps) { | ||
const {translate} = useLocalize(); | ||
|
||
return ( | ||
<WorkspacePageWithSections | ||
shouldUseScrollView | ||
headerText={translate('workspace.common.bills')} | ||
route={route} | ||
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BILLS} | ||
> | ||
{(hasVBA: boolean, policyID: string) => ( | ||
<> | ||
{!hasVBA && <WorkspaceBillsNoVBAView policyID={policyID} />} | ||
{hasVBA && <WorkspaceBillsVBAView policyID={policyID} />} | ||
</> | ||
)} | ||
</WorkspacePageWithSections> | ||
); | ||
} | ||
|
||
WorkspaceBillsPage.displayName = 'WorkspaceBillsPage'; | ||
|
||
export default WorkspaceBillsPage; |
This file contains 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 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
Oops, something went wrong.