Skip to content

Commit

Permalink
Merge pull request #9 from mvl-at/feature/debug-display
Browse files Browse the repository at this point in the history
Add display debug mode
  • Loading branch information
eiskasten committed Oct 4, 2022
2 parents f8ef46f + 39c3e67 commit c2b9d0e
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ import {MatMenuModule} from '@angular/material/menu';
import {MAT_SNACK_BAR_DEFAULT_OPTIONS, MatSnackBarModule} from '@angular/material/snack-bar';
import {SelfComponent} from './pages/self/self.component';
import {MatExpansionModule} from '@angular/material/expansion';
import {DebugDisplayPipe} from './pipes/debug-display.pipe';

@NgModule({
declarations: [AppComponent, NavigationComponent, MemberCardComponent, MembersComponent, FallbackImgDirective, ArchiveComponent, ScoreEditorComponent, ChipListComponent, TrimDirective, BlackboardComponent, BlackboardItemComponent, FooterComponent, LoginComponent, SelfComponent],
declarations: [AppComponent, NavigationComponent, MemberCardComponent, MembersComponent, FallbackImgDirective, ArchiveComponent, ScoreEditorComponent, ChipListComponent, TrimDirective, BlackboardComponent, BlackboardItemComponent, FooterComponent, LoginComponent, SelfComponent, DebugDisplayPipe],
imports: [BrowserModule, AppRoutingModule, BrowserAnimationsModule, HttpClientModule, LayoutModule, MatToolbarModule, MatButtonModule, MatSidenavModule, MatIconModule, MatListModule, MatCardModule, RouterModule.forRoot([], {
useHash: false,
anchorScrolling: 'enabled',
Expand Down
1 change: 1 addition & 0 deletions src/app/components/navigation/navigation.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</button>
<span fxHide.lt-sm>Musikverein Leopoldsdorf</span>
<span class="spacer"></span>
<mat-icon *ngIf="true|debugDisplay">code</mat-icon>
<button *ngIf="selfService.user" [matMenuTriggerFor]="userMenu"
mat-button>{{selfService.user.firstName}} {{selfService.user.lastName}}
<mat-icon>arrow_drop_down</mat-icon>
Expand Down
8 changes: 8 additions & 0 deletions src/app/pipes/debug-display.pipe.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { DebugDisplayPipe } from './debug-display.pipe';

describe('DebugDisplayPipe', () => {
it('create an instance', () => {
const pipe = new DebugDisplayPipe();
expect(pipe).toBeTruthy();
});
});
31 changes: 31 additions & 0 deletions src/app/pipes/debug-display.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* OpenLid, the frontend of the Musikverein Leopoldsdorf.
* Copyright (C) 2022 Richard Stöckl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/

import {Pipe, PipeTransform} from '@angular/core';

@Pipe({
name: 'debugDisplay'
})
export class DebugDisplayPipe implements PipeTransform {

transform(showInDebugOnly: boolean): boolean {
return !!localStorage.getItem('debug_display') === showInDebugOnly;
}
}

0 comments on commit c2b9d0e

Please sign in to comment.