changed author and topic filter
This commit is contained in:
+166
-94
@@ -1,100 +1,172 @@
|
||||
<div class="trend-layout">
|
||||
<!-- Linkes Sidebar-Panel: Steuerung -->
|
||||
<aside class="trend-sidebar">
|
||||
<!-- Zeitraum-Auswahl -->
|
||||
<app-year-range-slider
|
||||
[minYear]="2000"
|
||||
[maxYear]="2026"
|
||||
[(startYear)]="startYear"
|
||||
[(endYear)]="endYear"
|
||||
(startYearChange)="updateUrlParams()"
|
||||
(endYearChange)="updateUrlParams()">
|
||||
</app-year-range-slider>
|
||||
<div class="trend-layout-wrapper">
|
||||
<!-- Strategy Selection Toggles Bar -->
|
||||
<div class="strategy-toggles-bar">
|
||||
<button
|
||||
[class.active]="selectedSearchType() === 'publications'"
|
||||
(click)="setSearchType('publications')">
|
||||
<mat-icon>library_books</mat-icon> Publikationen
|
||||
</button>
|
||||
<button
|
||||
[class.active]="selectedSearchType() === 'authors'"
|
||||
(click)="setSearchType('authors')">
|
||||
<mat-icon>people</mat-icon> Autoren
|
||||
</button>
|
||||
<button
|
||||
[class.active]="selectedSearchType() === 'patents'"
|
||||
(click)="setSearchType('patents')">
|
||||
<mat-icon>assignment</mat-icon> Patente
|
||||
</button>
|
||||
<button
|
||||
[class.active]="selectedSearchType() === 'projects'"
|
||||
(click)="setSearchType('projects')">
|
||||
<mat-icon>business_center</mat-icon> Projekte
|
||||
</button>
|
||||
<button
|
||||
[class.active]="selectedSearchType() === 'news'"
|
||||
(click)="setSearchType('news')">
|
||||
<mat-icon>campaign</mat-icon> News
|
||||
</button>
|
||||
<button
|
||||
[class.active]="selectedSearchType() === 'all'"
|
||||
(click)="setSearchType('all')">
|
||||
<mat-icon>dashboard</mat-icon> Themenlebenszyklus (All)
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Länder/Kontinente vergleichen -->
|
||||
<app-location-selector
|
||||
[comparisonCountries]="comparisonCountries()"
|
||||
[comparisonRegions]="comparisonRegions()"
|
||||
[locationQuery]="locationQuery()"
|
||||
[locationSearchResults]="locationSearchResults()"
|
||||
[getEntityColor]="boundGetEntityColor"
|
||||
[isVisible]="boundIsVisible"
|
||||
(addLocation)="addLocation($event)"
|
||||
(removeLocation)="removeLocation($event.id, $event.type)"
|
||||
(searchChange)="onLocationSearchChange($event)"
|
||||
(toggleVisibility)="toggleVisibility($event)">
|
||||
</app-location-selector>
|
||||
</aside>
|
||||
<div class="trend-layout">
|
||||
<!-- Linkes Sidebar-Panel: Steuerung -->
|
||||
<aside class="trend-sidebar">
|
||||
<!-- Zeitraum-Auswahl -->
|
||||
<app-year-range-slider
|
||||
[minYear]="2000"
|
||||
[maxYear]="2026"
|
||||
[(startYear)]="startYear"
|
||||
[(endYear)]="endYear"
|
||||
(startYearChange)="updateUrlParams()"
|
||||
(endYearChange)="updateUrlParams()">
|
||||
</app-year-range-slider>
|
||||
|
||||
<!-- Rechtes Haupt-Panel: Toggles & Diagramm -->
|
||||
<main class="trend-main">
|
||||
<div class="trend-toggles-bar">
|
||||
<span class="toggle-label">Visualisierungsskala:</span>
|
||||
<div class="toggle-buttons">
|
||||
<button
|
||||
[class.active]="chartMode() === 'normalized'"
|
||||
(click)="setChartMode('normalized')"
|
||||
title="Normiert das Publikationsvolumen auf [0,1], um die Form von Wachstumstrends zu vergleichen.">
|
||||
<mat-icon>trending_down</mat-icon> Normierte Skala
|
||||
</button>
|
||||
<button
|
||||
[class.active]="chartMode() === 'total'"
|
||||
(click)="setChartMode('total')"
|
||||
title="Zeigt die absolute Anzahl der Publikationen.">
|
||||
<mat-icon>bar_chart</mat-icon> Gesamtvolumen
|
||||
</button>
|
||||
<button
|
||||
[class.active]="chartMode() === 'cumulative'"
|
||||
(click)="setChartMode('cumulative')"
|
||||
title="Zeigt das normierte kumulierte Publikationswachstum (S-Kurve).">
|
||||
<mat-icon>trending_up</mat-icon> S-Kurve (Normiert)
|
||||
</button>
|
||||
<!-- Länder/Kontinente vergleichen -->
|
||||
@if (activeConfig().showLocationSelector) {
|
||||
<app-location-selector
|
||||
[comparisonCountries]="comparisonCountries()"
|
||||
[comparisonRegions]="comparisonRegions()"
|
||||
[locationQuery]="locationQuery()"
|
||||
[locationSearchResults]="locationSearchResults()"
|
||||
[getEntityColor]="boundGetEntityColor"
|
||||
[isVisible]="boundIsVisible"
|
||||
(addLocation)="addLocation($event)"
|
||||
(removeLocation)="removeLocation($event.id, $event.type)"
|
||||
(searchChange)="onLocationSearchChange($event)"
|
||||
(toggleVisibility)="toggleVisibility($event)">
|
||||
</app-location-selector>
|
||||
}
|
||||
|
||||
<!-- Top-Autoren einer Einrichtung hinzufügen (Authors Tab Sidebar Placement) -->
|
||||
@if (activeConfig().showAuthorSelector) {
|
||||
<app-author-institution-selector
|
||||
[searchQuery]="authorInstSearchQuery()"
|
||||
[searchResults]="authorInstSearchResults()"
|
||||
(addInstitutionAuthors)="
|
||||
addInstitutionAuthors($event.id, $event.name)
|
||||
"
|
||||
(searchChange)="onAuthorInstSearchChange($event)">
|
||||
</app-author-institution-selector>
|
||||
}
|
||||
</aside>
|
||||
|
||||
<!-- Rechtes Haupt-Panel: Toggles & Diagramm -->
|
||||
<main class="trend-main">
|
||||
<div class="trend-toggles-bar">
|
||||
<span class="toggle-label">Visualisierungsskala:</span>
|
||||
<div class="toggle-buttons">
|
||||
<button
|
||||
[class.active]="chartMode() === 'normalized'"
|
||||
(click)="setChartMode('normalized')"
|
||||
title="Normiert das Publikationsvolumen auf [0,1], um die Form von Wachstumstrends zu vergleichen.">
|
||||
<mat-icon>trending_down</mat-icon> Normierte Skala
|
||||
</button>
|
||||
<button
|
||||
[class.active]="chartMode() === 'total'"
|
||||
(click)="setChartMode('total')"
|
||||
title="Zeigt die absolute Anzahl der Publikationen.">
|
||||
<mat-icon>bar_chart</mat-icon> Gesamtvolumen
|
||||
</button>
|
||||
<button
|
||||
[class.active]="chartMode() === 'cumulative'"
|
||||
(click)="setChartMode('cumulative')"
|
||||
title="Zeigt das normierte kumulierte Publikationswachstum (S-Kurve).">
|
||||
<mat-icon>trending_up</mat-icon> S-Kurve (Normiert)
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="chart-holder-card">
|
||||
@if (isTrendLoading()) {
|
||||
<div class="loader-overlay">
|
||||
<div class="spinner"></div>
|
||||
<p>Trenddaten werden aus dem Publikationsverzeichnis abgerufen...</p>
|
||||
</div>
|
||||
}
|
||||
@if (selectedTrendTopics().length > 1) {
|
||||
<div class="chart-topic-tabs">
|
||||
@for (topic of selectedTrendTopics(); track topic) {
|
||||
<app-topic-chip
|
||||
[label]="topic"
|
||||
[active]="activeChartTopic() === topic"
|
||||
[color]="getTopicColor(topic)"
|
||||
(chipClick)="updateActiveChartTopic(topic)">
|
||||
</app-topic-chip>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<app-uni-trend-chart
|
||||
[data]="trendResponse()"
|
||||
[mode]="chartMode()"
|
||||
[activeTopic]="activeChartTopic()"
|
||||
[startYear]="startYear()"
|
||||
[endYear]="endYear()"></app-uni-trend-chart>
|
||||
</div>
|
||||
<div class="chart-holder-card">
|
||||
@if (isTrendLoading()) {
|
||||
<div class="loader-overlay">
|
||||
<div class="spinner"></div>
|
||||
<p>Trenddaten werden abgerufen...</p>
|
||||
</div>
|
||||
}
|
||||
@if (
|
||||
selectedTrendTopics().length > 1 && selectedSearchType() !== 'news'
|
||||
) {
|
||||
<div class="chart-topic-tabs">
|
||||
@for (topic of selectedTrendTopics(); track topic) {
|
||||
<app-topic-chip
|
||||
[label]="topic"
|
||||
[active]="activeChartTopic() === topic"
|
||||
[color]="getTopicColor(topic)"
|
||||
(chipClick)="updateActiveChartTopic(topic)">
|
||||
</app-topic-chip>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<app-uni-trend-chart
|
||||
[data]="trendResponse()"
|
||||
[mode]="chartMode()"
|
||||
[activeTopic]="activeChartTopic()"
|
||||
[startYear]="startYear()"
|
||||
[endYear]="endYear()"></app-uni-trend-chart>
|
||||
</div>
|
||||
|
||||
<!-- Unified Institution Search, Compare, & Recommendations -->
|
||||
<app-institution-selector
|
||||
[comparisonInstitutions]="comparisonInstitutions()"
|
||||
[primaryInstitution]="primaryInstitution()"
|
||||
[primaryInstitutionName]="primaryInstitutionName()"
|
||||
[topSuggestions]="topSuggestions()"
|
||||
[isSuggestionsLoading]="isSuggestionsLoading()"
|
||||
[activeChartTopic]="activeChartTopic()"
|
||||
[searchQuery]="searchQuery()"
|
||||
[searchResults]="searchResults()"
|
||||
[getEntityColor]="boundGetEntityColor"
|
||||
[isVisible]="boundIsVisible"
|
||||
(addInstitution)="addInstitution($event.id, $event.name)"
|
||||
(removeInstitution)="removeInstitution($event)"
|
||||
(searchChange)="onSearchChange($event)"
|
||||
(toggleVisibility)="toggleVisibility($event)">
|
||||
</app-institution-selector>
|
||||
</main>
|
||||
<!-- Unified Institution Search, Compare, & Recommendations -->
|
||||
@if (activeConfig().showInstitutionSelector) {
|
||||
<app-institution-selector
|
||||
[comparisonInstitutions]="comparisonInstitutions()"
|
||||
[primaryInstitution]="primaryInstitution()"
|
||||
[primaryInstitutionName]="primaryInstitutionName()"
|
||||
[topSuggestions]="topSuggestions()"
|
||||
[isSuggestionsLoading]="isSuggestionsLoading()"
|
||||
[activeChartTopic]="activeChartTopic()"
|
||||
[searchQuery]="searchQuery()"
|
||||
[searchResults]="searchResults()"
|
||||
[getEntityColor]="boundGetEntityColor"
|
||||
[isVisible]="boundIsVisible"
|
||||
(addInstitution)="addInstitution($event.id, $event.name)"
|
||||
(removeInstitution)="removeInstitution($event)"
|
||||
(searchChange)="onSearchChange($event)"
|
||||
(toggleVisibility)="toggleVisibility($event)">
|
||||
</app-institution-selector>
|
||||
}
|
||||
|
||||
<!-- Reusable Author Selection UI (Main Panel below chart) -->
|
||||
@if (activeConfig().showAuthorSelector) {
|
||||
<app-author-selector
|
||||
[comparisonAuthors]="comparisonAuthors()"
|
||||
[topSuggestions]="recommendedAuthors()"
|
||||
[isSuggestionsLoading]="isSuggestionsLoading()"
|
||||
[activeChartTopic]="activeChartTopic()"
|
||||
[searchQuery]="authorSearchQuery()"
|
||||
[searchResults]="authorSearchResults()"
|
||||
[getEntityColor]="boundGetEntityColor"
|
||||
[isVisible]="boundIsVisible"
|
||||
(addAuthor)="addAuthor($event.id, $event.name)"
|
||||
(removeAuthor)="removeAuthor($event)"
|
||||
(searchChange)="onAuthorSearchChange($event)"
|
||||
(toggleVisibility)="toggleVisibility($event)">
|
||||
</app-author-selector>
|
||||
}
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+44
@@ -179,3 +179,47 @@
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.strategy-toggles-bar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
background: #f8fafc;
|
||||
border-radius: 12px;
|
||||
padding: 6px;
|
||||
border: 1px solid #e2e8f0;
|
||||
margin-bottom: 0.5rem;
|
||||
|
||||
button {
|
||||
padding: 0.5rem 1rem;
|
||||
border: none;
|
||||
background: none;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: #64748b;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
mat-icon {
|
||||
font-size: 16px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
&:hover:not(.active) {
|
||||
color: #0f172a;
|
||||
background: #f1f5f9;
|
||||
}
|
||||
&.active {
|
||||
background: white;
|
||||
color: #3b82f6;
|
||||
box-shadow:
|
||||
0 4px 6px -1px rgba(0, 0, 0, 0.05),
|
||||
0 2px 4px -1px rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+435
-46
@@ -32,20 +32,78 @@ import {
|
||||
AutocompleteResponseResultsInner,
|
||||
UniversityRankingsService,
|
||||
InstitutionsService,
|
||||
PersonsService,
|
||||
} from '../../../api';
|
||||
import { TopicChipComponent } from '../../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
|
||||
import { YearRangeSliderComponent } from '../../../shared/ui/year-range-slider/year-range-slider.component';
|
||||
import { LocationSelectorComponent } from '../../../shared/ui/location-selector/location-selector.component';
|
||||
import { InstitutionSelectorComponent } from '../../../shared/ui/institution-selector/institution-selector.component';
|
||||
import { AuthorSelectorComponent } from '../../../shared/ui/author-selector/author-selector.component';
|
||||
import { AuthorInstitutionSelectorComponent } from '../../../shared/ui/author-institution-selector/author-institution-selector.component';
|
||||
import { SearchResultsStateService } from '../../keywords-search/search-results/search-results-state.service';
|
||||
|
||||
export interface CompareItem {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface TrendStrategyConfig {
|
||||
showInstitutionSelector: boolean;
|
||||
showLocationSelector: boolean;
|
||||
showAuthorSelector: boolean;
|
||||
yAxisLabel: string;
|
||||
chartTitle: string;
|
||||
}
|
||||
|
||||
export const TREND_CONFIGS: Record<string, TrendStrategyConfig> = {
|
||||
publications: {
|
||||
showInstitutionSelector: true,
|
||||
showLocationSelector: true,
|
||||
showAuthorSelector: false,
|
||||
yAxisLabel: 'Publikationen',
|
||||
chartTitle: 'Publikationstrends',
|
||||
},
|
||||
authors: {
|
||||
showInstitutionSelector: false,
|
||||
showLocationSelector: false,
|
||||
showAuthorSelector: true,
|
||||
yAxisLabel: 'Publikationen von Autoren',
|
||||
chartTitle: 'Autorentrends',
|
||||
},
|
||||
patents: {
|
||||
showInstitutionSelector: true,
|
||||
showLocationSelector: false,
|
||||
showAuthorSelector: false,
|
||||
yAxisLabel: 'Patentanmeldungen',
|
||||
chartTitle: 'Patentrecherche-Trends',
|
||||
},
|
||||
projects: {
|
||||
showInstitutionSelector: true,
|
||||
showLocationSelector: false,
|
||||
showAuthorSelector: false,
|
||||
yAxisLabel: 'Projektförderung (Anz)',
|
||||
chartTitle: 'Drittmittelförderung-Trends',
|
||||
},
|
||||
news: {
|
||||
showInstitutionSelector: false,
|
||||
showLocationSelector: false,
|
||||
showAuthorSelector: false,
|
||||
yAxisLabel: 'Pressemitteilungen',
|
||||
chartTitle: 'Nachrichtentrends',
|
||||
},
|
||||
all: {
|
||||
showInstitutionSelector: false,
|
||||
showLocationSelector: false,
|
||||
showAuthorSelector: false,
|
||||
yAxisLabel: 'Aktivitäts-Index',
|
||||
chartTitle: 'Cross-Domain-Themenlebenszyklus (UDE)',
|
||||
},
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'app-uni-trend-parent',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
@@ -58,6 +116,8 @@ export interface CompareItem {
|
||||
YearRangeSliderComponent,
|
||||
LocationSelectorComponent,
|
||||
InstitutionSelectorComponent,
|
||||
AuthorSelectorComponent,
|
||||
AuthorInstitutionSelectorComponent,
|
||||
],
|
||||
templateUrl: './uni-trend-parent.component.html',
|
||||
styleUrl: './uni-trend-parent.component.scss',
|
||||
@@ -66,13 +126,22 @@ export interface CompareItem {
|
||||
export class UniTrendParentComponent implements OnInit {
|
||||
private readonly apiService = inject(UniversityRankingsService);
|
||||
private readonly institutionsApiService = inject(InstitutionsService);
|
||||
private readonly personsApiService = inject(PersonsService);
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
// Inject SearchResultsStateService optionally if loaded in keywords search
|
||||
private readonly state = inject(SearchResultsStateService, {
|
||||
optional: true,
|
||||
});
|
||||
|
||||
// Input containing extracted/selected keywords from parent
|
||||
readonly keywords = input<string[]>([]);
|
||||
|
||||
// Trend settings signals
|
||||
readonly selectedSearchType = signal<
|
||||
'publications' | 'authors' | 'patents' | 'projects' | 'news' | 'all'
|
||||
>('publications');
|
||||
readonly selectedTrendTopics = signal<string[]>([]);
|
||||
readonly primaryInstitution = signal<string | null>(null);
|
||||
readonly primaryInstitutionName = signal<string>(
|
||||
@@ -83,6 +152,7 @@ export class UniTrendParentComponent implements OnInit {
|
||||
{ id: 'DE', name: 'Deutschland' },
|
||||
]);
|
||||
readonly comparisonRegions = signal<CompareItem[]>([]);
|
||||
readonly comparisonAuthors = signal<CompareItem[]>([]);
|
||||
readonly startYear = signal<number>(2010);
|
||||
readonly endYear = signal<number>(2025);
|
||||
readonly chartMode = signal<'normalized' | 'total' | 'cumulative'>(
|
||||
@@ -90,16 +160,24 @@ export class UniTrendParentComponent implements OnInit {
|
||||
);
|
||||
readonly activeChartTopic = signal<string>('');
|
||||
|
||||
// Config mapper for active strategy UI representation
|
||||
readonly activeConfig = computed(
|
||||
() => TREND_CONFIGS[this.selectedSearchType()],
|
||||
);
|
||||
|
||||
// Cached parameters of the last active search request to track "isDirty"
|
||||
readonly fetchedSearchType = signal<string | null>(null);
|
||||
readonly fetchedTopics = signal<string[]>([]);
|
||||
readonly fetchedInstitutions = signal<CompareItem[]>([]);
|
||||
readonly fetchedCountries = signal<CompareItem[]>([]);
|
||||
readonly fetchedRegions = signal<CompareItem[]>([]);
|
||||
readonly fetchedAuthors = signal<CompareItem[]>([]);
|
||||
|
||||
// Results & Loading signals
|
||||
readonly rawTrendResponse = signal<TrendResponse | null>(null);
|
||||
readonly isTrendLoading = signal<boolean>(false);
|
||||
readonly topSuggestions = signal<TopInstitutionItem[]>([]);
|
||||
readonly recommendedAuthors = signal<any[]>([]);
|
||||
readonly isSuggestionsLoading = signal<boolean>(false);
|
||||
|
||||
getTopicColor(topic: string): string {
|
||||
@@ -111,6 +189,12 @@ export class UniTrendParentComponent implements OnInit {
|
||||
readonly searchResults = signal<AutocompleteResponseResultsInner[]>([]);
|
||||
readonly locationQuery = signal<string>('');
|
||||
readonly locationSearchResults = signal<AutocompleteLocationItem[]>([]);
|
||||
readonly authorSearchQuery = signal<string>('');
|
||||
readonly authorSearchResults = signal<any[]>([]);
|
||||
readonly authorInstSearchQuery = signal<string>('');
|
||||
readonly authorInstSearchResults = signal<AutocompleteResponseResultsInner[]>(
|
||||
[],
|
||||
);
|
||||
|
||||
// Years array for selects
|
||||
readonly availableYears: number[] = [];
|
||||
@@ -136,8 +220,15 @@ export class UniTrendParentComponent implements OnInit {
|
||||
const insts = this.comparisonInstitutions().map((i) => i.id);
|
||||
const countries = this.comparisonCountries().map((c) => c.id);
|
||||
const regions = this.comparisonRegions().map((r) => r.id);
|
||||
const authors = this.comparisonAuthors().map((a) => a.id);
|
||||
|
||||
const orderedIds = [primaryId, ...insts, ...countries, ...regions];
|
||||
const orderedIds = [
|
||||
primaryId,
|
||||
...insts,
|
||||
...countries,
|
||||
...regions,
|
||||
...authors,
|
||||
];
|
||||
|
||||
const idx = orderedIds.indexOf(entityId);
|
||||
if (idx === -1) return '#9ca3af';
|
||||
@@ -172,6 +263,34 @@ export class UniTrendParentComponent implements OnInit {
|
||||
const raw = this.rawTrendResponse();
|
||||
if (!raw) return null;
|
||||
|
||||
const type = this.selectedSearchType();
|
||||
if (type === 'news' || type === 'all') {
|
||||
return {
|
||||
...raw,
|
||||
series: raw.series.map((s) => ({
|
||||
...s,
|
||||
visible: this.isVisible(s.entity_id),
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
if (type === 'authors') {
|
||||
const currentAuthorIds = new Set(
|
||||
this.comparisonAuthors().map((a) => a.id.toLowerCase()),
|
||||
);
|
||||
const filtered = raw.series
|
||||
.filter((s) => currentAuthorIds.has(s.entity_id.toLowerCase()))
|
||||
.map((s) => ({
|
||||
...s,
|
||||
visible: this.isVisible(s.entity_id),
|
||||
}));
|
||||
return {
|
||||
...raw,
|
||||
series: filtered,
|
||||
};
|
||||
}
|
||||
|
||||
// Default: publications, patents, projects
|
||||
const currentInstIds = new Set(
|
||||
this.comparisonInstitutions().map((i: CompareItem) => i.id.toLowerCase()),
|
||||
);
|
||||
@@ -235,6 +354,7 @@ export class UniTrendParentComponent implements OnInit {
|
||||
const kws = this.keywords();
|
||||
const currentSelections = untracked(() => this.selectedTrendTopics());
|
||||
const currentActive = untracked(() => this.activeChartTopic());
|
||||
const searchType = this.selectedSearchType();
|
||||
|
||||
if (kws.length > 0) {
|
||||
// Find existing selections that are still in keywords, or default to all
|
||||
@@ -254,10 +374,17 @@ export class UniTrendParentComponent implements OnInit {
|
||||
this.activeChartTopic.set(updatedSelections[0] || '');
|
||||
}
|
||||
|
||||
// If comparison list is empty, initialize default institutions dynamically
|
||||
const currentInsts = untracked(() => this.comparisonInstitutions());
|
||||
if (currentInsts.length === 0) {
|
||||
untracked(() => this.initializeDefaultInstitutions());
|
||||
// If comparison list is empty, initialize default institutions/authors dynamically
|
||||
if (searchType === 'authors') {
|
||||
const currentAuthors = untracked(() => this.comparisonAuthors());
|
||||
if (currentAuthors.length === 0) {
|
||||
untracked(() => this.initializeDefaultAuthors());
|
||||
}
|
||||
} else {
|
||||
const currentInsts = untracked(() => this.comparisonInstitutions());
|
||||
if (currentInsts.length === 0) {
|
||||
untracked(() => this.initializeDefaultInstitutions());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.selectedTrendTopics.set([]);
|
||||
@@ -275,46 +402,62 @@ export class UniTrendParentComponent implements OnInit {
|
||||
});
|
||||
});
|
||||
|
||||
// Effect: automatically refetch trend data whenever topics or comparisons change (fully reactive)
|
||||
// Effect: automatically refetch trend data whenever topics or comparisons change (fully reactive with subset check)
|
||||
effect(() => {
|
||||
const topics = this.selectedTrendTopics();
|
||||
const insts = this.comparisonInstitutions();
|
||||
const countries = this.comparisonCountries();
|
||||
const regions = this.comparisonRegions();
|
||||
const authors = this.comparisonAuthors();
|
||||
const searchType = this.selectedSearchType();
|
||||
|
||||
if (topics.length === 0) return;
|
||||
|
||||
// Check if all requested topics and entities are subsets of what was already fetched
|
||||
const fetchedT = new Set(untracked(() => this.fetchedTopics()));
|
||||
const fetchedI = new Set(
|
||||
untracked(() => this.fetchedInstitutions()).map((i) =>
|
||||
i.id.toLowerCase(),
|
||||
),
|
||||
);
|
||||
const fetchedC = new Set(
|
||||
untracked(() => this.fetchedCountries()).map((c) => c.id.toLowerCase()),
|
||||
);
|
||||
const fetchedR = new Set(
|
||||
untracked(() => this.fetchedRegions()).map((r) => r.id.toLowerCase()),
|
||||
);
|
||||
const fetchedType = untracked(() => this.fetchedSearchType());
|
||||
|
||||
const allTopicsFetched = topics.every((t) => fetchedT.has(t));
|
||||
const allInstsFetched = insts.every((i) =>
|
||||
fetchedI.has(i.id.toLowerCase()),
|
||||
);
|
||||
const allCountriesFetched = countries.every((c) =>
|
||||
fetchedC.has(c.id.toLowerCase()),
|
||||
);
|
||||
const allRegionsFetched = regions.every((r) =>
|
||||
fetchedR.has(r.id.toLowerCase()),
|
||||
);
|
||||
const sameType = searchType === fetchedType;
|
||||
|
||||
if (
|
||||
allTopicsFetched &&
|
||||
allInstsFetched &&
|
||||
allCountriesFetched &&
|
||||
allRegionsFetched
|
||||
) {
|
||||
let allEntitiesFetched = false;
|
||||
if (sameType) {
|
||||
if (searchType === 'authors') {
|
||||
const fetchedA = new Set(
|
||||
untracked(() => this.fetchedAuthors()).map((a) =>
|
||||
a.id.toLowerCase(),
|
||||
),
|
||||
);
|
||||
allEntitiesFetched = authors.every((a) =>
|
||||
fetchedA.has(a.id.toLowerCase()),
|
||||
);
|
||||
} else if (searchType === 'news' || searchType === 'all') {
|
||||
allEntitiesFetched = true;
|
||||
} else {
|
||||
// publications, patents, projects
|
||||
const fetchedI = new Set(
|
||||
untracked(() => this.fetchedInstitutions()).map((i) =>
|
||||
i.id.toLowerCase(),
|
||||
),
|
||||
);
|
||||
const fetchedC = new Set(
|
||||
untracked(() => this.fetchedCountries()).map((c) =>
|
||||
c.id.toLowerCase(),
|
||||
),
|
||||
);
|
||||
const fetchedR = new Set(
|
||||
untracked(() => this.fetchedRegions()).map((r) =>
|
||||
r.id.toLowerCase(),
|
||||
),
|
||||
);
|
||||
allEntitiesFetched =
|
||||
insts.every((i) => fetchedI.has(i.id.toLowerCase())) &&
|
||||
countries.every((c) => fetchedC.has(c.id.toLowerCase())) &&
|
||||
regions.every((r) => fetchedR.has(r.id.toLowerCase()));
|
||||
}
|
||||
}
|
||||
|
||||
const hasResponse = !!untracked(() => this.rawTrendResponse());
|
||||
if (allTopicsFetched && sameType && allEntitiesFetched && hasResponse) {
|
||||
// All requested data is already present in rawTrendResponse, so skip backend call!
|
||||
return;
|
||||
}
|
||||
@@ -324,6 +467,10 @@ export class UniTrendParentComponent implements OnInit {
|
||||
|
||||
// Handle initialization and synchronization of URL state
|
||||
this.route.queryParams.subscribe((params) => {
|
||||
if (params['search_type']) {
|
||||
this.selectedSearchType.set(params['search_type'] as any);
|
||||
}
|
||||
|
||||
// Parse institutions serialized as id|name
|
||||
if (params['institutions']) {
|
||||
const insts = Array.isArray(params['institutions'])
|
||||
@@ -405,6 +552,33 @@ export class UniTrendParentComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
// Parse authors
|
||||
if (params['authors']) {
|
||||
const auths = Array.isArray(params['authors'])
|
||||
? params['authors']
|
||||
: [params['authors']];
|
||||
const parsed = auths.map((a: string) => {
|
||||
const parts = a.split('|');
|
||||
return { id: parts[0], name: parts[1] || parts[0] };
|
||||
});
|
||||
|
||||
const currentIds = this.comparisonAuthors()
|
||||
.map((a) => a.id)
|
||||
.sort()
|
||||
.join(',');
|
||||
const parsedIds = parsed
|
||||
.map((a) => a.id)
|
||||
.sort()
|
||||
.join(',');
|
||||
if (currentIds !== parsedIds) {
|
||||
this.comparisonAuthors.set(parsed);
|
||||
}
|
||||
} else {
|
||||
if (this.comparisonAuthors().length > 0) {
|
||||
this.comparisonAuthors.set([]);
|
||||
}
|
||||
}
|
||||
|
||||
if (params['start_year']) {
|
||||
this.startYear.set(Number(params['start_year']));
|
||||
}
|
||||
@@ -429,7 +603,9 @@ export class UniTrendParentComponent implements OnInit {
|
||||
const kws = this.keywords();
|
||||
if (kws.length === 0) return;
|
||||
|
||||
const topic = kws[0];
|
||||
// Use mapped topic names if softSearch is false
|
||||
const topics = this.state?.topicsList() ?? kws;
|
||||
const topic = topics[0] || kws[0] || 'Artificial Intelligence';
|
||||
this.isSuggestionsLoading.set(true);
|
||||
|
||||
forkJoin({
|
||||
@@ -457,13 +633,11 @@ export class UniTrendParentComponent implements OnInit {
|
||||
}) => {
|
||||
const uniqueInsts = new Map<string, string>();
|
||||
|
||||
// Add DE ones
|
||||
deInsts.forEach((inst: TopInstitutionItem) => {
|
||||
if (inst.id)
|
||||
uniqueInsts.set(inst.id, inst.display_name || 'Unbekannt');
|
||||
});
|
||||
|
||||
// Add overall ones
|
||||
overallInsts.forEach((inst: TopInstitutionItem) => {
|
||||
if (inst.id)
|
||||
uniqueInsts.set(inst.id, inst.display_name || 'Unbekannt');
|
||||
@@ -476,7 +650,6 @@ export class UniTrendParentComponent implements OnInit {
|
||||
this.comparisonInstitutions.set(list);
|
||||
this.isSuggestionsLoading.set(false);
|
||||
|
||||
// Auto-fetch trend data on first load if we don't have it yet
|
||||
if (!this.rawTrendResponse()) {
|
||||
this.fetchTrendData();
|
||||
}
|
||||
@@ -488,15 +661,62 @@ export class UniTrendParentComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
// Fetch recommended institutions for comparison based on current topics
|
||||
loadTrendSuggestions() {
|
||||
// Dynamically load top authors for UDE to initialize comparison list
|
||||
initializeDefaultAuthors() {
|
||||
const kws = this.keywords();
|
||||
if (kws.length === 0) return;
|
||||
|
||||
const topics = this.state?.topicsList() ?? kws;
|
||||
const topic = topics[0] || kws[0] || 'Artificial Intelligence';
|
||||
this.isSuggestionsLoading.set(true);
|
||||
|
||||
this.personsApiService
|
||||
.searchPersonsList(
|
||||
undefined, // query
|
||||
'University of Duisburg-Essen', // primary institution
|
||||
undefined, // sortBy
|
||||
undefined, // sortOrder
|
||||
[topic], // topic
|
||||
1, // page
|
||||
3, // pageSize
|
||||
undefined, // include (fetch all fields!)
|
||||
)
|
||||
.subscribe({
|
||||
next: (res) => {
|
||||
const list = (res.results || []).map((author: any) => ({
|
||||
id: author.id,
|
||||
name: author.display_name || 'Unbekannt',
|
||||
}));
|
||||
this.comparisonAuthors.set(list);
|
||||
this.isSuggestionsLoading.set(false);
|
||||
|
||||
if (!this.rawTrendResponse()) {
|
||||
this.fetchTrendData();
|
||||
}
|
||||
},
|
||||
error: (err) => {
|
||||
console.error('Failed to load default authors:', err);
|
||||
this.isSuggestionsLoading.set(false);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Fetch recommended institutions or authors for comparison based on current topics
|
||||
loadTrendSuggestions() {
|
||||
if (this.selectedSearchType() === 'authors') {
|
||||
this.loadRecommendedAuthors();
|
||||
return;
|
||||
}
|
||||
|
||||
this.isSuggestionsLoading.set(true);
|
||||
const kws = this.keywords();
|
||||
const topics = this.state?.topicsList() ?? kws;
|
||||
const topic =
|
||||
this.activeChartTopic() ||
|
||||
(this.selectedTrendTopics().length > 0
|
||||
? this.selectedTrendTopics()[0]
|
||||
: this.keywords().length > 0
|
||||
? this.keywords()[0]
|
||||
: topics.length > 0
|
||||
? topics[0]
|
||||
: 'Artificial Intelligence');
|
||||
|
||||
const countryFilter =
|
||||
@@ -526,18 +746,57 @@ export class UniTrendParentComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
// Trigger search trend data (only when "Search" is clicked)
|
||||
// Load UDE recommended authors for selected topic
|
||||
loadRecommendedAuthors() {
|
||||
this.isSuggestionsLoading.set(true);
|
||||
const kws = this.keywords();
|
||||
const topics = this.state?.topicsList() ?? kws;
|
||||
const topic =
|
||||
this.activeChartTopic() ||
|
||||
(this.selectedTrendTopics().length > 0
|
||||
? this.selectedTrendTopics()[0]
|
||||
: topics.length > 0
|
||||
? topics[0]
|
||||
: 'Artificial Intelligence');
|
||||
|
||||
this.personsApiService
|
||||
.searchPersonsList(
|
||||
undefined, // query
|
||||
'University of Duisburg-Essen', // UDE
|
||||
undefined, // sortBy
|
||||
undefined, // sortOrder
|
||||
[topic], // topic
|
||||
1, // page
|
||||
6, // pageSize
|
||||
undefined, // include (fetch all fields!)
|
||||
)
|
||||
.subscribe({
|
||||
next: (res) => {
|
||||
this.recommendedAuthors.set(res.results || []);
|
||||
this.isSuggestionsLoading.set(false);
|
||||
},
|
||||
error: () => {
|
||||
this.isSuggestionsLoading.set(false);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Trigger search trend data
|
||||
fetchTrendData() {
|
||||
const topics = this.selectedTrendTopics();
|
||||
if (topics.length === 0) return;
|
||||
|
||||
this.isTrendLoading.set(true);
|
||||
|
||||
// Save parameters of this request to check dirty state later
|
||||
this.fetchedSearchType.set(this.selectedSearchType());
|
||||
this.fetchedTopics.set([...topics]);
|
||||
this.fetchedInstitutions.set([...this.comparisonInstitutions()]);
|
||||
this.fetchedCountries.set([...this.comparisonCountries()]);
|
||||
this.fetchedRegions.set([...this.comparisonRegions()]);
|
||||
this.fetchedAuthors.set([...this.comparisonAuthors()]);
|
||||
|
||||
const kws = this.state?.keywordsList() ?? [];
|
||||
const softSearch = this.state?.softSearch() ?? true;
|
||||
|
||||
this.apiService
|
||||
.getTrendApiInseServiceUniversityRankingsTrendGet(
|
||||
@@ -545,6 +804,10 @@ export class UniTrendParentComponent implements OnInit {
|
||||
this.comparisonInstitutions().map((i: CompareItem) => i.id),
|
||||
this.comparisonCountries().map((c: CompareItem) => c.id),
|
||||
this.comparisonRegions().map((r: CompareItem) => r.id),
|
||||
kws,
|
||||
softSearch,
|
||||
this.selectedSearchType(),
|
||||
this.comparisonAuthors().map((a: CompareItem) => a.id),
|
||||
)
|
||||
.subscribe({
|
||||
next: (response: TrendResponse) => {
|
||||
@@ -561,6 +824,7 @@ export class UniTrendParentComponent implements OnInit {
|
||||
// Update query params to synchronize state
|
||||
updateUrlParams() {
|
||||
const queryParams: any = {
|
||||
search_type: this.selectedSearchType(),
|
||||
trend_topics: this.selectedTrendTopics(),
|
||||
institutions:
|
||||
this.comparisonInstitutions().length > 0
|
||||
@@ -580,6 +844,12 @@ export class UniTrendParentComponent implements OnInit {
|
||||
(r: CompareItem) => `${r.id}|${r.name}`,
|
||||
)
|
||||
: null,
|
||||
authors:
|
||||
this.comparisonAuthors().length > 0
|
||||
? this.comparisonAuthors().map(
|
||||
(a: CompareItem) => `${a.id}|${a.name}`,
|
||||
)
|
||||
: null,
|
||||
start_year: this.startYear(),
|
||||
end_year: this.endYear(),
|
||||
chart_mode: this.chartMode(),
|
||||
@@ -613,13 +883,36 @@ export class UniTrendParentComponent implements OnInit {
|
||||
|
||||
this.selectedTrendTopics.set(updated);
|
||||
|
||||
// Auto-update active tab selection if previous was removed
|
||||
const active = this.activeChartTopic();
|
||||
if (!updated.includes(active)) {
|
||||
this.activeChartTopic.set(updated[0] || '');
|
||||
}
|
||||
}
|
||||
|
||||
// Strategy SearchType changes
|
||||
setSearchType(
|
||||
type: 'publications' | 'authors' | 'patents' | 'projects' | 'news' | 'all',
|
||||
) {
|
||||
this.selectedSearchType.set(type);
|
||||
|
||||
// Auto-initialize default lists if empty for the target type
|
||||
const kws = this.keywords();
|
||||
if (kws.length > 0) {
|
||||
if (type === 'authors' && this.comparisonAuthors().length === 0) {
|
||||
this.initializeDefaultAuthors();
|
||||
} else if (
|
||||
type !== 'authors' &&
|
||||
type !== 'news' &&
|
||||
type !== 'all' &&
|
||||
this.comparisonInstitutions().length === 0
|
||||
) {
|
||||
this.initializeDefaultInstitutions();
|
||||
}
|
||||
}
|
||||
|
||||
this.updateUrlParams();
|
||||
}
|
||||
|
||||
// Add comparison institution
|
||||
addInstitution(id: string, name: string) {
|
||||
const current = this.comparisonInstitutions();
|
||||
@@ -633,7 +926,6 @@ export class UniTrendParentComponent implements OnInit {
|
||||
this.searchResults.set([]);
|
||||
}
|
||||
|
||||
// Remove comparison institution (data reuses instantly via computed)
|
||||
removeInstitution(id: string) {
|
||||
const current = this.comparisonInstitutions();
|
||||
this.comparisonInstitutions.set(
|
||||
@@ -665,7 +957,6 @@ export class UniTrendParentComponent implements OnInit {
|
||||
this.loadTrendSuggestions();
|
||||
}
|
||||
|
||||
// Remove country or region
|
||||
removeLocation(id: string, type: 'country' | 'continent') {
|
||||
if (type === 'country') {
|
||||
const current = this.comparisonCountries();
|
||||
@@ -681,6 +972,63 @@ export class UniTrendParentComponent implements OnInit {
|
||||
this.loadTrendSuggestions();
|
||||
}
|
||||
|
||||
// Add Top 3 Authors for a selected institution from institutions autocomplete
|
||||
addInstitutionAuthors(id: string, name: string) {
|
||||
const kws = this.keywords();
|
||||
const topics = this.state?.topicsList() ?? kws;
|
||||
const topic =
|
||||
this.activeChartTopic() || topics[0] || 'Artificial Intelligence';
|
||||
|
||||
this.isSuggestionsLoading.set(true);
|
||||
|
||||
this.personsApiService
|
||||
.searchPersonsList(
|
||||
undefined, // query
|
||||
name, // institutionName
|
||||
undefined, // sortBy
|
||||
undefined, // sortOrder
|
||||
[topic], // topic
|
||||
1, // page
|
||||
3, // pageSize
|
||||
undefined, // include
|
||||
)
|
||||
.subscribe({
|
||||
next: (res) => {
|
||||
const current = this.comparisonAuthors();
|
||||
const updated = [...current];
|
||||
(res.results || []).forEach((author: any) => {
|
||||
if (author.id && !updated.some((a) => a.id === author.id)) {
|
||||
updated.push({
|
||||
id: author.id,
|
||||
name: author.display_name || 'Unbekannt',
|
||||
});
|
||||
}
|
||||
});
|
||||
this.comparisonAuthors.set(updated);
|
||||
this.isSuggestionsLoading.set(false);
|
||||
},
|
||||
error: (err) => {
|
||||
console.error('Failed to load top authors for institution:', err);
|
||||
this.isSuggestionsLoading.set(false);
|
||||
},
|
||||
});
|
||||
|
||||
this.authorInstSearchQuery.set('');
|
||||
this.authorInstSearchResults.set([]);
|
||||
}
|
||||
|
||||
addAuthor(id: string, name: string) {
|
||||
const current = this.comparisonAuthors();
|
||||
if (!current.some((a) => a.id === id)) {
|
||||
this.comparisonAuthors.set([...current, { id, name }]);
|
||||
}
|
||||
}
|
||||
|
||||
removeAuthor(id: string) {
|
||||
const current = this.comparisonAuthors();
|
||||
this.comparisonAuthors.set(current.filter((a: CompareItem) => a.id !== id));
|
||||
}
|
||||
|
||||
// Scaling mode toggle (data reuses instantly)
|
||||
setChartMode(mode: 'normalized' | 'total' | 'cumulative') {
|
||||
this.chartMode.set(mode);
|
||||
@@ -732,4 +1080,45 @@ export class UniTrendParentComponent implements OnInit {
|
||||
this.locationSearchResults.set([]);
|
||||
}
|
||||
}
|
||||
|
||||
// Autocomplete query changes for authors in the authors tab (direct search)
|
||||
onAuthorSearchChange(query: string) {
|
||||
this.authorSearchQuery.set(query);
|
||||
if (query.trim().length >= 3) {
|
||||
this.personsApiService
|
||||
.searchPersonsAutocomplete(
|
||||
query,
|
||||
'display_name,last_known_institutions',
|
||||
)
|
||||
.subscribe({
|
||||
next: (res: any) => {
|
||||
this.authorSearchResults.set(res.results || []);
|
||||
},
|
||||
error: () => {
|
||||
this.authorSearchResults.set([]);
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.authorSearchResults.set([]);
|
||||
}
|
||||
}
|
||||
|
||||
// Autocomplete query changes for institutions inside the top-authors selector
|
||||
onAuthorInstSearchChange(query: string) {
|
||||
this.authorInstSearchQuery.set(query);
|
||||
if (query.trim().length >= 3) {
|
||||
this.institutionsApiService
|
||||
.autocompleteInstitutions(query, undefined, 'education', 10)
|
||||
.subscribe({
|
||||
next: (res: AutocompleteResponse) => {
|
||||
this.authorInstSearchResults.set(res.results || []);
|
||||
},
|
||||
error: () => {
|
||||
this.authorInstSearchResults.set([]);
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.authorInstSearchResults.set([]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<div class="author-institution-selector-container">
|
||||
<div class="search-compare-section">
|
||||
<div class="section-header">
|
||||
<h3>Top-Autoren einer Einrichtung hinzufügen</h3>
|
||||
</div>
|
||||
|
||||
<!-- Autocomplete Search Input for Institutions -->
|
||||
<div class="autocomplete-search">
|
||||
<mat-icon class="search-icon">search</mat-icon>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Einrichtung suchen, um deren Top-3 Autoren hinzuzufügen..."
|
||||
[value]="searchQuery()"
|
||||
(input)="onSearchInput($event)" />
|
||||
|
||||
@if (searchResults().length > 0) {
|
||||
<ul class="autocomplete-results">
|
||||
@for (result of searchResults(); track result.id) {
|
||||
<li>
|
||||
<button (click)="onSelectResult(result)">
|
||||
<span class="name">{{ result.display_name }}</span>
|
||||
<span class="hint">{{
|
||||
result.hint || result.entity_type
|
||||
}}</span>
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
.author-institution-selector-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: white;
|
||||
border: 1px solid #d7e4ff;
|
||||
border-radius: 16px;
|
||||
padding: 24px;
|
||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||
box-sizing: border-box;
|
||||
margin-top: 20px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.search-compare-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
|
||||
h3 {
|
||||
font-size: 0.9rem;
|
||||
font-weight: 700;
|
||||
color: #07163d;
|
||||
margin: 0 0 1rem 0;
|
||||
line-height: 1.2;
|
||||
}
|
||||
}
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 0.5rem;
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Autocomplete Search input */
|
||||
.autocomplete-search {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
.search-icon {
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 18px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
color: #9ca3af;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 0.6rem 0.6rem 0.6rem 2.2rem;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #d1d5db;
|
||||
font-size: 0.8125rem;
|
||||
outline: none;
|
||||
box-sizing: border-box;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:focus {
|
||||
border-color: #3b82f6;
|
||||
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.autocomplete-results {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 50;
|
||||
background: white;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
|
||||
margin-top: 4px;
|
||||
padding: 4px 0;
|
||||
list-style: none;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
|
||||
li button {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0.6rem 1rem;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transition: background 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
background: #f3f4f6;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
}
|
||||
.hint {
|
||||
font-size: 0.65rem;
|
||||
color: #6b7280;
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
import { Component, input, output } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
@Component({
|
||||
selector: 'app-author-institution-selector',
|
||||
standalone: true,
|
||||
imports: [CommonModule, MatIconModule],
|
||||
templateUrl: './author-institution-selector.component.html',
|
||||
styleUrl: './author-institution-selector.component.scss',
|
||||
})
|
||||
export class AuthorInstitutionSelectorComponent {
|
||||
readonly searchQuery = input<string>('');
|
||||
readonly searchResults = input<any[]>([]);
|
||||
|
||||
readonly addInstitutionAuthors = output<{ id: string; name: string }>();
|
||||
readonly searchChange = output<string>();
|
||||
|
||||
onSearchInput(event: Event): void {
|
||||
const val = (event.target as HTMLInputElement).value;
|
||||
this.searchChange.emit(val);
|
||||
}
|
||||
|
||||
onSelectResult(result: any): void {
|
||||
this.addInstitutionAuthors.emit({
|
||||
id: result.id || '',
|
||||
name: result.display_name || '',
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<div class="author-selector-container">
|
||||
<!-- Left Column: Search & Compared Authors -->
|
||||
<div class="search-compare-section">
|
||||
<div class="section-header">
|
||||
<h3>Autoren vergleichen</h3>
|
||||
</div>
|
||||
|
||||
<!-- Autocomplete Search Input for Authors -->
|
||||
<div class="autocomplete-search">
|
||||
<mat-icon class="search-icon">search</mat-icon>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Autor suchen und hinzufügen..."
|
||||
[value]="searchQuery()"
|
||||
(input)="onSearchInput($event)" />
|
||||
|
||||
@if (searchResults().length > 0) {
|
||||
<ul class="autocomplete-results">
|
||||
@for (result of searchResults(); track result.id) {
|
||||
<li>
|
||||
<button (click)="onSelectResult(result)">
|
||||
<span class="name">{{ result.display_name }}</span>
|
||||
<span class="hint">{{
|
||||
result.last_known_institutions?.[0]?.display_name ||
|
||||
'Keine Institution'
|
||||
}}</span>
|
||||
</button>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- List of Compared Authors -->
|
||||
<div class="comparison-list">
|
||||
@if (comparisonAuthors().length > 0) {
|
||||
<div class="chips-flex">
|
||||
@for (auth of comparisonAuthors(); track auth.id) {
|
||||
<div
|
||||
class="comparison-item"
|
||||
[style.border-color]="getEntityColor()(auth.id)"
|
||||
[style.background]="
|
||||
'color-mix(in srgb, ' +
|
||||
getEntityColor()(auth.id) +
|
||||
' 8%, #ffffff)'
|
||||
"
|
||||
[style.color]="getEntityColor()(auth.id)">
|
||||
<span class="item-name" [title]="auth.name">
|
||||
<mat-icon>person</mat-icon> {{ auth.name }}
|
||||
</span>
|
||||
<div class="item-actions">
|
||||
<button
|
||||
type="button"
|
||||
class="action-btn visibility-btn"
|
||||
(click)="onToggleVisibility(auth.id)"
|
||||
[style.color]="getEntityColor()(auth.id)"
|
||||
[title]="
|
||||
isVisible()(auth.id)
|
||||
? 'In Visualisierung ausblenden'
|
||||
: 'In Visualisierung einblenden'
|
||||
">
|
||||
<mat-icon>{{
|
||||
isVisible()(auth.id) ? 'visibility' : 'visibility_off'
|
||||
}}</mat-icon>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="action-btn remove-btn"
|
||||
(click)="onRemove(auth.id)"
|
||||
[style.color]="getEntityColor()(auth.id)"
|
||||
aria-label="Autor entfernen">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
<div class="empty-list-info">
|
||||
Keine Autoren ausgewählt. Suchen Sie nach Autoren, um sie zu
|
||||
vergleichen.
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right Column: Recommendations -->
|
||||
<div class="recommendations-section">
|
||||
<h3>
|
||||
Empfohlene Top-Autoren (UDE) für das Thema: {{ activeChartTopic() }}
|
||||
</h3>
|
||||
|
||||
<div class="suggestions-grid">
|
||||
@if (isSuggestionsLoading()) {
|
||||
<div class="suggestions-loader">
|
||||
<div class="spinner-small"></div>
|
||||
<span>Empfehlungen werden geladen...</span>
|
||||
</div>
|
||||
} @else {
|
||||
@if (topSuggestions().length === 0) {
|
||||
<p class="no-suggestions-msg">
|
||||
Keine Autorenempfehlungen für dieses Thema gefunden.
|
||||
</p>
|
||||
} @else {
|
||||
<div class="suggestions-flex">
|
||||
@for (item of topSuggestions(); track item.id || '') {
|
||||
<button
|
||||
type="button"
|
||||
class="suggestion-item-horizontal"
|
||||
(click)="onSelectSuggestion(item)"
|
||||
[disabled]="isAlreadyAdded(item.id)">
|
||||
<mat-icon class="add-icon">add</mat-icon>
|
||||
<div class="info">
|
||||
<strong class="name">{{ item.display_name }}</strong>
|
||||
<span class="meta">
|
||||
{{ item.works_count?.toLocaleString() || 0 }} Publikationen
|
||||
•
|
||||
{{ item.cited_by_count?.toLocaleString() || 0 }} Zitate
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,320 @@
|
||||
.author-selector-container {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1.5fr;
|
||||
gap: 24px;
|
||||
background: white;
|
||||
border: 1px solid #d7e4ff;
|
||||
border-radius: 16px;
|
||||
padding: 24px;
|
||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||
box-sizing: border-box;
|
||||
margin-top: 20px;
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 20px;
|
||||
padding: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.search-compare-section,
|
||||
.recommendations-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
|
||||
h3 {
|
||||
font-size: 0.9rem;
|
||||
font-weight: 700;
|
||||
color: #07163d;
|
||||
margin: 0 0 1rem 0;
|
||||
line-height: 1.2;
|
||||
}
|
||||
}
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 0.5rem;
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Autocomplete Search input */
|
||||
.autocomplete-search {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
margin-bottom: 1rem;
|
||||
|
||||
.search-icon {
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 18px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
color: #9ca3af;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 0.6rem 0.6rem 0.6rem 2.2rem;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #d1d5db;
|
||||
font-size: 0.8125rem;
|
||||
outline: none;
|
||||
box-sizing: border-box;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:focus {
|
||||
border-color: #3b82f6;
|
||||
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.autocomplete-results {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 50;
|
||||
background: white;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
|
||||
margin-top: 4px;
|
||||
padding: 4px 0;
|
||||
list-style: none;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
|
||||
li button {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0.6rem 1rem;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transition: background 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
background: #f3f4f6;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
}
|
||||
.hint {
|
||||
font-size: 0.65rem;
|
||||
color: #6b7280;
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Comparison list & chips */
|
||||
.comparison-list {
|
||||
flex: 1;
|
||||
min-height: 80px;
|
||||
|
||||
.empty-list-info {
|
||||
font-size: 0.75rem;
|
||||
color: #9ca3af;
|
||||
text-align: center;
|
||||
padding: 16px;
|
||||
border: 1px dashed #e5e7eb;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.chips-flex {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
max-height: 180px;
|
||||
overflow-y: auto;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.comparison-item {
|
||||
display: inline-flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 6px;
|
||||
padding: 0.35rem 0.6rem;
|
||||
gap: 8px;
|
||||
transition: all 0.2s ease;
|
||||
max-width: 100%;
|
||||
|
||||
.item-name {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 180px;
|
||||
|
||||
mat-icon {
|
||||
font-size: 14px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.item-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 2px;
|
||||
border-radius: 4px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.15s ease;
|
||||
|
||||
mat-icon {
|
||||
font-size: 14px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
&.remove-btn:hover {
|
||||
color: #ef4444 !important;
|
||||
background: #fee2e2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Recommendations suggestions section */
|
||||
.suggestions-grid {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.suggestions-flex {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 10px;
|
||||
max-height: 250px;
|
||||
overflow-y: auto;
|
||||
padding-right: 4px;
|
||||
|
||||
@media (max-width: 600px) {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.suggestion-item-horizontal {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
background: #f9fafb;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
box-sizing: border-box;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: #f3f4f6;
|
||||
border-color: #3b82f6;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
background: #f3f4f6;
|
||||
}
|
||||
|
||||
.add-icon {
|
||||
color: #3b82f6;
|
||||
font-size: 18px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
|
||||
.name {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: #1f2937;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.meta {
|
||||
font-size: 0.65rem;
|
||||
color: #6b7280;
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.no-suggestions-msg {
|
||||
font-size: 0.75rem;
|
||||
color: #6b7280;
|
||||
margin: 12px 0 0 0;
|
||||
}
|
||||
|
||||
.suggestions-loader {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 0.75rem;
|
||||
color: #6b7280;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.spinner-small {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-top: 2px solid #3b82f6;
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import { Component, input, output } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
export interface CompareItem {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-author-selector',
|
||||
standalone: true,
|
||||
imports: [CommonModule, MatIconModule],
|
||||
templateUrl: './author-selector.component.html',
|
||||
styleUrl: './author-selector.component.scss',
|
||||
})
|
||||
export class AuthorSelectorComponent {
|
||||
readonly comparisonAuthors = input<CompareItem[]>([]);
|
||||
readonly topSuggestions = input<any[]>([]);
|
||||
readonly isSuggestionsLoading = input<boolean>(false);
|
||||
readonly searchQuery = input<string>('');
|
||||
readonly searchResults = input<any[]>([]);
|
||||
readonly activeChartTopic = input<string>('');
|
||||
readonly getEntityColor = input<(id: string) => string>(() => '#9ca3af');
|
||||
readonly isVisible = input<(id: string) => boolean>(() => true);
|
||||
|
||||
readonly addAuthor = output<{ id: string; name: string }>();
|
||||
readonly removeAuthor = output<string>();
|
||||
readonly searchChange = output<string>();
|
||||
readonly toggleVisibility = output<string>();
|
||||
|
||||
onSearchInput(event: Event): void {
|
||||
const val = (event.target as HTMLInputElement).value;
|
||||
this.searchChange.emit(val);
|
||||
}
|
||||
|
||||
onSelectResult(result: any): void {
|
||||
this.addAuthor.emit({
|
||||
id: result.id || '',
|
||||
name: result.display_name || '',
|
||||
});
|
||||
}
|
||||
|
||||
onSelectSuggestion(item: any): void {
|
||||
this.addAuthor.emit({
|
||||
id: item.id || '',
|
||||
name: item.display_name || 'Unbekannt',
|
||||
});
|
||||
}
|
||||
|
||||
onRemove(id: string): void {
|
||||
this.removeAuthor.emit(id);
|
||||
}
|
||||
|
||||
onToggleVisibility(id: string): void {
|
||||
this.toggleVisibility.emit(id);
|
||||
}
|
||||
|
||||
isAlreadyAdded(id: string | undefined): boolean {
|
||||
if (!id) return false;
|
||||
return this.comparisonAuthors().some((i) => i.id === id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user