From 5c4dbe602f6b51411095d6e82105ec4f249ae614 Mon Sep 17 00:00:00 2001
From: Kazgatari <56477241+Kazgatari@users.noreply.github.com>
Date: Thu, 23 Jul 2026 19:43:26 +0200
Subject: [PATCH] removed year selector from resolver. Adapted child components
to scale dynamically
---
webapp/src/app/app.routes.ts | 2 -
.../uni-trend-parent.component.html | 132 +++++++++---------
.../uni-trend-parent.component.scss | 28 ++--
.../uni-trend-parent.component.ts | 106 +++++++++++---
.../institution-selector.component.scss | 9 +-
.../location-selector.component.scss | 7 +
6 files changed, 179 insertions(+), 105 deletions(-)
diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts
index 0f21900e..48127b36 100644
--- a/webapp/src/app/app.routes.ts
+++ b/webapp/src/app/app.routes.ts
@@ -262,8 +262,6 @@ export const routes: Routes = [
'countries',
'regions',
'authors',
- 'start_year',
- 'end_year',
'fuzzy',
];
return keys.some(
diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html
index 5dde3d72..ccc758ea 100644
--- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html
+++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html
@@ -183,88 +183,84 @@
}
-
-
+
+
@if (activeConfig().showLocationSelector) {
-
+
+
}
@if (activeConfig().showAuthorSelector) {
-
+
+
}
@if (activeConfig().showInstitutionSelector) {
-
+
+
}
@if (activeConfig().showAuthorSelector) {
-
+
+
}
} @else {
diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.scss b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.scss
index 3b8c9181..c6318867 100644
--- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.scss
+++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.scss
@@ -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 {
diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts
index 7a1635eb..93a3b375 100644
--- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts
+++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.ts
@@ -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
= {};
@@ -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[] = [];
diff --git a/webapp/src/app/shared/ui/institution-selector/institution-selector.component.scss b/webapp/src/app/shared/ui/institution-selector/institution-selector.component.scss
index 733745d7..6f9d42f5 100644
--- a/webapp/src/app/shared/ui/institution-selector/institution-selector.component.scss
+++ b/webapp/src/app/shared/ui/institution-selector/institution-selector.component.scss
@@ -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;
diff --git a/webapp/src/app/shared/ui/location-selector/location-selector.component.scss b/webapp/src/app/shared/ui/location-selector/location-selector.component.scss
index 08b79102..d61042fb 100644
--- a/webapp/src/app/shared/ui/location-selector/location-selector.component.scss
+++ b/webapp/src/app/shared/ui/location-selector/location-selector.component.scss
@@ -1,3 +1,10 @@
+:host {
+ display: block;
+ width: 100%;
+ min-width: 0;
+ max-width: 100%;
+}
+
.control-card {
background: white;
border-radius: 10px;