MCPcopy Create free account
hub / github.com/codealong-dev/ride-sharing / RiderTripOverview

Function RiderTripOverview

web/src/components/RiderTripOverview.tsx:21–154  ·  view source on GitHub ↗
({
  trip,
  status,
  assignedDriver,
  paymentSession,
  onPackageSelect,
  onCancel,
}: TripOverviewProps)

Source from the content-addressed store, hash-verified

19}
20
21export const RiderTripOverview = ({
22 trip,
23 status,
24 assignedDriver,
25 paymentSession,
26 onPackageSelect,
27 onCancel,
28}: TripOverviewProps) => {
29 if (!trip) {
30 return (
31 <TripOverviewCard
32 title="Start a trip"
33 description="Click on the map to set a destination"
34 />
35 )
36 }
37
38 if (status === TripEvents.PaymentSessionCreated && paymentSession) {
39 return (
40 <TripOverviewCard
41 title="Payment Required"
42 description="Please complete the payment to confirm your trip"
43 >
44 <div className="flex flex-col gap-4">
45 <DriverCard driver={assignedDriver} />
46
47 <div className="text-sm text-gray-500">
48 <p>Amount: {paymentSession.amount} {paymentSession.currency}</p>
49 <p>Trip ID: {paymentSession.tripID}</p>
50 </div>
51 <StripePaymentButton paymentSession={paymentSession} />
52 </div>
53 </TripOverviewCard>
54 )
55 }
56
57 if (status === TripEvents.NoDriversFound) {
58 return (
59 <TripOverviewCard
60 title="No drivers found"
61 description="No drivers found for your trip, please try again later"
62 >
63 <Button variant="outline" className="w-full" onClick={onCancel}>
64 Go back
65 </Button>
66 </TripOverviewCard>
67 )
68 }
69
70 if (status === TripEvents.DriverAssigned) {
71 return (
72 <TripOverviewCard
73 title="Driver assigned!"
74 description="Your driver is on the way, waiting for payment confirmation to show..."
75 >
76 <div className="flex flex-col space-y-3 justify-center items-center mb-4">
77 {/* <p>Driver: {trip.id}</p> */}
78 </div>

Callers

nothing calls this directly

Calls 2

convertSecondsToMinutesFunction · 0.90

Tested by

no test coverage detected