import { LineBadge } from '../atoms/LineBadge'; import { Departure } from '../../types'; import { useAlwaysOn } from '../../contexts/AlwaysOnContext'; export const DepartureItem = ({ departure }: { departure: Departure }) => { const alwaysOn = useAlwaysOn(); const depTime = new Date(departure.scheduled); const diffMin = Math.round((depTime.getTime() - Date.now()) / 60000); const timeText = diffMin <= 0 ? 'Now' : `${diffMin} min`; return (
{departure.destination}
{timeText}
); };