Skip to content
Open
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
60 changes: 38 additions & 22 deletions src/app/pages/explore/explore.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ <h1 class="page-heading">{{ 'Explore' | translate }}</h1>
<span>{{ 'Open' | translate }}</span>
</a>
@if (selectedTab() === 'objects') {
<button mat-menu-item [matMenuTriggerFor]="quickAddToCollectionMenu">
<button
mat-menu-item
[matMenuTriggerFor]="quickAddToCollectionMenu"
[class.pseudo-disabled]="!isAuthenticated()"
>
<mat-icon color="primary">library_add</mat-icon>
<span>{{ 'Add to collection' | translate }}</span>
</button>
Expand Down Expand Up @@ -101,32 +105,44 @@ <h1 class="page-heading">{{ 'Explore' | translate }}</h1>
</button>
</div>

<mat-menu #quickAddToCollectionMenu="matMenu">
@if (isAuthenticated$ | observableValue | async; as isAuthenticated) {
@if (isAuthenticated.value) {
<button mat-menu-item (click)="openCompilationWizard(selectObjectId)">
<mat-icon color="primary">create_new_folder</mat-icon>
<span>{{ 'New collection with this object' | translate }}</span>
</button>
@if (userCompilations$ | async; as userCompilations) {
@if (userCompilations.length > 0) {
@for (compilation of userCompilations; track compilation._id) {
<button mat-menu-item (click)="quickAddToCompilation(compilation)">
<mat-icon color="primary">collections</mat-icon>
<span>{{ compilation.name }}</span>
</button>
}
<!-- <mat-menu #quickAddToCollectionMenu="matMenu">
@if (isAuthenticated()) {
<button mat-menu-item (click)="openCompilationWizard(selectObjectId)">
<mat-icon color="primary">create_new_folder</mat-icon>
<span>{{ 'New collection with this object' | translate }}</span>
</button>
@if (userCompilations$ | async; as userCompilations) {
@if (userCompilations.length > 0) {
@for (compilation of userCompilations; track compilation._id) {
<button mat-menu-item (click)="quickAddToCompilation(compilation)">
<mat-icon color="primary">collections</mat-icon>
<span>{{ compilation.name }}</span>
</button>
}
}
} @else {
<div style="padding: 0 2rem">
<p>{{ 'You have to login to create and modify collections.' | translate }}</p>
</div>
}
} @else {
<div style="padding: 0 2rem">
<p>{{ 'Loading...' | translate }}</p>
<mat-spinner mode="indeterminate" />
<p>{{ 'You have to login to create and modify collections.' | translate }}</p>
</div>
}
</mat-menu> -->

<mat-menu #quickAddToCollectionMenu="matMenu">
@if (isAuthenticated()) {
<button mat-menu-item (click)="openCompilationWizard(selectObjectId)">
<mat-icon color="primary">create_new_folder</mat-icon>
<span>{{ 'New collection with this object' | translate }}</span>
</button>
@for (compilation of userCompilations(); track compilation._id) {
<button mat-menu-item (click)="quickAddToCompilation(compilation)">
<mat-icon color="primary">collections</mat-icon>
<span>{{ compilation.name }}</span>
</button>
}
} @else {
<div style="padding: 0 2rem">
<p>{{ 'You have to login to create and modify collections.' | translate }}</p>
</div>
}
</mat-menu>
8 changes: 8 additions & 0 deletions src/app/pages/explore/explore.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,11 @@ div.loading-overlay {
user-select: none;
}
}

.pseudo-disabled {
color: rgba(0, 0, 0, 0.38);
}

.pseudo-disabled mat-icon {
opacity: 0.38;
}
11 changes: 6 additions & 5 deletions src/app/pages/explore/explore.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meta, Title } from '@angular/platform-browser';
import { NavigationEnd, Router, RouterModule } from '@angular/router';

import { AsyncPipe } from '@angular/common';
import { toObservable } from '@angular/core/rxjs-interop';
import { toObservable, toSignal } from '@angular/core/rxjs-interop';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatButtonModule } from '@angular/material/button';
import { MatOptionModule } from '@angular/material/core';
Expand Down Expand Up @@ -75,7 +75,6 @@ type Pagination = {
AsyncPipe,
RouterModule,
TranslatePipe,
ObservableValuePipe,
MathPipe,
TabsComponent,
SearchBarComponent,
Expand Down Expand Up @@ -283,14 +282,16 @@ export class ExploreComponent implements OnInit {
});
}

get isAuthenticated$() {
return this.account.isAuthenticated$;
}
isAuthenticated = toSignal(this.account.isAuthenticated$);

userCompilations$ = this.account.compilations$.pipe(
map(compilations => compilations.filter(isCompilation)),
);

userCompilations = toSignal(
this.account.compilations$.pipe(map(compilations => compilations.filter(isCompilation))),
);

public async openCompilationWizard(_id?: string) {
const element = this.filteredResults.find(e => e._id === _id);
this.dialogHelper.openCompilationWizard(element);
Expand Down
9 changes: 5 additions & 4 deletions src/app/pages/profile-page/profile-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
#tabs
>
<aside>
@if (selectedTab() !== 'groups') {
<!-- @if (selectedTab() !== 'groups') {
<app-search-bar (searchTextChanged)="searchText.set($event)" />
}
} -->
<app-search-bar (searchTextChanged)="searchText.set($event)" />
</aside>
@switch (tabs.selectedTab()?.value) {
@case ('objects') {
Expand All @@ -27,9 +28,9 @@
@case ('collections') {
<app-profile-compilations [searchText]="searchText()" />
}
@case ('groups') {
<!-- @case ('groups') {
<app-profile-groups />
}
} -->
}
</app-tabs>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/app/pages/profile-page/profile-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { TranslatePipe } from 'src/app/pipes';
import { AccountService, DialogHelperService, SnackbarService } from 'src/app/services';
import { ProfileCompilationsComponent } from './compilations/compilations.component';
import { ProfileEntitiesComponent } from './entities/entities.component';
import { ProfileGroupsComponent } from './groups/groups.component';
// import { ProfileGroupsComponent } from './groups/groups.component';
import { ProfilePageHeaderComponent } from './profile-page-header/profile-page-header.component';
import { ProfilePageHelpComponent } from './profile-page-help.component';

Expand All @@ -39,7 +39,7 @@ import { ProfilePageHelpComponent } from './profile-page-help.component';
MatProgressSpinnerModule,
TranslatePipe,
ProfileEntitiesComponent,
ProfileGroupsComponent,
// ProfileGroupsComponent,
ProfileCompilationsComponent,
ProfilePageHeaderComponent,
TabsComponent,
Expand All @@ -61,7 +61,7 @@ export class ProfilePageComponent implements OnInit {
{ label: 'Objects', value: 'objects' },
{ label: 'Drafts', value: 'drafts' },
{ label: 'Collections', value: 'collections' },
{ label: 'Groups', value: 'groups' },
// { label: 'Groups', value: 'groups' },
] as const satisfies Tab[];
selectedTab = signal<string>('objects');

Expand Down