Skip to content

Commit f1ac928

Browse files
author
Jon Myrick
authored
Merge pull request CodewarsClone#97 from CodewarsClone/output
Output
2 parents a290aa3 + eb8711e commit f1ac928

6 files changed

Lines changed: 77 additions & 20 deletions

File tree

src/assets/scss/styles.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ a {
108108
font-weight: 400;
109109
}
110110

111+
.font14-reg-nw {
112+
font-family: $font;
113+
font-size: 14px;
114+
line-height: 22px;
115+
font-weight: 400;
116+
}
117+
111118
.searchBar-font {
112119
color: #efefef;
113120
font-size: 14px;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
1+
<div class='instructions-text'>
22
<h2 class="font20-reg">Instructions</h2>
33
<div>
44
<p class="font14-reg pre-line">{{instructions}}</p>
55
</div>
6+
</div>

src/components/training/output.html

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
1-
<div>
2-
<p class="font14-reg">Time: {{time}} <span class='pass'> Passed: </span>{{testPass}} <span class='fail'> Failed: </span>{{testFail}} </p>
3-
<div class="font14-reg" ng-repeat='val in answer'>
4-
<hr>
5-
<u>Test Results:</u> <br><br>
6-
{{val.value}}
7-
<div class='val1'ng-repeat='val1 in val.nest'>
1+
<div class='output'>
2+
<div class="font14-reg val output-header">
3+
<div class='output-items'>
4+
Time: <span class='white'>{{time}}</span>
5+
</div>
6+
<div class='pass output-items'>
7+
Passed:<span class='white'>{{testPass}}</span>
8+
</div>
9+
<div class='fail output-items'>
10+
Failed: <span class='white'>{{testFail}}</span>
11+
</div>
12+
</div>
13+
<hr>
14+
<span class='font14-reg val'><u>Test Results:</u></span> <br><br>
15+
<div class="font14-reg-nw val" ng-repeat='val in answer' ng-class="val.passed != undefined ? (val.passed ? 'pass' : 'fail') : 'white'">
16+
{{val.value}}
17+
<div class='val1' ng-repeat='val1 in val.nest' ng-class="val1.passed != undefined ? (val1.passed ? 'pass' : 'fail') : 'white'">
818
<span>{{val1.value}}</span>
919
<div class='val2' ng-repeat='val2 in val1.nest'>
10-
<span ng-class="val2.passed ? 'pass' : 'fail'">{{val2.value}}</span>
20+
<span ng-class="val2.passed != undefined ? (val2.passed ? 'pass' : 'fail') : 'white'">{{val2.value}}</span>
1121
</div>
1222
</div>
1323
</div>

src/components/training/training.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ <h2 class="font20-reg">Name of Kata</h2>
4444
</div> -->
4545
<div class="instructions" ng-style="instructionStyle">
4646
<div class="instructions-head">
47-
<div class='instructions-selector font14-lit-gray' ng-click='showInstructions()'>Instructions</div>
48-
<div class='output-selector font14-lit-gray' ng-click='showOutput()'>Output</div>
47+
<div class='instructions-selector font14-lit-gray' ng-click='showInstructions()'><div class='button-text'>Instructions</div></div>
48+
<div class='output-selector font14-lit-gray' ng-click='showOutput()'><div class='button-text'>Output</div></div>
4949
<!--<button class="instructions-selector font13-reg-gray" ng-click="showInstructions()">Instructions</button>
5050
<button class="instructions-selector font13-reg-gray" ng-click="showOutput()">Output</button>-->
5151
</div>
@@ -57,10 +57,10 @@ <h2 class="font20-reg">Name of Kata</h2>
5757
<div class="solution-div font14-lit-gray">
5858
<div class="solutions-header">
5959
<p>Solution:</p>
60-
<button value='small' ng-click="kataStyle={'width':'40vw'}; instructionStyle={'width':'60vw'}; allGone={'height':'100px'}">small</button>
60+
<!--<button value='small' ng-click="kataStyle={'width':'40vw'}; instructionStyle={'width':'60vw'}; allGone={'height':'100px'}">small</button>
6161
<button value='medium' ng-click="kataStyle={'width':'60vw'}; instructionStyle={'width':'40vw'}; allGone={'height':'100px'}">medium</button>
6262
<button value='large' ng-click="kataStyle={'width':'100vw','margin':'15px'}; instructionStyle={'display':'none'}; allGone={'height':'100px'}">large</button>
63-
<button value='full-screen' ng-click="kataStyle={'width':'100vw','margin':'15px'}; instructionStyle={'display':'none'}; allGone={'display':'none'}; exampleGone={'display':'none'}">full screen</button>
63+
<button value='full-screen' ng-click="kataStyle={'width':'100vw','margin':'15px'}; instructionStyle={'display':'none'}; allGone={'display':'none'}; exampleGone={'display':'none'}">full screen</button>-->
6464
</div>
6565
<div ng-style="exampleGone" class='example'>
6666
<textarea name="solution" id="solution-input" ng-init="solutionInput = 'var a = 1;'" ng-model="solutionInput"></textarea>

src/components/training/training.scss

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ $green-color: #5F8120;
1919
$grey-color2: #3B3C3E;
2020
$pass: #7C9A44;
2121
$fail: #C05C40;
22+
$output: #151718;
23+
$white: white;
2224

2325
// STUFF ALONG THE TOP
2426
.training-top {
@@ -100,12 +102,11 @@ $fail: #C05C40;
100102
}
101103

102104
.instructions {
103-
// height: calc(100vh - 150px);
104105
width: 40vw;
105106
overflow: scroll;
106107
margin: 15px;
107108
background-color: $container1;
108-
padding: 10px;
109+
// padding: 10px;
109110
height: 105vh;
110111
}
111112

@@ -121,9 +122,8 @@ $fail: #C05C40;
121122
height: 40px;
122123
text-align: center;
123124
cursor: pointer;
124-
vertical-align: center;
125-
padding: 5px;
126125
background-color: $grey-color2;
126+
display:flex;
127127
}
128128

