-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Add Expensify Card promoting banner to Company cards page #56561
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
luacmartins
merged 11 commits into
Expensify:main
from
ikevin127:ikevin127-expensifyCardPromotion
Feb 12, 2025
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e07f982
Add Expensify Promoting banner to the Company cards page
ikevin127 620fb1c
Update - Add Expensify Card promoting banner to Company cards page
ikevin127 bff5be5
Merge branch 'main' of https://github.com/Expensify/App into ikevin12…
ikevin127 e66af34
addressed lint issues
ikevin127 0675be5
addressed lint issues
ikevin127 43c6973
code review & design adjustments
ikevin127 14249fb
addressed lint issues
ikevin127 fcb30f3
Merge branch 'main' of https://github.com/Expensify/App into ikevin12…
ikevin127 7d91ce9
code review adjustments
ikevin127 8471815
Merge branch 'main' of https://github.com/Expensify/App into ikevin12…
ikevin127 56c5f26
Merge branch 'main' of https://github.com/Expensify/App into ikevin12…
ikevin127 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
55 changes: 55 additions & 0 deletions
55
assets/images/simple-illustrations/simple-illustration__creditcards--green.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
71 changes: 71 additions & 0 deletions
71
src/pages/workspace/companyCards/WorkspaceCompanyCardExpensifyCardPromotionBanner.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,71 @@ | ||
| import React, {useCallback, useMemo} from 'react'; | ||
| import {View} from 'react-native'; | ||
| import type {OnyxEntry} from 'react-native-onyx'; | ||
| import Button from '@components/Button'; | ||
| import {CreditCardsNewGreen} from '@components/Icon/Illustrations'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||
| import useStyleUtils from '@hooks/useStyleUtils'; | ||
| import useTheme from '@hooks/useTheme'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import {enableExpensifyCard} from '@libs/actions/Policy/Policy'; | ||
| import {navigateToExpensifyCardPage} from '@libs/PolicyUtils'; | ||
| import BillingBanner from '@pages/settings/Subscription/CardSection/BillingBanner/BillingBanner'; | ||
| import type {Policy} from '@src/types/onyx'; | ||
|
|
||
| type WorkspaceCompanyCardExpensifyCardPromotionBannerProps = { | ||
| policy: OnyxEntry<Policy>; | ||
| }; | ||
|
|
||
| function WorkspaceCompanyCardExpensifyCardPromotionBanner({policy}: WorkspaceCompanyCardExpensifyCardPromotionBannerProps) { | ||
| const theme = useTheme(); | ||
| const styles = useThemeStyles(); | ||
| const {translate} = useLocalize(); | ||
| const StyleUtils = useStyleUtils(); | ||
| const {shouldUseNarrowLayout} = useResponsiveLayout(); | ||
| const policyID = policy?.id; | ||
| const areExpensifyCardsEnabled = policy?.areExpensifyCardsEnabled; | ||
|
|
||
| const handleLearnMore = useCallback(() => { | ||
| if (!policyID) { | ||
| return; | ||
| } | ||
|
|
||
| if (areExpensifyCardsEnabled) { | ||
| navigateToExpensifyCardPage(policyID); | ||
| return; | ||
| } | ||
|
|
||
| enableExpensifyCard(policyID, true, true); | ||
| }, [policyID, areExpensifyCardsEnabled]); | ||
|
|
||
| const rightComponent = useMemo(() => { | ||
| const smallScreenStyle = shouldUseNarrowLayout ? [styles.flex0, styles.flexBasis100, styles.justifyContentCenter] : []; | ||
| return ( | ||
| <View style={[styles.flexRow, styles.gap2, smallScreenStyle]}> | ||
| <Button | ||
| success | ||
| onPress={handleLearnMore} | ||
| style={shouldUseNarrowLayout && styles.flex1} | ||
| text={translate('workspace.moreFeatures.companyCards.expensifyCardBannerLearnMoreButton')} | ||
| /> | ||
| </View> | ||
| ); | ||
| }, [styles, shouldUseNarrowLayout, translate, handleLearnMore]); | ||
|
|
||
| return ( | ||
| <View style={[styles.ph4, styles.mb4]}> | ||
| <BillingBanner | ||
| icon={CreditCardsNewGreen} | ||
| title={translate('workspace.moreFeatures.companyCards.expensifyCardBannerTitle')} | ||
| titleStyle={StyleUtils.getTextColorStyle(theme.text)} | ||
| subtitle={translate('workspace.moreFeatures.companyCards.expensifyCardBannerSubtitle')} | ||
| subtitleStyle={[styles.mt1, styles.textLabel]} | ||
| style={[styles.borderRadiusComponentLarge]} | ||
| rightComponent={rightComponent} | ||
| /> | ||
| </View> | ||
| ); | ||
| } | ||
|
|
||
| export default WorkspaceCompanyCardExpensifyCardPromotionBanner; |
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.