@@ -152,6 +152,16 @@ class App extends Component {
152152 } )
153153 }
154154
155+ /**
156+ * Clears all of the logs from the current state.
157+ */
158+ clearLogs = ( ) => {
159+ this . setState ( {
160+ ...this . state ,
161+ results : [ ]
162+ } )
163+ }
164+
155165 /**
156166 * Downloads the currently displayed source code to the user's desktop.
157167 */
@@ -209,7 +219,7 @@ class App extends Component {
209219
210220 < Grid container >
211221 < Grid item xs = { 6 } >
212- < FormControl style = { { textAlign : 'center' , width : '20%' , marginLeft : '1.5%' , marginRight : '3 .5%' } } >
222+ < FormControl style = { { textAlign : 'center' , width : '20%' , marginLeft : '1.5%' , marginRight : '2 .5%' } } >
213223 < Select
214224 labelId = 'select-language-label'
215225 id = 'select-language'
@@ -222,21 +232,6 @@ class App extends Component {
222232 < MenuItem value = 'c_cpp' > { languages [ 'c_cpp' ] } </ MenuItem >
223233 </ Select >
224234 </ FormControl >
225- < Button variant = 'contained' color = 'primary'
226- onClick = { this . executeCode }
227- disabled = { this . state . disabled }
228- style = { { background : '#0269a4' , marginRight : '3.5%' } } >
229- { this . state . disabled ? 'Running code...' : 'Run Code' }
230- </ Button >
231- { /* TODO: Add 'Download Code' button to download script to local desktop for users. */ }
232- { /* <Button variant='contained' color='primary'
233- disabled
234- onClick={this.downloadCode}
235- style={{ background: '#0269a4', marginRight: '3.5%' }}>
236- Download Code
237- </Button> */ }
238- </ Grid >
239- < Grid item xs = { 6 } style = { { textAlign : 'right' } } >
240235 < FormControlLabel
241236 control = {
242237 < Checkbox
@@ -262,6 +257,26 @@ class App extends Component {
262257 style = { { marginRight : '2.5%' } }
263258 />
264259 </ Grid >
260+ < Grid item xs = { 6 } style = { { textAlign : 'right' } } >
261+ { /* TODO: Add 'Download Code' button to download script to local desktop for users. */ }
262+ { /* <Button variant='contained' color='primary'
263+ disabled
264+ onClick={this.downloadCode}
265+ style={{ background: '#0269a4', marginRight: '3.5%' }}>
266+ Download Code
267+ </Button> */ }
268+ < Button variant = 'contained' color = 'primary'
269+ onClick = { this . clearLogs }
270+ style = { { background : '#0269a4' , marginRight : '2.5%' } } >
271+ Clear Logs
272+ </ Button >
273+ < Button variant = 'contained' color = 'primary'
274+ onClick = { this . executeCode }
275+ disabled = { this . state . disabled }
276+ style = { { background : '#0269a4' , marginRight : '1.5%' } } >
277+ { this . state . disabled ? 'Running code...' : 'Run Code' }
278+ </ Button >
279+ </ Grid >
265280 </ Grid >
266281 </ div >
267282 ) ;
0 commit comments