Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gloriousCode committed Aug 16, 2018
1 parent bdcf87a commit 6c0ad60
Show file tree
Hide file tree
Showing 16 changed files with 94 additions and 82 deletions.
4 changes: 2 additions & 2 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"start": "node hooks/environments/set_profile.js && npm-run-all -p ng:serve electron:serve",
"build": "node hooks/environments/set_profile.js && ng build && npm run electron:tsc",
"build:prod": "node hooks/environments/set_profile.js && ng build --prod && npm run electron:tsc",
"lint": "tslint -c tslint.json src/**/*{.ts,.tsx} main.ts",
"lint:fix": "tslint --fix -c tslint.json src/**/*{.ts,.tsx} main.ts",
"lint": "tslint --project tslint.json src/**/*{.ts,.tsx} main.ts",
"lint:fix": "tslint --fix --project tslint.json src/**/*{.ts,.tsx} main.ts",
"ng:serve": "ng serve -o",
"electron:tsc": "tsc main.ts",
"electron:serve": "wait-on http-get://localhost:4200/ && npm run electron:tsc && electron . --serve",
Expand Down
5 changes: 4 additions & 1 deletion web/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export class AppComponent implements OnInit {
private ws: WebsocketResponseHandlerService;
public isConnected = false;

constructor(public electronService: ElectronService, sidebarService: SidebarService, private router: Router, private websocketHandler: WebsocketResponseHandlerService) {
constructor(public electronService: ElectronService,
sidebarService: SidebarService,
private router: Router,
private websocketHandler: WebsocketResponseHandlerService) {

if (electronService.isElectron()) {
console.log('Mode electron');
Expand Down
46 changes: 26 additions & 20 deletions web/src/app/pages/settings/settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ import { Config, CurrencyPairRedux, Wallet } from './../../shared/classes/config
import { MatSnackBar, MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material';
import { WalletComponent } from '../wallet/wallet.component';

@Component({
selector: 'app-dialog-overview-example-dialog',
template: '<h4>Enabled Currencies</h4><div *ngFor="let currency of data.pairs">'
+ '<mat-checkbox name="{{currency.Name}}2" [(ngModel)]="currency.Enabled">{{currency.Name}}</mat-checkbox>'
+ '</div><button mat-raised-button color="primary" (click)="close()">DONE</button>',
})
export class EnabledCurrenciesDialogueComponent {

constructor(
public dialogRef: MatDialogRef<EnabledCurrenciesDialogueComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) { }

onNoClick(): void {
this.dialogRef.close();
}

public close(): void {
this.dialogRef.close();

}
}

@Component({
selector: 'app-settings',
templateUrl: './settings.component.html',
Expand All @@ -18,10 +40,13 @@ export class SettingsComponent implements OnInit {
private snackBar: MatSnackBar;
private dialogue;

constructor(private websocketHandler: WebsocketResponseHandlerService, snackBar: MatSnackBar, public dialog: MatDialog) {
constructor(private websocketHandler: WebsocketResponseHandlerService,
snackBar: MatSnackBar,
public dialog: MatDialog) {
this.ws = websocketHandler;
this.snackBar = snackBar;
}

ngOnInit() {
this.ws.shared.subscribe(msg => {
if (msg.event === WebSocketMessageType.GetConfig) {
Expand Down Expand Up @@ -82,25 +107,6 @@ export class SettingsComponent implements OnInit {
}
}

@Component({
selector: 'app-dialog-overview-example-dialog',
template: '<h4>Enabled Currencies</h4><div *ngFor="let currency of data.pairs"><mat-checkbox name="{{currency.Name}}2" [(ngModel)]="currency.Enabled">{{currency.Name}}</mat-checkbox></div><button mat-raised-button color="primary" (click)="close()">DONE</button>',
})
export class EnabledCurrenciesDialogueComponent {

constructor(
public dialogRef: MatDialogRef<EnabledCurrenciesDialogueComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) { }

onNoClick(): void {
this.dialogRef.close();
}

public close(): void {
this.dialogRef.close();

}

}


25 changes: 15 additions & 10 deletions web/src/app/pages/wallet/wallet.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,23 @@ export class WalletComponent implements OnInit {
this.ws.shared.subscribe(msg => {
if (msg.event === WebSocketMessageType.GetPortfolio) {
this.wallet = <Wallet>msg.data;
console.log(msg.data);
this.attachIcon(this.wallet.coin_totals);
this.attachIcon(this.wallet.coins_offline);
this.attachIcon(this.wallet.coins_online);
console.log('wallet: ' + msg.data);
console.log('message: ' + JSON.stringify(msg));
console.log('data: ' + this.wallet);

this.attachIcon(this.wallet.offline_summary.BTC);
this.attachIcon(this.wallet.offline_summary.ETH);
this.attachIcon(this.wallet.offline_summary.LTC);
if (this.wallet != null && this.wallet.coin_totals != null) {
this.attachIcon(this.wallet.coin_totals);
this.attachIcon(this.wallet.coins_offline);
this.attachIcon(this.wallet.coins_online);

this.attachIcon(this.wallet.online_summary.BTC);
this.attachIcon(this.wallet.online_summary.ETH);
this.attachIcon(this.wallet.online_summary.LTC);
this.attachIcon(this.wallet.offline_summary.BTC);
this.attachIcon(this.wallet.offline_summary.ETH);
this.attachIcon(this.wallet.offline_summary.LTC);

this.attachIcon(this.wallet.online_summary.BTC);
this.attachIcon(this.wallet.online_summary.ETH);
this.attachIcon(this.wallet.online_summary.LTC);
}
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ export class WebsocketResponseHandlerService {
this.isConnected = this.ws.isConnected;
}, 2000);
const websocketResponseMessage = JSON.parse(response.data);
const websocketResponseData = websocketResponseMessage.Data === undefined ? websocketResponseMessage.data : websocketResponseMessage.Data;
const websocketResponseEvent = websocketResponseMessage.Event === undefined ? websocketResponseMessage.event : websocketResponseMessage.Event;
const websocketResponseData = websocketResponseMessage.Data === undefined
? websocketResponseMessage.data
: websocketResponseMessage.Data;
const websocketResponseEvent = websocketResponseMessage.Event === undefined
? websocketResponseMessage.event
: websocketResponseMessage.Event;
const responseMessage = new WebSocketMessage();

responseMessage.event = websocketResponseEvent;
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/services/websocket/websocket.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class WebsocketService {
}, 400);

if (ws.readyState !== WebSocket.OPEN) {
new Error('Failed to send message to websocket after 10 attempts');
throw new Error('Failed to send message to websocket after 10 attempts');
this.isConnected = false;
}
}
Expand Down
11 changes: 6 additions & 5 deletions web/src/app/shared/classes/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { inherits } from 'util';

export class CurrencyPairRedux {
Name: string;
ParsedName: string;
Enabled: boolean;
}

export class Config {
Name: string;
EncryptConfig?: number;
Expand Down Expand Up @@ -113,11 +119,6 @@ export class Config {
}
}

export class CurrencyPairRedux {
Name: string;
ParsedName: string;
Enabled: boolean;
}

export interface CurrencyPairFormat {
Uppercase: boolean;
Expand Down
16 changes: 8 additions & 8 deletions web/src/app/shared/classes/websocket.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
export class WebSocketMessageType {
public static Auth = 'auth';
public static GetConfig = 'GetConfig';
public static SaveConfig = 'SaveConfig';
public static GetPortfolio = 'GetPortfolio';
public static TickerUpdate = 'ticker_update';
}

export class WebSocketMessage {
public event: string;
public data: any;
Expand All @@ -23,11 +31,3 @@ export class WebSocketMessage {
return response;
}
}

export class WebSocketMessageType {
public static Auth = 'auth';
public static GetConfig = 'GetConfig';
public static SaveConfig = 'SaveConfig';
public static GetPortfolio = 'GetPortfolio';
public static TickerUpdate = 'ticker_update';
}
15 changes: 7 additions & 8 deletions web/src/app/shared/my-orders/my-orders.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { Component, OnInit } from '@angular/core';

export class MyOrders {
public count: number;
public total: number;
public price: number;
public amount: number;
}

@Component({
selector: 'app-my-orders',
templateUrl: './my-orders.component.html',
Expand All @@ -25,11 +32,3 @@ export class MyOrdersComponent implements OnInit {
this.orders.push(item);
}
}


export class MyOrders {
public count: number;
public total: number;
public price: number;
public amount: number;
}
15 changes: 7 additions & 8 deletions web/src/app/shared/orders/orders.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { Component, OnInit } from '@angular/core';

export class Order {
public count: number;
public total: number;
public price: number;
public amount: number;
}

@Component({
selector: 'app-orders',
templateUrl: './orders.component.html',
Expand Down Expand Up @@ -49,11 +56,3 @@ export class OrdersComponent implements OnInit {
}

}


export class Order {
public count: number;
public total: number;
public price: number;
public amount: number;
}
1 change: 0 additions & 1 deletion web/src/app/shared/theme-picker/theme-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {CommonModule} from '@angular/common';
styleUrls: ['theme-picker.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
host: {'aria-hidden': 'true'},
})
export class ThemePickerComponent {
currentTheme;
Expand Down
14 changes: 6 additions & 8 deletions web/src/app/shared/trade-history/trade-history.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { Component, OnInit } from '@angular/core';

export class TradeHistoryOrder {
public price: number;
public time: Date;
public amount: number;
}

@Component({
selector: 'app-trade-history',
templateUrl: './trade-history.component.html',
Expand Down Expand Up @@ -45,12 +51,4 @@ export class TradeHistoryComponent implements OnInit {
this.orders.push(item);
this.orders.push(item);
}



}
export class TradeHistoryOrder {
public price: number;
public time: Date;
public amount: number;
}
6 changes: 3 additions & 3 deletions web/src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// import 'core-js/es6/date';
// import 'core-js/es6/array';
// import 'core-js/es6/regexp';
import 'core-js/es6/map';
// import 'core-js/es6/map';
// import 'core-js/es6/set';

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
Expand All @@ -41,8 +41,8 @@


/** Evergreen browsers require these. **/
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
// import 'core-js/es6/reflect';
// import 'core-js/es7/reflect';


/** ALL Firefox browsers require the following to support `@angular/animation`. **/
Expand Down
2 changes: 1 addition & 1 deletion web/src/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"outDir": "../out-tsc/spec",
"module": "commonjs",
"target": "es2015",
"target": "es5",
"baseUrl": "",
"types": [
"jasmine",
Expand Down
3 changes: 1 addition & 2 deletions web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es6",
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"es2015",
"dom",
]
}
Expand Down
3 changes: 1 addition & 2 deletions web/tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"eofline": true,
"forin": true,
"import-blacklist": [
true,
"rxjs/Rx"
true
],
"import-spacing": true,
"indent": [
Expand Down

0 comments on commit 6c0ad60

Please sign in to comment.