@@ -8,7 +8,6 @@ import { useSelector, useDispatch } from 'react-redux';
88import classNames from 'classnames' ;
99import { Console as ConsoleFeed } from 'console-feed' ;
1010import {
11- CONSOLE_FEED_WITHOUT_ICONS ,
1211 CONSOLE_FEED_LIGHT_STYLES ,
1312 CONSOLE_FEED_DARK_STYLES ,
1413 CONSOLE_FEED_CONTRAST_STYLES
@@ -43,7 +42,7 @@ import { useDidUpdate } from '../hooks/custom-hooks';
4342import useHandleMessageEvent from '../hooks/useHandleMessageEvent' ;
4443import { listen } from '../../../utils/dispatcher' ;
4544
46- const getConsoleFeedStyle = ( theme , times , fontSize ) => {
45+ const getConsoleFeedStyle = ( theme , fontSize ) => {
4746 const style = {
4847 BASE_FONT_FAMILY : 'Inconsolata, monospace'
4948 } ;
@@ -73,33 +72,30 @@ const getConsoleFeedStyle = (theme, times, fontSize) => {
7372 } ;
7473 const CONSOLE_FEED_SIZES = {
7574 TREENODE_LINE_HEIGHT : 1.2 ,
76- BASE_FONT_SIZE : fontSize ,
77- ARROW_FONT_SIZE : fontSize ,
78- LOG_ICON_WIDTH : fontSize ,
79- LOG_ICON_HEIGHT : 1.45 * fontSize
75+ BASE_FONT_SIZE : ` ${ fontSize } px` ,
76+ ARROW_FONT_SIZE : ` ${ fontSize } px` ,
77+ LOG_ICON_WIDTH : ` ${ fontSize } px` ,
78+ LOG_ICON_HEIGHT : ` ${ 1.45 * fontSize } px`
8079 } ;
8180
82- if ( times > 1 ) {
83- Object . assign ( style , CONSOLE_FEED_WITHOUT_ICONS ) ;
84- }
8581 switch ( theme ) {
8682 case 'light' :
8783 return Object . assign (
88- CONSOLE_FEED_LIGHT_STYLES ,
84+ CONSOLE_FEED_LIGHT_STYLES || { } ,
8985 CONSOLE_FEED_LIGHT_ICONS ,
9086 CONSOLE_FEED_SIZES ,
9187 style
9288 ) ;
9389 case 'dark' :
9490 return Object . assign (
95- CONSOLE_FEED_DARK_STYLES ,
91+ CONSOLE_FEED_DARK_STYLES || { } ,
9692 CONSOLE_FEED_DARK_ICONS ,
9793 CONSOLE_FEED_SIZES ,
9894 style
9995 ) ;
10096 case 'contrast' :
10197 return Object . assign (
102- CONSOLE_FEED_CONTRAST_STYLES ,
98+ CONSOLE_FEED_CONTRAST_STYLES || { } ,
10399 CONSOLE_FEED_CONTRAST_ICONS ,
104100 CONSOLE_FEED_SIZES ,
105101 style
@@ -114,7 +110,6 @@ const Console = ({ t }) => {
114110 const isExpanded = useSelector ( ( state ) => state . ide . consoleIsExpanded ) ;
115111 const isPlaying = useSelector ( ( state ) => state . ide . isPlaying ) ;
116112 const { theme, fontSize } = useSelector ( ( state ) => state . preferences ) ;
117-
118113 const {
119114 collapseConsole,
120115 expandConsole,
@@ -170,30 +165,16 @@ const Console = ({ t }) => {
170165 </ div >
171166 </ header >
172167 < div className = "preview-console__body" >
173- < div ref = { cm } className = "preview-console__messages" >
174- { consoleEvents . map ( ( consoleEvent ) => {
175- const { method, times } = consoleEvent ;
176- return (
177- < div
178- key = { consoleEvent . id }
179- className = { `preview-console__message preview-console__message--${ method } ` }
180- >
181- { times > 1 && (
182- < div
183- className = "preview-console__logged-times"
184- style = { { fontSize, borderRadius : fontSize / 2 } }
185- >
186- { times }
187- </ div >
188- ) }
189- < ConsoleFeed
190- styles = { getConsoleFeedStyle ( theme , times , fontSize ) }
191- logs = { [ consoleEvent ] }
192- key = { `${ consoleEvent . id } -${ theme } -${ fontSize } ` }
193- />
194- </ div >
195- ) ;
196- } ) }
168+ < div
169+ ref = { cm }
170+ className = "preview-console__messages"
171+ style = { { fontSize } }
172+ >
173+ < ConsoleFeed
174+ styles = { getConsoleFeedStyle ( theme , fontSize ) }
175+ logs = { consoleEvents }
176+ key = { `${ theme } -${ fontSize } ` }
177+ />
197178 </ div >
198179 { isExpanded && isPlaying && (
199180 < ConsoleInput
0 commit comments