added loading component, adjusted ui #192

Merged
genja merged 1 commits from feature/keywords-analysis into dev 2026-07-06 14:50:35 +02:00
3 changed files with 311 additions and 285 deletions
@@ -11,7 +11,10 @@
<input
matInput
placeholder="https://example.com/article"
[formControl]="form.controls.urlInput" />
[formControl]="form.controls.urlInput"
(keydown.enter)="
onExtractKeywordsClick(); $event.preventDefault()
" />
</mat-form-field>
<button
mat-flat-button
@@ -55,46 +58,38 @@
</div>
</mat-tab>
</mat-tab-group>
@if (isExtracting()) {
<div class="progress-container">
<mat-progress-bar
mode="determinate"
[value]="progress()"
color="primary">
</mat-progress-bar>
<div class="status-message">{{ statusMessage() }}</div>
</div>
}
<!-- Extraction Table -->
@if (keywordsExist()) {
@if (isExtracting() || keywordsExist()) {
<!-- Extraction Table -->
<div class="extraction-grid">
<mat-card class="keyword-card extracted-card">
<mat-card-content>
<!-- View toggle: Topic Mapping vs. LLM Keywords -->
<div class="keywords-toolbar">
@if (topicLegendGroups.length > 0) {
<app-topic-legend
[groups]="topicLegendGroups"
[visible]="subfieldLegendVisible()"
[expanded]="subfieldLegendExpanded()"
[collapsedGroupLimit]="3"
variant="default"
(visibleChange)="onSubfieldLegendVisibleChange($event)"
(expandedChange)="onSubfieldLegendExpandedChange($event)">
</app-topic-legend>
}
<mat-card
class="keyword-card progress-container"
[class.loading]="isExtracting()">
@if (keywordsExist()) {
<mat-card-content>
<!-- View toggle: Topic Mapping vs. LLM Keywords -->
<div class="keywords-toolbar">
@if (topicLegendGroups.length > 0) {
<app-topic-legend
[groups]="topicLegendGroups"
[visible]="subfieldLegendVisible()"
[expanded]="subfieldLegendExpanded()"
[collapsedGroupLimit]="3"
variant="default"
(visibleChange)="onSubfieldLegendVisibleChange($event)"
(expandedChange)="onSubfieldLegendExpandedChange($event)">
</app-topic-legend>
}
<!-- Manual input is ALWAYS available, independent of extraction state -->
<div class="toolbar-wrapper">
@if (!isExtracting()) {
<!-- Manual input is ALWAYS available, independent of extraction state -->
<div class="toolbar-wrapper">
<div class="toolbar-controls thick-border">
<div class="toolbar-group toolbar-group--view">
@if (areAllSelected()) {
<button
mat-stroked-button
color="primary"
(click)="deselectAll()">
(click)="deselectAll()"
[disabled]="isExtracting()">
<mat-icon>select_all</mat-icon>
<span>Alle abwählen</span>
</button>
@@ -117,12 +112,14 @@
(change)="onViewToggleChange($event.value)"
aria-label="Keyword Ansicht wählen">
<mat-button-toggle
[disabled]="isExtracting()"
value="llm"
matTooltip="Extrahierte Keywords">
<mat-icon>text_fields</mat-icon>
<span>Extrahierte Keywords</span>
</mat-button-toggle>
<mat-button-toggle
[disabled]="isExtracting()"
value="topic"
matTooltip="Topic Mapping">
<mat-icon>account_tree</mat-icon>
@@ -143,63 +140,27 @@
</button>
</div>
</div>
} @else {
<!-- Empty placeholder keeps grid column 1 occupied so
the autocomplete below stays fixed in column 2 -->
<div
class="toolbar-controls toolbar-controls--placeholder"></div>
}
<div class="spacer toolbar-controls manual-input-controls">
<app-topic-autocomplete
label="z. B. Knowledge Graphs"
placeholder="Thema suchen oder eintippen..."
(topicSelected)="addKeywordFromInput($event)" />
<div class="spacer toolbar-controls manual-input-controls">
<app-topic-autocomplete
label="z. B. Knowledge Graphs"
placeholder="Thema suchen oder eintippen..."
(topicSelected)="addKeywordFromInput($event)" />
</div>
</div>
</div>
</div>
<!-- ===== Reusable chip stack templates ===== -->
<ng-template
#keywordChipStack
let-keywords="keywords"
let-emptyText="emptyText">
@if (keywords.length > 0) {
<div class="keyword-chip-stack">
@for (
keyword of keywords;
track keyword.llm_keyword.keyword
) {
<app-topic-chip
[label]="getChipLabel(keyword)"
[count]="
keywordView() === 'topic' ? getChipCount(keyword) : null
"
[description]="getChipDescription(keyword)"
[subfieldName]="getChipSubfieldName(keyword)"
[fieldName]="getChipFieldName(keyword)"
[domainName]="getChipDomainName(keyword)"
[color]="getTopicColor(keyword.topic_mapping?.topic)"
[active]="isKeywordSelected(keyword)"
countIcon="article"
descriptionTooltipTarget="button"
(chipClick)="toggleKeywordSelection(keyword)">
</app-topic-chip>
}
</div>
} @else {
<p class="empty-state small">{{ emptyText }}</p>
}
</ng-template>
<ng-template #manualChipStack>
<div class="keyword-chip-stack manual-stack">
@if (manualKeywords().length > 0) {
@for (
keyword of manualKeywords();
track keyword.llm_keyword.keyword
) {
<div class="manual-chip-row">
<!-- ===== Reusable chip stack templates ===== -->
<ng-template
#keywordChipStack
let-keywords="keywords"
let-emptyText="emptyText">
@if (keywords.length > 0) {
<div class="keyword-chip-stack">
@for (
keyword of keywords;
track keyword.llm_keyword.keyword
) {
<app-topic-chip
[label]="getChipLabel(keyword)"
[count]="
@@ -217,173 +178,225 @@
descriptionTooltipTarget="button"
(chipClick)="toggleKeywordSelection(keyword)">
</app-topic-chip>
<button
mat-icon-button
type="button"
color="warn"
aria-label="Manuelles Keyword entfernen"
(click)="removeManualKeyword(keyword)">
<mat-icon>cancel</mat-icon>
</button>
}
</div>
} @else {
<p class="empty-state small">{{ emptyText }}</p>
}
</ng-template>
<ng-template #manualChipStack>
<div class="keyword-chip-stack manual-stack">
@if (manualKeywords().length > 0) {
@for (
keyword of manualKeywords();
track keyword.llm_keyword.keyword
) {
<div class="manual-chip-row">
<app-topic-chip
[label]="getChipLabel(keyword)"
[count]="
keywordView() === 'topic'
? getChipCount(keyword)
: null
"
[description]="getChipDescription(keyword)"
[subfieldName]="getChipSubfieldName(keyword)"
[fieldName]="getChipFieldName(keyword)"
[domainName]="getChipDomainName(keyword)"
[color]="getTopicColor(keyword.topic_mapping?.topic)"
[active]="isKeywordSelected(keyword)"
countIcon="article"
descriptionTooltipTarget="button"
(chipClick)="toggleKeywordSelection(keyword)">
</app-topic-chip>
<button
mat-icon-button
type="button"
color="warn"
aria-label="Manuelles Keyword entfernen"
(click)="removeManualKeyword(keyword)">
<mat-icon>cancel</mat-icon>
</button>
</div>
}
} @else {
<p class="empty-state small">Nichts hinzugefügt</p>
}
@if (loadingNewKeyword()) {
<div class="manual-chip-row">
<app-topic-chip
[label]="'Neues Keyword wird hinzugefügt...'">
</app-topic-chip>
<button mat-icon-button></button>
</div>
}
} @else {
<p class="empty-state small">Nichts hinzugefügt</p>
}
@if (loadingNewKeyword()) {
<div class="manual-chip-row">
<app-topic-chip
[label]="'Neues Keyword wird hinzugefügt...'">
</app-topic-chip>
<button mat-icon-button></button>
</div>
}
</div>
</ng-template>
</div>
</ng-template>
<!-- ===== Desktop / tablet table view ===== -->
@if (!isMobile()) {
<div class="keyword-table">
<div class="table-head">
<div class="head-cell sub-cell broad-sub">
Breite Keywords
<!-- ===== Desktop / tablet table view ===== -->
@if (!isMobile()) {
<div class="keyword-table">
<div class="table-head">
<div class="head-cell sub-cell broad-sub">
Breite Keywords
</div>
<div class="head-cell sub-cell coarse-sub">
Coarse Keywords
</div>
<div class="head-cell sub-cell fine-sub thick-border">
Fine Keywords
</div>
<div class="head-cell sub-cell manual-sub">
Eigene Keywords
</div>
</div>
<div class="head-cell sub-cell coarse-sub">
Coarse Keywords
</div>
<div class="head-cell sub-cell fine-sub thick-border">
Fine Keywords
</div>
<div class="head-cell sub-cell manual-sub">
Eigene Keywords
<div class="table-body">
<div class="table-col broad-col">
<ng-container
*ngTemplateOutlet="
keywordChipStack;
context: {
keywords: broadKeywords(),
emptyText: 'Nichts extrahiert',
}
"></ng-container>
</div>
<div class="table-col coarse-col">
<ng-container
*ngTemplateOutlet="
keywordChipStack;
context: {
keywords: coarseKeywords(),
emptyText: 'Nichts extrahiert',
}
"></ng-container>
</div>
<div class="table-col fine-col thick-border">
<ng-container
*ngTemplateOutlet="
keywordChipStack;
context: {
keywords: fineKeywords(),
emptyText: 'Nichts extrahiert',
}
"></ng-container>
</div>
<div class="table-col own-col">
<ng-container
*ngTemplateOutlet="manualChipStack"></ng-container>
</div>
</div>
</div>
} @else {
<!-- ===== Mobile: tabbed view instead of squashed columns ===== -->
<mat-tab-group
class="mobile-keyword-tabs"
animationDuration="150ms">
<mat-tab>
<ng-template mat-tab-label>
<span>Breit</span>
<span class="tab-count">{{
broadKeywords().length
}}</span>
</ng-template>
<div class="mobile-tab-panel">
<ng-container
*ngTemplateOutlet="
keywordChipStack;
context: {
keywords: broadKeywords(),
emptyText: 'Nichts extrahiert',
}
"></ng-container>
</div>
</mat-tab>
<div class="table-body">
<div class="table-col broad-col">
<ng-container
*ngTemplateOutlet="
keywordChipStack;
context: {
keywords: broadKeywords(),
emptyText: 'Nichts extrahiert',
}
"></ng-container>
</div>
<mat-tab>
<ng-template mat-tab-label>
<span>Coarse</span>
<span class="tab-count">{{
coarseKeywords().length
}}</span>
</ng-template>
<div class="mobile-tab-panel">
<ng-container
*ngTemplateOutlet="
keywordChipStack;
context: {
keywords: coarseKeywords(),
emptyText: 'Nichts extrahiert',
}
"></ng-container>
</div>
</mat-tab>
<div class="table-col coarse-col">
<ng-container
*ngTemplateOutlet="
keywordChipStack;
context: {
keywords: coarseKeywords(),
emptyText: 'Nichts extrahiert',
}
"></ng-container>
</div>
<mat-tab>
<ng-template mat-tab-label>
<span>Fine</span>
<span class="tab-count">{{ fineKeywords().length }}</span>
</ng-template>
<div class="mobile-tab-panel">
<ng-container
*ngTemplateOutlet="
keywordChipStack;
context: {
keywords: fineKeywords(),
emptyText: 'Nichts extrahiert',
}
"></ng-container>
</div>
</mat-tab>
<div class="table-col fine-col thick-border">
<ng-container
*ngTemplateOutlet="
keywordChipStack;
context: {
keywords: fineKeywords(),
emptyText: 'Nichts extrahiert',
}
"></ng-container>
</div>
<mat-tab>
<ng-template mat-tab-label>
<span>Eigene</span>
<span class="tab-count">{{
manualKeywords().length
}}</span>
</ng-template>
<div class="mobile-tab-panel">
<ng-container
*ngTemplateOutlet="manualChipStack"></ng-container>
</div>
</mat-tab>
</mat-tab-group>
}
<div class="table-col own-col">
<ng-container
*ngTemplateOutlet="manualChipStack"></ng-container>
</div>
</div>
</div>
} @else {
<!-- ===== Mobile: tabbed view instead of squashed columns ===== -->
<mat-tab-group
class="mobile-keyword-tabs"
animationDuration="150ms">
<mat-tab>
<ng-template mat-tab-label>
<span>Breit</span>
<span class="tab-count">{{ broadKeywords().length }}</span>
</ng-template>
<div class="mobile-tab-panel">
<ng-container
*ngTemplateOutlet="
keywordChipStack;
context: {
keywords: broadKeywords(),
emptyText: 'Nichts extrahiert',
}
"></ng-container>
</div>
</mat-tab>
<mat-tab>
<ng-template mat-tab-label>
<span>Coarse</span>
<span class="tab-count">{{ coarseKeywords().length }}</span>
</ng-template>
<div class="mobile-tab-panel">
<ng-container
*ngTemplateOutlet="
keywordChipStack;
context: {
keywords: coarseKeywords(),
emptyText: 'Nichts extrahiert',
}
"></ng-container>
</div>
</mat-tab>
<mat-tab>
<ng-template mat-tab-label>
<span>Fine</span>
<span class="tab-count">{{ fineKeywords().length }}</span>
</ng-template>
<div class="mobile-tab-panel">
<ng-container
*ngTemplateOutlet="
keywordChipStack;
context: {
keywords: fineKeywords(),
emptyText: 'Nichts extrahiert',
}
"></ng-container>
</div>
</mat-tab>
<mat-tab>
<ng-template mat-tab-label>
<span>Eigene</span>
<span class="tab-count">{{ manualKeywords().length }}</span>
</ng-template>
<div class="mobile-tab-panel">
<ng-container
*ngTemplateOutlet="manualChipStack"></ng-container>
</div>
</mat-tab>
</mat-tab-group>
<!-- Source content display -->
@if (sourceContent().length > 0) {
<mat-divider></mat-divider>
<mat-expansion-panel class="source-expansion">
<mat-expansion-panel-header>
<mat-panel-title
>Quellentext: {{ sourceUrl() }}</mat-panel-title
>
</mat-expansion-panel-header>
<div class="source-text">{{ sourceContent() }}</div>
</mat-expansion-panel>
}
</mat-card-content>
} @else {
@if (isExtracting()) {
<app-loading
text="{{ statusMessage() }}"
icon="group"
[size]="200"
[diameter]="200" />
}
<!-- Source content display -->
@if (sourceContent().length > 0) {
<mat-divider></mat-divider>
<mat-expansion-panel class="source-expansion">
<mat-expansion-panel-header>
<mat-panel-title
>Quellentext: {{ sourceUrl() }}</mat-panel-title
>
</mat-expansion-panel-header>
<div class="source-text">{{ sourceContent() }}</div>
</mat-expansion-panel>
}
</mat-card-content>
}
</mat-card>
</div>
@if (isExtracting() && keywordsExist()) {
<div class="status-message">{{ statusMessage() }}</div>
}
</div>
}
@if (keywordsExist()) {
<!-- Search Buttons -->
<div class="search-container" style="display: flex; gap: 1rem">
<button
@@ -406,13 +419,12 @@
</button>
</div>
}
<!-- Trend Comparison Section -->
@if (showVisualization() && selectedKeywords().length > 0) {
<div style="margin-top: 2rem">
<app-uni-trend-parent
[keywords]="selectedKeywords()"></app-uni-trend-parent>
</div>
}
</div>
<!-- Trend Comparison Section -->
@if (showVisualization() && selectedKeywords().length > 0) {
<div style="margin-top: 2rem">
<app-uni-trend-parent
[keywords]="selectedKeywords()"></app-uni-trend-parent>
</div>
}
</div>
@@ -192,6 +192,7 @@ mat-button-toggle-group {
.keyword-card {
background-color: var(--sg-background);
padding: 0.5rem;
border: 0;
.mat-card-header {
padding: 0 0 0.5rem 0;
@@ -557,50 +558,62 @@ mat-button-toggle-group {
PROGRESS BAR
============================================================ */
.progress-container {
margin-top: 1rem;
padding: 0.5rem 0;
min-height: 500px;
margin-top: 0.5rem;
position: relative;
padding: 1rem;
background: var(--sg-surface);
border-radius: 4px;
mat-progress-bar {
position: relative;
overflow: hidden;
::ng-deep .mat-progress-bar-fill::after {
background-color: #2196f3;
}
&::after {
content: '';
position: absolute;
inset: 0;
pointer-events: none;
background: linear-gradient(
105deg,
transparent 0%,
rgba(5, 65, 230, 0.4) 100%,
transparent 0%
);
animation: shimmer 2s ease-in-out infinite;
}
&.loading {
border-color: transparent;
}
.status-message {
margin-top: 0.5rem;
font-size: 0.9rem;
color: var(--sg-text-secondary);
text-align: center;
font-weight: 500;
&.loading::before {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
padding: 2px;
background: linear-gradient(
90deg,
transparent 0%,
transparent 35%,
#2196f3 50%,
transparent 65%,
transparent 100%
);
background-size: 200% 100%;
animation: border-loading 1.5s linear infinite;
-webkit-mask:
linear-gradient(#fff 0 0) content-box,
linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
pointer-events: none;
}
}
@keyframes shimmer {
0% {
transform: translateX(-100%);
.status-message {
align-self: center;
margin-top: 0.5rem;
font-size: 0.9rem;
color: var(--sg-text-secondary);
text-align: center;
font-weight: 500;
}
@keyframes border-loading {
from {
background-position: 200% 0;
}
100% {
transform: translateX(100%);
to {
background-position: -200% 0;
}
}
/* ============================================================
ACCESSIBILITY
============================================================ */
@@ -23,7 +23,7 @@ import { KeywordsTopicsRequest } from '../../api/model/keywordsTopicsRequest';
import { KeywordEntryWithTopic } from '../../api/model/keywordEntryWithTopic';
import { TopicAutocompleteComponent } from '../../shared/ui/topic-autocomplete/topic-autocomplete.component';
import { UniTrendParentComponent } from '../university-ranking/uni-trend-parent/uni-trend-parent.component';
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
import { TopicLegendComponent } from '../../shared/ui/topic-legend/topic-legend.component';
import { Topic } from '../../api/model/topic';
@@ -70,6 +70,7 @@ type KeywordView = 'llm' | 'topic';
MatTooltipModule,
A11yModule,
NgTemplateOutlet,
LoadingComponent,
],
templateUrl: './keywords-search.component.html',
styleUrl: './keywords-search.component.scss',