-
Notifications
You must be signed in to change notification settings - Fork 3.8k
feat: [91243] add agent promotion banners to workspace #91251
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
yuwenmemon
merged 21 commits into
main
from
feat/91243-add-agent-promotion-banners-to-workspace
May 26, 2026
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
4b50416
Add agents workflows banner and related translations
NicolasBonet 7547cee
Add agents rules promo banner and related translations
NicolasBonet b8bf0f8
Update translations for agents promo banners across multiple languages
NicolasBonet 9788cb2
Refactor agents promo banner rendering in Workspace Workflows page
NicolasBonet fa4e054
Add AgentPromotionalBanner component and integrate into PolicyRulesPa…
NicolasBonet 7120f34
Update badgeHigher style for web compatibility
NicolasBonet 479e99a
Refactor AgentPromotionalBanner badge implementation and update styles
NicolasBonet fd5b2c0
Refactor AgentPromotionalBanner to utilize BillingBanner component
NicolasBonet a842f1d
Refactor badge rendering in AgentPromotionalBanner for improved reada…
NicolasBonet cbb150a
Refactor AgentPromotionalBanner styles and badge alignment
NicolasBonet 1ffca0a
Refactor AgentPromotionalBanner to remove unused styles and improve l…
NicolasBonet 751d29d
Refactor BillingBanner component to remove unused rightIconFill prop
NicolasBonet f17a947
Merge branch 'main' into feat/91243-add-agent-promotion-banners-to-wo…
NicolasBonet 5fdafee
Update AgentsPromoBannersTest to match on subtitles instead of titles…
NicolasBonet bdebb27
Merge branch 'main' into feat/91243-add-agent-promotion-banners-to-wo…
NicolasBonet aa3fb60
Add agent promotional banners to workspace
NicolasBonet 0493fdc
Update AgentPromotionalBanner styles and layout
NicolasBonet b9df7b2
Update button size in AgentPromotionalBanner component
NicolasBonet df42ab3
Merge branch 'main' into feat/91243-add-agent-promotion-banners-to-wo…
NicolasBonet d7bb167
feat: fix spacing in mobile
NicolasBonet 75575dd
fix: adjust badge alignment for web platform in promotional banner
NicolasBonet 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
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,114 @@ | ||
| import React, {useMemo} from 'react'; | ||
| import type {StyleProp, ViewStyle} from 'react-native'; | ||
| import {View} from 'react-native'; | ||
| import {useMemoizedLazyExpensifyIcons, useMemoizedLazyIllustrations} from '@hooks/useLazyAsset'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import BillingBanner from '@pages/settings/Subscription/CardSection/BillingBanner/BillingBanner'; | ||
| import Badge from './Badge'; | ||
| import Button from './Button'; | ||
| import Text from './Text'; | ||
|
|
||
| type AgentPromotionalBannerProps = { | ||
| /** Title shown next to the bot illustration. */ | ||
| title: string; | ||
|
|
||
| /** Supporting copy under the title. */ | ||
| subtitle: string; | ||
|
|
||
| /** Called when the dismiss (X) button is pressed. */ | ||
| onDismiss: () => void; | ||
|
|
||
| /** Sentry label for the dismiss button. */ | ||
| dismissSentryLabel: string; | ||
|
|
||
| /** Optional CTA text. When omitted, the CTA is not rendered. */ | ||
| ctaText?: string; | ||
|
|
||
| /** Called when the CTA is pressed. Required when `ctaText` is set. */ | ||
| onCtaPress?: () => void; | ||
|
|
||
| /** Sentry label for the CTA. Required when `ctaText` is set. */ | ||
| ctaSentryLabel?: string; | ||
|
|
||
| /** Extra styles applied to the outer container. */ | ||
| style?: StyleProp<ViewStyle>; | ||
| }; | ||
|
|
||
| function AgentPromotionalBanner({title, subtitle, onDismiss, dismissSentryLabel, ctaText, onCtaPress, ctaSentryLabel, style}: AgentPromotionalBannerProps) { | ||
| const styles = useThemeStyles(); | ||
| const {translate} = useLocalize(); | ||
| const {shouldUseNarrowLayout} = useResponsiveLayout(); | ||
| const illustrations = useMemoizedLazyIllustrations(['AiBot']); | ||
| const expensifyIcons = useMemoizedLazyExpensifyIcons(['Close']); | ||
|
|
||
| const hasCta = !!ctaText && !!onCtaPress; | ||
|
|
||
| const titleNode = useMemo( | ||
| () => ( | ||
| <View style={[styles.flexRow, styles.flexShrink1]}> | ||
| <Text style={[styles.textStrong]}> | ||
| {title} | ||
| <Badge | ||
| badgeStyles={styles.agentPromotionalBannerBadge} | ||
| success | ||
| isStrong | ||
| isCondensed | ||
| text={translate('common.new')} | ||
| /> | ||
| </Text> | ||
| </View> | ||
| ), | ||
| [title, styles, translate], | ||
| ); | ||
|
|
||
| const rightComponent = useMemo(() => { | ||
| if (!hasCta) { | ||
| return null; | ||
| } | ||
| if (shouldUseNarrowLayout) { | ||
| return ( | ||
| <View style={[styles.flex0, styles.flexBasis100, styles.maxWidth100Percentage, styles.justifyContentCenter]}> | ||
| <Button | ||
| success | ||
| medium | ||
| text={ctaText} | ||
| onPress={onCtaPress} | ||
| sentryLabel={ctaSentryLabel} | ||
| /> | ||
| </View> | ||
| ); | ||
| } | ||
| return ( | ||
| <Button | ||
| success | ||
| small | ||
| text={ctaText} | ||
| onPress={onCtaPress} | ||
| sentryLabel={ctaSentryLabel} | ||
| /> | ||
| ); | ||
| }, [hasCta, shouldUseNarrowLayout, ctaText, onCtaPress, ctaSentryLabel, styles]); | ||
|
|
||
| return ( | ||
| <View style={style}> | ||
| <BillingBanner | ||
|
NicolasBonet marked this conversation as resolved.
|
||
| icon={illustrations.AiBot} | ||
| title={titleNode} | ||
| subtitle={subtitle} | ||
| subtitleStyle={[styles.mt1]} | ||
| style={[styles.borderRadiusComponentLarge, styles.gap4]} | ||
| rightIcon={expensifyIcons.Close} | ||
| onRightIconPress={onDismiss} | ||
| rightIconAccessibilityLabel={translate('common.dismiss')} | ||
| rightIconSentryLabel={dismissSentryLabel} | ||
| rightComponent={rightComponent} | ||
| /> | ||
| </View> | ||
| ); | ||
| } | ||
|
|
||
| AgentPromotionalBanner.displayName = 'AgentPromotionalBanner'; | ||
|
|
||
| export default AgentPromotionalBanner; | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
❌ CLEAN-REACT-PATTERNS-0 (docs)
React Compiler is enabled in this codebase and automatically memoizes derived values. The
useMemowrappingtitleNode(line 48) andrightComponent(line 66) is redundant — the compiler will handle caching these JSX expressions based on their captured dependencies.Remove both
useMemocalls and declare the values as plain expressions:Similarly for
rightComponent— use a plain conditional expression instead ofuseMemo. Also remove theuseMemoimport fromreact(line 1).Note: If this file does not compile with React Compiler, the manual memoization may be necessary until the compilation issue is resolved — verify with
npm run react-compiler-compliance-check check-changed.Reviewed at: 75575dd | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.