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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,32 @@
}

h2 {
margin-top: 0;
margin-top: 1rem;
margin-bottom: 1rem;
}

.title {
font-weight: bold;
margin-bottom: 0;
}

.block {
& + .block {
border-top: solid 0.01rem mat.m2-get-color-from-palette(theme.$kompakkt-primary, 500);
padding-top: 1rem;
margin-top: 1rem;
}
}

img {
display: block;
height: 3rem;
.block.biblio {
p {
margin-bottom: 0;
}

.biblio-subtitle {
margin-top: 0.25rem;
font-size: 0.875em;
color: #6b6b6b;
}
}

p {
Expand All @@ -43,6 +54,7 @@ p {
display: flex;
flex-wrap: wrap;
gap: 1.5rem;
margin-top: 1rem;
}

.wrap-item {
Expand All @@ -65,3 +77,32 @@ p {
content: ': ';
}
}

.attribution {
font-size: 14px;
margin-top: 0;
}

a {
color: mat.m2-get-color-from-palette(theme.$kompakkt-primary, 500);
}

.license-block {
display: flex;
align-items: center;
gap: 0.5rem;
}

.link-list {
margin-top: 1rem;
display: flex;
align-items: center;
}

.bold {
font-weight: bold;
}

mat-divider {
margin-top: 1rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { TranslatePipe } from '../../../pipes/translate.pipe';
import { DetailInstitutionComponent } from '../detail-institution/detail-institution.component';
import { DetailPersonComponent } from '../detail-person/detail-person.component';
import { KeyValuePipe } from '@angular/common';
import { MatDividerModule } from '@angular/material/divider';
import { MatIconModule } from '@angular/material/icon';

// TODO: Kompakkt/Common typeguard
const isAddress = (obj: IAddress): obj is IAddress => {
Expand All @@ -32,7 +34,9 @@ const isAddress = (obj: IAddress): obj is IAddress => {
templateUrl: './detail-entity.component.html',
styleUrls: ['./detail-entity.component.scss'],
imports: [
MatDividerModule,
MatExpansionModule,
MatIconModule,
DetailPersonComponent,
DetailInstitutionComponent,
TranslatePipe,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,48 +1,57 @@
@if (institution$ | async; as institution) {
@if (roles$ | async; as roles) {
<div>
<p class="capitalize format-title-agents">
@for (role of roles; track role; let last = $last) {
{{ role }}<span>{{ last ? ': ' : ', ' }}</span>
}
</p>
<p>{{ institution.name }}</p>
@if (address$ | async; as address) {
<div class="address">
@if (address.street || address.number) {
<p>
@if (address.street) {
<span>{{ address.street }}</span>
}
@if (address.number) {
<span>{{ address.number }}</span>
}
</p>
@if (institution(); as institution) {
@if (roles(); as roles) {
<div class="institution-card" [matMenuTriggerFor]="institutionMenu" #trigger="matMenuTrigger">
<div class="agent-image">
<img [src]="imageUrl()" [alt]="'Profile picture of ' | translate" appAnimatedImage />
</div>
<div>
<p>{{ institution.name }}</p>
<p class="capitalize format-title-agents">
@for (role of roles; track role; let last = $last) {
{{ role }}<span>{{ last ? '' : ', ' }}</span>
}
</p>
</div>
</div>
}

@if (address.postcode || address.city) {
<p>
@if (address.postcode) {
<span>{{ address.postcode }}</span>
}
@if (address.city) {
<span>{{ address.city }}</span>
}
</p>
}
<mat-menu #institutionMenu="matMenu" class="institution-menu" xPosition="after">
<div class="institution-menu-content" (click)="$event.stopPropagation()">
<div class="agent-image">
<img [src]="imageUrl()" [alt]="'Profile picture of ' | translate" appAnimatedImage />
</div>
<div class="menu-text">
<p class="menu-title">{{ institution.name }}</p>
@if (address(); as address) {
<div class="address">
@if (address.street || address.number) {
<p>
@if (address.street) {
<span>{{ address.street }}</span>
}
@if (address.number) {
<span>{{ address.number }}</span>
}
</p>
}

@if (address.country) {
<p>{{ address.country }}</p>
}
@if (address.postcode || address.city) {
<p>
@if (address.postcode) {
<span>{{ address.postcode }}</span>
}
@if (address.city) {
<span>{{ address.city }}</span>
}
</p>
}

<!-- @if (address.building) {
<p>{{ address.building }}</p>
} -->
</div>
}
@if (note$ | async; as note) {
<p>{{ note }}</p>
}
@if (address.country) {
<p>{{ address.country }}</p>
}
</div>
}
</div>
</div>
}
</mat-menu>
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,65 @@ h3 {
margin-bottom: 1rem;
}

.institution-card {
margin-bottom: 1rem;
margin-top: 1rem;
display: flex;
align-items: center;
gap: 0.5rem;

cursor: pointer;

p {
margin: 0;
line-height: 1.2;
}
}

.agent-image {
width: 3rem;
height: 3rem;
overflow: hidden;
border-radius: 50%;

img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
}

.institution-menu-content {
display: flex;
align-items: flex-start;
gap: 1rem;
padding: 1rem;

.agent-image {
flex: 0 0 auto;
width: 3rem;
height: 3rem;
margin: 0;
}

.menu-text {
min-width: 0;
overflow-wrap: anywhere;

p {
margin: 0;
line-height: 1.3;
}

.menu-title {
font-weight: 500;
margin-bottom: 0.25rem;
color: mat.m2-get-color-from-palette(theme.$kompakkt-primary, 500);
}
}
}

.mat-mdc-chip[color='primary'] {
background: mat.m2-get-color-from-palette(theme.$kompakkt-primary, 500);
color: white;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,56 +1,35 @@
import { Component, input, OnChanges, SimpleChanges } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { Component, computed, input } from '@angular/core';

import { AsyncPipe } from '@angular/common';
import { IAddress, IInstitution } from '@kompakkt/common';

const firstKey = (obj: any) => Object.keys(obj)[0] ?? '';
import { IAddress, IInstitution, isAddress } from '@kompakkt/common';
import { TranslatePipe } from '../../../pipes/translate.pipe';
import { MatMenuModule } from '@angular/material/menu';

@Component({
selector: 'app-detail-institution',
templateUrl: './detail-institution.component.html',
styleUrls: ['./detail-institution.component.scss'],
imports: [AsyncPipe],
imports: [TranslatePipe, MatMenuModule],
})
export class DetailInstitutionComponent implements OnChanges {
institution = input<IInstitution>();

private institutionSubject = new BehaviorSubject(this.institution());

get institution$() {
return this.institutionSubject.pipe(
filter(institution => !!institution),
map(institution => institution as IInstitution),
);
}

get roles$() {
return this.institution$.pipe(
map(institution => institution.roles[firstKey(institution.roles)]),
filter(roleArr => !!roleArr),
map(roleArr => (roleArr as string[]).map(role => role.split('_').join(' ').toLowerCase())),
);
}
export class DetailInstitutionComponent {
institution = input.required<IInstitution>();

get note$() {
return this.institution$.pipe(
map(institution => institution.notes[firstKey(institution.notes)]),
filter(note => !!note),
map(note => note as string),
roles = computed(() => {
const roles = this.institution().roles;
const firstRoleArr = Object.values(roles).find(
(value): value is string[] => Array.isArray(value) && value.length > 0,
);
}
return firstRoleArr?.map(role => role.split('_').join(' ').toLowerCase());
});

get address$() {
return this.institution$.pipe(
map(institution => institution.addresses[firstKey(institution.addresses)]),
filter(address => !!address),
map(address => address as IAddress),
address = computed(() => {
const references = this.institution().addresses;
const firstContactRef = Object.values(references).find((value): value is IAddress =>
isAddress(value),
);
}
return firstContactRef;
});

ngOnChanges(changes: SimpleChanges): void {
const institution = changes.institution?.currentValue as IInstitution | undefined;
if (institution) this.institutionSubject.next(institution);
}
imageUrl = computed(() => {
return '/assets/kompakkt-logo-cube.svg';
});
}
Loading
Loading