Skip to content

Commit 75d7d9d

Browse files
committed
Show software identifier as main name and include alternate names in dropdown
1 parent 9f51df0 commit 75d7d9d

3 files changed

Lines changed: 45 additions & 6 deletions

File tree

src/app/features/containers/pages/container/container.component.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,34 @@ table th {
543543
border-radius: 1rem;
544544
}
545545

546+
.display-names {
547+
padding-inline: 16px 16px;
548+
margin-bottom: 16px;
549+
color: rgba(var(--main-font-color), 0.9);
550+
}
551+
552+
553+
.display-names-label {
554+
font-size: 0.875rem;
555+
font-weight: 600;
556+
text-box: trim-both cap alphabetic;
557+
}
558+
559+
.display-names-chips {
560+
display: inline-flex;
561+
align-items: center;
562+
gap: 8px;
563+
flex-wrap: wrap;
564+
}
565+
566+
.display-chip {
567+
text-box: trim-both cap alphabetic;
568+
font-size: 0.75rem;
569+
padding: 6px 6px;
570+
background-color: rgba(var(--main-font-color), 0.06);
571+
border: 1px solid rgba(var(--main-font-color), 0.04);
572+
}
573+
546574
.article-links {
547575
display: flex;
548576
flex-direction: column;

src/app/features/containers/pages/container/container.component.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,26 @@ <h3>Software that co-occurs with {{ container!.name }} in Bio-Protocol articles<
285285
<div class="software-name-wrapper">
286286
@if (software.inBdip) {
287287
<a [routerLink]="['/container', software.name]" class="software-name bdip-link" (click)="$event.stopPropagation()">
288-
{{ software.displayName }}
288+
{{ software.name }}
289289
</a>
290290
} @else {
291-
<span class="software-name">{{ software.displayName }}</span>
291+
<span class="software-name">{{ software.name }}</span>
292292
}
293293
<span class="cooccurrence-count">{{ software.count }} {{ software.count === 1 ? 'article' : 'articles' }}</span>
294294
</div>
295295
<svg-icon src="assets/icons/fluent-icons/ic_fluent_chevron_down_24_regular.svg" svgClass="chevron-icon" />
296296
</summary>
297+
<!-- Show the different display names (if more than one) when the details are opened -->
298+
@if (software.displayNames && software.displayNames.length > 1) {
299+
<div class="display-names">
300+
<span class="display-names-chips">
301+
<span class="display-names-label">Also known as</span>
302+
@for (dname of software.displayNames; track dname) {
303+
<span class="chip display-chip">{{ dname }}</span>
304+
}
305+
</span>
306+
</div>
307+
}
297308
<div class="article-links">
298309
@for (articleId of getCooccurringArticles(software.name); track articleId) {
299310
<a [href]="getBioProtocolArticleUrl(articleId)" target="_blank" class="article-link">

src/app/features/containers/pages/container/container.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export class ContainerComponent {
244244
/**
245245
* Get sorted related software by cooccurrence count and name
246246
*/
247-
getSortedRelatedSoftware(): { name: string; displayName: string; count: number; inBdip: boolean }[] {
247+
getSortedRelatedSoftware(): { name: string; displayNames: string[]; count: number; inBdip: boolean }[] {
248248
const relatedSoftwareData = this.relatedSoftware();
249249
if (!relatedSoftwareData || !this.container) {
250250
return [];
@@ -263,13 +263,13 @@ export class ContainerComponent {
263263
return Object.entries(currentEntry.cooccurrences)
264264
.map(([softwareName, cooccurrence]) => {
265265
const softwareEntry = relatedSoftwareData.software[softwareName];
266-
const displayName = softwareEntry?.names?.[0] || softwareName;
266+
const displayNames = softwareEntry?.names;
267267
const count = cooccurrence?.count ?? 0;
268268
const inBdip = bdipContainers.has(softwareName.toLowerCase());
269269

270270
return {
271271
name: softwareName,
272-
displayName,
272+
displayNames,
273273
count,
274274
inBdip
275275
};
@@ -280,7 +280,7 @@ export class ContainerComponent {
280280
return b.count - a.count;
281281
}
282282
// Then by displayName asc (case-insensitive)
283-
return a.displayName.localeCompare(b.displayName, undefined, { sensitivity: 'base' });
283+
return a.name.localeCompare(b.name, undefined, { sensitivity: 'base' });
284284
});
285285
}
286286

0 commit comments

Comments
 (0)