@@ -2,10 +2,9 @@ import { makeStyles } from "@mui/styles";
2
2
import { LogLevel } from "api/typesGenerated" ;
3
3
import dayjs from "dayjs" ;
4
4
import { FC , useMemo } from "react" ;
5
- import { MONOSPACE_FONT_FAMILY } from "../../../ theme/constants" ;
6
- import { combineClasses } from "../../../ utils/combineClasses" ;
5
+ import { MONOSPACE_FONT_FAMILY } from "theme/constants" ;
6
+ import { combineClasses } from "utils/combineClasses" ;
7
7
import AnsiToHTML from "ansi-to-html" ;
8
- import { Theme } from "@mui/material/styles" ;
9
8
10
9
export interface Line {
11
10
time : string ;
@@ -16,19 +15,15 @@ export interface Line {
16
15
export interface LogsProps {
17
16
lines : Line [ ] ;
18
17
hideTimestamps ?: boolean ;
19
- lineNumbers ?: boolean ;
20
18
className ?: string ;
21
19
}
22
20
23
21
export const Logs : FC < React . PropsWithChildren < LogsProps > > = ( {
24
22
hideTimestamps,
25
23
lines,
26
- lineNumbers,
27
24
className = "" ,
28
25
} ) => {
29
- const styles = useStyles ( {
30
- lineNumbers : Boolean ( lineNumbers ) ,
31
- } ) ;
26
+ const styles = useStyles ( ) ;
32
27
33
28
return (
34
29
< div className = { combineClasses ( [ className , styles . root ] ) } >
@@ -38,9 +33,7 @@ export const Logs: FC<React.PropsWithChildren<LogsProps>> = ({
38
33
{ ! hideTimestamps && (
39
34
< >
40
35
< span className = { styles . time } >
41
- { lineNumbers
42
- ? idx + 1
43
- : dayjs ( line . time ) . format ( `HH:mm:ss.SSS` ) }
36
+ { dayjs ( line . time ) . format ( `HH:mm:ss.SSS` ) }
44
37
</ span >
45
38
< span className = { styles . space } />
46
39
</ >
@@ -63,9 +56,7 @@ export const LogLine: FC<{
63
56
number ?: number ;
64
57
style ?: React . CSSProperties ;
65
58
} > = ( { line, hideTimestamp, number, style } ) => {
66
- const styles = useStyles ( {
67
- lineNumbers : Boolean ( number ) ,
68
- } ) ;
59
+ const styles = useStyles ( ) ;
69
60
const output = useMemo ( ( ) => {
70
61
return convert . toHtml ( line . output . split ( / \r / g) . pop ( ) as string ) ;
71
62
} , [ line . output ] ) ;
@@ -89,12 +80,7 @@ export const LogLine: FC<{
89
80
) ;
90
81
} ;
91
82
92
- const useStyles = makeStyles <
93
- Theme ,
94
- {
95
- lineNumbers : boolean ;
96
- }
97
- > ( ( theme ) => ( {
83
+ const useStyles = makeStyles ( ( theme ) => ( {
98
84
root : {
99
85
minHeight : 156 ,
100
86
padding : theme . spacing ( 1 , 0 ) ,
@@ -116,7 +102,7 @@ const useStyles = makeStyles<
116
102
fontSize : 14 ,
117
103
color : theme . palette . text . primary ,
118
104
fontFamily : MONOSPACE_FONT_FAMILY ,
119
- height : ( { lineNumbers } ) => ( lineNumbers ? logLineHeight : "auto" ) ,
105
+ height : "auto" ,
120
106
// Whitespace is significant in terminal output for alignment
121
107
whiteSpace : "pre" ,
122
108
padding : theme . spacing ( 0 , 4 ) ,
@@ -141,7 +127,7 @@ const useStyles = makeStyles<
141
127
} ,
142
128
time : {
143
129
userSelect : "none" ,
144
- width : ( { lineNumbers } ) => theme . spacing ( lineNumbers ? 3.5 : 12.5 ) ,
130
+ width : theme . spacing ( 12.5 ) ,
145
131
whiteSpace : "pre" ,
146
132
display : "inline-block" ,
147
133
color : theme . palette . text . secondary ,
0 commit comments