From 16c0b399c8cb1e1e5882bb2aa516a860db7efb44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Sun, 5 Jul 2026 19:47:16 +0200 Subject: [PATCH] feat(frontend/search): added card search template, moved institutions and projects to it --- .../institutions/institutions.component.html | 185 ++++++++---------- .../institutions/institutions.component.scss | 27 --- .../institutions/institutions.component.ts | 23 ++- .../modules/projects/projects.component.html | 149 ++++++-------- .../modules/projects/projects.component.scss | 27 --- .../modules/projects/projects.component.ts | 28 +-- .../ui/card-search/card-search.component.html | 54 +++++ .../ui/card-search/card-search.component.scss | 31 +++ .../ui/card-search/card-search.component.ts | 50 +++++ 9 files changed, 306 insertions(+), 268 deletions(-) create mode 100644 webapp/src/app/shared/ui/card-search/card-search.component.html create mode 100644 webapp/src/app/shared/ui/card-search/card-search.component.scss create mode 100644 webapp/src/app/shared/ui/card-search/card-search.component.ts diff --git a/webapp/src/app/modules/institutions/institutions.component.html b/webapp/src/app/modules/institutions/institutions.component.html index 5edb4c3c..b722948c 100644 --- a/webapp/src/app/modules/institutions/institutions.component.html +++ b/webapp/src/app/modules/institutions/institutions.component.html @@ -3,104 +3,89 @@ -
- - -
- - - -
-
- - - - @let institutionPageValue = institutionPage(); - - @if ( - institutionPageValue.elements && institutionPageValue.elements.length > 0 - ) { -
- @for (institution of institutionPageValue.elements; track $index) { - @let institutionId = extractInstitutionId(institution); - - - {{ getDisplayName(institution) }} - {{ institution.geo?.city }}, - {{ institution.geo?.country }} - - - - - - - - - - - - info - Übersicht - - - article - Publikationen - - - work - Projekte - - - verified - Patente - - - - - } -
- } @else { -
-

Keine passenden Institutionen gefunden.

-
- } - - - - + + + + + + {{ getDisplayName(institution) }} + {{ institution.geo?.city }}, + {{ institution.geo?.country }} + + + + + + + + + + + + info + Übersicht + + + article + Publikationen + + + work + Projekte + + + verified + Patente + + + + + diff --git a/webapp/src/app/modules/institutions/institutions.component.scss b/webapp/src/app/modules/institutions/institutions.component.scss index 8edbecef..ce9afb83 100644 --- a/webapp/src/app/modules/institutions/institutions.component.scss +++ b/webapp/src/app/modules/institutions/institutions.component.scss @@ -5,23 +5,6 @@ padding: 1rem; } -.sorting { - display: flex; - justify-content: flex-end; - gap: 0.5rem; -} - -.sorting select { - padding: 0.75rem; - border: 1px solid var(--sg-border); - border-radius: var(--sg-radius-sm); - font-size: 1rem; -} - -.sorting select:hover { - cursor: pointer; -} - .cards { display: grid; gap: 1.5rem; @@ -71,13 +54,3 @@ mat-card-actions a { border: 1px solid var(--sg-border); border-radius: var(--sg-radius-sm); } - -.no-results { - text-align: center; - padding: 2rem; - color: var(--sg-text-secondary); -} - -.search-and-sorting { - padding: 0 1rem; -} diff --git a/webapp/src/app/modules/institutions/institutions.component.ts b/webapp/src/app/modules/institutions/institutions.component.ts index 18eea25f..48abc772 100644 --- a/webapp/src/app/modules/institutions/institutions.component.ts +++ b/webapp/src/app/modules/institutions/institutions.component.ts @@ -1,16 +1,16 @@ -import { Component, input } from '@angular/core'; +import { Component, computed, input } from '@angular/core'; import { Institution, InstitutionPage } from '../../api'; import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card'; import { RouterModule } from '@angular/router'; import { MatIconModule } from '@angular/material/icon'; import { MatDividerModule } from '@angular/material/divider'; -import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component'; + +import { SelectorOption } from '../../shared/ui/query-param-selector/query-param-selector.component'; import { - QueryParamSelectorComponent, - SelectorOption, -} from '../../shared/ui/query-param-selector/query-param-selector.component'; -import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component'; + Page, + CardSearchComponent, +} from '../../shared/ui/card-search/card-search.component'; @Component({ selector: 'app-institutions', @@ -20,9 +20,7 @@ import { QueryParamInputComponent } from '../../shared/ui/query-param-input/quer MatIconModule, MatDividerModule, RouterModule, - QueryParamPaginatorComponent, - QueryParamSelectorComponent, - QueryParamInputComponent, + CardSearchComponent, ], templateUrl: './institutions.component.html', styleUrl: './institutions.component.scss', @@ -30,6 +28,13 @@ import { QueryParamInputComponent } from '../../shared/ui/query-param-input/quer export class InstitutionsComponent { institutionPage = input.required(); + page = computed(() => ({ + page: this.institutionPage().page || 0, + size: this.institutionPage().size || 10, + total: this.institutionPage().total || 0, + elements: this.institutionPage().elements || [], + })); + sortingOptions: SelectorOption[] = [ { value: 'relevance', display_name: 'Relevanz' }, { value: 'name', display_name: 'Name' }, diff --git a/webapp/src/app/modules/projects/projects.component.html b/webapp/src/app/modules/projects/projects.component.html index b2bcbddf..210363ec 100644 --- a/webapp/src/app/modules/projects/projects.component.html +++ b/webapp/src/app/modules/projects/projects.component.html @@ -2,98 +2,59 @@

