Skip to content
This repository was archived by the owner on Apr 26, 2022. It is now read-only.

Commit

Permalink
some more polish 💄
Browse files Browse the repository at this point in the history
  • Loading branch information
ThorstenHans committed Sep 16, 2016
1 parent 9aaa672 commit 1db36f7
Show file tree
Hide file tree
Showing 54 changed files with 416 additions and 354 deletions.
9 changes: 9 additions & 0 deletions gulpTasks/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
rename = require('gulp-rename'),
inject = require('gulp-inject'),
uglify = require('gulp-uglify'),
tslint = require('gulp-tslint'),
watch = require('gulp-watch'),
Builder = require('systemjs-builder');

Expand All @@ -30,6 +31,14 @@
.pipe(gulp.dest(path.join(config.targets.buildFolder)));
});

gulp.task("[private-web]:lint-app-code", () =>
gulp.src(config.source.files.app.ts)
.pipe(tslint({
formatter: 'verbose'
}))
.pipe(tslint.report())
);

gulp.task('[private-web]:bundle-vendor-scripts', function () {
var builder = new Builder();
gulp.src(config.source.files.angular2rc1deps)
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"gulp-sourcemaps": "^1.6.0",
"gulp-symdest": "^1.0.0",
"gulp-tap": "^0.1.3",
"gulp-tslint": "^6.1.1",
"gulp-typescript": "^2.10.0",
"gulp-uglify": "^1.4.1",
"gulp-watch": "^4.3.5",
Expand All @@ -56,6 +57,7 @@
"stream-series": "^0.1.1",
"systemjs-builder": "0.15.13",
"tether": "^1.1.1",
"tslint": "^3.15.1",
"typescript": "^2.0.2",
"typings": "^1.3.2"
},
Expand Down
6 changes: 6 additions & 0 deletions src/BoardZ/app/apiConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export class ApiConfig {

public get rootUrl(): string {
return 'https://boardzapi.azurewebsites.net/';
}
}
3 changes: 0 additions & 3 deletions src/BoardZ/app/appConfig.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/BoardZ/app/components/dashboard/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ <h3>Dashboard</h3>
</div>

<div class="col-md-6">
<widget [target]="'/games/all'" [caption]="'Games'" [color]="'red'" [count]="gameCount" [icon]="'gamepad'"></widget>
<widget [target]="'/games/all'" [caption]="'Games'" [color]="'purple'" [count]="gameCount" [icon]="'gamepad'"></widget>
</div>
<div class="col-md-6">
<widget [target]="'/radiussearch'" [caption]="'Players'" [color]="'blue'" [count]="playerCount" [icon]="'users'"></widget>
<widget [target]="'/radiussearch'" [caption]="'Players'" [color]="'yellow'" [count]="playerCount" [icon]="'users'"></widget>
</div>
</div>
7 changes: 3 additions & 4 deletions src/BoardZ/app/components/dashboard/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@ import {PlayersService} from '../../services/playersService';
selector: 'dashboard',
templateUrl: 'dashboard.html'
})
//todo: @NeedsAuthentication()
export class DashboardComponent implements OnInit {
public playerCount: string = '-';
public gameCount: string = '-';

constructor(private _gamesService: GamesService,
constructor(private _gamesService: GamesService,
private _playersService: PlayersService) {
}

ngOnInit(): any {
public ngOnInit(): any {
this._playersService.getPlayerCount()
.subscribe(result => this.playerCount = result.toString());

this._gamesService.getGameCount()
.subscribe(result => this.gameCount = result.toString());
}
Expand Down
4 changes: 2 additions & 2 deletions src/BoardZ/app/components/games/details.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="row">
<div class="col-md-12">
<div class="box box-info">
<div class="box box-warning">
<div class="box-header with-border">
<h3 *ngIf="model.id" class="box-title">New game</h3>
<h3 *ngIf="!model.id" class="box-title">Game details</h3>
Expand Down Expand Up @@ -35,7 +35,7 @@ <h3 *ngIf="!model.id" class="box-title">Game details</h3>
<div class="pull-right">
<button type="button" class="btn btn-default" (click)="abort()">Abort</button>
<button type="button" class="btn btn-default" (click)="reset()">Reset</button>
<button type="submit" class="btn btn-primary" [disabled]="!form.valid || !form.dirty">Save
<button type="submit" class="btn btn-warning" [disabled]="!form.valid || !form.dirty">Save
</button>
<button type="button" class="btn btn-danger" *ngIf="model.id !== null" (click)="deleteGame()">
Delete
Expand Down
35 changes: 15 additions & 20 deletions src/BoardZ/app/components/games/details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,15 @@ import {LoginService} from '../../services/loginService';
import {Notification} from '../../models/notification';
import {NotificationType} from '../../models/notificationType';

// fix WebStorm errors for deprecated router
export interface RouteSegment {
params: Array<any>;
}

export interface RouteTree {
}

@Component({
moduleId: module.id,
selector: 'gameDetail',
templateUrl: 'details.html'
})
//todo: @NeedsAuthentication()
export class GameDetailsComponent implements OnInit {

private _needsReset: boolean;
private _pictureUrl: string = "";
private _pictureUrl: string = '';
private _coordinates: GeoLocation = null;
private _sending: boolean;

Expand All @@ -50,7 +41,9 @@ export class GameDetailsComponent implements OnInit {
public ngOnInit(): any {
this.route.data.forEach((data: { game: Game }) => {
this.originalModel = this._gameService.deepClone(this.model = data.game || new Game());
if (this._needsReset) this.reset();
if (this._needsReset) {
this.reset();
}
});
}

Expand All @@ -59,7 +52,9 @@ export class GameDetailsComponent implements OnInit {
.subscribe(
(game) => {
this.originalModel = this._gameService.deepClone(this.model = game);
if (this._needsReset) this.reset();
if (this._needsReset) {
this.reset();
}
},
(error) => {
this._logService.logError('Could not find game. Error was: ' + error);
Expand Down Expand Up @@ -88,21 +83,21 @@ export class GameDetailsComponent implements OnInit {
this._gameService.addGame(this.model)
.subscribe(
(newId) => {
this._notificationService.notifySuccess('New game was added.')
this._notificationService.notifySuccess('New game was added.');
this._needsReset = true;
this.loadGame(newId);
},
()=> this._notificationService.notifyError('Could not save new game.')
() => this._notificationService.notifyError('Could not save new game.')
);
} else {
this._gameService.updateGame(this.model)
.subscribe((oldId) => {
this._notificationService.notifySuccess('Game data was updated.')
this._notificationService.notifySuccess('Game data was updated.');
this._needsReset = true;
this.loadGame(oldId);
},
() => {
this._notificationService.notifyError('Could not update game data.')
this._notificationService.notifyError('Could not update game data.');
}
);
}
Expand Down Expand Up @@ -141,19 +136,19 @@ export class GameDetailsComponent implements OnInit {
this._sending = true;
this._signalRService.sendIAmGaming(this.model.name);

var player = new Player();
let player = new Player();
player.name = this._loginService.username;
player.boardGameId = this.model.id;
player.coordinate = this._coordinates;
player.imageUrl = this._pictureUrl;

this._playersService.add(player)
.subscribe(()=> {
.subscribe(() => {
this._notificationService.notify(new Notification(`Thanks for sharing, ${player.name}`, NotificationType.Success));

},
()=> console.log('error while uploading'),
()=> this._sending = false
() => console.log('error while uploading'),
() => this._sending = false
);
}
}
13 changes: 0 additions & 13 deletions src/BoardZ/app/components/games/games.ts

This file was deleted.

8 changes: 8 additions & 0 deletions src/BoardZ/app/components/games/gamesRoot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {Component} from '@angular/core';

@Component({
moduleId: module.id,
templateUrl: 'gamesRoot.html'
})
export class GamesRootComponent {
}
35 changes: 0 additions & 35 deletions src/BoardZ/app/components/games/gamesRoutes.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/BoardZ/app/components/games/list.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="row">
<div class="col-md-12">
<div class="box">
<div class="box box-warning">
<div class="box-header">
<h3 class="box-title">All Games</h3>

Expand Down
6 changes: 3 additions & 3 deletions src/BoardZ/app/components/games/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ export class GameListComponent implements OnInit {
}

public openGameDetails(game: Game): void {
this._router.navigate(['../details', game.id], { relativeTo: this._route});
this._router.navigate(['../details', game.id], { relativeTo: this._route });
}

public openCreateGame(): void {
this._router.navigate(['../new'], {relativeTo: this._route });
this._router.navigate(['../new'], { relativeTo: this._route });
}

public ngOnInit(): void {
this._gamesService.getAll()
.subscribe(
(games)=> this.games = games,
(games) => this.games = games,
(err) => this._notificationService.notifyError('Error while fetching game data')
);
}
Expand Down
10 changes: 3 additions & 7 deletions src/BoardZ/app/components/header/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@ export class HeaderComponent implements OnInit {
private notifications: Notification[] = [];

public loggedIn: boolean = false;
public currentLocation: string = 'BoardZ!';

constructor(public loginService: LoginService,
private _tokenService: TokenService,
private _notificationService: NotificationService) {
}

ngOnInit(): any {
public ngOnInit(): any {
this._notificationService.notifications.subscribe(
(notification) => this.onNotification(notification)
);
this._tokenService.isAuthenticated().subscribe(result => {
this.loggedIn = result
});
this._tokenService.isAuthenticated().subscribe(result => this.loggedIn = result);
}

public dismiss(notification: Notification): boolean {
Expand All @@ -36,8 +33,7 @@ export class HeaderComponent implements OnInit {
if (index > -1) {
this.notifications.splice(index, 1);
}
}
else {
} else {
this.notifications = [];
}

Expand Down
6 changes: 2 additions & 4 deletions src/BoardZ/app/components/locateIt/locateIt.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
///<reference path="../../../../../typings/main/ambient/leaflet/leaflet.d.ts" />

import {Component, Output, OnInit, EventEmitter} from '@angular/core';

import {GeoLocation} from '../../models/geoLocation';
import {GeolocationService} from '../../services/geolocationService';

Expand Down Expand Up @@ -32,17 +31,16 @@ export class LocateItComponent implements OnInit {
}).addTo(this.map);

this._isLocating = true;

this._geolocationService.locate()
.then((coords: GeoLocation)=> {
.then((coords: GeoLocation) => {
this._hasError = false;
this._isLocating = false;
this._coords = coords;
this._onLocated.emit(coords);

this.setMapMarkerAndView();
})
.catch(()=> {
.catch(() => {
this._hasError = true;
this._isLocating = false;
});
Expand Down
Loading

0 comments on commit 1db36f7

Please sign in to comment.