"use client"; import React from "react"; import { BikeRoute } from "@timetoleave/core"; import LoadingSpinner from "@/app/ui/LoadingSpinner"; import Button from "@/app/ui/Button"; type BikeSectionProps = { bikeRoute: BikeRoute | null | undefined; bikeLoading: boolean; bikeError: string | null | undefined; onRefresh?: () => void; className?: string; forceVisible?: boolean; }; const BikeSection: React.FC = ({ bikeRoute, bikeLoading, bikeError, onRefresh, className = "", forceVisible = false, }) => { if (!forceVisible && !bikeRoute && !bikeLoading && !bikeError) { return null; } return (

Bicycle Route

Door-to-door route to the event

{onRefresh && ( )}
{bikeLoading ? (
) : bikeError ? (
Error: {bikeError}
) : bikeRoute ? (
Distance {Math.round(bikeRoute.distance / 1000)} km ({Math.round(bikeRoute.distance)} m)
Duration {Math.floor(bikeRoute.duration / 60)} min {bikeRoute.duration % 60} s
{bikeRoute.steps && bikeRoute.steps.length > 0 && (

Steps

    {bikeRoute.steps.map((step, index) => (
  • {step.name} {step.instruction}
  • ))}
)}
) : (
Add origin and destination coordinates to calculate a bike route.
)}
); }; export default BikeSection;