Replace topic chips in publication detail view with shared topic chips
This commit is contained in:
@@ -176,11 +176,14 @@
|
||||
</div>
|
||||
<div class="tags">
|
||||
@for (topic of publication.topics ?? []; track topic.id) {
|
||||
<span
|
||||
class="topic-tag"
|
||||
[title]="topic.field?.display_name || ''">
|
||||
{{ topic.display_name }}
|
||||
</span>
|
||||
<app-topic-chip
|
||||
[label]="topic.display_name || ''"
|
||||
[description]="topic.description"
|
||||
[subfieldName]="topic.subfield?.display_name"
|
||||
[fieldName]="topic.field?.display_name"
|
||||
[domainName]="topic.domain?.display_name"
|
||||
[color]="getTopicColor(topic)">
|
||||
</app-topic-chip>
|
||||
}
|
||||
@for (keyword of publication.keywords ?? []; track keyword.id) {
|
||||
<span>{{ keyword.display_name }}</span>
|
||||
|
||||
@@ -268,12 +268,6 @@ aside {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.tags .topic-tag {
|
||||
border-color: #cbd8f1;
|
||||
background: #f5f8ff;
|
||||
color: var(--sg-text);
|
||||
}
|
||||
|
||||
.source-list,
|
||||
.compact-list,
|
||||
.link-list {
|
||||
|
||||
@@ -13,7 +13,10 @@ import {
|
||||
Location as ApiLocation,
|
||||
Work,
|
||||
WorksService,
|
||||
WorkTopic,
|
||||
} from '../../api';
|
||||
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { topicHierarchyColor } from '../../shared/utils/topic-colors';
|
||||
|
||||
interface DetailLink {
|
||||
label: string;
|
||||
@@ -36,6 +39,7 @@ interface InstitutionDetail {
|
||||
MatIconModule,
|
||||
MatProgressSpinnerModule,
|
||||
RouterLink,
|
||||
TopicChipComponent,
|
||||
UpperCasePipe,
|
||||
],
|
||||
templateUrl: './publication-detail.component.html',
|
||||
@@ -71,6 +75,17 @@ export class PublicationDetailComponent implements OnInit {
|
||||
this.location.back();
|
||||
}
|
||||
|
||||
getTopicColor(topic: WorkTopic): string {
|
||||
return topicHierarchyColor({
|
||||
id: topic.id,
|
||||
name: topic.display_name,
|
||||
field_id: topic.field?.id,
|
||||
field_name: topic.field?.display_name,
|
||||
domain_id: topic.domain?.id,
|
||||
domain_name: topic.domain?.display_name,
|
||||
});
|
||||
}
|
||||
|
||||
abstractText(): string | null {
|
||||
const index = this.publication?.abstract_inverted_index;
|
||||
if (!index || typeof index !== 'object') return null;
|
||||
|
||||
Reference in New Issue
Block a user