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
22 changes: 13 additions & 9 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
"@angular/platform-browser": "21.2.6",
"@angular/platform-browser-dynamic": "21.2.6",
"@angular/router": "21.2.6",
"@kompakkt/common": "git+https://github.com/Kompakkt/Common.git#6797ea53a6f976ebc3310db5d434ee20848793bd",
"@kompakkt/common": "git+https://github.com/Kompakkt/Common.git#49b7d222f9d6edd719ae7183ba53c96acedd9d0f",
"@kompakkt/komponents": "git+https://github.com/Kompakkt/Komponents#445b8ac",
"@kompakkt/plugins": "git+https://github.com/Kompakkt/Plugins.git#5e5274042bee8730dc8789de610a09a741e77c60",
"@kompakkt/server-openapi": "git+https://github.com/Kompakkt/Server.git#b6b5bfcccd4247285eafc77652f0a4b7a43f37ca",
"@kompakkt/plugins": "git+https://github.com/Kompakkt/Plugins.git#2c754b80adc41be0c2e1010027a8ce2cd3712ce8",
"@kompakkt/server-openapi": "git+https://github.com/Kompakkt/Server.git#d73de702a6b2a94c4824f95e5fef008ac18d572b",
"bson-objectid": "^2.0.4",
"fast-deep-equal": "^3.1.3",
"fscreen": "1.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
<div class="detail-block">
<h2>{{ compilation.name }}</h2>
<p>{{ compilation.description }}</p>
@if (compilation.creator) {
<p>
{{ 'Created by' | translate }} {{ compilation.creator.fullname }} {{ 'on' | translate }}
{{ creationDate() }}
</p>
}
<!-- <div id="actions">
<button mat-flat-button matTooltip="{{ 'Embed this compilation on your website' | translate }}" (click)="embed()">
<mat-icon>perm_media</mat-icon>
Expand Down Expand Up @@ -64,4 +58,11 @@ <h2>{{ 'Collection objects' | translate }}</h2>
</div>
</div>
}

<div class="detail-block footer">
<app-uploaded-by [creator]="compilation.creator" />
@if (compilation.__updatedAt; as updatedAt) {
<p class="last-edited">{{ 'Last edited' | translate }} {{ updatedAt | date: 'medium' }}</p>
}
</div>
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { Component, computed, inject, input } from '@angular/core';
import { Component, computed, input } from '@angular/core';
import { DatePipe } from '@angular/common';
import { MatIconModule } from '@angular/material/icon';
import { MatTooltipModule } from '@angular/material/tooltip';
import { RouterLink } from '@angular/router';
import { DetailPageHelperService } from 'src/app/services';
import { ICompilation, IEntity, isEntity } from '@kompakkt/common';
import { TranslatePipe } from '../../pipes/translate.pipe';
import { UploadedByComponent } from '../uploaded-by/uploaded-by.component';

