-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
85 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 59 additions & 12 deletions
71
src/app/member-menu/member-dashboard/member-dashboard.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,85 @@ | ||
import { Component, OnInit, OnDestroy } from '@angular/core'; | ||
|
||
import { Component, OnInit, OnDestroy, ViewChild, HostListener } from '@angular/core'; | ||
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; | ||
/** | ||
* Environment | ||
*/ | ||
import { environment } from '../../../environments/environment'; | ||
|
||
@Component({ | ||
selector: 'app-member-dashboard', | ||
templateUrl: './member-dashboard.component.html', | ||
styleUrls: ['./member-dashboard.component.scss'] | ||
selector: 'app-member-dashboard', | ||
templateUrl: './member-dashboard.component.html', | ||
styleUrls: ['./member-dashboard.component.scss'] | ||
}) | ||
export class MemberDashboardComponent implements OnInit, OnDestroy { | ||
|
||
/** | ||
* Children Modals | ||
*/ | ||
@ViewChild('badgeModal') badgeModal: NgbModalRef; | ||
|
||
|
||
|
||
|
||
/** | ||
* Configuration and Static Data | ||
*/ | ||
public configAccess: Boolean[] = environment.access; | ||
public configAccess: Boolean[] = environment.access; | ||
|
||
/** | ||
* Component Constructor | ||
* | ||
* @param modalService: NgbModal | ||
*/ | ||
constructor() { } | ||
constructor( | ||
private modalService: NgbModal, | ||
) { } | ||
|
||
/** | ||
* On Init | ||
*/ | ||
ngOnInit() { | ||
} | ||
ngOnInit() { | ||
} | ||
|
||
/** | ||
* On Destroy | ||
*/ | ||
ngOnDestroy() { | ||
ngOnDestroy() { | ||
} | ||
|
||
/** | ||
* Close Modal on Browser Back Button | ||
*/ | ||
controlModalState(state: boolean): void { | ||
if (state) { | ||
const modalState = { | ||
modal: true, | ||
desc: 'MemberDashboardModals' | ||
}; | ||
history.pushState(modalState, null); | ||
} else { | ||
if (window.history.state.modal) { | ||
history.back(); | ||
} | ||
} | ||
} | ||
|
||
@HostListener('window:popstate') | ||
dismissModal(): void { | ||
if (this.modalService.hasOpenModals()) { | ||
this.modalService.dismissAll(); | ||
this.controlModalState(false); | ||
} | ||
} | ||
|
||
/** | ||
* Open Badge Modal | ||
*/ | ||
openBadgeExplainer(): void { | ||
this.controlModalState(true); | ||
this.modalService.open(this.badgeModal) | ||
.result.then( | ||
() => { this.controlModalState(false); console.log('closed'); }, | ||
() => { this.controlModalState(false); console.log('dismissed'); }); | ||
} | ||
} | ||
|
||
|
||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.