Skip to content

Commit 0637616

Browse files
committed
feat / fix: Added missing fields to search results
1 parent d813bf7 commit 0637616

4 files changed

Lines changed: 53 additions & 8 deletions

File tree

projects/website-angular/src/app/community/icon-lib/icon-lib.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ interface ParsedReference {
4949

5050
@Component({
5151
selector: 'app-icon-lib',
52-
imports: [PageLayoutComponent, RouterLink],
52+
imports: [PageLayoutComponent],
5353
templateUrl: './icon-lib.component.html',
5454
styleUrl: './icon-lib.component.scss'
5555
})

projects/website-angular/src/app/search/search.component.html

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,11 @@ <h2>{{ group.typeName }} ({{ group.entriesCount }})</h2>
280280
<div class="group-entries">
281281
@for (entry of group.entries; track entry.dbId) {
282282
<div class="search-entry">
283-
<div class="entry-header">
283+
<div class="type-icon">
284+
TODO: Add type icons
285+
</div>
286+
<div class="entry-info">
287+
<div class="entry-header">
284288
@if (entry.deleted) {
285289
<mat-icon class="deleted-icon">delete</mat-icon>
286290
<span class="deleted" [innerHTML]="entry.stId"></span>
@@ -298,7 +302,7 @@ <h2>{{ group.typeName }} ({{ group.entriesCount }})</h2>
298302
[routerLink]="getDetailLink(entry)"
299303
[innerHTML]="entry.name">
300304
</a>
301-
<span class="entry-id">{{ entry.stId }}</span>
305+
<span class="entry-id" [innerHTML]="entry.stId"></span>
302306
}
303307

304308
</div>
@@ -320,16 +324,33 @@ <h2>{{ group.typeName }} ({{ group.entriesCount }})</h2>
320324
Compartments: {{ entry.compartmentNames.join(', ') }}
321325
</div>
322326
}
327+
@if (entry.iconCuratorName) {
328+
<div class="entry-compartments">Curator: <a [href]="'https://orcid.org/' + entry.iconCuratorOrcidId" target="_blank" rel="noopener">
329+
{{ entry.iconCuratorName }}
330+
</a></div>
331+
}
332+
@if (entry.iconDesignerName) {
333+
<div class="entry-compartments">Designer: <a [href]="entry.iconDesignerUrl" target="_blank" rel="noopener">
334+
{{ entry.iconDesignerName }}
335+
</a></div>
336+
}
323337
@if (entry.summation) {
324338
<p class="entry-summation" [innerHTML]="entry.summation"></p>
325339
}
326-
@if (entry.referenceName) {
340+
@if (entry.referenceName || entry.databaseName) {
327341
<div class="entry-reference">
328-
Reference: <a [href]="entry.referenceURL" target="_blank" rel="noopener"><span [innerHTML]="entry.referenceName"></span> ({{ entry.referenceIdentifier }})</a>
342+
Reference: <a [href]="entry.referenceURL" target="_blank" rel="noopener"><span [innerHTML]="entry.referenceName ?? entry.databaseName"></span> ({{ entry.referenceIdentifier }})</a>
329343
</div>
330344
}
345+
<button (click)="printEntry(entry)">O</button>
346+
</div>
347+
@if (entry.exactType == "Icon") {
348+
<div class="icon-preview">
349+
<img [src]="iconSvgUrl(entry)" [alt]="entry.stId" loading="lazy" (error)="onImgError($event)" width="100" height="auto"/>
350+
</div>
351+
}
331352
</div>
332-
}
353+
}
333354
</div>
334355
}
335356
</div>
@@ -343,12 +364,12 @@ <h2>{{ group.typeName }} ({{ group.entriesCount }})</h2>
343364
<div class="search-entry">
344365
<div class="entry-header">
345366
<a class="entry-name" [routerLink]="getDetailLink(entry)" [innerHTML]="entry.name"></a>
346-
<span class="entry-id">{{ entry.stId }}</span>
367+
<span class="entry-id" [innerHTML]="entry.stId"></span>
347368
</div>
348369
@if (entry.species?.length) {
349370
<div class="entry-species">
350371
@for (sp of entry.species; track sp; let last = $last) {
351-
<span class="species-tag">{{ sp }}</span>
372+
<span class="species-tag" [innerHTML]="sp"></span>
352373
}
353374
</div>
354375
}

projects/website-angular/src/app/search/search.component.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,15 @@ $border-radius: 8px;
243243
margin-top: 16px;
244244
}
245245

246+
.type-icon {
247+
width: 10px;
248+
}
249+
246250
.search-entry {
251+
display: flex;
252+
flex-direction: row;
253+
align-items: center;
254+
247255
padding: 12px 0;
248256
border-top: 1px solid rgba(0, 0, 0, 0.08);
249257

@@ -252,6 +260,10 @@ $border-radius: 8px;
252260
}
253261
}
254262

263+
.entry-info {
264+
flex: 1;
265+
}
266+
255267
.entry-header {
256268
display: flex;
257269
align-items: baseline;

projects/website-angular/src/app/search/search.component.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
} from '../../services/search.service';
1818
import { DatePipe } from '@angular/common';
1919
import { MatIcon } from "@angular/material/icon";
20+
import { IconEntry } from '../../services/icon.service';
2021

2122
@Component({
2223
selector: 'app-search',
@@ -257,6 +258,14 @@ export class SearchComponent implements OnInit, OnDestroy, AfterViewInit {
257258
return of(null);
258259
}
259260

261+
printEntry(entry: SearchEntry): void {
262+
console.log('Entry details:', entry);
263+
}
264+
265+
iconSvgUrl(entry: SearchEntry): string {
266+
return `https://dev.reactome.org/icon/${entry.stId}.svg`;
267+
}
268+
260269
get allEntries(): SearchEntry[] {
261270
if (!this.results?.results) return [];
262271
return this.results.results.flatMap(g => this.filterDeletedEntries(g.entries));
@@ -341,6 +350,9 @@ export class SearchComponent implements OnInit, OnDestroy, AfterViewInit {
341350
}
342351

343352
getDetailLink(entry: SearchEntry): string {
353+
//Remove HTML tags from entry.stId if present
354+
entry.stId = entry.stId?.replace(/<[^>]*>/g, '');
355+
344356
if (entry.exactType === 'Interactor') return '/content/detail/interactor/' + entry.stId;
345357
if (entry.exactType === 'Icon') return '/content/detail/icon/' + entry.stId;
346358
return '/content/detail/' + entry.stId;

0 commit comments

Comments
 (0)