Skip to content

Commit

Permalink
Merge master.
Browse files Browse the repository at this point in the history
  • Loading branch information
nkolic committed Feb 12, 2024
2 parents 87877d3 + 1ebe6b5 commit c16e5b8
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const StopPointsViewer = ({ goBackToAddressSelector }: StopPointsViewerProps) =>
</StreetAddress>
</StreetAddressContainer>
<TouchableOpacity
testID="editIcon"
onPress={() => goBackToAddressSelector(requestStopPoints.length - 1)}
>
<SvgIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const BottomSheetInputField = forwardRef((props, ref) => (

{ props.onDrag && (
<DragTouchableIconContainer
testID={`DragIconContainer_${props.index}`}
onPressIn={() => props.onDrag()}
onPressOut={() => props.onEndDrag()}
>
Expand All @@ -83,7 +84,7 @@ const BottomSheetInputField = forwardRef((props, ref) => (

{ props.remove && (
<TouchableIconContainer width={30} marginLeft={15} onPress={() => props.remove()}>
<RemoveIconContainer>
<RemoveIconContainer testID={`removeIcon_${props.index}`}>
<SvgIcon
Svg={deleteIcon}
stroke="#333"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,29 @@ import { View } from 'react-native';
import SvgIcon from '../../../../../../Components/SvgIcon';
import i18n from '../../../../../../I18n';
import Seat from '../../../../../../assets/seat.svg';
import { getFormattedPrice, TAG_OPTIONS } from '../../../../../../context/newRideContext/utils';
import {
getFormattedPrice,
TAG_OPTIONS,
} from '../../../../../../context/newRideContext/utils';
import { Context as ThemeContext } from '../../../../../../context/theme';
import {
Circle, AvailableSeats,
Capacity, CardContainer,
CarIcon, Eta,
Row, Price,
ServiceDetails, TimeDetails,
Title, Description,
CarContainer, TitleContainer,
EstimatedText, WrapRow, HighEta,
Circle,
AvailableSeats,
Capacity,
CardContainer,
CarIcon,
Eta,
Row,
Price,
ServiceDetails,
TimeDetails,
Title,
Description,
CarContainer,
TitleContainer,
EstimatedText,
WrapRow,
HighEta,
} from './styled';
import Tag from '../../../../../../Components/Tag';
import { RidePageContext } from '../../../../../../context/newRideContext';
Expand All @@ -26,18 +38,20 @@ import showPriceBasedOnAccount from '../../../../../../services/showPriceBasedOn

const FARE_POPUP = 'farePopup';

const ServiceCard = ({ service, withBorder }) => {
const ServiceCard = ({ service, withBorder, testID }) => {
const { businessAccountId } = useContext(RidePageContext);
const theme = useContext(ThemeContext);
const {
setChosenService, chosenService, serviceEstimations, ride,
} = useContext(RidePageContext);
const { setChosenService, chosenService, serviceEstimations, ride } =

Check failure on line 44 in examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/ServiceCard/index.js

View workflow job for this annotation

GitHub Actions / lint

Expected a line break after this opening brace

Check failure on line 44 in examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/ServiceCard/index.js

View workflow job for this annotation

GitHub Actions / lint

Expected a line break before this closing brace

Check failure on line 44 in examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/ServiceCard/index.js

View workflow job for this annotation

GitHub Actions / lint

There should be no line break before or after '='
useContext(RidePageContext);
const { showPrice, loadShowPrice } = SettingContext.useContainer();
const { getBusinessAccountById } = PaymentContext.useContainer();
const [popup, setPopup] = useState(null);
const isFutureRide = ride.scheduledTo;
const unavailable = !((ride.scheduledTo && service.priceCalculationId)
|| (service.eta || service.isHighEtaAsapRide));
const unavailable = !(
(ride.scheduledTo && service.priceCalculationId) ||

Check failure on line 51 in examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/ServiceCard/index.js

View workflow job for this annotation

GitHub Actions / lint

'||' should be placed at the beginning of the line
service.eta ||

Check failure on line 52 in examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/ServiceCard/index.js

View workflow job for this annotation

GitHub Actions / lint

'||' should be placed at the beginning of the line
service.isHighEtaAsapRide
);
const isSelected = chosenService && chosenService.id === service.id;
const sharedTagContainerStyles = {
borderWidth: 1,
Expand Down Expand Up @@ -70,28 +84,23 @@ const ServiceCard = ({ service, withBorder }) => {

const etaTimeDetails = () => {
if (service.isHighEtaAsapRide) {
return (
<HighEta theme={theme}>
{i18n.t('rideDetails.highEta')}
</HighEta>
);
return <HighEta theme={theme}>{i18n.t('rideDetails.highEta')}</HighEta>;
}
return (
<TimeDetails>
<Eta>
{moment(service.eta).format('h:mm A')}
</Eta>
<Eta>{moment(service.eta).format('h:mm A')}</Eta>
<Circle />
<Eta>
{getEta()}
</Eta>
<Eta>{getEta()}</Eta>
</TimeDetails>
);
};

const getDescription = forFutureRidesView => (
<Description style={{ ...(forFutureRidesView && { width: '60%' }) }} numberOfLines={2}>
{(service.description || '')}
const getDescription = (forFutureRidesView) => (

Check failure on line 98 in examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/ServiceCard/index.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected parentheses around single function argument having a body with no curly braces
<Description
style={{ ...(forFutureRidesView && { width: '60%' }) }}
numberOfLines={2}
>
{service.description || ''}
</Description>
);

Expand All @@ -104,16 +113,23 @@ const ServiceCard = ({ service, withBorder }) => {
return i18n.t('rideDetails.unavailable');
}

return showPrice ? getFormattedPrice(service.currency, service.price) : null;
return showPrice
? getFormattedPrice(service.currency, service.price)
: null;
};

useEffect(() => {
showPriceBasedOnAccount(loadShowPrice, getBusinessAccountById, businessAccountId);
showPriceBasedOnAccount(
loadShowPrice,
getBusinessAccountById,
businessAccountId

Check failure on line 125 in examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/ServiceCard/index.js

View workflow job for this annotation

GitHub Actions / lint

Missing trailing comma
);
}, [businessAccountId]);

return (
<>
<CardContainer
testID={testID}
theme={theme}
withBorder={withBorder}
selected={isSelected}
Expand All @@ -130,79 +146,62 @@ const ServiceCard = ({ service, withBorder }) => {
}}
>
<CarContainer unavailable={unavailable}>
<CarIcon
resizeMode="contain"
source={{ uri: service.iconUrl }}
/>
<CarIcon resizeMode='contain' source={{ uri: service.iconUrl }} />

Check failure on line 149 in examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/ServiceCard/index.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected usage of singlequote
</CarContainer>
<ServiceDetails unavailable={unavailable}>
<WrapRow>
<Title numberOfLines={2}>
{service.name}
</Title>
<Title numberOfLines={2}>{service.name}</Title>
<TitleContainer>
{serviceEstimations.filter(s => s.price).length > 1
&& service.tag
&& !(isFutureRide && service.tag === TAG_OPTIONS.FASTEST)
? (
<Tag
key={service.tag}
containerStyles={tagStyles[service.tag].container}
text={service.tag}
textColor={tagStyles[service.tag].textColor}
/>
)
: <View />
}
<Price>
{getUnavailableText()}
</Price>
{serviceEstimations.filter((s) => s.price).length > 1 &&

Check failure on line 155 in examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/ServiceCard/index.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected parentheses around single function argument having a body with no curly braces

Check failure on line 155 in examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/ServiceCard/index.js

View workflow job for this annotation

GitHub Actions / lint

'&&' should be placed at the beginning of the line
service.tag &&
!(isFutureRide && service.tag === TAG_OPTIONS.FASTEST) ? (
<Tag
key={service.tag}
containerStyles={tagStyles[service.tag].container}
text={service.tag}
textColor={tagStyles[service.tag].textColor}
/>
) : (
<View />
)}
<Price>{getUnavailableText()}</Price>
</TitleContainer>
</WrapRow>
{!unavailable && (
<WrapRow>
{!isFutureRide
? (
etaTimeDetails()
)
: getDescription(isFutureRide)}

{service.isPriceEstimated && showPrice ? (
<EstimatedText>
{i18n.t('rideDetails.estimatedFare')}
</EstimatedText>
) : (
<Capacity>
<AvailableSeats>
{service.availableSeats}
</AvailableSeats>
<SvgIcon Svg={Seat} width={15} height={15} />
</Capacity>
)}
<WrapRow>
{!isFutureRide ? etaTimeDetails() : getDescription(isFutureRide)}

</WrapRow>
{service.isPriceEstimated && showPrice ? (
<EstimatedText>
{i18n.t('rideDetails.estimatedFare')}
</EstimatedText>
) : (
<Capacity>
<AvailableSeats>{service.availableSeats}</AvailableSeats>
<SvgIcon Svg={Seat} width={15} height={15} />
</Capacity>
)}
</WrapRow>
)}
{!isFutureRide && (
<Row>
{getDescription()}
{service.isPriceEstimated && showPrice ? (
<Capacity>
<AvailableSeats>
{service.availableSeats}
</AvailableSeats>
<SvgIcon Svg={Seat} width={15} height={15} />
</Capacity>
) : null}
</Row>
<Row>
{getDescription()}
{service.isPriceEstimated && showPrice ? (
<Capacity>
<AvailableSeats>{service.availableSeats}</AvailableSeats>
<SvgIcon Svg={Seat} width={15} height={15} />
</Capacity>
) : null}
</Row>
)}
</ServiceDetails>
</CardContainer>
{popup === FARE_POPUP && (
<FareBreakdownPopup
isVisible={popup === FARE_POPUP}
service={service}
onClose={() => setPopup('')}
/>
<FareBreakdownPopup
isVisible={popup === FARE_POPUP}
service={service}
onClose={() => setPopup('')}
/>
)}
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ const ServiceOptions = () => {

return (
<ServiceOptionsContainer alwaysBounceVertical={false}>

{ serviceEstimations?.length === 0
? (
<EmptyState
Expand Down

0 comments on commit c16e5b8

Please sign in to comment.