Skip to content
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
34 changes: 34 additions & 0 deletions src/app/components/actionbar/actionbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@
<mat-icon>share</mat-icon>
</button>
</div>

@if (isCompilation()) {
<button
mat-icon-button
[matMenuTriggerFor]="informationMenu"
#infoMenuTrigger="matMenuTrigger"
>
<mat-icon>info</mat-icon>
</button>
}
}
</mat-toolbar>

Expand Down Expand Up @@ -233,3 +243,27 @@
}
}
</mat-menu>

<mat-menu #informationMenu="matMenu">
@if (element(); as element) {
@if (isCompilation()) {
<div class="actionbar-info">
<div class="info-header">
<p class="info-headline">{{ element.name }}</p>
<button mat-icon-button (click)="closeInfoMenu()">
<mat-icon class="material-symbols-outlined">close</mat-icon>
</button>
</div>
<p>{{ compilationDescription() }}</p>
<p>
<span class="info-bold">{{ entityCount() }}</span>
{{ 'objects' | translate }}
</p>
<p>
<span class="info-bold">{{ 'Creator: ' }}</span>
{{ element.creator.fullname }}
</p>
</div>
}
}
</mat-menu>
19 changes: 19 additions & 0 deletions src/app/components/actionbar/actionbar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,22 @@
.container {
padding-top: 10px;
}

.actionbar-info {
padding: 30px;

.info-header {
display: flex;
justify-content: space-between;
align-items: center;
}

.info-headline {
font-size: 16px !important;
font-weight: bold;
}

.info-bold {
font-weight: bold;
}
}
23 changes: 20 additions & 3 deletions src/app/components/actionbar/actionbar.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { filter, firstValueFrom, map, of, shareReplay, switchMap, tap } from 'rxjs';

import { Component, computed, input, signal } from '@angular/core';
import { Component, computed, input, signal, viewChild } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatSelectModule } from '@angular/material/select';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
Expand All @@ -14,7 +14,7 @@ import { MatInputModule } from '@angular/material/input';

import { toObservable, toSignal } from '@angular/core/rxjs-interop';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatMenuModule } from '@angular/material/menu';
import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatTooltipModule } from '@angular/material/tooltip';
import {
Expand All @@ -32,14 +32,14 @@ import {
AccountService,
AllowAnnotatingService,
BackendService,
DetailPageHelperService,
DialogHelperService,
SelectHistoryService,
SnackbarService,
} from 'src/app/services';
import { IsUserOfRolePipe } from '../../pipes/is-user-of-role.pipe';
import { TranslatePipe } from '../../pipes/translate.pipe';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { OverlayModule } from '@angular/cdk/overlay';

@Component({
selector: 'app-actionbar',
Expand All @@ -58,6 +58,7 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
MatProgressSpinnerModule,
ReactiveFormsModule,
MatOptionModule,
OverlayModule,
RouterLink,
MatMenuModule,
TranslatePipe,
Expand Down Expand Up @@ -91,6 +92,16 @@ export class ActionbarComponent {

showUsesInCollection = computed(() => this.isEntity() && this.isDetailPage());

compilationDescription = computed(() => {
const element = this.element();
return isCompilation(element) ? element.description : '';
});

entityCount = computed(() => {
const element = this.element();
return isCompilation(element) && element.entities ? Object.keys(element.entities).length : 0;
});

metadataDownload = computed(() => {
const element = this.element();
if (!isEntity(element) && !isCompilation(element)) return;
Expand Down Expand Up @@ -134,6 +145,8 @@ export class ActionbarComponent {
return !!element.options?.allowDownload;
});

readonly infoMenuTrigger = viewChild<MatMenuTrigger>('infoMenuTrigger');

constructor(
private account: AccountService,
private allowAnnotatingHelper: AllowAnnotatingService,
Expand Down Expand Up @@ -335,6 +348,10 @@ export class ActionbarComponent {
this.isUpdatingPublishState.set(false);
}

public closeInfoMenu() {
this.infoMenuTrigger()?.closeMenu();
}

public async openDownloadDialog() {
const options = await firstValueFrom(this.entityDownloadOptions$);
if (!options) {
Expand Down
Loading