Light theme added for non-material components

This commit is contained in:
Piotr Pekala 2019-11-27 07:18:41 -08:00
parent 919e5fb44b
commit 0c8c09ef56
23 changed files with 95 additions and 52 deletions

View File

@ -27,6 +27,6 @@ export class AppComponent implements OnInit {
this.electronService.ipcRenderer.send('settings.changed', settings); this.electronService.ipcRenderer.send('settings.changed', settings);
}); });
} }
this.themeService.setDarkMode(false); // this.themeService.setDarkMode(false);
} }
} }

View File

@ -1,5 +1,5 @@
.ad { .ad {
background-color: #263238; background-color: transparent;
width: 400px; width: 400px;
padding-top: 10px; padding-top: 10px;
padding-bottom: 10px; padding-bottom: 10px;

View File

@ -1,7 +1,7 @@
<div class="notification-box" [ngClass]="{hidden: !isVisible}"> <div class="notification-box" [ngClass]="{hidden: !isVisible}">
<mat-progress-bar mode="determinate" [value]="progress"></mat-progress-bar> <mat-progress-bar mode="determinate" [value]="progress"></mat-progress-bar>
<div style="display: flex; height: 102px;"> <div style="display: flex; height: 102px;">
<div class="content"> <div class="content" [ngClass]="{lightTheme: isLightThemeEnabled}">
<app-adbutler (onLoad)="onLoadingAdbutler($event)" theme="dark"></app-adbutler> <app-adbutler (onLoad)="onLoadingAdbutler($event)" theme="dark"></app-adbutler>
<mat-icon (click)="closeNotification()" class="close-button">close</mat-icon> <mat-icon (click)="closeNotification()" class="close-button">close</mat-icon>
</div> </div>

View File

@ -14,6 +14,10 @@
border-bottom: 2px solid #0097a7; border-bottom: 2px solid #0097a7;
} }
.lightTheme {
background-color: white;
}
.close-button { .close-button {
position: fixed; position: fixed;
bottom: 90px; bottom: 90px;

View File

@ -1,5 +1,6 @@
import { Component, OnInit, OnDestroy } from '@angular/core'; import { Component, OnInit, OnDestroy } from '@angular/core';
import { timer, Observable, Subscription } from 'rxjs'; import { timer, Observable, Subscription } from 'rxjs';
import { ThemeService } from '../../services/theme.service';
@Component({ @Component({
selector: 'app-notification-box', selector: 'app-notification-box',
@ -22,11 +23,15 @@ export class NotificationBoxComponent implements OnInit, OnDestroy {
breakTime: number = 20; breakTime: number = 20;
isEndless: boolean = false; isEndless: boolean = false;
numberOfViews: number = 1; numberOfViews: number = 1;
isLightThemeEnabled: boolean = false;
constructor(){} constructor(
private themeService: ThemeService
){}
ngOnInit() { ngOnInit() {
this.startTimer(); this.startTimer();
this.themeService.getActualTheme() === 'light' ? this.isLightThemeEnabled = true : this.isLightThemeEnabled = false;
} }
startTimer() { startTimer() {

View File

@ -5,6 +5,7 @@
</div> </div>
<div <div
class="consoleWrapper" class="consoleWrapper"
[ngClass]="{lightTheme: isLightThemeEnabled}"
(mousedown)="toggleDragging(true)" (mousedown)="toggleDragging(true)"
[ngStyle]="style" [ngStyle]="style"
mwlResizable mwlResizable

View File

@ -11,8 +11,12 @@
font-size: 12px; font-size: 12px;
} }
.lightTheme {
background: #0d47a1;
}
.filterButton { .filterButton {
background: #263238; background: transparent;
color: white; color: white;
border: none; border: none;
margin-top: 0px; margin-top: 0px;
@ -54,7 +58,7 @@
} }
.commandLine { .commandLine {
background-color: #263238; background-color: transparent;
color: white; color: white;
border: none; border: none;
} }

View File

@ -13,6 +13,7 @@ import { LogEventsDataSource } from './log-events-datasource';
import { HttpServer } from '../../../services/http-server.service'; import { HttpServer } from '../../../services/http-server.service';
import { LogEvent } from '../../../models/logEvent'; import { LogEvent } from '../../../models/logEvent';
import { ResizeEvent } from 'angular-resizable-element'; import { ResizeEvent } from 'angular-resizable-element';
import { ThemeService } from '../../../services/theme.service';
@Component({ @Component({
@ -49,16 +50,19 @@ export class LogConsoleComponent implements OnInit, AfterViewInit, OnDestroy {
public styleInside: object = { height: `120px` }; public styleInside: object = { height: `120px` };
isDraggingEnabled: boolean = false; isDraggingEnabled: boolean = false;
public isLightThemeEnabled: boolean = false;
constructor( constructor(
private projectWebServiceHandler: ProjectWebServiceHandler, private projectWebServiceHandler: ProjectWebServiceHandler,
private nodeService: NodeService, private nodeService: NodeService,
private nodesDataSource: NodesDataSource, private nodesDataSource: NodesDataSource,
private logEventsDataSource: LogEventsDataSource, private logEventsDataSource: LogEventsDataSource,
private httpService: HttpServer private httpService: HttpServer,
private themeService: ThemeService
) {} ) {}
ngOnInit() { ngOnInit() {
this.themeService.getActualTheme() === 'light' ? this.isLightThemeEnabled = true : this.isLightThemeEnabled = false;
this.nodeSubscription = this.projectWebServiceHandler.nodeNotificationEmitter.subscribe((event) => { this.nodeSubscription = this.projectWebServiceHandler.nodeNotificationEmitter.subscribe((event) => {
let node: Node = event.event as Node; let node: Node = event.event as Node;
let message: string = ''; let message: string = '';

View File

@ -5,7 +5,7 @@
width: 40px; width: 40px;
margin-right: 12px !important; margin-right: 12px !important;
margin-left: 12px !important; margin-left: 12px !important;
background: #263238; background: transparent;
padding: 0; padding: 0;
border: none; border: none;
background-color: transparent; background-color: transparent;

View File

@ -5,7 +5,7 @@
width: 40px; width: 40px;
margin-right: 12px !important; margin-right: 12px !important;
margin-left: 12px !important; margin-left: 12px !important;
background: #263238; background: transparent;
padding: 0; padding: 0;
border: none; border: none;
background-color: transparent; background-color: transparent;

View File

@ -145,11 +145,11 @@
</mat-toolbar> </mat-toolbar>
</div> </div>
<div id="show-menu-wrapper" [ngClass]="{ shadowed: !isProjectMapMenuVisible }" *ngIf="!readonly"> <div id="show-menu-wrapper" [ngClass]="{lightTheme: isLightThemeEnabled, shadowed: !isProjectMapMenuVisible }" *ngIf="!readonly">
<button class="arrow-button" mat-icon-button (click)="showMenu()"><mat-icon class="unmarked">keyboard_arrow_right</mat-icon></button> <button class="arrow-button" mat-icon-button (click)="showMenu()"><mat-icon class="unmarked">keyboard_arrow_right</mat-icon></button>
</div> </div>
<div id="menu-wrapper" [ngClass]="{ extended: isProjectMapMenuVisible }"> <div id="menu-wrapper" [ngClass]="{lightTheme: isLightThemeEnabled, extended: isProjectMapMenuVisible }">
<app-nodes-menu [server]="server" [project]="project"></app-nodes-menu> <app-nodes-menu [server]="server" [project]="project"></app-nodes-menu>
<mat-divider class="divider" [vertical]="true"></mat-divider> <mat-divider class="divider" [vertical]="true"></mat-divider>
<app-project-map-menu [server]="server" [project]="project"></app-project-map-menu> <app-project-map-menu [server]="server" [project]="project"></app-project-map-menu>
@ -159,7 +159,7 @@
<app-context-menu [project]="project" [server]="server"></app-context-menu> <app-context-menu [project]="project" [server]="server"></app-context-menu>
</div> </div>
<div id="zoom-buttons"> <div [ngClass]="{lightTheme: isLightThemeEnabled}" class="zoom-buttons">
<button class="zoom-button" (click)="zoomIn()"><mat-icon>zoom_in</mat-icon></button> <button class="zoom-button" (click)="zoomIn()"><mat-icon>zoom_in</mat-icon></button>
<button class="zoom-button" (click)="resetZoom()"><mat-icon>adjust</mat-icon></button> <button class="zoom-button" (click)="resetZoom()"><mat-icon>adjust</mat-icon></button>
<button class="zoom-button" (click)="zoomOut()"><mat-icon>zoom_out</mat-icon></button> <button class="zoom-button" (click)="zoomOut()"><mat-icon>zoom_out</mat-icon></button>

View File

@ -21,6 +21,10 @@ g.node:hover {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
} }
.lightTheme {
background: #0d47a1!important;
}
#show-menu-wrapper { #show-menu-wrapper {
position: fixed; position: fixed;
background: transparent; background: transparent;
@ -66,7 +70,7 @@ g.node:hover {
width: 40px; width: 40px;
margin-right: 12px !important; margin-right: 12px !important;
margin-left: 12px !important; margin-left: 12px !important;
background: #263238; background: transparent;
padding: 0; padding: 0;
border: none; border: none;
background-color: transparent; background-color: transparent;
@ -101,7 +105,7 @@ mat-divider.divider {
color: #0097a7!important; color: #0097a7!important;
} }
#zoom-buttons { .zoom-buttons {
position: fixed; position: fixed;
background: #263238; background: #263238;
bottom: 20px; bottom: 20px;
@ -112,7 +116,7 @@ mat-divider.divider {
outline: none; outline: none;
height: 40px; height: 40px;
width: 40px; width: 40px;
background: #263238; background: transparent;
border: none; border: none;
color: white; color: white;
font-size: 1.25rem; font-size: 1.25rem;
@ -122,21 +126,6 @@ mat-divider.divider {
margin-left: -6px; margin-left: -6px;
} }
} }
.zoom-button-white {
outline: none;
height: 40px;
width: 40px;
color: #263238;
border: none;
background: white;
font-size: 1.25rem;
font-weight: bold;
mat-icon {
margin-left: -6px;
}
}
} }
@-moz-document url-prefix() { @-moz-document url-prefix() {

View File

@ -65,6 +65,7 @@ import { NavigationDialogComponent } from '../projects/navigation-dialog/navigat
import { ConfirmationBottomSheetComponent } from '../projects/confirmation-bottomsheet/confirmation-bottomsheet.component'; import { ConfirmationBottomSheetComponent } from '../projects/confirmation-bottomsheet/confirmation-bottomsheet.component';
import { NodeAddedEvent } from '../template/template-list-dialog/template-list-dialog.component'; import { NodeAddedEvent } from '../template/template-list-dialog/template-list-dialog.component';
import { NotificationService } from '../../services/notification.service'; import { NotificationService } from '../../services/notification.service';
import { ThemeService } from '../../services/theme.service';
@Component({ @Component({
@ -102,6 +103,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
private scrollX: number = 0; private scrollX: number = 0;
private scrollY: number = 0; private scrollY: number = 0;
private scrollEnabled: boolean = false; private scrollEnabled: boolean = false;
public isLightThemeEnabled: boolean = false;
@ViewChild(ContextMenuComponent, {static: false}) contextMenu: ContextMenuComponent; @ViewChild(ContextMenuComponent, {static: false}) contextMenu: ContextMenuComponent;
@ViewChild(D3MapComponent, {static: false}) mapChild: D3MapComponent; @ViewChild(D3MapComponent, {static: false}) mapChild: D3MapComponent;
@ -150,10 +152,12 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
private ethernetLinkWidget: EthernetLinkWidget, private ethernetLinkWidget: EthernetLinkWidget,
private serialLinkWidget: SerialLinkWidget, private serialLinkWidget: SerialLinkWidget,
private bottomSheet: MatBottomSheet, private bottomSheet: MatBottomSheet,
private notificationService: NotificationService private notificationService: NotificationService,
private themeService: ThemeService
) {} ) {}
ngOnInit() { ngOnInit() {
this.themeService.getActualTheme() === 'light' ? this.isLightThemeEnabled = true : this.isLightThemeEnabled = false;
this.settings = this.settingsService.getAll(); this.settings = this.settingsService.getAll();
this.isTopologySummaryVisible = this.mapSettingsService.isTopologySummaryVisible; this.isTopologySummaryVisible = this.mapSettingsService.isTopologySummaryVisible;
this.isConsoleVisible = this.mapSettingsService.isLogConsoleVisible; this.isConsoleVisible = this.mapSettingsService.isLogConsoleVisible;

View File

@ -1,4 +1,4 @@
<div class="dialogWrapper"> <div class="dialogWrapper" [ngClass]="{lightTheme: isLightThemeEnabled}">
<div class="title">{{message}}</div> <div class="title">{{message}}</div>
<div> <div>
<button mat-button (click)="onNoClick()">No</button> <button mat-button (click)="onNoClick()">No</button>

View File

@ -7,8 +7,8 @@
align-items: center; align-items: center;
} }
mat-bottom-sheet-container { .lightTheme {
background: #263238; background-color: white;
} }
.title { .title {

View File

@ -1,5 +1,6 @@
import { Component, OnInit, Inject } from '@angular/core'; import { Component, OnInit, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA, MatBottomSheetRef } from '@angular/material'; import { MatDialogRef, MAT_DIALOG_DATA, MatBottomSheetRef } from '@angular/material';
import { ThemeService } from '../../../services/theme.service';
@Component({ @Component({
selector: 'app-confirmation-bottomsheet', selector: 'app-confirmation-bottomsheet',
@ -8,10 +9,16 @@ import { MatDialogRef, MAT_DIALOG_DATA, MatBottomSheetRef } from '@angular/mater
}) })
export class ConfirmationBottomSheetComponent implements OnInit { export class ConfirmationBottomSheetComponent implements OnInit {
message: string = ''; message: string = '';
isLightThemeEnabled: boolean = false;
constructor(private bottomSheetRef: MatBottomSheetRef<ConfirmationBottomSheetComponent>) {} constructor(
private bottomSheetRef: MatBottomSheetRef<ConfirmationBottomSheetComponent>,
private themeService: ThemeService
) {}
ngOnInit() {} ngOnInit() {
this.themeService.getActualTheme() === 'light' ? this.isLightThemeEnabled = true : this.isLightThemeEnabled = false;
}
onNoClick(): void { onNoClick(): void {
this.bottomSheetRef.dismiss(false); this.bottomSheetRef.dismiss(false);

View File

@ -1,4 +1,4 @@
<div class="dialogWrapper"> <div class="dialogWrapper" [ngClass]="{lightTheme: isLightThemeEnabled}">
<div class="title"> Do you want to navigate to {{projectMessage}}?</div> <div class="title"> Do you want to navigate to {{projectMessage}}?</div>
<div> <div>
<button mat-button (click)="onNoClick()">No</button> <button mat-button (click)="onNoClick()">No</button>

View File

@ -7,8 +7,8 @@
align-items: center; align-items: center;
} }
mat-bottom-sheet-container { .lightTheme {
background: #263238; background-color: white;
} }
.title { .title {

View File

@ -1,5 +1,6 @@
import { Component, OnInit, Inject } from '@angular/core'; import { Component, OnInit, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA, MatBottomSheetRef } from '@angular/material'; import { MatDialogRef, MAT_DIALOG_DATA, MatBottomSheetRef } from '@angular/material';
import { ThemeService } from '../../../services/theme.service';
@Component({ @Component({
selector: 'app-navigation-dialog', selector: 'app-navigation-dialog',
@ -8,10 +9,16 @@ import { MatDialogRef, MAT_DIALOG_DATA, MatBottomSheetRef } from '@angular/mater
}) })
export class NavigationDialogComponent implements OnInit { export class NavigationDialogComponent implements OnInit {
projectMessage: string = ''; projectMessage: string = '';
isLightThemeEnabled: boolean = false;
constructor(private bottomSheetRef: MatBottomSheetRef<NavigationDialogComponent>) {} constructor(
private bottomSheetRef: MatBottomSheetRef<NavigationDialogComponent>,
private themeService: ThemeService
) {}
ngOnInit() {} ngOnInit() {
this.themeService.getActualTheme() === 'light' ? this.isLightThemeEnabled = true : this.isLightThemeEnabled = false;
}
onNoClick(): void { onNoClick(): void {
this.bottomSheetRef.dismiss(false); this.bottomSheetRef.dismiss(false);

View File

@ -8,6 +8,7 @@
(mousedown)="toggleDragging(true)" (mousedown)="toggleDragging(true)"
*ngIf="projectsStatistics" *ngIf="projectsStatistics"
[ngStyle]="style" [ngStyle]="style"
[ngClass]="{lightTheme: isLightThemeEnabled}"
mwlResizable mwlResizable
[validateResize]="validate" [validateResize]="validate"
[resizeEdges]="{ right: true, left: true, bottom: true, top: true }" [resizeEdges]="{ right: true, left: true, bottom: true, top: true }"

View File

@ -11,6 +11,10 @@
font-size: 12px; font-size: 12px;
} }
.lightTheme {
background: #0d47a1;
}
.summaryHeaderMenu { .summaryHeaderMenu {
height: 24px; height: 24px;
} }

View File

@ -10,6 +10,7 @@ import { Compute } from '../../models/compute';
import { ComputeService } from '../../services/compute.service'; import { ComputeService } from '../../services/compute.service';
import { LinksDataSource } from '../../cartography/datasources/links-datasource'; import { LinksDataSource } from '../../cartography/datasources/links-datasource';
import { ResizeEvent } from 'angular-resizable-element'; import { ResizeEvent } from 'angular-resizable-element';
import { ThemeService } from '../../services/theme.service';
@Component({ @Component({
@ -36,18 +37,21 @@ export class TopologySummaryComponent implements OnInit, OnDestroy {
captureFilterEnabled: boolean = false; captureFilterEnabled: boolean = false;
packetFilterEnabled: boolean = false; packetFilterEnabled: boolean = false;
computes: Compute[] = []; computes: Compute[] = [];
isTopologyVisible: boolean = true;
isTopologyVisible: boolean = true;
isDraggingEnabled: boolean = false; isDraggingEnabled: boolean = false;
isLightThemeEnabled: boolean = false;
constructor( constructor(
private nodesDataSource: NodesDataSource, private nodesDataSource: NodesDataSource,
private projectService: ProjectService, private projectService: ProjectService,
private computeService: ComputeService, private computeService: ComputeService,
private linksDataSource: LinksDataSource private linksDataSource: LinksDataSource,
private themeService: ThemeService
) {} ) {}
ngOnInit() { ngOnInit() {
this.themeService.getActualTheme() === 'light' ? this.isLightThemeEnabled = true : this.isLightThemeEnabled = false;
this.subscriptions.push( this.subscriptions.push(
this.nodesDataSource.changes.subscribe((nodes: Node[]) => { this.nodesDataSource.changes.subscribe((nodes: Node[]) => {
this.nodes = nodes; this.nodes = nodes;

View File

@ -1,23 +1,21 @@
import { Injectable, RendererFactory2, Renderer2, Inject } from '@angular/core'; import { Injectable, RendererFactory2, Renderer2, Inject, EventEmitter } from '@angular/core';
import { Observable, BehaviorSubject, combineLatest } from 'rxjs'; import { Observable, BehaviorSubject, combineLatest } from 'rxjs';
import { DOCUMENT } from '@angular/common'; import { DOCUMENT } from '@angular/common';
@Injectable({ @Injectable({ providedIn: 'root' })
providedIn: 'root'
})
export class ThemeService { export class ThemeService {
private _mainTheme$: BehaviorSubject<string> = new BehaviorSubject('theme-default'); private _mainTheme$: BehaviorSubject<string> = new BehaviorSubject('theme-default');
private _darkMode$: BehaviorSubject<boolean> = new BehaviorSubject(false); private _darkMode$: BehaviorSubject<boolean> = new BehaviorSubject(false);
darkMode$: Observable<boolean> = this._darkMode$.asObservable();
private _renderer: Renderer2; private _renderer: Renderer2;
private head: HTMLElement; private head: HTMLElement;
private themeLinks: HTMLElement[] = []; private themeLinks: HTMLElement[] = [];
darkMode$: Observable<boolean> = this._darkMode$.asObservable();
theme$: Observable<[string, boolean]>; theme$: Observable<[string, boolean]>;
public themeChanged = new EventEmitter<string>();
//this should taken from memory
public savedTheme: string = 'light';
constructor( constructor(
rendererFactory: RendererFactory2, rendererFactory: RendererFactory2,
@Inject(DOCUMENT) document: Document @Inject(DOCUMENT) document: Document
@ -34,12 +32,23 @@ export class ThemeService {
}) })
} }
getActualTheme() {
return this.savedTheme;
}
setMainTheme(name: string) { setMainTheme(name: string) {
this._mainTheme$.next(name); this._mainTheme$.next(name);
} }
setDarkMode(value: boolean) { setDarkMode(value: boolean) {
this._darkMode$.next(value); this._darkMode$.next(value);
if (value) {
this.savedTheme = 'dark';
this.themeChanged.emit(this.savedTheme);
} else {
this.savedTheme = 'light';
this.themeChanged.emit(this.savedTheme);
}
} }
private async loadCss(filename: string) { private async loadCss(filename: string) {