import { useRef } from "react"; import { ChevronRightIcon } from "@heroicons/react/20/solid"; // @ts-ignore import { DateTime } from "luxon"; function msToTime(ms: number) { let milliseconds = parseInt(ms.toFixed(1)); let seconds = parseInt((ms / 1000).toFixed(1)); let minutes = parseInt((ms / (1000 * 60)).toFixed(1)); let hours = parseInt((ms / (1000 * 60 * 60)).toFixed(1)); let days = parseInt((ms / (1000 * 60 * 60 * 24)).toFixed(1)); if (milliseconds < 1000) return milliseconds + "ms"; else if (seconds < 60) return seconds + "s"; else if (minutes < 60) return minutes + "m"; else if (hours < 24) return hours + "hr"; else return days + " Days"; } export default function HistoryList(props: any) { return (
{props.items.map((i: any) => { let h = props.history[i.index]; return (
  • {DateTime.fromMillis(h.timestamp / 1000000).toLocaleString( DateTime.TIME_WITH_SECONDS, )}

    {DateTime.fromMillis(h.timestamp / 1000000).toLocaleString( DateTime.DATE_SHORT, )}

                      {h.command}
                    

    {h.user}  on  {h.host}  in  {h.cwd}

    {h.exit}

    {h.duration ? (

    ) : (
    )}
  • ); })}
    ); }