Passende Projekte finden

- -
- - - -
- - EU - BUND - DFG - - -
- - - -
-
-
- - - - @let fundingProjectPageValue = fundingProjectPage(); - - @if ( - fundingProjectPageValue.elements && - fundingProjectPageValue.elements.length > 0 - ) { -
- @for (fundingProject of fundingProjectPageValue.elements; track $index) { - - - {{ fundingProject.title }} - {{ - fundingProject.type | uppercase - }} - - - - - - - - - - - - info - Übersicht - - - - - } -
- } @else { -
-

Keine passenden Projekte gefunden.

-
- } - - - - + + + + + + {{ element.title }} + {{ element.type | uppercase }} + + + + + + + + + + + + info + Übersicht + + + + + + + + + EU + BUND + DFG + + diff --git a/webapp/src/app/modules/projects/projects.component.scss b/webapp/src/app/modules/projects/projects.component.scss index 32a0f31e..55063bd0 100644 --- a/webapp/src/app/modules/projects/projects.component.scss +++ b/webapp/src/app/modules/projects/projects.component.scss @@ -5,23 +5,6 @@ padding: 1rem; } -.sorting { - display: flex; - justify-content: flex-end; - gap: 0.5rem; -} - -.sorting select { - padding: 0.75rem; - border: 1px solid var(--sg-border); - border-radius: var(--sg-radius-sm); - font-size: 1rem; -} - -.sorting select:hover { - cursor: pointer; -} - .cards { display: grid; gap: 1.5rem; @@ -29,10 +12,6 @@ padding: 0 1rem; } -mat-paginator { - background-color: var(--sg-background); -} - .card { padding: 0.5rem; background-color: var(--sg-background); @@ -76,12 +55,6 @@ mat-card-actions a { border-radius: var(--sg-radius-sm); } -.no-results { - text-align: center; - padding: 2rem; - color: var(--sg-text-secondary); -} - .mat-mdc-standard-chip { border-radius: var(--sg-radius-sm); } diff --git a/webapp/src/app/modules/projects/projects.component.ts b/webapp/src/app/modules/projects/projects.component.ts index 4361c9bb..984ee116 100644 --- a/webapp/src/app/modules/projects/projects.component.ts +++ b/webapp/src/app/modules/projects/projects.component.ts @@ -1,4 +1,4 @@ -import { Component, input, signal } from '@angular/core'; +import { Component, computed, input, signal } from '@angular/core'; import { FundingProject, FundingProjectPage, ProjectType } from '../../api'; import { MatDividerModule } from '@angular/material/divider'; import { MatIconModule } from '@angular/material/icon'; @@ -8,12 +8,12 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { MatButtonModule } from '@angular/material/button'; import { DatePipe, UpperCasePipe } from '@angular/common'; import { MatChipListboxChange, MatChipsModule } from '@angular/material/chips'; -import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component'; -import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component'; + +import { SelectorOption } from '../../shared/ui/query-param-selector/query-param-selector.component'; import { - QueryParamSelectorComponent, - SelectorOption, -} from '../../shared/ui/query-param-selector/query-param-selector.component'; + CardSearchComponent, + Page, +} from '../../shared/ui/card-search/card-search.component'; @Component({ selector: 'app-projects', @@ -26,9 +26,7 @@ import { UpperCasePipe, DatePipe, MatChipsModule, - QueryParamInputComponent, - QueryParamPaginatorComponent, - QueryParamSelectorComponent, + CardSearchComponent, ], templateUrl: './projects.component.html', styleUrl: './projects.component.scss', @@ -36,6 +34,13 @@ import { export class ProjectsComponent { fundingProjectPage = input.required(); + page = computed(() => ({ + page: this.fundingProjectPage().page || 0, + size: this.fundingProjectPage().size || 10, + total: this.fundingProjectPage().total || 0, + elements: this.fundingProjectPage().elements || [], + })); + urlChips = signal(['eu', 'bund', 'dfg']); sortingOptions: SelectorOption[] = [{ value: 'title', display_name: 'Name' }]; @@ -72,13 +77,14 @@ export class ProjectsComponent { getDetaiLink(fundingProject: FundingProject): string | null { if (fundingProject.type === 'bund') { - const encodedId = encodeURIComponent(fundingProject.id) + const encodedId = encodeURIComponent(fundingProject.id); return '/projects/bund/' + encodedId; } else if (fundingProject.type === 'dfg') { return '/projects/dfg/' + fundingProject.id; } else if (fundingProject.type === 'eu') { return '/projects/eu/' + fundingProject.id; - } else + } else { return null; } + } } diff --git a/webapp/src/app/shared/ui/card-search/card-search.component.html b/webapp/src/app/shared/ui/card-search/card-search.component.html new file mode 100644 index 00000000..c06d03a6 --- /dev/null +++ b/webapp/src/app/shared/ui/card-search/card-search.component.html @@ -0,0 +1,54 @@ + diff --git a/webapp/src/app/shared/ui/card-search/card-search.component.scss b/webapp/src/app/shared/ui/card-search/card-search.component.scss new file mode 100644 index 00000000..521dda4c --- /dev/null +++ b/webapp/src/app/shared/ui/card-search/card-search.component.scss @@ -0,0 +1,31 @@ +.card-search { + display: flex; + flex-direction: column; + gap: 1rem; +} + +.card-search-filter { + display: flex; + flex-direction: row; + gap: 1rem; + padding: 0rem 1rem; +} + +.cards { + display: grid; + gap: 1.5rem; + grid-template-columns: repeat(auto-fit, minmax(var(--card-min-width), 1fr)); + padding: 0 1rem; +} + +.pagination { + display: flex; + justify-content: end; + padding: 0rem 1rem; +} + +.no-results { + text-align: center; + padding: 2rem; + color: var(--sg-text-secondary); +} diff --git a/webapp/src/app/shared/ui/card-search/card-search.component.ts b/webapp/src/app/shared/ui/card-search/card-search.component.ts new file mode 100644 index 00000000..0b8bcc5b --- /dev/null +++ b/webapp/src/app/shared/ui/card-search/card-search.component.ts @@ -0,0 +1,50 @@ +import { Component, input, TemplateRef } from '@angular/core'; +import { QueryParamInputComponent } from '../query-param-input/query-param-input.component'; +import { + QueryParamSelectorComponent, + SelectorOption, +} from '../query-param-selector/query-param-selector.component'; +import { MatDivider } from '@angular/material/divider'; +import { QueryParamPaginatorComponent } from '../query-param-paginator/query-param-paginator.component'; +import { NgTemplateOutlet } from '@angular/common'; + +export type Page = { + page: number; + size: number; + total: number; + elements: any[]; +}; + +@Component({ + selector: 'app-card-search', + imports: [ + QueryParamInputComponent, + QueryParamSelectorComponent, + MatDivider, + QueryParamPaginatorComponent, + NgTemplateOutlet, + ], + templateUrl: './card-search.component.html', + styleUrl: './card-search.component.scss', +}) +export class CardSearchComponent { + cardTmp = input.required>(); + additionalFiltersTmp = input>(); + noResultsTmp = input>(); + + + cardMinWidth = input(300); + + page = input.required(); + + withSearch = input(true); + searchLabel = input('Suchen'); + searchQueryParamKey = input('search'); + + sortingOptions = input(); + sortByQueryParamKey = input('sort_by'); + sortByLabel = input('Sortieren nach'); + sortingDirectionOptions = input(); + sortingDirectionQueryParamKey = input('sorting_order'); + sortingDirectionLabel = input('Sortierreihenfolge'); +}