129129
.output-selector {
@@ -132,7 +132,16 @@ $fail: #C05C40;
132132
text-align: center;
133133
cursor: pointer;
134134
line-height: 40px;
135-
padding: 5px;
135+
display:flex;
136+
}
137+
138+
.button-text {
139+
margin:auto;
140+
align-self: center;
141+
}
142+
143+
.instructions-text {
144+
padding: 5px 0 0 10px;
136145
}
137146

138147
hr {
@@ -183,6 +192,24 @@ hr {
183192
white-space: pre-line;
184193
}
185194

195+
.output {
196+
background-color: $output;
197+
width: 100%;
198+
height: 93%;
199+
margin: 0 0 0 10px;
200+
overflow: auto;
201+
}
202+
203+
.output-header {
204+
display:flex;
205+
flex-direction: row;
206+
align-content: left;
207+
}
208+
209+
.output-items {
210+
justify-content: space-between;
211+
}
212+
186213
.pass {
187214
color: $pass;
188215
}
@@ -191,6 +218,13 @@ hr {
191218
color: $fail;
192219
}
193220

221+
.white {
222+
color: $white;
223+
}
224+
225+
.val {
226+
padding: 5px 0 0 5px;
227+
}
194228
.val1 {
195229
padding: 0 0 0 15px;
196230
}

src/components/training/trainingCtrl.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ angular.module('app').controller('trainingCtrl', function ($scope, $state, mainS
6060
var solutions = solutionsCode.getValue();
6161
var examples = examplesCode.getValue();
6262
$scope.showOutput();
63+
var t0 = performance.now();
6364
solutions = solutions
6465
.replace(/\s*\n*\r*\/\/.*\n*\r*/g, '')
6566
.replace(/\n\s*\./g, `.`)
@@ -73,7 +74,12 @@ angular.module('app').controller('trainingCtrl', function ($scope, $state, mainS
7374
.replace(/\s+/g, ` `);
7475
console.log(examples);
7576
mainService.testExamples(solutions, examples).then((response) => {
76-
console.log(response.data);
77+
var t1 = performance.now();
78+
$scope.answer = response.data.nest;
79+
console.log(response.data.nest[0]);
80+
$scope.time = Math.round(t1 - t0) + " ms";
81+
$scope.testPass = response.data.passCount;
82+
$scope.testFail = response.data.testCount - response.data.passCount;
7783
});
7884
};
7985

@@ -90,7 +96,6 @@ angular.module('app').controller('trainingCtrl', function ($scope, $state, mainS
9096
var t1 = performance.now();
9197
$scope.answer = response.data.nest;
9298
console.log(response.data.nest[0]);
93-
9499
$scope.time = Math.round(t1 - t0) + " ms";
95100
$scope.testPass = response.data.passCount;
96101
$scope.testFail = response.data.testCount - response.data.passCount;

0 commit comments

Comments
 (0)