-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[TS Migration] Migrate WorkspaceCard to Typescript #34963
Changes from 9 commits
35c6ca5
136cf97
04eff8e
ea1d37b
71d6e39
ee51cfc
74051cb
c27c85a
b7abae0
03222ab
997b4d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
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 UnorderedList from '@components/UnorderedList'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
|
||
type WorkspaceCardNoVBAViewProps = { | ||
/** The policy ID currently being configured */ | ||
policyID: string; | ||
}; | ||
|
||
function WorkspaceCardNoVBAView({policyID}: WorkspaceCardNoVBAViewProps) { | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
const unorderedListItems = [translate('workspace.card.benefit1'), translate('workspace.card.benefit2'), translate('workspace.card.benefit3'), translate('workspace.card.benefit4')]; | ||
|
||
return ( | ||
<Section | ||
title={translate('workspace.card.header')} | ||
icon={Illustrations.CreditCardsNew} | ||
> | ||
<View style={[styles.mv4]}> | ||
<Text>{translate('workspace.card.noVBACopy')}</Text> | ||
</View> | ||
|
||
<UnorderedList items={unorderedListItems} /> | ||
<ConnectBankAccountButton | ||
policyID={policyID} | ||
style={[styles.mt6]} | ||
/> | ||
</Section> | ||
); | ||
} | ||
|
||
WorkspaceCardNoVBAView.displayName = 'WorkspaceCardNoVBAView'; | ||
|
||
export default WorkspaceCardNoVBAView; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,28 +2,27 @@ import React from 'react'; | |
import {View} from 'react-native'; | ||
import * as Expensicons from '@components/Icon/Expensicons'; | ||
import * as Illustrations from '@components/Icon/Illustrations'; | ||
import type {MenuItemWithLink} from '@components/MenuItemList'; | ||
import Section from '@components/Section'; | ||
import Text from '@components/Text'; | ||
import UnorderedList from '@components/UnorderedList'; | ||
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import * as Link from '@userActions/Link'; | ||
|
||
const propTypes = { | ||
...withLocalizePropTypes, | ||
}; | ||
|
||
const MENU_LINKS = { | ||
ISSUE_AND_MANAGE_CARDS: 'domain_companycards', | ||
RECONCILE_CARDS: encodeURI('domain_companycards?param={"section":"cardReconciliation"}'), | ||
SETTLEMENT_FREQUENCY: encodeURI('domain_companycards?param={"section":"configureSettings"}'), | ||
}; | ||
} as const; | ||
|
||
function WorkspaceCardVBAWithECardView(props) { | ||
function WorkspaceCardVBAWithECardView() { | ||
const styles = useThemeStyles(); | ||
const menuItems = [ | ||
const {translate} = useLocalize(); | ||
|
||
const menuItems: MenuItemWithLink[] = [ | ||
{ | ||
title: props.translate('workspace.common.issueAndManageCards'), | ||
title: translate('workspace.common.issueAndManageCards'), | ||
onPress: () => Link.openOldDotLink(MENU_LINKS.ISSUE_AND_MANAGE_CARDS), | ||
icon: Expensicons.ExpensifyCard, | ||
shouldShowRightIcon: true, | ||
|
@@ -32,7 +31,7 @@ function WorkspaceCardVBAWithECardView(props) { | |
link: () => Link.buildOldDotURL(MENU_LINKS.ISSUE_AND_MANAGE_CARDS), | ||
}, | ||
{ | ||
title: props.translate('workspace.common.reconcileCards'), | ||
title: translate('workspace.common.reconcileCards'), | ||
onPress: () => Link.openOldDotLink(MENU_LINKS.RECONCILE_CARDS), | ||
icon: Expensicons.ReceiptSearch, | ||
shouldShowRightIcon: true, | ||
|
@@ -41,7 +40,7 @@ function WorkspaceCardVBAWithECardView(props) { | |
link: () => Link.buildOldDotURL(MENU_LINKS.RECONCILE_CARDS), | ||
}, | ||
{ | ||
title: props.translate('workspace.common.settlementFrequency'), | ||
title: translate('workspace.common.settlementFrequency'), | ||
onPress: () => Link.openOldDotLink(MENU_LINKS.SETTLEMENT_FREQUENCY), | ||
icon: Expensicons.Gear, | ||
shouldShowRightIcon: true, | ||
|
@@ -53,30 +52,24 @@ function WorkspaceCardVBAWithECardView(props) { | |
|
||
return ( | ||
<Section | ||
title={props.translate('workspace.card.headerWithEcard')} | ||
title={translate('workspace.card.headerWithEcard')} | ||
icon={Illustrations.CreditCardsNew} | ||
menuItems={menuItems} | ||
isCentralPane | ||
> | ||
<View style={[styles.mv3]}> | ||
<Text>{props.translate('workspace.card.VBAWithECardCopy')}</Text> | ||
<Text>{translate('workspace.card.VBAWithECardCopy')}</Text> | ||
</View> | ||
|
||
<View style={[styles.mv3]}> | ||
<UnorderedList | ||
items={[ | ||
props.translate('workspace.card.benefit1'), | ||
props.translate('workspace.card.benefit2'), | ||
props.translate('workspace.card.benefit3'), | ||
props.translate('workspace.card.benefit4'), | ||
]} | ||
items={[translate('workspace.card.benefit1'), translate('workspace.card.benefit2'), translate('workspace.card.benefit3'), translate('workspace.card.benefit4')]} | ||
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. As we have done in other files, can we move this to a separate const. 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. You are right, missed that one, thank you! |
||
/> | ||
</View> | ||
</Section> | ||
); | ||
} | ||
|
||
WorkspaceCardVBAWithECardView.propTypes = propTypes; | ||
WorkspaceCardVBAWithECardView.displayName = 'WorkspaceCardVBAWithECardView'; | ||
|
||
export default withLocalize(WorkspaceCardVBAWithECardView); | ||
export default WorkspaceCardVBAWithECardView; |
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.
isCentralPane
prop is removed. Was this intentional change?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 was not intentional, I've added the prop again. Thanks for pointing that out!