more stuff

This commit is contained in:
Jamie Rees 2019-03-26 14:14:03 +00:00
commit 9c2eb7369f
9 changed files with 53 additions and 24 deletions

View file

@ -70,7 +70,7 @@ const routes: Routes = [
{ loadChildren: "./wizard/wizard.module#WizardModule", path: "Wizard" }, { loadChildren: "./wizard/wizard.module#WizardModule", path: "Wizard" },
{ loadChildren: "./usermanagement/usermanagement.module#UserManagementModule", path: "usermanagement" }, { loadChildren: "./usermanagement/usermanagement.module#UserManagementModule", path: "usermanagement" },
{ loadChildren: "./requests/requests.module#RequestsModule", path: "requestsOld" }, { loadChildren: "./requests/requests.module#RequestsModule", path: "requestsOld" },
{ loadChildren: "./requests-list/requests-list.module#RequestsListModule", path: "requests" }, { loadChildren: "./requests-list/requests-list.module#RequestsListModule", path: "requests-list" },
{ loadChildren: "./search/search.module#SearchModule", path: "search" }, { loadChildren: "./search/search.module#SearchModule", path: "search" },
{ loadChildren: "./recentlyAdded/recentlyAdded.module#RecentlyAddedModule", path: "recentlyadded" }, { loadChildren: "./recentlyAdded/recentlyAdded.module#RecentlyAddedModule", path: "recentlyadded" },
{ loadChildren: "./vote/vote.module#VoteModule", path: "vote" }, { loadChildren: "./vote/vote.module#VoteModule", path: "vote" },

View file

@ -2,11 +2,16 @@
<div class="row justify-content-md-center top-spacing"> <div class="row justify-content-md-center top-spacing">
<div class="btn-group" role="group" aria-label="Basic example"> <div class="btn-group" role="group" aria-label="Basic example">
<button type="button" (click)="popular()" [ngClass]="popularActive ? 'active-button' : ''" mat-raised-button <button type="button" (click)="popular()" [attr.color]="popularActive ? 'accent' : 'primary'"
class="btn grow" color="primary">{{'Discovery.PopularTab' | translate}}</button> [ngClass]="popularActive ? 'mat-accent' : 'mat-primary'" mat-raised-button
<button type="button" (click)="trending()" [ngClass]="trendingActive ? 'active-button' : ''" class="btn grow" >{{'Discovery.PopularTab' | translate}}</button>
<button type="button" (click)="trending()"
[attr.color]="trendingActive ? 'accent' : 'primary'"
[ngClass]="trendingActive ? 'mat-accent' : 'mat-primary'"
mat-raised-button class="btn grow" color="primary">{{'Discovery.TrendingTab' | translate}}</button> mat-raised-button class="btn grow" color="primary">{{'Discovery.TrendingTab' | translate}}</button>
<button type="button" (click)="upcoming()" [ngClass]="upcomingActive ? 'active-button' : ''" <button type="button" (click)="upcoming()"
[attr.color]="upcomingActive ? 'accent' : 'primary'"
[ngClass]="upcomingActive ? 'mat-accent' : 'mat-primary'"
mat-raised-button class="btn grow" color="primary">{{'Discovery.UpcomingTab' | translate}}</button> mat-raised-button class="btn grow" color="primary">{{'Discovery.UpcomingTab' | translate}}</button>
</div> </div>
</div> </div>

View file

@ -70,7 +70,7 @@
</div> </div>
<div class="col-12 col-md-10"> <div class="col-12 col-md-10" *ngIf="tvRequest">
<mat-accordion> <mat-accordion>
<mat-expansion-panel> <mat-expansion-panel>
<mat-expansion-panel-header> <mat-expansion-panel-header>

View file

@ -3,12 +3,13 @@
[mode]="(isHandset$ | async) ? 'over' : 'side'" [opened]="!(isHandset$ | async)"> [mode]="(isHandset$ | async) ? 'over' : 'side'" [opened]="!(isHandset$ | async)">
<mat-toolbar>{{applicationName}}</mat-toolbar> <mat-toolbar>{{applicationName}}</mat-toolbar>
<mat-nav-list> <mat-nav-list>
<a *ngFor="let nav of navItems" mat-list-item [routerLink]="nav.link" [routerLinkActive]="['active-list-item']" > <a *ngFor="let nav of navItems" mat-list-item [routerLink]="nav.link"
[routerLinkActive]="getTheme()" >
<mat-icon aria-label="Side nav toggle icon">{{nav.icon}}</mat-icon> <mat-icon aria-label="Side nav toggle icon">{{nav.icon}}</mat-icon>
{{nav.name | translate}} {{nav.name | translate}}
</a> </a>
<a class="bottom-nav-link" mat-list-item [routerLinkActive]="['active-list-item']" aria-label="Toggle sidenav" (click)="logOut();"> <a class="bottom-nav-link" mat-list-item [routerLinkActive]="theme === 'dark' ? 'active-list-item-dark' : 'active-list-item'" aria-label="Toggle sidenav" (click)="logOut();">
<mat-icon aria-label="Side nav toggle icon">exit_to_app</mat-icon> <mat-icon aria-label="Side nav toggle icon">exit_to_app</mat-icon>
{{ 'NavigationBar.Logout' | translate }} {{ 'NavigationBar.Logout' | translate }}
</a> </a>

View file

@ -44,6 +44,12 @@
.active-list-item { .active-list-item {
background: $accent !important; background: $accent !important;
color:white;
}
.active-list-item-dark {
background: $accent-dark !important;
color:black;
} }
.bottom-nav-link { .bottom-nav-link {

View file

@ -1,4 +1,4 @@
import { Component, Input, Output, EventEmitter, HostBinding } from '@angular/core'; import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
@ -9,7 +9,7 @@ import { INavBar } from '../interfaces/ICommon';
templateUrl: './my-nav.component.html', templateUrl: './my-nav.component.html',
styleUrls: ['./my-nav.component.scss'], styleUrls: ['./my-nav.component.scss'],
}) })
export class MyNavComponent { export class MyNavComponent implements OnInit {
isHandset$: Observable<boolean> = this.breakpointObserver.observe(Breakpoints.Handset) isHandset$: Observable<boolean> = this.breakpointObserver.observe(Breakpoints.Handset)
.pipe( .pipe(
@ -21,14 +21,18 @@ export class MyNavComponent {
@Input() public username: string; @Input() public username: string;
@Output() public logoutClick = new EventEmitter(); @Output() public logoutClick = new EventEmitter();
@Output() public themeChange = new EventEmitter<string>(); @Output() public themeChange = new EventEmitter<string>();
public theme: string;
constructor(private breakpointObserver: BreakpointObserver) { constructor(private breakpointObserver: BreakpointObserver) {
} }
public ngOnInit(): void {
this.theme = localStorage.getItem("theme");
}
public navItems: INavBar[] = [ public navItems: INavBar[] = [
{ name: "NavigationBar.Discover", icon: "find_replace", link: "/discover" }, { name: "NavigationBar.Discover", icon: "find_replace", link: "/discover" },
{ name: "NavigationBar.Requests", icon: "list", link: "/requests" }, { name: "NavigationBar.Requests", icon: "list", link: "/requests-list" },
{ name: "NavigationBar.UserManagement", icon: "account_circle", link: "/usermanagement" }, { name: "NavigationBar.UserManagement", icon: "account_circle", link: "/usermanagement" },
{ name: "NavigationBar.Settings", icon: "settings", link: "/Settings/About" }, { name: "NavigationBar.Settings", icon: "settings", link: "/Settings/About" },
] ]
@ -38,19 +42,23 @@ export class MyNavComponent {
} }
public switchTheme() { public switchTheme() {
const theme = localStorage.getItem("theme"); if (this.theme) {
if (theme) {
localStorage.removeItem("theme"); localStorage.removeItem("theme");
let newTheme = ""; let newTheme = "";
if (theme === "dark") { if (this.theme === "dark") {
newTheme = "light"; newTheme = "light";
} else { } else {
newTheme = "dark"; newTheme = "dark";
} }
localStorage.setItem("theme", newTheme) localStorage.setItem("theme", newTheme)
this.theme = newTheme;
this.themeChange.emit(newTheme); this.themeChange.emit(newTheme);
} }
} }
public getTheme(){
debugger;
return this.theme === 'dark' ? 'active-list-item-dark' : 'active-list-item';
}
} }

View file

@ -2,5 +2,19 @@ export function getBaseLocation() {
debugger; debugger;
let paths: string[] = location.pathname.split('/').splice(1, 1); let paths: string[] = location.pathname.split('/').splice(1, 1);
let basePath: string = (paths && paths[0] ? paths[0] : ""); let basePath: string = (paths && paths[0] ? paths[0] : "");
if(invalidProxies.indexOf(basePath) === -1){
return '/';
}
return '/' + basePath; return '/' + basePath;
} }
const invalidProxies: string[] = [
'discover',
'requests-list',
'Settings',
'issues',
'usermanagement',
'recentlyadded',
'details',
'vote'
]

View file

@ -13,8 +13,3 @@
.btn-orange { .btn-orange {
background-color: #F57C00; background-color: #F57C00;
} }
.active-button {
background-color: #5dffbd !important;
color: white;
}

View file

@ -4,8 +4,8 @@
// Define the palettes for your theme using the Material Design palettes available in palette.scss // Define the palettes for your theme using the Material Design palettes available in palette.scss
// (imported above). For each palette, you can optionally specify a default, lighter, and darker // (imported above). For each palette, you can optionally specify a default, lighter, and darker
// hue. Available color palettes: https://material.io/design/color/ // hue. Available color palettes: https://material.io/design/color/
$ombi-app-primary: mat-palette($ombi-primary, 500); $ombi-app-primary: mat-palette($ombi-primary);
$ombi-app-accent : mat-palette($ombi-accent, A200, A100, A400); $ombi-app-accent : mat-palette($ombi-accent, 400);
// The warn palette is optional (defaults to red). // The warn palette is optional (defaults to red).
$ombi-app-warn : mat-palette($mat-deep-orange); $ombi-app-warn : mat-palette($mat-deep-orange);