({ trip, onPackageSelect, onCancel }: DriverListProps)
| 13 | |
| 14 | |
| 15 | export function DriverList({ trip, onPackageSelect, onCancel }: DriverListProps) { |
| 16 | return ( |
| 17 | <div className="flex items-center justify-center p-4 min-h-screen bg-black/20"> |
| 18 | <div className="bg-white rounded-2xl shadow-lg p-6 max-w-md w-full"> |
| 19 | <h2 className="text-xl font-semibold mb-2">Select your desired ride</h2> |
| 20 | <p className="text-sm text-gray-500 mb-6">Routing for {convertMetersToKilometers(trip?.distance ?? 0)}</p> |
| 21 | <div className="flex items-center gap-1 text-sm text-gray-500 mb-2"> |
| 22 | <Clock className="w-4 h-4" /> |
| 23 | <span>You'll arrive in: {convertSecondsToMinutes(trip?.duration ?? 0)}</span> |
| 24 | </div> |
| 25 | <div className="space-y-4"> |
| 26 | {trip?.rideFares.map((fare) => { |
| 27 | const Icon = PackagesMeta[fare.packageSlug].icon; |
| 28 | const price = fare.totalPriceInCents && `$${(fare.totalPriceInCents / 100).toFixed(2)}` |
| 29 | |
| 30 | return ( |
| 31 | <div |
| 32 | key={fare.id} |
| 33 | className={cn( |
| 34 | "flex items-center justify-between p-4 rounded-lg border transition-all cursor-pointer", |
| 35 | "hover:border-primary hover:bg-primary/5", |
| 36 | )} |
| 37 | onClick={() => onPackageSelect(fare)} |
| 38 | > |
| 39 | <div className="flex items-center gap-4"> |
| 40 | <div className="p-2 bg-gray-100 rounded-lg"> |
| 41 | {Icon} |
| 42 | </div> |
| 43 | <div> |
| 44 | <h3 className="font-medium">{PackagesMeta[fare.packageSlug].name}</h3> |
| 45 | <p className="text-sm text-gray-500">{PackagesMeta[fare.packageSlug].description}</p> |
| 46 | </div> |
| 47 | </div> |
| 48 | <div className="text-right"> |
| 49 | <p className="font-semibold">{price}</p> |
| 50 | </div> |
| 51 | </div> |
| 52 | ); |
| 53 | })} |
| 54 | </div> |
| 55 | <div className="mt-6 space-y-4"> |
| 56 | <Button |
| 57 | variant="outline" |
| 58 | className="w-full" |
| 59 | onClick={() => onCancel()} |
| 60 | > |
| 61 | Back to Map |
| 62 | </Button> |
| 63 | </div> |
| 64 | </div> |
| 65 | </div> |
| 66 | ) |
| 67 | } |
nothing calls this directly
no test coverage detected