From 920d70d23022eea63c632eea697551755f6bdb0e Mon Sep 17 00:00:00 2001 From: Hristo Nedelkov Date: Tue, 28 Nov 2023 12:13:04 +0200 Subject: [PATCH] add timestamp if needed --- src/pages/LogsPage/TerminalRow.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/pages/LogsPage/TerminalRow.tsx b/src/pages/LogsPage/TerminalRow.tsx index d99e0699..8cd5f7af 100644 --- a/src/pages/LogsPage/TerminalRow.tsx +++ b/src/pages/LogsPage/TerminalRow.tsx @@ -9,6 +9,7 @@ type DataType = { interface RowProps { data: DataType | undefined index: number + timestamp: boolean } function cutSentenceToRandomWords(sentence: string) { const randomLength = Math.floor(Math.random() * 100) + 1 @@ -17,7 +18,7 @@ function cutSentenceToRandomWords(sentence: string) { return slicedWords.join(' ') } -const TerminalRow = ({ data, index }: RowProps) => { +const TerminalRow = ({ data, index, timestamp }: RowProps) => { if (!data) { return Loading... } @@ -41,10 +42,12 @@ const TerminalRow = ({ data, index }: RowProps) => { > {index} - - {new Date(Date.now()).getHours()}:{new Date(Date.now()).getMinutes()}: - {new Date(Date.now()).getSeconds()} - + {timestamp && ( + + {new Date(Date.now()).getHours()}:{new Date(Date.now()).getMinutes()}: + {new Date(Date.now()).getSeconds()} + + )}