fix: if timestamp is undefined skip rendering

This commit is contained in:
bennykok 2024-02-01 18:30:57 +08:00
parent ea675fcd4c
commit 5d349153d2

View File

@ -7,7 +7,7 @@ import { toast } from "sonner";
export type LogsType = { export type LogsType = {
machine_id?: string; machine_id?: string;
logs: string; logs: string;
timestamp: number; timestamp?: number;
}[]; }[];
export function LogsViewer({ export function LogsViewer({
@ -65,7 +65,7 @@ export function LogsViewer({
navigator.clipboard.writeText(x.logs); navigator.clipboard.writeText(x.logs);
}} }}
> >
{!hideTimestamp && ( {!hideTimestamp && x.timestamp != undefined && (
<> <>
<span className="w-[150px] flex-shrink-0"> <span className="w-[150px] flex-shrink-0">
{new Date(x.timestamp * 1000).toLocaleString()} {new Date(x.timestamp * 1000).toLocaleString()}