fix: button only shown if there are any visible projects

Closes #4883
This commit is contained in:
Johannes Millan 2025-08-01 12:55:24 +02:00
parent f53bd27bb2
commit 1ca503cb59
2 changed files with 6 additions and 5 deletions

View file

@ -77,7 +77,7 @@
<!-- <mat-icon>visibility</mat-icon>-->
<!-- </button>-->
<button
[style.display]="projectList.length ? '' : 'none'"
[style.display]="allNonInboxProjects().length ? '' : 'none'"
class="additional-btn"
#projectExpandBtn2
mat-icon-button
@ -100,7 +100,7 @@
[rightClickTriggerEl]="projectExpandBtn"
></context-menu>
<ng-template #contextMenu>
@for (project of allNonInboxProjects$ | async; track project.id) {
@for (project of allNonInboxProjects(); track project.id) {
<button
mat-menu-item
(click)="toggleProjectVisibility(project)"

View file

@ -58,6 +58,7 @@ import { TranslatePipe } from '@ngx-translate/core';
import { AsyncPipe } from '@angular/common';
import { toggleHideFromMenu } from '../../features/project/store/project.actions';
import { PluginMenuComponent } from '../../plugins/ui/plugin-menu.component';
import { toSignal } from '@angular/core/rxjs-interop';
@Component({
selector: 'side-nav',
@ -107,9 +108,9 @@ export class SideNavComponent implements OnDestroy {
this.isProjectsExpanded,
);
allNonInboxProjects$: Observable<Project[]> = this._store.select(
selectAllProjectsExceptInbox,
);
allNonInboxProjects = toSignal(this._store.select(selectAllProjectsExceptInbox), {
initialValue: [],
});
nonHiddenProjects$: Observable<Project[]> = this.isProjectsExpanded$.pipe(
switchMap((isExpanded) =>
isExpanded