Skip to content

Commit 57e2d43

Browse files
committed
refactor: code cleanup
1 parent 8a78375 commit 57e2d43

15 files changed

+48
-51
lines changed

src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class AppComponent implements OnInit {
1414
if (!(evt instanceof NavigationEnd)) {
1515
return;
1616
}
17-
window.scrollTo(0, 0)
17+
window.scrollTo(0, 0);
1818
});
1919
}
2020
}

src/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
AppHeaderModule,
3131
AppFooterModule,
3232
AppSidebarModule,
33-
} from '@coreui/angular'
33+
} from '@coreui/angular';
3434

3535
// Import routing module
3636
import { AppRoutingModule } from './app.routing';

src/app/containers/default-layout/default-layout.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class DefaultLayoutComponent {
1313
constructor() {
1414

1515
this.changes = new MutationObserver((mutations) => {
16-
this.sidebarMinimized = document.body.classList.contains('sidebar-minimized')
16+
this.sidebarMinimized = document.body.classList.contains('sidebar-minimized');
1717
});
1818

1919
this.changes.observe(<Element>this.element, {

src/app/views/base/forms.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class FormsComponent {
88
constructor() { }
99

1010
isCollapsed: boolean = false;
11-
iconCollapse: string = "icon-arrow-up";
11+
iconCollapse: string = 'icon-arrow-up';
1212

1313
collapsed(event: any): void {
1414
// console.log(event);
@@ -20,7 +20,7 @@ export class FormsComponent {
2020

2121
toggleCollapse(): void {
2222
this.isCollapsed = !this.isCollapsed;
23-
this.iconCollapse = this.isCollapsed ? "icon-arrow-down" : "icon-arrow-up";
23+
this.iconCollapse = this.isCollapsed ? 'icon-arrow-down' : 'icon-arrow-up';
2424
}
2525

2626
}

src/app/views/base/paginations.component.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ export class PaginationsComponent {
1313
currentPage: number = 4;
1414
smallnumPages: number = 0;
1515

16+
maxSize: number = 5;
17+
bigTotalItems: number = 675;
18+
bigCurrentPage: number = 1;
19+
numPages: number = 0;
20+
21+
currentPager: number = 4;
22+
1623
setPage(pageNo: number): void {
1724
this.currentPage = pageNo;
1825
}
@@ -21,11 +28,4 @@ export class PaginationsComponent {
2128
console.log('Page changed to: ' + event.page);
2229
console.log('Number items per page: ' + event.itemsPerPage);
2330
}
24-
25-
maxSize: number = 5;
26-
bigTotalItems: number = 675;
27-
bigCurrentPage: number = 1;
28-
numPages: number = 0;
29-
30-
currentPager: number = 4;
3131
}

src/app/views/base/popovers.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {DomSanitizer} from '@angular/platform-browser';
88
export class PopoversComponent {
99

1010
constructor(sanitizer: DomSanitizer) {
11-
this.html = sanitizer.sanitize(SecurityContext.HTML, this.html)
11+
this.html = sanitizer.sanitize(SecurityContext.HTML, this.html);
1212
}
1313

1414
title: string = 'Welcome word';

src/app/views/base/progress.component.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,25 @@ export class ProgressComponent implements OnDestroy {
1010
dynamic: number;
1111
type: string;
1212

13+
stacked: any[] = [];
14+
15+
timer: any = null;
16+
buttonCaption: string = 'Start';
17+
1318
constructor() {
1419
this.random();
15-
this.randomStacked()
20+
this.randomStacked();
1621
}
1722

1823
ngOnDestroy() {
1924
if (this.timer) {
20-
clearInterval(this.timer)
25+
clearInterval(this.timer);
2126
}
2227
// console.log(`onDestroy`, this.timer);
2328
}
2429

2530
random(): void {
26-
let value = Math.floor(Math.random() * 100 + 1);
31+
const value = Math.floor(Math.random() * 100 + 1);
2732
let type: string;
2833

2934
if (value < 25) {
@@ -42,16 +47,14 @@ export class ProgressComponent implements OnDestroy {
4247

4348
}
4449

45-
stacked: any[] = [];
46-
4750
randomStacked(): void {
48-
let types = ['success', 'info', 'warning', 'danger'];
51+
const types = ['success', 'info', 'warning', 'danger'];
4952

5053
this.stacked = [];
51-
let n = Math.floor(Math.random() * 4 + 1);
54+
const n = Math.floor(Math.random() * 4 + 1);
5255
for (let i = 0; i < n; i++) {
53-
let index = Math.floor(Math.random() * 4);
54-
let value = Math.floor(Math.random() * 27 + 3);
56+
const index = Math.floor(Math.random() * 4);
57+
const value = Math.floor(Math.random() * 27 + 3);
5558
this.stacked.push({
5659
value,
5760
type: types[index],
@@ -60,9 +63,6 @@ export class ProgressComponent implements OnDestroy {
6063
}
6164
}
6265

63-
timer: any = null;
64-
buttonCaption: string = 'Start';
65-
6666
randomize(): void {
6767
if (this.timer) {
6868
clearInterval(this.timer);

src/app/views/base/tooltips.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {Component, SecurityContext} from '@angular/core';
2-
import {DomSanitizer} from "@angular/platform-browser";
2+
import {DomSanitizer} from '@angular/platform-browser';
33

44
@Component({
55
templateUrl: 'tooltips.component.html'
66
})
77
export class TooltipsComponent {
88

99
constructor(sanitizer: DomSanitizer) {
10-
this.html = sanitizer.sanitize(SecurityContext.HTML, this.html)
10+
this.html = sanitizer.sanitize(SecurityContext.HTML, this.html);
1111
}
1212

1313
content: string = 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus.';

src/app/views/buttons/dropdowns.component.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import { Component } from '@angular/core';
55
})
66
export class DropdownsComponent {
77

8+
status: { isOpen: boolean } = { isOpen: false };
9+
disabled: boolean = false;
10+
isDropup: boolean = true;
11+
autoClose: boolean = false;
12+
813
constructor() { }
914

1015
items: string[] = [
@@ -23,8 +28,6 @@ export class DropdownsComponent {
2328
console.log('Dropdown state is changed');
2429
}
2530

26-
status: { isOpen: boolean } = { isOpen: false };
27-
2831
toggleDropdown($event: MouseEvent): void {
2932
$event.preventDefault();
3033
$event.stopPropagation();
@@ -34,10 +37,4 @@ export class DropdownsComponent {
3437
change(value: boolean): void {
3538
this.status.isOpen = value;
3639
}
37-
38-
disabled: boolean = false;
39-
40-
isDropup: boolean = true;
41-
42-
autoClose: boolean = false;
4340
}

src/app/views/dashboard/dashboard.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { CustomTooltips } from '@coreui/coreui-plugin-chartjs-custom-tooltips';
88
})
99
export class DashboardComponent implements OnInit {
1010

11+
radioModel: string = 'Month';
12+
1113
// lineChart1
1214
public lineChart1Data: Array<any> = [
1315
{
@@ -241,7 +243,7 @@ export class DashboardComponent implements OnInit {
241243
position: 'nearest',
242244
callbacks: {
243245
labelColor: function(tooltipItem, chart) {
244-
return { backgroundColor: chart.data.datasets[tooltipItem.datasetIndex].borderColor }
246+
return { backgroundColor: chart.data.datasets[tooltipItem.datasetIndex].borderColor };
245247
}
246248
}
247249
},
@@ -384,6 +386,4 @@ export class DashboardComponent implements OnInit {
384386
this.mainChartData3.push(65);
385387
}
386388
}
387-
388-
radioModel: string = 'Month';
389389
}

0 commit comments

Comments
 (0)