adapted shared topic chip to accept already fetched topics instead of making another seperate call (+ error handling for possible null and undifined types as specified in the openapi generated model). Hopefully found all instances of regular material tooltip and changed to use new chip
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/head This commit looks good
This commit is contained in:
@@ -179,6 +179,8 @@
|
||||
<div class="keyword-chip-stack">
|
||||
@for (keyword of keywords; track keyword.llm_keyword.keyword) {
|
||||
<app-topic-chip
|
||||
[topic]="keyword.topic_mapping?.topic"
|
||||
[topicId]="keyword.topic_mapping?.topic?.id"
|
||||
[label]="getChipLabel(keyword)"
|
||||
[count]="
|
||||
keywordView() === 'topic' ? getChipCount(keyword) : null
|
||||
@@ -209,6 +211,8 @@
|
||||
) {
|
||||
<div class="manual-chip-row">
|
||||
<app-topic-chip
|
||||
[topic]="keyword.topic_mapping?.topic"
|
||||
[topicId]="keyword.topic_mapping?.topic?.id"
|
||||
[label]="getChipLabel(keyword)"
|
||||
[count]="
|
||||
keywordView() === 'topic' ? getChipCount(keyword) : null
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
track getEntryTrack(entry)
|
||||
) {
|
||||
<app-topic-chip
|
||||
[topic]="entry.topic_mapping?.topic"
|
||||
[topicId]="entry.topic_mapping?.topic?.id"
|
||||
[label]="getChipLabel(entry)"
|
||||
[count]="getChipCount(entry)"
|
||||
[description]="getChipDescription(entry)"
|
||||
|
||||
@@ -138,6 +138,7 @@
|
||||
track topic.topic_id ?? topic.topic_display_name
|
||||
) {
|
||||
<app-topic-chip
|
||||
[topicId]="topic.topic_id"
|
||||
[label]="topic.topic_display_name"
|
||||
[fieldName]="topic.field_name"
|
||||
[domainName]="topic.domain_name"
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
track topic.topic_id ?? topic.topic_display_name
|
||||
) {
|
||||
<app-topic-chip
|
||||
[topicId]="topic.topic_id"
|
||||
[label]="topic.topic_display_name"
|
||||
[fieldName]="topic.field_name"
|
||||
[domainName]="topic.domain_name"
|
||||
|
||||
@@ -106,6 +106,8 @@
|
||||
[skText]="loading()"
|
||||
class="person-topic-chip"
|
||||
size="mini"
|
||||
[topic]="topic"
|
||||
[topicId]="topic.id"
|
||||
[label]="topic.display_name || ''"
|
||||
[description]="topic.description"
|
||||
[subfieldName]="topic.subfield?.display_name"
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
} @else if (tags().length > 0) {
|
||||
@for (tag of tags(); track tag.label) {
|
||||
<app-topic-chip
|
||||
[topicId]="tag.id"
|
||||
[label]="tag.label"
|
||||
[count]="tag.count"
|
||||
[description]="tag.description"
|
||||
|
||||
@@ -41,9 +41,9 @@
|
||||
<span
|
||||
class="filter-topic-chip"
|
||||
[style.--topic-color]="getFilterTopicColor(filter.value)"
|
||||
[matTooltip]="getFilterTopicTooltip(filter.value)"
|
||||
matTooltipClass="topic-chip-tooltip"
|
||||
[matTooltipDisabled]="!getFilterTopicTooltip(filter.value)">
|
||||
[appComponentTooltip]="AppTopicTooltipComponent"
|
||||
[tooltipInputs]="getFilterTopicInputs(filter.value)"
|
||||
[tooltipMaxWidth]="'500px'">
|
||||
<mat-icon class="filter-topic-chip__icon">label</mat-icon>
|
||||
<span class="filter-topic-chip__label">{{
|
||||
filter.value
|
||||
|
||||
@@ -46,6 +46,9 @@ import {
|
||||
import { SkTextDirective } from '../../custom-directives/sk-text.directive';
|
||||
import { BookmarkService } from '../../shared/services/bookmark.service';
|
||||
|
||||
import { ComponentTooltipDirective } from '../../directives/component-tooltip.directive';
|
||||
import { AppTopicTooltipComponent } from '../../shared/ui/app-topic-tooltip/app-topic-tooltip.component';
|
||||
|
||||
type InstitutionYearFilterMode = 'in' | 'from' | 'between';
|
||||
|
||||
@Component({
|
||||
@@ -62,17 +65,19 @@ type InstitutionYearFilterMode = 'in' | 'from' | 'between';
|
||||
MatCheckboxModule,
|
||||
MatRadioModule,
|
||||
MatTooltipModule,
|
||||
MatAutocompleteModule,
|
||||
TopicHierarchyComponent,
|
||||
PersonCardComponent,
|
||||
SkTextDirective,
|
||||
MatAutocompleteModule,
|
||||
CountryFlagComponent,
|
||||
SkTextDirective,
|
||||
ComponentTooltipDirective,
|
||||
],
|
||||
templateUrl: './person-list.component.html',
|
||||
styleUrl: './person-list.component.scss',
|
||||
standalone: true,
|
||||
})
|
||||
export class PersonListComponent {
|
||||
readonly AppTopicTooltipComponent = AppTopicTooltipComponent;
|
||||
private readonly router = inject(Router);
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly personsService = inject(PersonsService);
|
||||
@@ -477,6 +482,28 @@ export class PersonListComponent {
|
||||
});
|
||||
}
|
||||
|
||||
getFilterTopicInputs(topicName: string): { topicId?: string; topic?: any } {
|
||||
const topic = this.findPersonTopic(topicName);
|
||||
if (topic?.id) {
|
||||
return { topicId: topic.id };
|
||||
}
|
||||
return {
|
||||
topic: {
|
||||
display_name: topicName,
|
||||
description: this.getFilterTopicDescription(topicName) ?? undefined,
|
||||
subfield: this.getFilterTopicSubfieldName(topicName)
|
||||
? { display_name: this.getFilterTopicSubfieldName(topicName)! }
|
||||
: undefined,
|
||||
field: this.getFilterTopicFieldName(topicName)
|
||||
? { display_name: this.getFilterTopicFieldName(topicName)! }
|
||||
: undefined,
|
||||
domain: this.getFilterTopicDomainName(topicName)
|
||||
? { display_name: this.getFilterTopicDomainName(topicName)! }
|
||||
: undefined,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
clearAllFilters(): void {
|
||||
this.selectedTopics.set(new Set<string>());
|
||||
this.institutionControl.setValue('', { emitEvent: false });
|
||||
|
||||
+9
-10
@@ -171,11 +171,9 @@
|
||||
type="button"
|
||||
class="main-topic-button"
|
||||
[disabled]="!getMainTopicItem(item)?.id"
|
||||
[matTooltip]="getTopicTooltip(getMainTopicItem(item))"
|
||||
matTooltipClass="topic-chip-tooltip"
|
||||
[matTooltipDisabled]="
|
||||
!hasTopicTooltip(getMainTopicItem(item))
|
||||
"
|
||||
[appComponentTooltip]="AppTopicTooltipComponent"
|
||||
[tooltipInputs]="{ topicId: getMainTopicItem(item)?.id }"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(click)="
|
||||
selectTopic(getMainTopicItem(item), [item.year])
|
||||
">
|
||||
@@ -208,6 +206,7 @@
|
||||
trackBy: trackByTopic
|
||||
"
|
||||
class="timeline-topic-chip"
|
||||
[topicId]="topic.id"
|
||||
[label]="topic.name"
|
||||
[count]="topic.count"
|
||||
[description]="getTopicDescription(topic)"
|
||||
@@ -289,11 +288,9 @@
|
||||
type="button"
|
||||
class="main-topic-button"
|
||||
[disabled]="!phase.primaryTopic.id"
|
||||
[matTooltip]="getTopicTooltip(phase.primaryTopic)"
|
||||
matTooltipClass="topic-chip-tooltip"
|
||||
[matTooltipDisabled]="
|
||||
!hasTopicTooltip(phase.primaryTopic)
|
||||
"
|
||||
[appComponentTooltip]="AppTopicTooltipComponent"
|
||||
[tooltipInputs]="{ topicId: phase.primaryTopic.id }"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(click)="
|
||||
selectTopic(phase.primaryTopic, getPhaseYears(phase))
|
||||
">
|
||||
@@ -309,6 +306,7 @@
|
||||
<app-topic-chip
|
||||
*ngFor="let topic of phase.topics; trackBy: trackByTopic"
|
||||
class="phase-topic-chip"
|
||||
[topicId]="topic.id"
|
||||
[label]="topic.name"
|
||||
[count]="topic.count"
|
||||
[description]="getTopicDescription(topic)"
|
||||
@@ -387,6 +385,7 @@
|
||||
trackBy: trackByTopic
|
||||
"
|
||||
size="mini"
|
||||
[topicId]="topic.id"
|
||||
[label]="topic.name"
|
||||
[count]="topic.count"
|
||||
[description]="getTopicDescription(topic)"
|
||||
|
||||
+4
@@ -15,6 +15,8 @@ import {
|
||||
import { TopicChipComponent } from '../../../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { TopicLegendComponent } from '../../../../shared/ui/topic-legend/topic-legend.component';
|
||||
import { YearRangeSliderComponent } from '../../../../shared/ui/year-range-slider/year-range-slider.component';
|
||||
import { ComponentTooltipDirective } from '../../../../directives/component-tooltip.directive';
|
||||
import { AppTopicTooltipComponent } from '../../../../shared/ui/app-topic-tooltip/app-topic-tooltip.component';
|
||||
import { topicHierarchyColor } from '../../../../resolvers/utils/topic-colors';
|
||||
import {
|
||||
buildTopicLegendGroups,
|
||||
@@ -99,11 +101,13 @@ interface TimelineScrollAnchor {
|
||||
TopicChipComponent,
|
||||
TopicLegendComponent,
|
||||
YearRangeSliderComponent,
|
||||
ComponentTooltipDirective,
|
||||
],
|
||||
templateUrl: './research-timeline.component.html',
|
||||
styleUrl: './research-timeline.component.scss',
|
||||
})
|
||||
export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
readonly AppTopicTooltipComponent = AppTopicTooltipComponent;
|
||||
@ViewChild('timelineWrapper')
|
||||
private readonly timelineWrapper?: ElementRef<HTMLDivElement>;
|
||||
@Input() elements: TopicTimelineElement[] = [];
|
||||
|
||||
@@ -245,6 +245,7 @@
|
||||
track keyword.id || keyword.label
|
||||
) {
|
||||
<app-topic-chip
|
||||
[topicId]="keyword.id"
|
||||
[label]="keyword.label"
|
||||
[count]="keyword.count"
|
||||
[subfieldName]="keyword.subfieldName"
|
||||
|
||||
@@ -230,6 +230,8 @@
|
||||
<div class="tags">
|
||||
@for (topic of publication.topics; track topic.id) {
|
||||
<app-topic-chip
|
||||
[topic]="topic"
|
||||
[topicId]="topic.id"
|
||||
[label]="topic.display_name || ''"
|
||||
[description]="topic.description"
|
||||
[subfieldName]="topic.subfield?.display_name"
|
||||
|
||||
+4
-4
@@ -188,9 +188,9 @@
|
||||
<div class="cc-news-hint">
|
||||
<mat-icon>info_outline</mat-icon>
|
||||
<span>
|
||||
Der CC-News-Vergleich (hinterlegte Fläche, ab 2017) ist aktuell nur bei
|
||||
deaktivierter Fuzzy-Suche verfügbar, da für Web-Nachrichten kein
|
||||
Themen-Mapping existiert.
|
||||
Der CC-News-Vergleich (hinterlegte Fläche, ab 2017) ist aktuell
|
||||
nur bei deaktivierter Fuzzy-Suche verfügbar, da für
|
||||
Web-Nachrichten kein Themen-Mapping existiert.
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
@@ -198,11 +198,11 @@
|
||||
<div class="chart-topic-tabs">
|
||||
@for (topic of selectedTrendTopics(); track $index) {
|
||||
<app-topic-chip
|
||||
[topicId]="topic"
|
||||
[label]="getMappedTopic(topic)"
|
||||
[active]="activeChartTopic() === topic"
|
||||
[color]="getTopicColor(topic)"
|
||||
[disabled]="isTopicEmpty(topic)"
|
||||
[matTooltip]="getMappedTopic(topic)"
|
||||
(chipClick)="updateActiveChartTopic(topic)">
|
||||
</app-topic-chip>
|
||||
}
|
||||
|
||||
@@ -11,22 +11,36 @@ import { AppTopicCardComponent } from '../app-topic-card/app-topic-card.componen
|
||||
export class AppTopicTooltipComponent {
|
||||
private readonly topicsService = inject(TopicsV2Service);
|
||||
|
||||
topicId = input.required<string>();
|
||||
topicId = input<string | null | undefined>(undefined);
|
||||
topic = input<Topic | null | undefined>(undefined);
|
||||
|
||||
_topic = signal<Topic | undefined>(undefined);
|
||||
|
||||
_isLoading = signal<boolean>(false);
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const topicObj = this.topic();
|
||||
const topicId = this.topicId();
|
||||
if (!topicId) {
|
||||
this._topic.set(undefined);
|
||||
}
|
||||
this._isLoading.set(true);
|
||||
this.topicsService.getTopicById(topicId).subscribe((topic) => {
|
||||
this._topic.set(topic);
|
||||
|
||||
if (topicObj) {
|
||||
this._topic.set(topicObj);
|
||||
this._isLoading.set(false);
|
||||
});
|
||||
} else if (topicId) {
|
||||
const cleanId = topicId.replace('https://openalex.org/', '');
|
||||
this._isLoading.set(true);
|
||||
this.topicsService.getTopicById(cleanId).subscribe({
|
||||
next: (fetchedTopic) => {
|
||||
this._topic.set(fetchedTopic);
|
||||
this._isLoading.set(false);
|
||||
},
|
||||
error: () => {
|
||||
this._isLoading.set(false);
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this._topic.set(undefined);
|
||||
this._isLoading.set(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
<div class="keyword-stack">
|
||||
@for (topic of getUniqueOATopics(); track $index) {
|
||||
<app-topic-chip
|
||||
[topic]="topic"
|
||||
[topicId]="topic.id"
|
||||
[label]="topic.display_name || ''"
|
||||
[subfieldName]="topic.subfield?.display_name || ''"
|
||||
[fieldName]="topic.field?.display_name || ''"
|
||||
|
||||
@@ -1,29 +1,27 @@
|
||||
<button
|
||||
type="button"
|
||||
class="topic-chip__button"
|
||||
[class.topic-chip__button--without-count]="!hasCount"
|
||||
[disabled]="disabled"
|
||||
[attr.aria-pressed]="active ? 'true' : null"
|
||||
[matTooltip]="buttonTooltip"
|
||||
[matTooltipDisabled]="!buttonTooltip"
|
||||
matTooltipClass="topic-chip-tooltip"
|
||||
[class.topic-chip__button--without-count]="!hasCount()"
|
||||
[disabled]="disabled()"
|
||||
[attr.aria-pressed]="active() ? 'true' : null"
|
||||
[appComponentTooltip]="AppTopicTooltipComponent"
|
||||
[tooltipInputs]="tooltipInputs()"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(click)="handleClick()">
|
||||
<span
|
||||
class="topic-chip__label"
|
||||
[matTooltip]="labelTooltip"
|
||||
[matTooltipDisabled]="!labelTooltip"
|
||||
matTooltipClass="topic-chip-tooltip">
|
||||
{{ label }}
|
||||
<span class="topic-chip__label">
|
||||
{{ label() }}
|
||||
</span>
|
||||
|
||||
@if (hasCount) {
|
||||
@if (hasCount()) {
|
||||
<span
|
||||
class="topic-chip__count"
|
||||
[matTooltip]="normalizedCountTooltip"
|
||||
[matTooltipDisabled]="!normalizedCountTooltip">
|
||||
{{ count }}
|
||||
@if (countIconName) {
|
||||
<mat-icon class="topic-chip__count-icon">{{ countIconName }}</mat-icon>
|
||||
[matTooltip]="normalizedCountTooltip()"
|
||||
[matTooltipDisabled]="!normalizedCountTooltip()">
|
||||
{{ count() }}
|
||||
@if (countIconName()) {
|
||||
<mat-icon class="topic-chip__count-icon">{{
|
||||
countIconName()
|
||||
}}</mat-icon>
|
||||
}
|
||||
</span>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user