-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix: Place schedule demo button on the discount banner when there is one #57092
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
Conversation
@dubielzyk-expensify @fedirjh One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Not a blocker at all but: is it possible to get the admin button in the room header before the room animates in? It feels slightly jarring: CleanShot.2025-02-19.at.08.04.58.mp4 |
@truph01 The dismiss button is not displayed for me ![]() |
src/pages/settings/Subscription/CardSection/BillingBanner/EarlyDiscountBanner.tsx
Outdated
Show resolved
Hide resolved
src/pages/settings/Subscription/CardSection/BillingBanner/EarlyDiscountBanner.tsx
Outdated
Show resolved
Hide resolved
src/pages/settings/Subscription/CardSection/BillingBanner/EarlyDiscountBanner.tsx
Outdated
Show resolved
Hide resolved
I believe the dismiss icon is only showed per a certain condition, like if the trial is past X days or something. I think @dannymcclain knows what the deal is there! |
Yeah I do believe dismiss is only shown under certain conditions, but TBH I don't know exactly what those conditions are. @ryanschaffer can you clarify here? |
Nice, this is feeling pretty good to me. |
Reviewer Checklist
Screenshots/Videos |
Hmm no, in that case it should go full width. |
@truph01 This code change should fix it: Code Diffdiff --git a/src/pages/home/HeaderView.tsx b/src/pages/home/HeaderView.tsx
index 5cae1d65ccc..0c1f013d004 100644
--- a/src/pages/home/HeaderView.tsx
+++ b/src/pages/home/HeaderView.tsx
@@ -214,18 +214,11 @@ function HeaderView({report, parentReportAction, onNavigationMenuButtonClicked,
onPress={() => {
openExternalLink(account?.guideDetails?.calendarLink ?? '');
}}
- style={shouldUseNarrowLayout && shouldShowGuideBookingButtonInEarlyDiscountBanner && [styles.flex1]}
+ style={[styles.flex1]}
icon={CalendarSolid}
/>
);
- const getGuideBookButtonStyles = () => {
- if (isChatUsedForOnboarding) {
- return [styles.pb3, styles.pl5, styles.w50, styles.pr1];
- }
- return [styles.pb3, styles.ph5];
- };
-
return (
<>
<View
@@ -338,7 +331,7 @@ function HeaderView({report, parentReportAction, onNavigationMenuButtonClicked,
</View>
)}
</PressableWithoutFeedback>
- <View style={[styles.reportOptions, styles.flexRow, styles.alignItemsCenter]}>
+ <View style={[styles.reportOptions, styles.flexRow, styles.alignItemsCenter, styles.gap2]}>
{!shouldShowGuideBookingButtonInEarlyDiscountBanner && shouldShowGuideBooking && !shouldUseNarrowLayout && guideBookingButton}
{!shouldUseNarrowLayout && !shouldShowDiscount && isChatUsedForOnboarding && (
<FreeTrial
@@ -369,10 +362,8 @@ function HeaderView({report, parentReportAction, onNavigationMenuButtonClicked,
)}
</View>
{!isParentReportLoading && !isLoading && canJoin && shouldUseNarrowLayout && <View style={[styles.ph5, styles.pb2]}>{joinButton}</View>}
- <View style={isChatUsedForOnboarding && !shouldShowDiscount && shouldShowGuideBooking && [styles.dFlex, styles.flexRow]}>
- {!shouldShowGuideBookingButtonInEarlyDiscountBanner && !isLoading && shouldShowGuideBooking && shouldUseNarrowLayout && (
- <View style={getGuideBookButtonStyles()}>{guideBookingButton}</View>
- )}
+ <View style={isChatUsedForOnboarding && !shouldShowDiscount && shouldShowGuideBooking && [styles.dFlex, styles.flexRow, styles.gap2, styles.pb3, styles.ph5]}>
+ {!shouldShowGuideBookingButtonInEarlyDiscountBanner && !isLoading && shouldShowGuideBooking && shouldUseNarrowLayout && guideBookingButton}
{!isLoading && !shouldShowDiscount && isChatUsedForOnboarding && shouldUseNarrowLayout && (
<FreeTrial
pressable
diff --git a/src/pages/settings/Subscription/CardSection/BillingBanner/EarlyDiscountBanner.tsx b/src/pages/settings/Subscription/CardSection/BillingBanner/EarlyDiscountBanner.tsx
index 705b83b7796..cefa4ba0604 100644
--- a/src/pages/settings/Subscription/CardSection/BillingBanner/EarlyDiscountBanner.tsx
+++ b/src/pages/settings/Subscription/CardSection/BillingBanner/EarlyDiscountBanner.tsx
@@ -54,24 +54,25 @@ function EarlyDiscountBanner({isSubscriptionPage, GuideBookingButton, onDismisse
}, [firstDayFreeTrial]);
const dismissButton = useMemo(
- () => (
- <Tooltip text={translate('common.close')}>
- <PressableWithFeedback
- onPress={() => {
- setIsDismissed(true);
- onDismissedDiscountBanner?.();
- }}
- role={CONST.ROLE.BUTTON}
- accessibilityLabel={translate('common.close')}
- >
- <Icon
- src={Expensicons.Close}
- fill={theme.icon}
- />
- </PressableWithFeedback>
- </Tooltip>
- ),
- [theme.icon, translate, onDismissedDiscountBanner],
+ () =>
+ discountInfo?.discountType === 50 && (
+ <Tooltip text={translate('common.close')}>
+ <PressableWithFeedback
+ onPress={() => {
+ setIsDismissed(true);
+ onDismissedDiscountBanner?.();
+ }}
+ role={CONST.ROLE.BUTTON}
+ accessibilityLabel={translate('common.close')}
+ >
+ <Icon
+ src={Expensicons.Close}
+ fill={theme.icon}
+ />
+ </PressableWithFeedback>
+ </Tooltip>
+ ),
+ [discountInfo?.discountType, translate, theme.icon, onDismissedDiscountBanner],
);
const rightComponent = useMemo(() => {
@@ -85,7 +86,7 @@ function EarlyDiscountBanner({isSubscriptionPage, GuideBookingButton, onDismisse
text={translate('subscription.billingBanner.earlyDiscount.claimOffer')}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION.getRoute(Navigation.getActiveRoute()))}
/>
- {discountInfo?.discountType === 25 && (shouldUseNarrowLayout ? undefined : dismissButton)}
+ {!shouldUseNarrowLayout && dismissButton}
</View>
);
}, [
@@ -99,7 +100,6 @@ function EarlyDiscountBanner({isSubscriptionPage, GuideBookingButton, onDismisse
styles.gap2,
styles.flex1,
translate,
- discountInfo?.discountType,
GuideBookingButton,
dismissButton,
]);
@@ -125,7 +125,7 @@ function EarlyDiscountBanner({isSubscriptionPage, GuideBookingButton, onDismisse
<Text>{translate('subscription.billingBanner.earlyDiscount.onboardingChatTitle.phrase2', {discountType: discountInfo?.discountType})}</Text>
</Text>
)}
- {discountInfo?.discountType === 25 && (shouldUseNarrowLayout ? dismissButton : undefined)}
+ {shouldUseNarrowLayout && dismissButton}
</View>
);
diff --git a/src/pages/settings/Subscription/FreeTrial.tsx b/src/pages/settings/Subscription/FreeTrial.tsx
index 1d82614d66f..3d99372742c 100644
--- a/src/pages/settings/Subscription/FreeTrial.tsx
+++ b/src/pages/settings/Subscription/FreeTrial.tsx
@@ -56,7 +56,7 @@ function FreeTrial({badgeStyles, pressable = false, addSpacing = false, success
/>
);
- return addSpacing ? <View style={inARow ? [styles.pb3, styles.pr5, styles.w50, styles.pl1] : [styles.pb3, styles.ph5]}>{freeTrial}</View> : freeTrial;
+ return addSpacing ? <View style={inARow ? [styles.flex1] : [styles.pb3, styles.ph5]}>{freeTrial}</View> : freeTrial;
}
FreeTrial.displayName = 'FreeTrial';
|
Working on the fix. |
@fedirjh Thanks for your suggested code in this comment. However, I previously investigated the issue and found a solution that only requires a one-line change, which helps minimize the risk of regression. Let's first test whether my change in this commit resolves the issue. If it doesn't, I'll proceed with your suggested changes. Below are the results after applying my fix:
|
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.
@truph01 Thank you for the update. I’ve noticed that there is still no gap between the buttons in the wide-screen views. The code I provided here should fix and simplify thi. To further explain my changes, I observed that we are not utilizing styles correctly: instead of using flex
and gap
prop styles, we were relying on padding and margin to space items, which doesn’t look ideal to me.

src/pages/settings/Subscription/CardSection/BillingBanner/EarlyDiscountBanner.tsx
Outdated
Show resolved
Hide resolved
src/pages/settings/Subscription/CardSection/BillingBanner/EarlyDiscountBanner.tsx
Outdated
Show resolved
Hide resolved
src/pages/settings/Subscription/CardSection/BillingBanner/EarlyDiscountBanner.tsx
Outdated
Show resolved
Hide resolved
src/pages/settings/Subscription/CardSection/BillingBanner/EarlyDiscountBanner.tsx
Outdated
Show resolved
Hide resolved
src/pages/settings/Subscription/CardSection/BillingBanner/EarlyDiscountBanner.tsx
Outdated
Show resolved
Hide resolved
@fedirjh I applied your code changes here, which removes the getGuideBookButtonStyles function. However, I encountered an issue when applying that 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.
Looks good to me
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.
Looks good, thanks!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 9.1.7-1 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.1.7-2 🚀
|
text={translate('getAssistancePage.scheduleADemo')} | ||
onPress={() => { | ||
openExternalLink(account?.guideDetails?.calendarLink ?? ''); | ||
}} | ||
style={!shouldUseNarrowLayout && isChatUsedForOnboarding && styles.mr2} | ||
style={shouldUseNarrowLayout && shouldShowGuideBookingButtonInEarlyDiscountBanner && [styles.flex1]} |
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 PR introduced a style bug, detailed here #58974
Explanation of Change
Fixed Issues
$ #55879
PROPOSAL: #55879 (comment)
Tests
#admin
room.Offline tests
QA Steps
#admin
room.PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Screen.Recording.2025-02-19.at.17.36.40.mov
Android: mWeb Chrome
Screen.Recording.2025-02-19.at.17.34.56.mov
iOS: Native
Screen.Recording.2025-02-19.at.17.26.58.mov
iOS: mWeb Safari
Screen.Recording.2025-02-19.at.17.09.10.mov
MacOS: Chrome / Safari
Screen.Recording.2025-02-19.at.16.56.32.mov
MacOS: Desktop
Screen.Recording.2025-02-19.at.17.32.47.mov