"use client"; import React from "react"; import { WalkRoute } from "@timetoleave/core"; import LoadingSpinner from "@/app/ui/LoadingSpinner"; import Button from "@/app/ui/Button"; /** * Renders the walking route from the arrival station to the event destination. * * This is the "last mile" leg computed via OSRM walking profile. * Hidden when no route data, no loading, and no error are present. */ type WalkingOptionProps = { walkRoute: WalkRoute | null | undefined; walkLoading?: boolean; walkError?: string | null | undefined; onRefresh?: () => void; className?: string; }; const WalkingOption: React.FC = ({ walkRoute, walkLoading, walkError, onRefresh, className = "" }) => { if (!walkRoute && !walkLoading && !walkError) { return null; } return (

Final Walk

From arrival station to destination

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

Steps

    {walkRoute.steps.map((step: { name: string; instruction: string }, index: number) => (
  • {step.name} {step.instruction}
  • ))}
)}
) : null}
); }; export default WalkingOption;