"use client";
import { useEffect, useRef } from "react";
/** HH:MM (with the date when not today) in the viewer's time zone; the server renders its own zone first. */
export function LocalTime({ iso }: { iso: string }) {
const d = new Date(iso);
const today = new Date().toDateString() === d.toDateString();
const time = d.toLocaleTimeString("ru-RU", { hour: "2-digit", minute: "2-digit" });
return (
);
}
/** On narrow screens the side panel sits under the list: bring the chosen runner into view. */
export function ScrollIntoViewOnNarrow({ id }: { id: string | number }) {
const ref = useRef(null);
useEffect(() => {
if (window.matchMedia("(max-width: 1279px)").matches) ref.current?.scrollIntoView({ block: "start" });
}, [id]);
return ;
}