Skip to content

Commit

Permalink
Merge branch 'master' into mixpanel-limit-events
Browse files Browse the repository at this point in the history
  • Loading branch information
oriefrati authored Jan 14, 2024
2 parents ffbab29 + 2bdacfc commit 0e6f8b8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ const ServiceCard = ({ service, withBorder }) => {
)
: getDescription(isFutureRide)}

{service.isPriceEstimated ? (
{service.isPriceEstimated && showPrice ? (
<EstimatedText>
{i18n.t('rideDetails.estimatedFare')}
</EstimatedText>
Expand All @@ -181,7 +181,7 @@ const ServiceCard = ({ service, withBorder }) => {
{!isFutureRide && (
<Row>
{getDescription()}
{service.isPriceEstimated ? (
{service.isPriceEstimated && showPrice ? (
<Capacity>
<AvailableSeats>
{service.availableSeats}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Text } from 'react-native';
import { getCouponText } from '../../../../../context/newRideContext/utils';
import { RidePageContext } from '../../../../../context/newRideContext';
import { UserContext } from '../../../../../context/user';
import SettingsContext from '../../../../../context/settings';
import ServiceCard from './ServiceCard';
import { ServiceOptionsContainer } from './styles';
import { serviceCardSkeleton } from './ServiceCard/skeleton';
Expand All @@ -14,11 +15,16 @@ const SUCCESS_COLOR = '#25B861';

const ServiceOptions = () => {
const { serviceEstimations, stopRequestInterval } = useContext(RidePageContext);
const { showPrice, loadShowPrice } = SettingsContext.useContainer();

const { coupon } = useContext(UserContext);
const isDebuggingEnabled = (typeof atob !== 'undefined');
const { setTopBarProps } = useContext(BottomSheetContext);

useEffect(() => () => stopRequestInterval(), []);
useEffect(() => {
loadShowPrice();
}, []);

const clearTopBar = () => {
setTopBarProps(INITIAL_TOP_BAR_PROPS);
Expand All @@ -43,7 +49,8 @@ const ServiceOptions = () => {
useEffect(() => {
if (coupon && coupon.status !== 'error') {
setCouponTopBar();
} else if ((serviceEstimations || []).some(estimation => estimation.isPriceEstimated)) {
} else if (showPrice
&& (serviceEstimations || []).some(estimation => estimation.isPriceEstimated)) {
setEstimateFareTopBar();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
import { PaymentMethodInterface } from '../../context/payments/interface';
import * as navigationService from '../../services/navigation';
import PriceBreakdown from '../../Components/PriceBreakdown';
import SettingsContext from '../../context/settings';

type RidePriceBreakdownParams = {
rideId: string,
Expand All @@ -38,6 +39,8 @@ const RidePriceBreakDown = () => {
getRidePriceCalculation,
getRideFromApi,
} = useContext(RidePageContext);
const { showPrice, loadShowPrice } = SettingsContext.useContainer();


const updatePriceCalculation = async () => {
try {
Expand Down Expand Up @@ -75,6 +78,9 @@ const RidePriceBreakDown = () => {
useEffect(() => {
updateRideFromApi();
}, []);
useEffect(() => {
loadShowPrice();
}, []);

return (
<PageContainer>
Expand All @@ -97,7 +103,8 @@ const RidePriceBreakDown = () => {
</CreditCardRowContainer>
{
(priceCalculation && isPriceEstimated(priceCalculation.calculationBasis)
&& !RIDE_FINAL_STATES.includes(localRide?.state || ''))
&& !RIDE_FINAL_STATES.includes(localRide?.state || '')
&& showPrice)
? (
<EstimationContainer>
<EstimationText>{i18n.t('ridePriceBreakdown.estimatedText')}</EstimationText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ const FareBreakdownPopup = ({
<InnerContainer>
<CloseButton onPress={onClose} containerStyles={{ alignSelf: 'flex-end' }} />
<ServiceCard service={service} />
{service.isPriceEstimated && (
{service.isPriceEstimated && showPrice && (
<EstimatedTextContainer>
<EstimatedText>
{`${i18n.t('ridePriceBreakdown.estimatedText')}`}
</EstimatedText>
</EstimatedTextContainer>
)}
</InnerContainer>
{service.isPriceEstimated && <Line />}
{service.isPriceEstimated && showPrice && <Line />}
{showPrice
&& (
<PriceBreakdown
Expand Down

0 comments on commit 0e6f8b8

Please sign in to comment.