Skip to content

Commit

Permalink
💄 write sample locations as sub-lists
Browse files Browse the repository at this point in the history
  • Loading branch information
bunop committed Sep 15, 2023
1 parent b96566d commit 6c4f5a4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/app/samples/sample-detail/sample-detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ <h2>id: {{ sample._id.$oid }}</h2>
Type: {{ sample.type }}
</mat-list-item>

<mat-list-item role="listitem" *ngIf="sample.locations">
Locations: {{ sample.locations | locationsList }}
</mat-list-item>
<ng-container *ngIf="sample.locations">
<mat-list-item>Locations: </mat-list-item>
<mat-list class="subitem">
<div *ngFor="let location of sample.locations | locationsList">
<mat-list-item>{{ location }}</mat-list-item>
</div>
</mat-list>
</ng-container>

<mat-expansion-panel
*ngIf="sample.metadata"
Expand Down
4 changes: 4 additions & 0 deletions src/app/samples/sample-detail/sample-detail.component.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.mat-expansion-panel-header-title {
font-size: 16px;
}

.subitem {
margin-left: 30px;
}
6 changes: 3 additions & 3 deletions src/app/shared/locations-list.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { Multipoint } from '../samples/samples.model';
})
export class LocationsListPipe implements PipeTransform {

transform(value: Multipoint): string {
let result = '';
transform(value: Multipoint): string[] {
let result: string[] = [];

value.coordinates.forEach(position => {
result += `latitude: ${position[1]}, longitude: ${position[0]} `
result.push(`latitude: ${position[1]}, longitude: ${position[0]}`);
});

return result;
Expand Down

0 comments on commit 6c4f5a4

Please sign in to comment.