({ trip, status, onAcceptTrip, onDeclineTrip }: DriverTripOverviewProps)
| 11 | } |
| 12 | |
| 13 | export const DriverTripOverview = ({ trip, status, onAcceptTrip, onDeclineTrip }: DriverTripOverviewProps) => { |
| 14 | if (!trip) { |
| 15 | return ( |
| 16 | <TripOverviewCard |
| 17 | title="Waiting for a rider..." |
| 18 | description="Waiting for a rider to request a trip..." |
| 19 | /> |
| 20 | ) |
| 21 | } |
| 22 | |
| 23 | if (status === TripEvents.DriverTripRequest) { |
| 24 | return ( |
| 25 | <TripOverviewCard |
| 26 | title="Trip request received!" |
| 27 | description="A trip has been requested, check the route and accept the trip if you can take it." |
| 28 | > |
| 29 | <div className="flex flex-col gap-2"> |
| 30 | <Button onClick={onAcceptTrip}>Accept trip</Button> |
| 31 | <Button variant="outline" onClick={onDeclineTrip}>Decline trip</Button> |
| 32 | </div> |
| 33 | </TripOverviewCard> |
| 34 | ) |
| 35 | } |
| 36 | |
| 37 | if (status === TripEvents.DriverTripAccept) { |
| 38 | return ( |
| 39 | <TripOverviewCard |
| 40 | title="All set!" |
| 41 | description="You can now start the trip" |
| 42 | > |
| 43 | <div className="flex flex-col gap-4"> |
| 44 | <div className="flex flex-col gap-2"> |
| 45 | <h3 className="text-lg font-bold">Trip details</h3> |
| 46 | <p className="text-sm text-gray-500"> |
| 47 | Trip ID: {trip.id} |
| 48 | <br /> |
| 49 | Rider ID: {trip.userID} |
| 50 | </p> |
| 51 | </div> |
| 52 | </div> |
| 53 | </TripOverviewCard> |
| 54 | ) |
| 55 | } |
| 56 | |
| 57 | return null |
| 58 | } |
nothing calls this directly
no outgoing calls
no test coverage detected