removed year selector from resolver. Adapted child components to scale dynamically
This commit is contained in:
@@ -262,8 +262,6 @@ export const routes: Routes = [
|
||||
'countries',
|
||||
'regions',
|
||||
'authors',
|
||||
'start_year',
|
||||
'end_year',
|
||||
'fuzzy',
|
||||
];
|
||||
return keys.some(
|
||||
|
||||
+64
-68
@@ -183,88 +183,84 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Restructured Full-Width Comparison Panels Grid -->
|
||||
<div class="comparison-panels-grid">
|
||||
<!-- Combined Child Component Selectors Row (fits into a single line on desktop) -->
|
||||
<div class="comparison-selectors-row">
|
||||
<!-- Countries / Regions Selector -->
|
||||
@if (activeConfig().showLocationSelector) {
|
||||
<div class="comparison-panel-card">
|
||||
<app-location-selector
|
||||
[comparisonCountries]="comparisonCountries()"
|
||||
[comparisonRegions]="comparisonRegions()"
|
||||
[locationQuery]="locationQuery()"
|
||||
[locationSearchResults]="locationSearchResults()"
|
||||
[getEntityColor]="boundGetEntityColor"
|
||||
[isVisible]="boundIsVisible"
|
||||
[selectedPieEntityId]="selectedPieEntity()?.id ?? null"
|
||||
(addLocation)="addLocation($event)"
|
||||
(removeLocation)="removeLocation($event.id, $event.type)"
|
||||
(searchChange)="onLocationSearchChange($event)"
|
||||
(toggleVisibility)="toggleVisibility($event)"
|
||||
(selectPie)="onSelectPieEntity($event)">
|
||||
</app-location-selector>
|
||||
</div>
|
||||
<app-location-selector
|
||||
class="selector-item"
|
||||
[comparisonCountries]="comparisonCountries()"
|
||||
[comparisonRegions]="comparisonRegions()"
|
||||
[locationQuery]="locationQuery()"
|
||||
[locationSearchResults]="locationSearchResults()"
|
||||
[getEntityColor]="boundGetEntityColor"
|
||||
[isVisible]="boundIsVisible"
|
||||
[selectedPieEntityId]="selectedPieEntity()?.id ?? null"
|
||||
(addLocation)="addLocation($event)"
|
||||
(removeLocation)="removeLocation($event.id, $event.type)"
|
||||
(searchChange)="onLocationSearchChange($event)"
|
||||
(toggleVisibility)="toggleVisibility($event)"
|
||||
(selectPie)="onSelectPieEntity($event)">
|
||||
</app-location-selector>
|
||||
}
|
||||
|
||||
<!-- Top-Autoren einer Einrichtung hinzufügen -->
|
||||
@if (activeConfig().showAuthorSelector) {
|
||||
<div class="comparison-panel-card">
|
||||
<app-author-institution-selector
|
||||
[searchQuery]="authorInstSearchQuery()"
|
||||
[searchResults]="authorInstSearchResults()"
|
||||
(addInstitutionAuthors)="
|
||||
addInstitutionAuthors($event.id, $event.name)
|
||||
"
|
||||
(searchChange)="onAuthorInstSearchChange($event)">
|
||||
</app-author-institution-selector>
|
||||
</div>
|
||||
<app-author-institution-selector
|
||||
class="selector-item"
|
||||
[searchQuery]="authorInstSearchQuery()"
|
||||
[searchResults]="authorInstSearchResults()"
|
||||
(addInstitutionAuthors)="
|
||||
addInstitutionAuthors($event.id, $event.name)
|
||||
"
|
||||
(searchChange)="onAuthorInstSearchChange($event)">
|
||||
</app-author-institution-selector>
|
||||
}
|
||||
|
||||
<!-- Unified Institution Search, Compare, & Recommendations -->
|
||||
@if (activeConfig().showInstitutionSelector) {
|
||||
<div class="comparison-panel-card full-width-panel">
|
||||
<app-institution-selector
|
||||
[activeTab]="selectedSearchType()"
|
||||
[comparisonInstitutions]="comparisonInstitutions()"
|
||||
[primaryInstitution]="primaryInstitution()"
|
||||
[primaryInstitutionName]="primaryInstitutionName()"
|
||||
[topSuggestions]="topSuggestions()"
|
||||
[isSuggestionsLoading]="isSuggestionsLoading()"
|
||||
[activeChartTopic]="activeChartTopic()"
|
||||
[searchQuery]="searchQuery()"
|
||||
[searchResults]="searchResults()"
|
||||
[getEntityColor]="boundGetEntityColor"
|
||||
[isVisible]="boundIsVisible"
|
||||
[selectedPieEntityId]="selectedPieEntity()?.id ?? null"
|
||||
(addInstitution)="addInstitution($event.id, $event.name)"
|
||||
(removeInstitution)="removeInstitution($event)"
|
||||
(searchChange)="onSearchChange($event)"
|
||||
(toggleVisibility)="toggleVisibility($event)"
|
||||
(selectPie)="onSelectPieEntity($event)">
|
||||
</app-institution-selector>
|
||||
</div>
|
||||
<app-institution-selector
|
||||
class="selector-item selector-item--main"
|
||||
[activeTab]="selectedSearchType()"
|
||||
[comparisonInstitutions]="comparisonInstitutions()"
|
||||
[primaryInstitution]="primaryInstitution()"
|
||||
[primaryInstitutionName]="primaryInstitutionName()"
|
||||
[topSuggestions]="topSuggestions()"
|
||||
[isSuggestionsLoading]="isSuggestionsLoading()"
|
||||
[activeChartTopic]="activeChartTopic()"
|
||||
[searchQuery]="searchQuery()"
|
||||
[searchResults]="searchResults()"
|
||||
[getEntityColor]="boundGetEntityColor"
|
||||
[isVisible]="boundIsVisible"
|
||||
[selectedPieEntityId]="selectedPieEntity()?.id ?? null"
|
||||
(addInstitution)="addInstitution($event.id, $event.name)"
|
||||
(removeInstitution)="removeInstitution($event)"
|
||||
(searchChange)="onSearchChange($event)"
|
||||
(toggleVisibility)="toggleVisibility($event)"
|
||||
(selectPie)="onSelectPieEntity($event)">
|
||||
</app-institution-selector>
|
||||
}
|
||||
|
||||
<!-- Reusable Author Selection UI -->
|
||||
@if (activeConfig().showAuthorSelector) {
|
||||
<div class="comparison-panel-card full-width-panel">
|
||||
<app-author-selector
|
||||
[activeTab]="selectedSearchType()"
|
||||
[comparisonAuthors]="comparisonAuthors()"
|
||||
[topSuggestions]="recommendedAuthors()"
|
||||
[isSuggestionsLoading]="isSuggestionsLoading()"
|
||||
[activeChartTopic]="activeChartTopic()"
|
||||
[searchQuery]="authorSearchQuery()"
|
||||
[searchResults]="authorSearchResults()"
|
||||
[getEntityColor]="boundGetEntityColor"
|
||||
[isVisible]="boundIsVisible"
|
||||
[selectedPieEntityId]="selectedPieEntity()?.id ?? null"
|
||||
(addAuthor)="addAuthor($event.id, $event.name)"
|
||||
(removeAuthor)="removeAuthor($event)"
|
||||
(searchChange)="onAuthorSearchChange($event)"
|
||||
(toggleVisibility)="toggleVisibility($event)"
|
||||
(selectPie)="onSelectPieEntity($event)">
|
||||
</app-author-selector>
|
||||
</div>
|
||||
<app-author-selector
|
||||
class="selector-item selector-item--main"
|
||||
[activeTab]="selectedSearchType()"
|
||||
[comparisonAuthors]="comparisonAuthors()"
|
||||
[topSuggestions]="recommendedAuthors()"
|
||||
[isSuggestionsLoading]="isSuggestionsLoading()"
|
||||
[activeChartTopic]="activeChartTopic()"
|
||||
[searchQuery]="authorSearchQuery()"
|
||||
[searchResults]="authorSearchResults()"
|
||||
[getEntityColor]="boundGetEntityColor"
|
||||
[isVisible]="boundIsVisible"
|
||||
[selectedPieEntityId]="selectedPieEntity()?.id ?? null"
|
||||
(addAuthor)="addAuthor($event.id, $event.name)"
|
||||
(removeAuthor)="removeAuthor($event)"
|
||||
(searchChange)="onAuthorSearchChange($event)"
|
||||
(toggleVisibility)="toggleVisibility($event)"
|
||||
(selectPie)="onSelectPieEntity($event)">
|
||||
</app-author-selector>
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
|
||||
+13
-15
@@ -201,26 +201,24 @@
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.comparison-panels-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
|
||||
.comparison-selectors-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: stretch;
|
||||
gap: 1.25rem;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
.full-width-panel {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
}
|
||||
.selector-item {
|
||||
flex: 1 1 300px;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
.comparison-panel-card {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
border: 1px solid #e5e7eb;
|
||||
padding: 1.25rem;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
&.selector-item--main {
|
||||
flex: 2 1 450px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.no-data-fallback {
|
||||
|
||||
+87
-19
@@ -337,12 +337,18 @@ export class UniTrendParentComponent implements OnInit {
|
||||
return this.getTopicColor(topicName);
|
||||
}
|
||||
|
||||
const cleanId = (id: string | null | undefined): string => {
|
||||
if (!id) return '';
|
||||
const lower = id.toLowerCase().trim();
|
||||
return lower.includes('/') ? lower.split('/').pop()! : lower;
|
||||
};
|
||||
|
||||
const defaultInstId = 'https://openalex.org/I62318514';
|
||||
const primaryId = this.primaryInstitution() || defaultInstId;
|
||||
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 primaryId = cleanId(this.primaryInstitution() || defaultInstId);
|
||||
const insts = this.comparisonInstitutions().map((i) => cleanId(i.id));
|
||||
const countries = this.comparisonCountries().map((c) => cleanId(c.id));
|
||||
const regions = this.comparisonRegions().map((r) => cleanId(r.id));
|
||||
const authors = this.comparisonAuthors().map((a) => cleanId(a.id));
|
||||
|
||||
const orderedIds = [
|
||||
primaryId,
|
||||
@@ -352,7 +358,8 @@ export class UniTrendParentComponent implements OnInit {
|
||||
...authors,
|
||||
];
|
||||
|
||||
const idx = orderedIds.indexOf(entityId);
|
||||
const targetCleanId = cleanId(entityId);
|
||||
const idx = orderedIds.indexOf(targetCleanId);
|
||||
if (idx === -1) return '#9ca3af';
|
||||
|
||||
const entityColors = [
|
||||
@@ -388,7 +395,7 @@ export class UniTrendParentComponent implements OnInit {
|
||||
readonly boundGetEntityColor = (id: string) => this.getEntityColor(id);
|
||||
readonly boundIsVisible = (id: string) => this.isVisible(id);
|
||||
|
||||
// Computed: filters out items locally if they were removed from list and normalizes topic_data keys
|
||||
// Computed: filters out items locally if they were removed from list and normalizes topic_data keys & entity names
|
||||
readonly trendResponse = computed(() => {
|
||||
const raw = this.rawTrendResponse();
|
||||
if (!raw || !raw.series) return null;
|
||||
@@ -396,11 +403,81 @@ export class UniTrendParentComponent implements OnInit {
|
||||
const topics = this.selectedTrendTopics();
|
||||
const type = this.selectedSearchType();
|
||||
|
||||
const cleanId = (id: string | null | undefined): string => {
|
||||
if (!id) return '';
|
||||
const lower = id.toLowerCase().trim();
|
||||
return lower.includes('/') ? lower.split('/').pop()! : lower;
|
||||
};
|
||||
|
||||
const primaryInstCleanId = cleanId(
|
||||
this.primaryInstitution() || 'I62318514',
|
||||
);
|
||||
|
||||
const resolveEntityName = (s: TrendSeries): string => {
|
||||
const cId = cleanId(s.entity_id);
|
||||
|
||||
if (s.entity_type === 'institution') {
|
||||
if (cId === primaryInstCleanId) {
|
||||
return (
|
||||
this.primaryInstitutionName() ||
|
||||
s.entity_name ||
|
||||
'Haupt-Einrichtung'
|
||||
);
|
||||
}
|
||||
const foundInst = this.comparisonInstitutions().find(
|
||||
(i) => cleanId(i.id) === cId,
|
||||
);
|
||||
if (foundInst && foundInst.name && foundInst.name !== foundInst.id) {
|
||||
return foundInst.name;
|
||||
}
|
||||
} else if (s.entity_type === 'country') {
|
||||
const foundCountry = this.comparisonCountries().find(
|
||||
(c) => cleanId(c.id) === cId,
|
||||
);
|
||||
if (
|
||||
foundCountry &&
|
||||
foundCountry.name &&
|
||||
foundCountry.name !== foundCountry.id
|
||||
) {
|
||||
return foundCountry.name;
|
||||
}
|
||||
} else if (s.entity_type === 'region') {
|
||||
const foundRegion = this.comparisonRegions().find(
|
||||
(r) => cleanId(r.id) === cId,
|
||||
);
|
||||
if (
|
||||
foundRegion &&
|
||||
foundRegion.name &&
|
||||
foundRegion.name !== foundRegion.id
|
||||
) {
|
||||
return foundRegion.name;
|
||||
}
|
||||
} else if (s.entity_type === 'author') {
|
||||
const foundAuthor = this.comparisonAuthors().find(
|
||||
(a) => cleanId(a.id) === cId,
|
||||
);
|
||||
if (
|
||||
foundAuthor &&
|
||||
foundAuthor.name &&
|
||||
foundAuthor.name !== foundAuthor.id
|
||||
) {
|
||||
return foundAuthor.name;
|
||||
}
|
||||
}
|
||||
|
||||
return s.entity_name &&
|
||||
!s.entity_name.startsWith('I') &&
|
||||
s.entity_name.length > 8
|
||||
? s.entity_name
|
||||
: s.entity_name || cId;
|
||||
};
|
||||
|
||||
// Map series topic_data keys to display names so they match selectedTrendTopics
|
||||
const normalizeTopicData = (s: TrendSeries): TrendSeries => {
|
||||
if (!s.topic_data) return s;
|
||||
const nameResolved = resolveEntityName(s);
|
||||
if (!s.topic_data) return { ...s, entity_name: nameResolved };
|
||||
const rawTopicKeys = Object.keys(s.topic_data);
|
||||
if (rawTopicKeys.length === 0) return s;
|
||||
if (rawTopicKeys.length === 0) return { ...s, entity_name: nameResolved };
|
||||
|
||||
const newTopicData: Record<string, TopicYearlyData[]> = {};
|
||||
|
||||
@@ -430,6 +507,7 @@ export class UniTrendParentComponent implements OnInit {
|
||||
|
||||
return {
|
||||
...s,
|
||||
entity_name: nameResolved,
|
||||
topic_data: newTopicData,
|
||||
};
|
||||
};
|
||||
@@ -461,13 +539,6 @@ export class UniTrendParentComponent implements OnInit {
|
||||
}
|
||||
|
||||
// Default: publications, patents, projects
|
||||
// Resilient ID normalization helper
|
||||
const cleanId = (id: string | null | undefined): string => {
|
||||
if (!id) return '';
|
||||
const lower = id.toLowerCase().trim();
|
||||
return lower.includes('/') ? lower.split('/').pop()! : lower;
|
||||
};
|
||||
|
||||
const currentInstIds = new Set(
|
||||
this.comparisonInstitutions().map((i: CompareItem) => cleanId(i.id)),
|
||||
);
|
||||
@@ -477,9 +548,6 @@ export class UniTrendParentComponent implements OnInit {
|
||||
const currentRegionIds = new Set(
|
||||
this.comparisonRegions().map((r: CompareItem) => cleanId(r.id)),
|
||||
);
|
||||
const primaryInstCleanId = cleanId(
|
||||
this.primaryInstitution() || 'I62318514',
|
||||
);
|
||||
|
||||
const primaryInstSeries: TrendSeries[] = [];
|
||||
const compInstSeries: TrendSeries[] = [];
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
:host {
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.institution-selector-container {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1.5fr;
|
||||
@@ -8,7 +15,7 @@
|
||||
padding: 24px;
|
||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||
box-sizing: border-box;
|
||||
margin-top: 20px;
|
||||
margin-top: 0;
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
grid-template-columns: 1fr;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
:host {
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.control-card {
|
||||
background: white;
|
||||
border-radius: 10px;
|
||||
|
||||
Reference in New Issue
Block a user