Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add display debug mode #9

Merged
merged 1 commit into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}