@Component({
selector: 'app-compilation-detail',
templateUrl: './compilation-detail.component.html',
styleUrls: ['./compilation-detail.component.scss'],
imports: [MatTooltipModule, MatIconModule, RouterLink, TranslatePipe],
imports: [
DatePipe,
MatTooltipModule,
MatIconModule,
RouterLink,
TranslatePipe,
UploadedByComponent,
],
})
export class CompilationDetailComponent {
#helper = inject(DetailPageHelperService);

compilation = input<ICompilation>();

creationDate = computed(() => {
const compilation = this.compilation();
if (!compilation) return '';
return this.#helper.getCreationDate(compilation);
});

imageCount = computed(() => {
const compilation = this.compilation();
if (!compilation) return 0;
Expand Down
7 changes: 7 additions & 0 deletions src/app/components/entity-detail/entity-detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,10 @@ <h2>{{ digitalEntity.title }}</h2>
</div>
}
}

<div class="block footer">
<app-uploaded-by [creator]="entity().creator" />
@if (entity().__updatedAt; as updatedAt) {
<p class="last-edited">{{ 'Last edited' | translate }} {{ updatedAt | date: 'medium' }}</p>
}
</div>
23 changes: 14 additions & 9 deletions src/app/components/entity-detail/entity-detail.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

.block {
background: white;
padding-top: 2rem;

&:first-child {
padding-top: 2rem;
}

h2 {
color: mat.m2-get-color-from-palette(theme.$kompakkt-primary, 500);
Expand All @@ -18,15 +21,17 @@
}
}

.button-row .mat-icon {
transform: scale(1.5);
padding-left: auto;
padding-right: auto;
}
.button-row {
.mat-icon {
transform: scale(1.5);
padding-left: auto;
padding-right: auto;
}

.button-row .mat-mdc-unelevated-button > .mat-icon {
margin-right: 0 !important;
margin-left: 0 !important;
.mat-mdc-unelevated-button > .mat-icon {
margin-right: 0 !important;
margin-left: 0 !important;
}
}

.tag-chip {
Expand Down
13 changes: 12 additions & 1 deletion src/app/components/entity-detail/entity-detail.component.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import { Component, computed, inject, input } from '@angular/core';
import { DatePipe } from '@angular/common';
import { AccountService } from 'src/app/services';
import { IEntity, isDigitalEntity, isPhysicalEntity, isTag } from '@kompakkt/common';
import { DetailEntityComponent } from './detail-entity/detail-entity.component';
import { UploadedByComponent } from '../uploaded-by/uploaded-by.component';
import { MatChipsModule } from '@angular/material/chips';
import { MatDividerModule } from '@angular/material/divider';
import { MatIconModule } from '@angular/material/icon';
import { TranslatePipe } from 'src/app/pipes';

@Component({
selector: 'app-entity-detail',
templateUrl: './entity-detail.component.html',
styleUrls: ['./entity-detail.component.scss'],
imports: [DetailEntityComponent, MatChipsModule, MatDividerModule, MatIconModule],
imports: [
DatePipe,
TranslatePipe,
DetailEntityComponent,
UploadedByComponent,
MatChipsModule,
MatDividerModule,
MatIconModule,
],
})
export class EntityDetailComponent {
account = inject(AccountService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export class CollectionMediaContainerComponent {
element = input.required<ICompilation>();

private entityToRGB(entity: IEntity) {
return Object.values(entity.settings.background.color).slice(0, 3).join(',');
const color = entity.settings?.background?.color;
return color ? Object.values(color).slice(0, 3).join(',') : '64,64,64';
}

backgroundColor = computed(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,22 @@ export class EntityMediaContainerComponent {
const element = this.element();
if (!element) return undefined;
const previewVideo =
element.settings.previewVideo?.slice(1) ??
element.settings.preview.replaceAll('.webp', '.webm');
element.settings?.previewVideo?.slice(1) ??
element.settings?.preview?.replaceAll('.webp', '.webm');
return previewVideo ? getServerUrl(previewVideo) : undefined;
});

imageSource = computed(() => {
const element = this.element();
if (!element) return '';
const preview = element?.settings.preview;
const preview = element?.settings?.preview;
if (!preview) return 'assets/noimage.png';
return getServerUrl(preview);
});

private entityToRGB(entity: IEntity) {
return Object.values(entity.settings.background.color).slice(0, 3).join(',');
const color = entity.settings?.background?.color;
return color ? Object.values(color).slice(0, 3).join(',') : '64,64,64';
}

backgroundColor = computed(() => {
Expand Down
1 change: 1 addition & 0 deletions src/app/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export { SidenavListComponent } from './navigation/sidenav-list/sidenav-list.com
export { NavbarComponent } from './navigation/navbar/navbar.component';
export { FooterComponent } from './navigation/footer/footer.component';
export { UploadComponent } from './upload/upload.component';
export { UploadedByComponent } from './uploaded-by/uploaded-by.component';
export { NewsCardComponent } from './news-card/news-card.component';
55 changes: 20 additions & 35 deletions src/app/components/navigation/navbar/navbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
class="pill"
color="primary"
(click)="openEntityCreation()"
[disabled]="currentProfile()?._id !== userProfile()?._id"
[disabled]="!canCreateInCurrentProfile()"
>
<mat-icon class="material-symbols-filled">deployed_code</mat-icon>
{{ 'New object' | translate }}
Expand Down Expand Up @@ -130,44 +130,29 @@
<b>{{ 'Your other profiles' | translate }}</b>
</p>

@for (profile of allProfiles(); track profile._id) {
@if (profile._id !== currentProfile()?._id) {
@if (profile._id === userProfile()?._id) {
<button
mat-menu-item
class="menu-organization"
(click)="$event.stopPropagation(); account.switchToProfile(profile)"
matTooltip="{{ ('Switch to' | translate) + ' ' + profile.displayName }}"
matTooltipShowDelay="500"
>
<mat-icon color="primary">account_circle</mat-icon>
<span>{{ profile.displayName }}</span>
</button>
@for (profile of otherProfiles(); track profile._id) {
<button
mat-menu-item
class="menu-organization"
(click)="$event.stopPropagation(); account.switchToProfile(profile)"
>
@if (profileImageUrl(profile); as imgUrl) {
<img matMenuItemIcon class="account-image menu-avatar" [src]="imgUrl" alt="" />
} @else {
<button
mat-menu-item
class="menu-organization"
(click)="$event.stopPropagation(); account.switchToProfile(profile)"
matTooltip="{{ ('Switch to' | translate) + ' ' + profile.displayName }}"
matTooltipShowDelay="500"
>
<mat-icon color="primary">apartment</mat-icon>
<span>{{ profile.displayName }}</span>
</button>
<mat-icon color="primary">{{
profile._id === userProfile()?._id ? 'account_circle' : 'apartment'
}}</mat-icon>
}
}
<span>{{ profile.displayName }}</span>
</button>
}

<!-- TODO: Enable when organizational profiles are implemented -->
<button
[disabled]="true || currentProfile()?._id !== userProfile()?._id"
mat-menu-item
class="menu-create-organization"
(click)="editProfile()"
>
<mat-icon color="primary">add</mat-icon>
<span>{{ 'Create organizational profile' | translate }}</span>
</button>
@if (account.flags.testingCanManageOrganizations$ | async) {
<button mat-menu-item class="menu-create-organization" (click)="editProfile()">
<mat-icon color="primary">add</mat-icon>
<span>{{ 'Create organizational profile' | translate }}</span>
</button>
}

@if (account.role.isAdmin$ | async) {
<button mat-menu-item routerLink="/admin">
Expand Down
14 changes: 14 additions & 0 deletions src/app/components/navigation/navbar/navbar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ img.account-image {
width: 36px;
height: 36px;
}

&.menu-avatar {
width: 24px;
height: 24px;
flex-shrink: 0;
margin-right: var(--mat-menu-item-spacing, 12px);
}
}

.other-profiles-hint {
text-align: center;
margin: 0 0 8px;
color: gray;
font-size: 12px;
}

.account-preview {
Expand Down
Loading
Loading