+
@@ -49,7 +47,7 @@ export class BlockViewer {
@Input() previewStyle: string;
- @Input() free: boolean = false;
+ @Input() free: boolean = true;
@Input() new: boolean = false;
@@ -58,23 +56,14 @@ export class BlockViewer {
blockView: BlockView = BlockView.PREVIEW;
activateView(event: Event, blockView: BlockView) {
- if (!this.codeDisabled) {
- this.blockView = blockView;
- }
-
- event.preventDefault();
+
+ this.blockView = blockView;
+ event.preventDefault();
}
async copyCode(event: Event) {
- if (!this.codeDisabled) {
- await navigator.clipboard.writeText(this.code);
- }
-
- event.preventDefault();
- }
-
- get codeDisabled() {
- return this.free ? false : (environment ? environment.production: false);
+ await navigator.clipboard.writeText(this.code);
+ event.preventDefault();
}
}
diff --git a/src/app/components/charts/charts.component.ts b/src/app/components/charts/charts.component.ts
index b246a45..23748dd 100755
--- a/src/app/components/charts/charts.component.ts
+++ b/src/app/components/charts/charts.component.ts
@@ -1,9 +1,12 @@
-import { Component, OnInit } from '@angular/core';
+import { Component, OnDestroy, OnInit } from '@angular/core';
+import { Subscription } from 'rxjs';
+import { AppConfig } from 'src/app/api/appconfig';
+import { ConfigService } from 'src/app/service/app.config.service';
@Component({
templateUrl: './charts.component.html'
})
-export class ChartsComponent implements OnInit {
+export class ChartsComponent implements OnInit, OnDestroy {
lineData: any;
@@ -25,7 +28,19 @@ export class ChartsComponent implements OnInit {
radarOptions: any;
+ config: AppConfig;
+
+ subscription: Subscription;
+
+ constructor(public configService: ConfigService) { }
+
ngOnInit() {
+ this.config = this.configService.config;
+ this.subscription = this.configService.configUpdate$.subscribe(config => {
+ this.config = config;
+ this.updateChartOptions();
+ });
+
this.lineData = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
@@ -52,7 +67,7 @@ export class ChartsComponent implements OnInit {
plugins: {
legend: {
labels: {
- fontColor: '#FFFFFF'
+ color: '#A0A7B5'
}
}
},
@@ -96,7 +111,7 @@ export class ChartsComponent implements OnInit {
plugins: {
legend: {
labels: {
- fontColor: '#A0A7B5'
+ color: '#A0A7B5'
}
}
},
@@ -143,7 +158,7 @@ export class ChartsComponent implements OnInit {
plugins: {
legend: {
labels: {
- fontColor: '#A0A7B5'
+ color: '#A0A7B5'
}
}
}
@@ -180,7 +195,7 @@ export class ChartsComponent implements OnInit {
plugins: {
legend: {
labels: {
- fontColor: '#A0A7B5'
+ color: '#A0A7B5'
}
}
},
@@ -223,7 +238,7 @@ export class ChartsComponent implements OnInit {
plugins: {
legend: {
labels: {
- fontColor: '#A0A7B5'
+ color: '#A0A7B5'
}
}
},
@@ -236,4 +251,222 @@ export class ChartsComponent implements OnInit {
}
};
}
+
+ updateChartOptions() {
+ if (this.config.dark)
+ this.applyDarkTheme();
+ else
+ this.applyLightTheme();
+ }
+
+ applyLightTheme() {
+ this.lineOptions = {
+ plugins: {
+ legend: {
+ labels: {
+ color: '#A0A7B5'
+ }
+ }
+ },
+ scales: {
+ x: {
+ ticks: {
+ color: '#A0A7B5'
+ },
+ grid: {
+ color: 'rgba(160, 167, 181, .3)',
+ }
+ },
+ y: {
+ ticks: {
+ color: '#A0A7B5'
+ },
+ grid: {
+ color: 'rgba(160, 167, 181, .3)',
+ }
+ },
+ }
+ };
+
+ this.barOptions = {
+ plugins: {
+ legend: {
+ labels: {
+ color: '#A0A7B5'
+ }
+ }
+ },
+ scales: {
+ x: {
+ ticks: {
+ color: '#A0A7B5'
+ },
+ grid: {
+ color: 'rgba(160, 167, 181, .3)',
+ }
+ },
+ y: {
+ ticks: {
+ color: '#A0A7B5'
+ },
+ grid: {
+ color: 'rgba(160, 167, 181, .3)',
+ }
+ },
+ }
+ };
+
+ this.pieOptions = {
+ plugins: {
+ legend: {
+ labels: {
+ color: '#A0A7B5'
+ }
+ }
+ }
+ };
+
+ this.polarOptions = {
+ plugins: {
+ legend: {
+ labels: {
+ color: '#A0A7B5'
+ }
+ }
+ },
+ scales: {
+ r: {
+ grid: {
+ color: 'rgba(160, 167, 181, .3)'
+ }
+ }
+ }
+ };
+
+ this.radarOptions = {
+ plugins: {
+ legend: {
+ labels: {
+ color: '#A0A7B5'
+ }
+ }
+ },
+ scales: {
+ r: {
+ grid: {
+ color: 'rgba(160, 167, 181, .3)'
+ }
+ }
+ }
+ };
+
+ }
+
+ applyDarkTheme() {
+ this.lineOptions = {
+ plugins: {
+ legend: {
+ labels: {
+ color: '#ebedef'
+ }
+ }
+ },
+ scales: {
+ x: {
+ ticks: {
+ color: '#ebedef'
+ },
+ grid: {
+ color: 'rgba(160, 167, 181, .3)',
+ }
+ },
+ y: {
+ ticks: {
+ color: '#ebedef'
+ },
+ grid: {
+ color: 'rgba(160, 167, 181, .3)',
+ }
+ },
+ }
+ };
+
+ this.barOptions = {
+ plugins: {
+ legend: {
+ labels: {
+ color: '#ebedef'
+ }
+ }
+ },
+ scales: {
+ x: {
+ ticks: {
+ color: '#ebedef'
+ },
+ grid: {
+ color: 'rgba(160, 167, 181, .3)',
+ }
+ },
+ y: {
+ ticks: {
+ color: '#ebedef'
+ },
+ grid: {
+ color: 'rgba(160, 167, 181, .3)',
+ }
+ },
+ }
+ };
+
+ this.pieOptions = {
+ plugins: {
+ legend: {
+ labels: {
+ color: '#ebedef'
+ }
+ }
+ }
+ };
+
+ this.polarOptions = {
+ plugins: {
+ legend: {
+ labels: {
+ color: '#ebedef'
+ }
+ }
+ },
+ scales: {
+ r: {
+ grid: {
+ color: 'rgba(160, 167, 181, .3)'
+ }
+ }
+ }
+ };
+
+ this.radarOptions = {
+ plugins: {
+ legend: {
+ labels: {
+ color: '#ebedef'
+ }
+ }
+ },
+ scales: {
+ r: {
+ grid: {
+ color: 'rgba(160, 167, 181, .3)'
+ }
+ }
+ }
+ };
+ }
+
+ ngOnDestroy() {
+ if (this.subscription) {
+ this.subscription.unsubscribe();
+ }
+ }
}
diff --git a/src/app/service/app.config.service.ts b/src/app/service/app.config.service.ts
new file mode 100644
index 0000000..0a165d6
--- /dev/null
+++ b/src/app/service/app.config.service.ts
@@ -0,0 +1,27 @@
+import { Injectable } from '@angular/core';
+import { Subject } from 'rxjs';
+import { AppConfig } from '../api/appconfig';
+
+@Injectable()
+export class ConfigService {
+
+ config: AppConfig = {
+ theme: 'lara-light-indigo',
+ dark: false,
+ inputStyle: 'outlined',
+ ripple: true
+ };
+
+ private configUpdate = new Subject
();
+
+ configUpdate$ = this.configUpdate.asObservable();
+
+ updateConfig(config: AppConfig) {
+ this.config = config;
+ this.configUpdate.next(config);
+ }
+
+ getConfig() {
+ return this.config;
+ }
+}
diff --git a/src/app/service/app.menu.service.ts b/src/app/service/app.menu.service.ts
index 0163ecf..ba552db 100644
--- a/src/app/service/app.menu.service.ts
+++ b/src/app/service/app.menu.service.ts
@@ -15,6 +15,6 @@ export class MenuService {
}
reset() {
- // this.resetSource.next(true);
+ this.resetSource.next(true);
}
}