Skip to content

Commit

Permalink
add winner
Browse files Browse the repository at this point in the history
  • Loading branch information
IceMaD committed Feb 19, 2016
1 parent 3bdac75 commit 4793e08
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 15 deletions.
36 changes: 36 additions & 0 deletions app/sass/ext/_fonts.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(/node_modules/material-design-icons/iconfont/MaterialIcons-Regular.eot); /* For IE6-8 */
src: local('Material Icons'),
local('MaterialIcons-Regular'),
url(/node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff2) format('woff2'),
url(/node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff) format('woff'),
url(/node_modules/material-design-icons/iconfont/MaterialIcons-Regular.ttf) format('truetype');
}

.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 1.5em; /* Preferred icon size */
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;

/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;

/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;

/* Support for IE. */
font-feature-settings: 'liga';
}
21 changes: 19 additions & 2 deletions app/sass/style.sass
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import 'ext/reset'
@import 'ext/variables'
@import 'ext/mixins'
@import 'ext/fonts'

+component(tree)

Expand Down Expand Up @@ -73,6 +74,10 @@

content: none

+modifier(winner)

background-color: gold

+modifier(won)

background-color: lighten($granny-green, 10%)
Expand All @@ -89,6 +94,7 @@

background-color: darken($blush-pink, 20%)


+component(router-outlet)

display: none
Expand Down Expand Up @@ -177,6 +183,17 @@

+component(message)

+child(warning)
display: flex
align-items: center

+child(status)

margin-right: .5em

+modifier(error)

color: $blush-pink

+modifier(success)

color: $blush-pink
color: $granny-green
3 changes: 0 additions & 3 deletions app/templates/homepage.html

This file was deleted.

3 changes: 2 additions & 1 deletion app/templates/node.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
'--last': node.last,
'--won': node.status == 'won',
'--lost': node.status == 'lost',
'--highlighted': node.highlighted
'--highlighted': node.highlighted,
'--winner': node.last && node.team
}"
[overlay]="node"
(click)="node.win()">
Expand Down
13 changes: 10 additions & 3 deletions app/templates/team-management.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@

<div class="button-bar">
<span class="message">
<i class="message_status material-icons"
[class.--success]="isFilled()"
[class.--error]="!isFilled()">{{ isFilled() ? 'check' : 'close' }}</i>
Currently {{ teams.length }} teams
<span class="message_warning" *ngIf="!isFilled()">
X
</span>
</span>
<a class="button" [routerLink]="['TreeComponent']">Generate</a>
</div>
</div>


<ul>
<li>Edit Team name</li>
<li>Winner in gold</li>
<li>Remove all team button</li>
</ul>
10 changes: 7 additions & 3 deletions app/ts/Services/TeamHolderService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,14 @@ export class TeamHolderService {
}

private static hasConfirmed(): boolean {
if (this.hasTree() && confirm('Cette action aura pour effet de supprimer l\'arbre existant')) {
this._tree = null;
if (!this.hasTree()) {
return true;
}

return true
if (!confirm('Cette action aura pour effet de supprimer l\'arbre existant')) {
return false;
}
this._tree = null;
return true;
}
}
6 changes: 4 additions & 2 deletions app/ts/Services/TreeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ export class TreeManager {

this._nodes = this._nodes.concat(nodes);

nodes[0].last = true;

return nodes[0];
}

static findParentOf(nodeTofind: NodeModel): NodeModel|boolean {
static findParentOf(nodeToFind: NodeModel): NodeModel|boolean {

// For each node
for (let i:number = 0; i < this._nodes.length; i++) {
Expand All @@ -45,7 +47,7 @@ export class TreeManager {
let child:NodeModel = node.children[j];

// If the child match, return the parent
if (child.id === nodeTofind.id) {
if (child.id === nodeToFind.id) {
return node;
}
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.0",
"zone.js": "0.5.10",
"underscore": "~1.8.3"
"underscore": "~1.8.3",
"material-design-icons": "~2.2.0"
},
"devDependencies": {
"concurrently": "^1.0.0",
Expand Down

0 comments on commit 4793e08

Please sign in to comment.