// @ts-ignore import { DateTime } from "luxon"; import { ChevronRightIcon } from "@heroicons/react/20/solid"; import { Highlight, themes } from "prism-react-renderer"; // @ts-ignore import Prism from "prismjs"; // @ts-ignore import "prismjs/components/prism-bash"; import Drawer from "../Drawer"; import HistoryInspect from "./HistoryInspect"; 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 HistoryRow({ h }: any) { return (
{DateTime.fromMillis(h.timestamp / 1000000).toLocaleString( DateTime.TIME_WITH_SECONDS, )}
{DateTime.fromMillis(h.timestamp / 1000000).toLocaleString( DateTime.DATE_SHORT, )}
{tokens &&
tokens.map((line, i) => {
if (i != 0) return;
return (
{line.map((token, key) => (
))}
);
})}
)}
{h.user} on {h.host} in {h.cwd}
{h.exit}
{h.duration ? () : ( )}