Skip to content

Commit

Permalink
Merge pull request #142 from PnEcrins/improve-observations-list-ui
Browse files Browse the repository at this point in the history
improve observations list ui
  • Loading branch information
bastyen authored Oct 17, 2024
2 parents 8882ac7 + f066d04 commit 915a02e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,19 @@
<mat-list class="mat-expansion-panel-body-visible">
@for (observation of myObservations.features; track observation.id) {
<mat-list-item>
<span matListItemIcon class="event-type-container"
><img
[src]="getEventType(observation.properties.category)!.pictogram"
/></span>
<span matListItemTitle>{{
observation.properties.name && observation.properties.name !== ""
? observation.properties.name
: getEventType(observation.properties.category)!.label
}}</span>
<span matListItemLine>{{
observation.properties.event_date | date: "dd/MM/yyyy"
}}</span>
<span matListItemLine
>{{ observation.properties.event_date | date: "dd/MM/yyyy" }} -
{{ getEventType(observation.properties.category)!.label }}</span
>
<span matListItemMeta>
<button
mat-icon-button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,16 @@
justify-content: center;
align-items: center;
}

.event-type-container {
margin-inline-start: 0px;
margin-inline-end: 8px;
padding: calc(
calc(
var(--mdc-icon-button-state-layer-size, 48px) - var(
--mdc-icon-button-icon-size,
24px
)
) / 2
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,19 @@
<mat-icon>place</mat-icon>
</button></span
>

<span matListItemIcon class="event-type-container"
><img
[src]="getEventType(observation.properties.category)!.pictogram"
/></span>
<span matListItemTitle>{{
observation.properties.name && observation.properties.name !== ""
? observation.properties.name
: getEventType(observation.properties.category)!.label
}}</span>
<span matListItemLine>{{
observation.properties.event_date | date: "dd/MM/yyyy"
}}</span>
<span matListItemLine
>{{ observation.properties.event_date | date: "dd/MM/yyyy" }} -
{{ getEventType(observation.properties.category)!.label }}</span
>
<span matListItemMeta>
<button
mat-icon-button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,16 @@ $panel-height: 100vh;
}
}
}

.event-type-container {
margin-inline-start: 0px;
margin-inline-end: 8px;
padding: calc(
calc(
var(--mdc-icon-button-state-layer-size, 48px) - var(
--mdc-icon-button-icon-size,
24px
)
) / 2
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,10 @@ export class SynthesisInterfaceComponent {
sortObservations(observations: observationsFeatureCollection) {
observations.features.sort(
(a: ObservationFeature, b: ObservationFeature) => {
return a.properties.name!.localeCompare(b.properties.name!, undefined, {
numeric: true,
sensitivity: 'base',
});
return (
new Date(b.properties.event_date).getTime() -
new Date(a.properties.event_date).getTime()
);
},
);
}
Expand Down

0 comments on commit 915a02e

Please sign in to comment.