Skip to content

Commit

Permalink
add bus ID to callout (see #110)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwees committed Jan 30, 2024
1 parent 3379182 commit 0e42e81
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/components/map/BusCallout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ interface Props {
amenities: IAmenity[]
tintColor: string
routeName: string
busId: string
}

// Bus callout with amentities
const BusCallout: React.FC<Props> = ({ directionName, fullPercentage, amenities, tintColor, routeName }) => {
const BusCallout: React.FC<Props> = ({ directionName, fullPercentage, amenities, tintColor, routeName, busId }) => {
return (
<Callout>
<View style={{ width: 160 }}>
<View style={{ flexDirection: 'row', justifyContent: 'center', alignItems: 'center', marginBottom: 4 }}>
<BusIcon name={routeName} color={tintColor} isCallout={true} />
<Text style={{paddingLeft: 6, color: tintColor, fontWeight: "600"}}>{busId}</Text>
<View style={{ flex: 1 }} />
<AmenityRow amenities={amenities} color={"gray"} size={20} />
</View>
Expand Down
8 changes: 7 additions & 1 deletion app/components/map/markers/BusMarker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ const BusMarker: React.FC<Props> = ({ bus, tintColor, routeName }) => {
>
{/* Bus Icon on Map*/}
<BusMapIcon color={busColor} borderColor={borderColor} heading={bus.location.heading} iconColor={iconColor} />
<BusCallout directionName={bus.directionName} fullPercentage={Math.round((bus.passengersOnboard / bus.passengerCapacity)*100)} amenities={bus.amenities} tintColor={tintColor ?? "#500000"} routeName={routeName} />
<BusCallout
directionName={bus.directionName}
fullPercentage={Math.round((bus.passengersOnboard / bus.passengerCapacity)*100)}
amenities={bus.amenities} tintColor={tintColor ?? "#500000"}
routeName={routeName}
busId={bus.name}
/>
</Marker>
);
};
Expand Down

0 comments on commit 0e42e81

Please sign in to comment.