Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ type ButtonProps = Partial<ChildrenProps> & {
/** Any additional styles to pass to the right icon container. */
iconRightStyles?: StyleProp<ViewStyle>;

/** Any additional styles to pass to the icon wrapper container. */
iconWrapperStyles?: StyleProp<ViewStyle>;

/** Small sized button */
small?: boolean;

Expand Down Expand Up @@ -216,6 +219,7 @@ function Button(
icon = null,
iconStyles = [],
iconRightStyles = [],
iconWrapperStyles = [],
text = '',

small = false,
Expand Down Expand Up @@ -317,7 +321,7 @@ function Button(
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
if (icon || shouldShowRightIcon) {
return (
<View style={[isContentCentered ? styles.justifyContentCenter : styles.justifyContentBetween, styles.flexRow]}>
<View style={[isContentCentered ? styles.justifyContentCenter : styles.justifyContentBetween, styles.flexRow, iconWrapperStyles]}>
<View style={[styles.alignItemsCenter, styles.flexRow, styles.flexShrink1]}>
{!!icon && (
<View style={[styles.mr2, !text && styles.mr0, iconStyles]}>
Expand Down
5 changes: 4 additions & 1 deletion src/pages/home/HeaderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,11 @@ function HeaderView({report, parentReportAction, onNavigationMenuButtonClicked,
onPress={() => {
openExternalLink(account?.guideDetails?.calendarLink ?? '');
}}
style={shouldUseNarrowLayout && shouldShowGuideBookingButtonInEarlyDiscountBanner && [styles.flex1]}
style={shouldUseNarrowLayout && shouldShowGuideBookingButtonInEarlyDiscountBanner && styles.earlyDiscountButton}
icon={CalendarSolid}
// Ensure that a button with an icon displays an ellipsis when its content overflows https://github.com/Expensify/App/issues/58974#issuecomment-2794297554
iconWrapperStyles={[styles.mw100]}
isContentCentered
/>
);

Expand Down
11 changes: 7 additions & 4 deletions src/pages/home/TalkToSalesButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type TalkToSalesButtonProps = {

function TalkToSalesButton({shouldUseNarrowLayout, reportID}: TalkToSalesButtonProps) {
const {translate} = useLocalize();
const [talkToAISales] = useOnyx(ONYXKEYS.TALK_TO_AI_SALES);
const [talkToAISales] = useOnyx(ONYXKEYS.TALK_TO_AI_SALES, {canBeMissing: false});
const styles = useThemeStyles();
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [accountID] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.accountID});
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {canBeMissing: true});
const [accountID] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.accountID, canBeMissing: false});

if (!reportID || !accountID) {
return;
Expand Down Expand Up @@ -55,8 +55,11 @@ function TalkToSalesButton({shouldUseNarrowLayout, reportID}: TalkToSalesButtonP

initializeOpenAIRealtime(Number(reportID) ?? CONST.DEFAULT_NUMBER_ID, abTestCtaText());
}}
style={shouldUseNarrowLayout && [styles.flex1]}
style={shouldUseNarrowLayout && styles.earlyDiscountButton}
icon={talkToSalesIcon()}
// Ensure that a button with an icon displays an ellipsis when its content overflows https://github.com/Expensify/App/issues/58974#issuecomment-2794297554
iconWrapperStyles={[styles.mw100]}
isContentCentered
isLoading={talkToAISales?.isLoading}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function EarlyDiscountBanner({isSubscriptionPage, GuideBookingButton, TalkToSale
{GuideBookingButton}
<Button
success
style={shouldUseNarrowLayout ? styles.flex1 : styles.mr2}
style={shouldUseNarrowLayout ? styles.earlyDiscountButton : styles.mr2}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
style={shouldUseNarrowLayout ? styles.earlyDiscountButton : styles.mr2}
style={shouldUseNarrowLayout ? styles.earlyDiscountButton : styles.mr2}
iconWrapperStyles={[styles.w100]}
isContentCentered

@hoangzinh I think you forgot these changes here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because this button don't have icon, so we don't need to add those styles here

text={translate('subscription.billingBanner.earlyDiscount.claimOffer')}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION.getRoute(Navigation.getActiveRoute()))}
/>
Expand All @@ -101,7 +101,7 @@ function EarlyDiscountBanner({isSubscriptionPage, GuideBookingButton, TalkToSale
styles.flexRow,
styles.gap2,
styles.alignItemsCenter,
styles.flex1,
styles.earlyDiscountButton,
styles.mr2,
TalkToSalesButton,
GuideBookingButton,
Expand Down
6 changes: 6 additions & 0 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5671,6 +5671,12 @@ const styles = (theme: ThemeColors) =>
right: 0,
},

earlyDiscountButton: {
flexGrow: 1,
flexShrink: 1,
flexBasis: 'auto',
},

testDriveModalContainer: {
// On small/medium screens, we need to remove the top padding
paddingTop: 0,
Expand Down