Skip to content

Commit dbfb76d

Browse files
authored
Merge pull request #9 from dannyhp1/develop
Separated autocomplete with practice mode and added analytics.
2 parents 22d1bd5 + 7765c05 commit dbfb76d

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

public/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4+
<!-- Global site tag (gtag.js) - Google Analytics -->
5+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-129689668-4"></script>
6+
<script>
7+
window.dataLayer = window.dataLayer || [];
8+
function gtag(){dataLayer.push(arguments);}
9+
gtag('js', new Date());
10+
11+
gtag('config', 'UA-129689668-4');
12+
</script>
13+
414
<meta charset="utf-8" />
515
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
616
<meta name="viewport" content="width=device-width, initial-scale=1" />

src/App/App.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class App extends Component {
2525
source: {'java': code['java'], 'python': code['python'], 'c_cpp': code['c_cpp']},
2626
results: [ ],
2727
disabled: false,
28-
practice: false
28+
practice: false,
29+
autocomplete: true
2930
})
3031
}
3132

@@ -53,6 +54,13 @@ class App extends Component {
5354
})
5455
}
5556

57+
onChangeAutocomplete = () => {
58+
this.setState({
59+
...this.state,
60+
autocomplete: !this.state.autocomplete
61+
})
62+
}
63+
5664
setRunningStatus = () => {
5765
let currentResults = this.state.results;
5866
currentResults.unshift('Running your code...')
@@ -148,7 +156,7 @@ class App extends Component {
148156
<Grid container style={{ marginBottom: '1.5%' }}>
149157
<Grid item xs={6}>
150158
<CodeEditor
151-
autocomplete={!this.state.practice}
159+
autocomplete={this.state.autocomplete}
152160
language={this.state.practice === true ? 'plain_text' : this.state.language}
153161
source={this.state.source[this.state.language]}
154162
onChange={this.onChangeCode} />
@@ -188,6 +196,18 @@ class App extends Component {
188196
</Button> */}
189197
</Grid>
190198
<Grid item xs={6} style={{ textAlign: 'right' }}>
199+
<FormControlLabel
200+
control={
201+
<Checkbox
202+
checked={this.state.autocomplete}
203+
onChange={this.onChangeAutocomplete}
204+
value='autocomplete'
205+
style={{ color: '#0269a4' }}
206+
/>
207+
}
208+
label="Autocomplete"
209+
style={{ marginRight: '2.5%' }}
210+
/>
191211
<FormControlLabel
192212
control={
193213
<Checkbox
@@ -197,7 +217,7 @@ class App extends Component {
197217
style={{ color: '#0269a4' }}
198218
/>
199219
}
200-
label="Practice Mode"
220+
label="Practice Format"
201221
style={{ marginRight: '2.5%' }}
202222
/>
203223
</Grid>

0 commit comments

Comments
 (0)