Skip to content

Commit 8635db6

Browse files
fix: Fix authorship section and background on detail pages
Provide DatePipe in DetailComponent to fix NullInjectorError that silently broke the authorship template rendering. Add Created as a separate row, fix @for tracking to use $index instead of dbId to avoid JSOG shared-reference conflicts, and unset the background override so detail pages match the standard page background. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 914c3d0 commit 8635db6

4 files changed

Lines changed: 11 additions & 8 deletions

File tree

projects/pathway-browser/src/app/details/tabs/description-tab/description-tab.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,13 @@
244244

245245
<ng-template #authorsTemplate>
246246
<div class="element-container">
247-
@for (item of authorship(); track item) {
247+
@for (item of authorship(); track item.label) {
248248
<div class="row">
249249
<div class="label-container">{{ item.label }}</div>
250250
<div class="composition-container flex-column">
251-
@for (ie of item.data |sortByDate:'dataTime'; track ie.dbId) {
251+
@for (ie of item.data; track $index) {
252252
<div class="authorship-item">
253-
@for (author of ie.author; let i = $index; track author.dbId) {
253+
@for (author of ie.author; let i = $index; track $index) {
254254
<a [href]="`${CONTENT_DETAIL}/${author.dbId}`"
255255
[ngClass]="{'margin-right': !author.orcidId}">
256256
{{ author.firstname }} {{ author.surname }}

projects/pathway-browser/src/app/details/tabs/description-tab/description-tab.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ import HasModifiedResidue = Relationship.HasModifiedResidue;
5353
import {KeyValuePipe, NgClass, NgTemplateOutlet} from "@angular/common";
5454
import {RouterLink} from "@angular/router";
5555
import {SortByTextPipe} from "../../../pipes/sort-by-text.pipe";
56-
import {SortByDatePipe} from "../../../pipes/sort-by-date.pipe";
5756
import {IncludeRefPipe} from "../../../pipes/include-ref.pipe";
5857
import {AuthorshipDateFormatPipe} from "../../../pipes/authorship-date-format.pipe";
5958
import {MatDivider} from "@angular/material/divider";
@@ -90,7 +89,6 @@ import {
9089
KeyValuePipe,
9190
RouterLink,
9291
SortByTextPipe,
93-
SortByDatePipe,
9492
IncludeRefPipe,
9593
AuthorshipDateFormatPipe,
9694
MatDivider,
@@ -190,21 +188,23 @@ export class DescriptionTabComponent implements OnDestroy {
190188

191189
referenceEntity: Signal<ReferenceEntity> = computed(() => getProperty(this.obj(), DataKeys.REFERENCE_ENTITY));
192190

193-
readonly authorship: Signal<{ label: string, data: InstanceEdit[] }[]> = computed(() => {
191+
readonly authorship: Signal<{label: string, data: InstanceEdit[]}[]> = computed(() => {
194192
const arrayWrap = <E>(a: E[] | E) => Array.isArray(a) ? a : [a];
195193

196194
const obj = this.obj();
197195
// Ensure it's an array, either returning the existing array or wrapping it in one, it complains without this line.
198-
const finalAuthored = arrayWrap(getProperty(obj, DataKeys.AUTHORED) || getProperty(obj, DataKeys.CREATED) || []);
196+
const authored = arrayWrap(getProperty(obj, DataKeys.AUTHORED) || []);
199197
const reviewed = getProperty(obj, DataKeys.REVIEWED) || [];
200198
const edited = getProperty(obj, DataKeys.EDITED) || [];
201199
const revised = getProperty(obj, DataKeys.REVISED) || [];
200+
const created = arrayWrap(getProperty(obj, DataKeys.CREATED) || []);
202201

203202
return [
204-
...(finalAuthored.length > 0 ? [{label: Labels.AUTHOR, data: finalAuthored}] : []),
203+
...(authored.length > 0 ? [{label: Labels.AUTHOR, data: authored}] : []),
205204
...(reviewed.length > 0 ? [{label: Labels.REVIEWER, data: reviewed}] : []),
206205
...(edited.length > 0 ? [{label: Labels.EDITOR, data: edited}] : []),
207206
...(revised.length > 0 ? [{label: Labels.REVISER, data: revised}] : []),
207+
...(created.length > 0 ? [{label: 'Created', data: created}] : []),
208208
];
209209
});
210210

projects/website-angular/src/app/content/detail/detail.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
overflow-y: visible;
4040
overflow-x: visible;
4141
padding: 0;
42+
background: unset;
4243
}
4344

4445
#details {

projects/website-angular/src/app/content/detail/detail.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {Component, inject, OnInit, signal} from '@angular/core';
2+
import {DatePipe} from '@angular/common';
23
import {ActivatedRoute} from '@angular/router';
34
import {DomSanitizer} from '@angular/platform-browser';
45
import {MatIconRegistry} from '@angular/material/icon';
@@ -41,6 +42,7 @@ import {DetailSpeciesService} from './providers/detail-species.provider';
4142
{provide: SpeciesService, useClass: DetailSpeciesService},
4243
{provide: DiagramService, useValue: {}},
4344
{provide: ParticipantService, useValue: {getReferenceEntities: () => of([])}},
45+
DatePipe,
4446
],
4547
templateUrl: './detail.component.html',
4648
styleUrl: './detail.component.scss',

0 commit comments

Comments
 (0)