-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix(taxon sheet): correct taxon media view (#3287)
* Revert "fix(frontend) taxon sheet media" This reverts commit fab84e1. * feat: adjust the front structure used to display the taxon "profile" pic
- Loading branch information
Showing
11 changed files
with
74 additions
and
64 deletions.
There are no files selected for viewing
19 changes: 4 additions & 15 deletions
19
frontend/src/app/syntheseModule/taxon-sheet/indicator/indicator.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,5 @@ | ||
<div | ||
[className]="small ? 'card Indicator Indicator--small' : 'card Indicator'" | ||
[style]="indicator.type == 'image' ? 'padding: 0' : 'padding: 1rem'" | ||
> | ||
<ng-container *ngIf="indicator.type != 'image'; else media"> | ||
<mat-icon class="Indicator__icon">{{ indicator.matIcon }}</mat-icon> | ||
<span class="Indicator__value">{{ indicator.value }}</span> | ||
<span class="Indicator__name text-secondary">{{ indicator.name }}</span> | ||
</ng-container> | ||
<ng-template #media> | ||
<div | ||
class="Indicator__media cover image" | ||
[style.background-image]="'url(' + indicator.value + ')'" | ||
></div> | ||
</ng-template> | ||
<div [className]="small ? 'card Indicator Indicator--small' : 'card Indicator'"> | ||
<mat-icon class="Indicator__icon">{{ indicator.matIcon }}</mat-icon> | ||
<span class="Indicator__value">{{ indicator.value }}</span> | ||
<span class="Indicator__name text-secondary">{{ indicator.name }}</span> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
frontend/src/app/syntheseModule/taxon-sheet/indicator/indicator.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
frontend/src/app/syntheseModule/taxon-sheet/infos/taxon-image/taxon-image.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<img | ||
*ngIf="mediaUrl" | ||
class="TaxonImage" | ||
[src]="mediaUrl" | ||
/> |
5 changes: 5 additions & 0 deletions
5
frontend/src/app/syntheseModule/taxon-sheet/infos/taxon-image/taxon-image.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.TaxonImage { | ||
height: 100%; | ||
width: auto; | ||
border-radius: 0.25rem; | ||
} |
40 changes: 40 additions & 0 deletions
40
frontend/src/app/syntheseModule/taxon-sheet/infos/taxon-image/taxon-image.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { Component, Input } from '@angular/core'; | ||
import { ConfigService } from '@geonature/services/config.service'; | ||
import { DataFormService } from '@geonature_common/form/data-form.service'; | ||
import { Taxon } from '@geonature_common/form/taxonomy/taxonomy.component'; | ||
import { TaxonSheetService } from '../../taxon-sheet.service'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'taxon-image', | ||
templateUrl: 'taxon-image.component.html', | ||
styleUrls: ['taxon-image.component.scss'], | ||
imports: [CommonModule], | ||
}) | ||
export class TaxonImageComponent { | ||
mediaUrl: string = ''; | ||
|
||
constructor( | ||
private _ds: DataFormService, | ||
private _tss: TaxonSheetService, | ||
private _config: ConfigService | ||
) {} | ||
|
||
ngOnInit() { | ||
this._tss.taxon.subscribe((taxon: Taxon | null) => { | ||
this.mediaUrl = ''; | ||
if (!taxon) { | ||
return; | ||
} | ||
this._ds.getTaxonInfo(taxon.cd_ref, ['medias', 'cd_nom']).subscribe((taxonAttrAndMedias) => { | ||
const media = taxonAttrAndMedias['medias'].find( | ||
(m) => m.id_type == this._config.TAXHUB.ID_TYPE_MAIN_PHOTO | ||
); | ||
if (media) { | ||
this.mediaUrl = `${this._ds.getTaxhubAPI()}/tmedias/thumbnail/${media.id_media}?h=300&w300`; | ||
} | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters