Skip to content

Commit

Permalink
Added redirection to home when clicking on the topbar's icon
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-npacheco committed Apr 17, 2024
1 parent 12d1885 commit 64b82ad
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/app/components/home-app/home-app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
[topbarColor]="topbarColor"
[topbarTextColor]="topbarTextColor"
[imageFilePath]="topbarImage"
(urlNavigate)="topBarNavigate($event)"
></app-topbar>

<div *ngIf="apiIsSick" class="app-error-container background text" autosize>
Expand Down
11 changes: 7 additions & 4 deletions src/app/components/home-app/home-app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,28 +300,31 @@ export class HomeAppComponent implements OnDestroy, OnInit {
});
}

//Filter exhibit based on CreatedBy value, since there's no exhibit name
applyFilter(filterValue: string) {
this.filterString = filterValue.trim().toLowerCase();
this.exhibitList = this.exhibitList.filter(exhibit => {
const createdBy = this.getUserName(exhibit.createdBy).toLowerCase();
return createdBy.includes(this.filterString);
});
}
}

//make sure the exhibit options are changed when a user deletes the text, instead of clicking on the cancel icon
onFilterChange() {
if (!this.filterString) {
this.clearFilter();
}
}

//clear filter
clearFilter() {
this.filterString = '';
this.exhibitDataService.loadMineByCollection(this.collectionId);
}

topBarNavigate(url): void {
this.router.navigate(['/']).then(() => {
window.location.reload();
});
}

ngOnDestroy() {
this.unsubscribe$.next(null);
this.unsubscribe$.complete();
Expand Down
1 change: 1 addition & 0 deletions src/app/components/shared/top-bar/topbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*ngIf="!!imageFilePath"
class="no-sidenav"
[src]="imageFilePath"
(click)="goToUrl('/')"
/>
</span>
<span class="view-text">{{ title }}</span>
Expand Down
1 change: 1 addition & 0 deletions src/app/components/shared/top-bar/topbar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@
height: 32px;
width: 32px;
margin-top: 3px;
cursor: pointer;
}
5 changes: 5 additions & 0 deletions src/app/components/shared/top-bar/topbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class TopbarComponent implements OnInit, OnDestroy {
@Output() sidenavToggle?: EventEmitter<boolean> = new EventEmitter<boolean>();
@Output() setTeam?: EventEmitter<string> = new EventEmitter<string>();
@Output() editView?: EventEmitter<any> = new EventEmitter<any>();
@Output() urlNavigate?: EventEmitter<string> = new EventEmitter<string>();
currentUser$: Observable<AuthUser>;
theme$: Observable<Theme>;
unsubscribe$: Subject<null> = new Subject<null>();
Expand Down Expand Up @@ -75,6 +76,10 @@ export class TopbarComponent implements OnInit, OnDestroy {
this.authService.logout();
}

goToUrl(url): void {
this.urlNavigate.emit(url);
}

ngOnDestroy(): void {
this.unsubscribe$.next(null);
this.unsubscribe$.complete();
Expand Down

0 comments on commit 64b82ad

Please sign in to comment.