Skip to content

Commit

Permalink
fix show price in future ride + don't display offline text in busines…
Browse files Browse the repository at this point in the history
…s account payment (#822)

* fix show price in future ride

* Update index.tsx

* remove business accoun subtitle
  • Loading branch information
OmerGery authored Apr 10, 2024
1 parent 4faec21 commit e8cdb9f
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 72 deletions.

This file was deleted.

This file was deleted.

19 changes: 5 additions & 14 deletions examples/client/Locomotion/src/Components/CardRow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { View, Text } from 'react-native';
import moment from 'moment';
import styled, { ThemeContext } from 'styled-components';
import { PaymentIcon } from 'react-native-payment-icons';
import BusinessAccountText from '../BusinessAccountText';
import { RideInterface, RidePageContext } from '../../context/newRideContext';
import { PAYMENT_METHODS, paymentMethodToIconMap } from '../../pages/Payments/consts';
import Button from '../Button';
Expand Down Expand Up @@ -204,19 +203,11 @@ const CardRow = (paymentMethod: any) => {
)
: (
<>
{
(businessAccountId && offlinePaymentText)
? (
<BusinessAccountText
title={getPaymentMethodTitle()}
subTitle={offlinePaymentText}
/>
)
: (
<Type>
{getPaymentMethodTitle()}
</Type>
)}

<Type>
{getPaymentMethodTitle()}
</Type>

{paymentMethod.lastFour
? <Description>{getLastFourForamttedShort(paymentMethod.lastFour)}</Description>
: null}
Expand Down
6 changes: 3 additions & 3 deletions examples/client/Locomotion/src/Components/RideCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const RideCard = ({
const {
getRidePriceCalculation,
} = useContext(RidePageContext);
const { businessAccountId } = useContext(RidePageContext);

const { getBusinessAccountById } = PaymentContext.useContainer();
const { showPrice, loadShowPrice } = SettingContext.useContainer();

Expand All @@ -109,8 +109,8 @@ const RideCard = ({
}, [ride]);

useEffect(() => {
showPriceBasedOnAccount(loadShowPrice, getBusinessAccountById, businessAccountId);
}, [businessAccountId]);
showPriceBasedOnAccount(loadShowPrice, getBusinessAccountById, ride.businessAccountId);
}, [ride.businessAccountId]);

const formatScheludedTo = async (time: any) => {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useContext } from 'react';
import { Text, View } from 'react-native';
import styled, { ThemeContext } from 'styled-components';
import BusinessAccountText from '../BusinessAccountText';
import { FONT_SIZES } from '../../context/theme';
import SvgIcon from '../SvgIcon';

Expand Down Expand Up @@ -57,13 +56,7 @@ const TextRowWithIcon = ({
...((Image || icon) && { marginLeft: 10 }),
}}
>
{subTitle ? (
<BusinessAccountText
title={text}
subTitle={subTitle}
/>
)
: text}
{text}
</BasicText>
</Container>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { PaymentIcon } from 'react-native-payment-icons';
import styled, { ThemeContext } from 'styled-components';
import { useFocusEffect } from '@react-navigation/native';
import SkeletonContent from 'react-native-skeleton-content-nonexpo';
import BusinessAccountText from '../../../../../../Components/BusinessAccountText';
import { isCardPaymentMethod, isCashPaymentMethod, isOfflinePaymentMethod } from '../../../../../../lib/ride/utils';
import { getCouponText } from '../../../../../../context/newRideContext/utils';
import { MAIN_ROUTES } from '../../../../../routes';
Expand Down Expand Up @@ -77,7 +76,6 @@ interface PaymentButtonProps {
brand?: Brand;
id?: string;
invalid?: boolean;
subTitle?: string;
}


Expand All @@ -87,7 +85,6 @@ const PaymentButton = ({
brand,
id,
invalid,
subTitle,
}: PaymentButtonProps) => {
const { primaryColor } = useContext(ThemeContext);
const { getCoupon, coupon, setCoupon } = useContext(UserContext);
Expand Down Expand Up @@ -168,9 +165,7 @@ const PaymentButton = ({
width={40}
/>
)}
{ subTitle
? <BusinessAccountText title={title} subTitle={subTitle} />
: <TimeText numberOfLines={1}>{title}</TimeText> }
<TimeText numberOfLines={1}>{title}</TimeText>
</CardNameContainer>
<PromoButtonContainer>
{loadPromoButton()}
Expand All @@ -185,5 +180,4 @@ PaymentButton.defaultProps = {
brand: null,
id: null,
invalid: false,
subTitle: null,
};
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ const RideButtons = ({
brand={selectedPaymentMethod?.brand}
icon={paymentMethodToIconMap[selectedPaymentMethod?.id]}
title={getSelectedPaymentMethodTitle()}
subTitle={businessAccountId && offlinePaymentText}
id={selectedPaymentMethod?.id}
invalid={paymentMethodNotAllowedOnService}
/>
Expand Down

0 comments on commit e8cdb9f

Please sign in to comment.