feat(navigation): section-aware page skeletons and accessible navigation
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/pr-dev Build queued...

This commit is contained in:
2026-11-24 23:25:21 +01:00
parent a8b7c63897
commit cf9cf16a77
21 changed files with 1494 additions and 153 deletions
@@ -8,7 +8,7 @@ import {
effect,
inject,
} from '@angular/core';
import { ResolverStateService } from '../../app/shared/services/resolver-state.service';
import { NavigationStateService } from '../../app/shared/services/navigation-state.service';
@Directive({
selector: 'span, [skText]',
@@ -19,11 +19,11 @@ export class SkTextDirective implements OnChanges {
private readonly el = inject(ElementRef<HTMLElement>);
private readonly renderer = inject(Renderer2);
private readonly resolverStateService = inject(ResolverStateService);
private readonly navigationState = inject(NavigationStateService);
constructor() {
effect(() => {
const loading = this.skText || this.resolverStateService.isResolving();
const loading = this.skText || this.navigationState.isResolving();
if (loading) {
this.showSkeleton();
@@ -38,7 +38,7 @@ export class SkTextDirective implements OnChanges {
return;
}
if (this.skText || this.resolverStateService.isResolving()) {
if (this.skText || this.navigationState.isResolving()) {
this.showSkeleton();
} else {
this.hideSkeleton();
@@ -14,7 +14,7 @@ import { FilterObserver } from '../../shared/ui/selected-filters/selected-filter
import { AppInstitutionCardComponent } from '../../shared/ui/app-institution-card/app-institution-card.component';
import { SEARCH_ICON } from '../../shared/ui/icons';
import { PageContainerComponent } from '../../shared/ui/page-container/page-container.component';
import { ResolverStateService } from '../../shared/services/resolver-state.service';
import { NavigationStateService } from '../../shared/services/navigation-state.service';
@Component({
selector: 'app-institutions',
@@ -33,9 +33,9 @@ import { ResolverStateService } from '../../shared/services/resolver-state.servi
export class InstitutionsComponent {
institutionPage = input.required<InstitutionPage>();
private readonly resolverState = inject(ResolverStateService);
private readonly navigationState = inject(NavigationStateService);
readonly loading = computed(() =>
this.resolverState.isResolvingInside('/institutions'),
this.navigationState.isResolvingInside('/institutions'),
);
observers: FilterObserver[] = [
@@ -114,6 +114,8 @@
</div>
}
<app-live-region [text]="resultAnnouncement" />
<div class="toolbar">
<span [skText]="loading" class="result-count">{{
resultRange()
@@ -151,11 +153,15 @@
<!--><span>Sortiert nach Publikationen und Zitierungen</span>-->
</div>
@if (getPersons().length) {
@if (loading) {
<app-page-skeleton
variant="cards-plain"
[compact]="true"
[cardMinWidth]="280" />
} @else if (getPersons().length) {
<div class="person-grid">
@for (person of getPersons(); track person.id) {
<app-person-card
[loading]="loading"
[person]="person"
[isBookmarked]="isBookmarked(person)"
[selectedTopics]="selectedTopics()"
@@ -12,8 +12,7 @@ import { MatButtonModule } from '@angular/material/button';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatRadioModule } from '@angular/material/radio';
import { MatTooltipModule } from '@angular/material/tooltip';
import { ResolverStateService } from '../../shared/services/resolver-state.service';
import { NavigationStateService } from '../../shared/services/navigation-state.service';
import {
CustomAuthor,
DehydratedInstitution,
@@ -48,6 +47,8 @@ import { BookmarkService } from '../../shared/services/bookmark.service';
import { ComponentTooltipDirective } from '../../directives/component-tooltip.directive';
import { AppTopicTooltipComponent } from '../../shared/ui/app-topic-tooltip/app-topic-tooltip.component';
import { PageContainerComponent } from '../../shared/ui/page-container/page-container.component';
import { LiveRegionComponent } from '../../shared/ui/live-region/live-region.component';
import { PageSkeletonComponent } from '../../shared/ui/page-skeleton/page-skeleton.component';
import {
CLOSE_ICON,
FILTER_ICON,
@@ -81,6 +82,8 @@ type InstitutionYearFilterMode = 'in' | 'from' | 'between';
SkTextDirective,
ComponentTooltipDirective,
PageContainerComponent,
LiveRegionComponent,
PageSkeletonComponent,
],
templateUrl: './person-list.component.html',
styleUrl: './person-list.component.scss',
@@ -105,9 +108,9 @@ export class PersonListComponent {
private readonly bookmarkService = inject(BookmarkService);
public readonly state = inject(SharedStateService);
public readonly paginationService = inject(PaginationService);
public readonly resolverStateService = inject(ResolverStateService);
public readonly navigationState = inject(NavigationStateService);
readonly loadingState = computed(() =>
this.resolverStateService.isResolvingInside('/persons'),
this.navigationState.isResolvingInside('/persons'),
);
persons: CustomAuthor[] = [];
total = 0;
@@ -600,6 +603,13 @@ export class PersonListComponent {
return `${start}-${end} von ${this.total} Personen`;
}
/** Announced to screen readers whenever a new result set is rendered. */
get resultAnnouncement(): string {
if (this.loading) return '';
if (!this.total) return 'Keine Personen gefunden';
return this.resultRange();
}
// Bookmarks
toggleBookmark(person: CustomAuthor): void {
this.bookmarkService
@@ -9,7 +9,7 @@ import {
import { ActivatedRoute } from '@angular/router';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { ResolverStateService } from '../../shared/services/resolver-state.service';
import { NavigationStateService } from '../../shared/services/navigation-state.service';
import { NewsArticle, NewsPage } from '../../resolvers/person-news.resolver';
import {
CardSearchComponent,
@@ -27,7 +27,7 @@ import { SelectorOption } from '../../shared/ui/query-param-selector/query-param
export class PersonNewsComponent implements OnInit {
private readonly destroyRef = inject(DestroyRef);
private readonly route = inject(ActivatedRoute);
private readonly resolverStateService = inject(ResolverStateService);
private readonly navigationState = inject(NavigationStateService);
readonly sortingDirectionOptions: SelectorOption[] = [
{ value: 'desc', display_name: 'Neueste zuerst' },
@@ -40,7 +40,7 @@ export class PersonNewsComponent implements OnInit {
private currentSize = 10;
get loading(): boolean {
return this.resolverStateService.isResolving();
return this.navigationState.isResolving();
}
readonly page = computed<Page>(() => ({
@@ -16,7 +16,7 @@ import { FilterObserver } from '../../shared/ui/selected-filters/selected-filter
import { FilterCardComponent } from '../../shared/ui/filter-card/filter-card.component';
import { SEARCH_ICON } from '../../shared/ui/icons';
import { PageContainerComponent } from '../../shared/ui/page-container/page-container.component';
import { ResolverStateService } from '../../shared/services/resolver-state.service';
import { NavigationStateService } from '../../shared/services/navigation-state.service';
@Component({
selector: 'app-projects',
@@ -37,9 +37,9 @@ import { ResolverStateService } from '../../shared/services/resolver-state.servi
export class ProjectsComponent {
fundingProjectPage = input.required<FundingProjectPage>();
private readonly resolverState = inject(ResolverStateService);
private readonly navigationState = inject(NavigationStateService);
readonly loading = computed(() =>
this.resolverState.isResolvingInside('/projects'),
this.navigationState.isResolvingInside('/projects'),
);
page = computed<Page>(() => ({
@@ -19,7 +19,7 @@ import { PublicationFilterComponent } from '../../shared/ui/publication-filters/
import { SelectorOption } from '../../shared/ui/query-param-selector/query-param-selector.component';
import { workQueryParamKeys } from '../../resolvers/work-page.resolver';
import { PageContainerComponent } from '../../shared/ui/page-container/page-container.component';
import { ResolverStateService } from '../../shared/services/resolver-state.service';
import { NavigationStateService } from '../../shared/services/navigation-state.service';
@Component({
selector: 'app-publications',
@@ -35,10 +35,10 @@ import { ResolverStateService } from '../../shared/services/resolver-state.servi
export class PublicationsComponent {
private readonly route = inject(ActivatedRoute);
private readonly router = inject(Router);
private readonly resolverState = inject(ResolverStateService);
private readonly navigationState = inject(NavigationStateService);
readonly loading = computed(() =>
this.resolverState.isResolvingInside('/publications'),
this.navigationState.isResolvingInside('/publications'),
);
workPage = input.required<WorkPageV2>();
@@ -10,7 +10,7 @@ import { topicQueryParamKeys } from '../../resolvers/topic-page.resolver';
import { SelectorOption } from '../../shared/ui/query-param-selector/query-param-selector.component';
import { SEARCH_ICON } from '../../shared/ui/icons';
import { PageContainerComponent } from '../../shared/ui/page-container/page-container.component';
import { ResolverStateService } from '../../shared/services/resolver-state.service';
import { NavigationStateService } from '../../shared/services/navigation-state.service';
@Component({
selector: 'app-topics',
@@ -21,9 +21,9 @@ import { ResolverStateService } from '../../shared/services/resolver-state.servi
export class TopicsComponent {
topicPage = input.required<TopicPageV2>();
private readonly resolverState = inject(ResolverStateService);
private readonly navigationState = inject(NavigationStateService);
readonly loading = computed(() =>
this.resolverState.isResolvingInside('/topics'),
this.navigationState.isResolvingInside('/topics'),
);
observers: FilterObserver[] = [
@@ -0,0 +1,55 @@
import { inject, Injectable } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { NavigationEnd, Router } from '@angular/router';
import { filter } from 'rxjs';
import { navigationSectionFor, pathOf } from './navigation-sections';
/**
* Moves keyboard and screen-reader focus to the new page heading after a
* navigation between sections. In-section updates (tabs, filters, pagination)
* keep the focus where the user left it.
*/
@Injectable({ providedIn: 'root' })
export class NavigationFocusService {
private readonly router = inject(Router);
private lastPath: string | null = null;
constructor() {
this.router.events
.pipe(
filter(
(event): event is NavigationEnd => event instanceof NavigationEnd,
),
takeUntilDestroyed(),
)
.subscribe((event) => {
const path = pathOf(event.urlAfterRedirects);
const previousPath = this.lastPath;
this.lastPath = path;
// Skip the initial load and in-section updates.
if (previousPath === null) return;
const fromSection = navigationSectionFor(previousPath);
const toSection = navigationSectionFor(path);
if (fromSection?.id === toSection?.id) return;
this.focusPageHeading();
});
}
private focusPageHeading(): void {
// Wait for the activated component's view to be in the DOM.
requestAnimationFrame(() => {
const main = document.querySelector<HTMLElement>('main');
const heading = main?.querySelector<HTMLElement>('h1') ?? null;
const target = heading ?? main;
if (!target) return;
if (!target.hasAttribute('tabindex')) {
target.setAttribute('tabindex', '-1');
}
// The scroll service owns the scroll position; focusing must not move it.
target.focus({ preventScroll: true });
});
}
}
@@ -0,0 +1,331 @@
import {
ACCOUNT_CIRCLE_ICON,
BOOKMARKS_ICON,
DASHBOARD_ICON,
FOUNDER_ICON,
HIERARCHY_ICON,
INSTITUTION_ICON,
JOBS_ICON,
KEYWORDS_ICON,
NEWS_ICON,
ORGANIZATIONS_ICON,
PATENT_ICON,
PERSONS_ICON,
PERSON_ICON,
PROJECT_ICON,
PUBLICATION_ICON,
TOPIC_ICON,
} from '../ui/icons';
/**
* Shape of the page skeleton for a navigation target. The variants mirror the
* actual page layouts: card grids, data tables, master-detail pages, KPI
* dashboards, tree charts, forms and graphs.
*/
export type PageSkeletonVariant =
| 'cards'
| 'cards-plain'
| 'cards-sidebar'
| 'table'
| 'table-stats'
| 'detail'
| 'detail-table'
| 'detail-chart'
| 'dashboard'
| 'comparison'
| 'tree'
| 'form'
| 'graph';
export interface NavigationSection {
/** Stable identifier, used to detect navigations that stay inside a section. */
id: string;
/**
* URL prefix. A trailing slash means "any path below this prefix" and is
* used for detail routes that share their list's prefix (e.g. `/news/:id`).
*/
prefix: string;
label: string;
/** Announced and shown while the section's resolvers run. */
loadingText: string;
icon: string;
skeleton: PageSkeletonVariant;
}
/**
* Central map of the app's sections. Used for the navigation skeleton and to
* tell "from outside" navigations (show a skeleton) apart from in-section
* updates such as filters and pagination (keep the current content).
*/
export const NAVIGATION_SECTIONS: readonly NavigationSection[] = [
{
// Person list: card grid on the left, filter sidebar on the right.
id: 'persons',
prefix: '/persons',
label: 'Personen',
loadingText: 'Personen werden geladen …',
icon: PERSONS_ICON,
skeleton: 'cards-sidebar',
},
{
// Person detail: hero, tabs, timeline/wordcloud on the overview tab.
id: 'person',
prefix: '/person',
label: 'Person',
loadingText: 'Personendaten werden geladen …',
icon: PERSON_ICON,
skeleton: 'detail-chart',
},
{
id: 'publications',
prefix: '/publications',
label: 'Publikationen',
loadingText: 'Publikationen werden geladen …',
icon: PUBLICATION_ICON,
skeleton: 'cards',
},
{
id: 'publication',
prefix: '/publication',
label: 'Publikation',
loadingText: 'Publikationsdaten werden geladen …',
icon: PUBLICATION_ICON,
skeleton: 'detail',
},
{
id: 'project-detail',
prefix: '/projects/dfg/',
label: 'Projekt',
loadingText: 'Projektdaten werden geladen …',
icon: PROJECT_ICON,
skeleton: 'detail',
},
{
id: 'project-detail',
prefix: '/projects/bund/',
label: 'Projekt',
loadingText: 'Projektdaten werden geladen …',
icon: PROJECT_ICON,
skeleton: 'detail',
},
{
id: 'project-detail',
prefix: '/projects/eu/',
label: 'Projekt',
loadingText: 'Projektdaten werden geladen …',
icon: PROJECT_ICON,
skeleton: 'detail',
},
{
// Project list uses app-card-search, not a table.
id: 'projects',
prefix: '/projects',
label: 'Projekte',
loadingText: 'Projekte werden geladen …',
icon: PROJECT_ICON,
skeleton: 'cards',
},
{
id: 'institutions',
prefix: '/institutions',
label: 'Institutionen',
loadingText: 'Institutionen werden geladen …',
icon: INSTITUTION_ICON,
skeleton: 'cards',
},
{
// Institution detail tabs default to a publication table.
id: 'institution',
prefix: '/institution',
label: 'Institution',
loadingText: 'Institutionsdaten werden geladen …',
icon: INSTITUTION_ICON,
skeleton: 'detail-table',
},
{
// Patent list uses app-card-search; clicking a card opens a detail panel.
id: 'patents',
prefix: '/patents',
label: 'Patente',
loadingText: 'Patente werden geladen …',
icon: PATENT_ICON,
skeleton: 'cards',
},
{
id: 'patent',
prefix: '/patent',
label: 'Patent',
loadingText: 'Patentdaten werden geladen …',
icon: PATENT_ICON,
skeleton: 'detail',
},
{
id: 'news-detail',
prefix: '/news/',
label: 'Nachricht',
loadingText: 'Nachricht wird geladen …',
icon: NEWS_ICON,
skeleton: 'detail',
},
{
id: 'news',
prefix: '/news',
label: 'Nachrichten',
loadingText: 'Nachrichten werden geladen …',
icon: NEWS_ICON,
skeleton: 'cards',
},
{
// Topic list uses app-card-search, not a table.
id: 'topics',
prefix: '/topics',
label: 'Themen',
loadingText: 'Themen werden geladen …',
icon: TOPIC_ICON,
skeleton: 'cards',
},
{
// Topic detail tabs default to a publication table.
id: 'topic',
prefix: '/topic',
label: 'Thema',
loadingText: 'Themendaten werden geladen …',
icon: TOPIC_ICON,
skeleton: 'detail-table',
},
{
id: 'hierarchy',
prefix: '/hierarchy',
label: 'Hierarchie',
loadingText: 'Hierarchie wird geladen …',
icon: HIERARCHY_ICON,
skeleton: 'tree',
},
{
// KPI tiles plus several ECharts panels.
id: 'dashboard',
prefix: '/dashboard',
label: 'Dashboard',
loadingText: 'Dashboard wird geladen …',
icon: DASHBOARD_ICON,
skeleton: 'dashboard',
},
{
id: 'multipliers',
prefix: '/multipliers',
label: 'Multiplikatoren',
loadingText: 'Multiplikatoren werden geladen …',
icon: FOUNDER_ICON,
skeleton: 'table',
},
{
// KPI cards above a data table with expandable rows.
id: 'founders',
prefix: '/founders',
label: 'Gründungspotenzial',
loadingText: 'Gründungspotenzial wird geladen …',
icon: FOUNDER_ICON,
skeleton: 'table-stats',
},
{
id: 'collaboration-network',
prefix: '/collaboration-network',
label: 'Forschungsnetzwerk',
loadingText: 'Forschungsnetzwerk wird geladen …',
icon: PERSON_ICON,
skeleton: 'graph',
},
{
// Bookmarks are just a card grid, without search/sort/pagination.
id: 'bookmarks',
prefix: '/bookmarks',
label: 'Bookmarks',
loadingText: 'Bookmarks werden geladen …',
icon: BOOKMARKS_ICON,
skeleton: 'cards-plain',
},
{
// Two statistic tables, charts and a research-profile panel.
id: 'compare',
prefix: '/compare',
label: 'Autorenvergleich',
loadingText: 'Autorenvergleich wird geladen …',
icon: PERSON_ICON,
skeleton: 'comparison',
},
{
// Keyword extraction form with a four-column chip matrix.
id: 'keywords-results',
prefix: '/keywords/search-results',
label: 'Keyword-Suche',
loadingText: 'Ergebnisse werden geladen …',
icon: KEYWORDS_ICON,
skeleton: 'table',
},
{
id: 'keywords',
prefix: '/keywords',
label: 'Keywords',
loadingText: 'Keywords werden geladen …',
icon: KEYWORDS_ICON,
skeleton: 'form',
},
{
id: 'accounts',
prefix: '/accounts',
label: 'Accounts',
loadingText: 'Accounts werden geladen …',
icon: ACCOUNT_CIRCLE_ICON,
skeleton: 'table',
},
{
id: 'account',
prefix: '/account',
label: 'Mein Konto',
loadingText: 'Kontodaten werden geladen …',
icon: ACCOUNT_CIRCLE_ICON,
skeleton: 'detail',
},
{
id: 'organizations',
prefix: '/organizations',
label: 'Organisationen',
loadingText: 'Organisationen werden geladen …',
icon: ORGANIZATIONS_ICON,
skeleton: 'table',
},
{
// Health status cards above a data table.
id: 'jobs',
prefix: '/jobs',
label: 'Jobs',
loadingText: 'Jobs werden geladen …',
icon: JOBS_ICON,
skeleton: 'table-stats',
},
];
// Longest prefix first so `/persons` wins over `/person`.
const SECTIONS_BY_LENGTH = [...NAVIGATION_SECTIONS].sort(
(a, b) => b.prefix.length - a.prefix.length,
);
/** Resolve the section for a router URL (query string and hash are ignored). */
export function navigationSectionFor(
url: string | null | undefined,
): NavigationSection | null {
if (!url) return null;
const path = pathOf(url);
return SECTIONS_BY_LENGTH.find((section) => matchesPrefix(path, section.prefix)) ?? null;
}
function matchesPrefix(path: string, prefix: string): boolean {
return prefix.endsWith('/')
? path.startsWith(prefix)
: path === prefix || path.startsWith(`${prefix}/`);
}
/** Path part of a router URL. */
export function pathOf(url: string): string {
return url.split('?')[0].split('#')[0] || '/';
}
@@ -0,0 +1,111 @@
import { computed, inject, Injectable, signal } from '@angular/core';
import {
ActivatedRouteSnapshot,
NavigationCancel,
NavigationEnd,
NavigationError,
ResolveStart,
Router,
RouterStateSnapshot,
} from '@angular/router';
import {
NavigationSection,
navigationSectionFor,
pathOf,
} from './navigation-sections';
export interface NavigationTarget {
/** URL the router is navigating to (including query string). */
url: string;
/** Section of the target URL, if it is one of the known sections. */
section: NavigationSection | null;
/** URL the user is coming from, captured when resolving starts. */
fromUrl: string | null;
/** Section of the origin URL. */
fromSection: NavigationSection | null;
/** True when the navigation switches to a different section. */
external: boolean;
}
/**
* Central navigation state for the whole app.
*
* Resolvers run between `ResolveStart` and `NavigationEnd`; while they do, the
* layout shows a section skeleton for navigations that come from outside a
* section. In-section updates (filters, pagination, tabs) keep the current
* content on screen and only clear when the navigation finishes.
*/
@Injectable({ providedIn: 'root' })
export class NavigationStateService {
private readonly router = inject(Router);
private readonly currentTarget = signal<NavigationTarget | null>(null);
readonly target = this.currentTarget.asReadonly();
readonly isResolving = computed(() => this.currentTarget() !== null);
/** Section whose skeleton should be shown, or null to keep the content. */
readonly skeleton = computed<NavigationSection | null>(() => {
const target = this.currentTarget();
return target?.external ? target.section : null;
});
constructor() {
this.router.events.subscribe((event) => {
if (event instanceof ResolveStart) {
// Angular emits ResolveStart for every activation, even when no
// resolver is configured. Without resolvers there is nothing to wait
// for, so showing a skeleton would only cause a flash.
if (!hasResolvers(event.state)) return;
const fromUrl = this.router.url;
const section = navigationSectionFor(event.url);
const fromSection = navigationSectionFor(fromUrl);
this.currentTarget.set({
url: event.url,
section,
fromUrl,
fromSection,
external: section?.id !== fromSection?.id,
});
return;
}
if (
event instanceof NavigationEnd ||
event instanceof NavigationCancel ||
event instanceof NavigationError
) {
this.currentTarget.set(null);
}
});
}
/** True while resolving a URL that starts with `path` from outside `path`. */
isResolvingFromOutside(path: string): boolean {
const target = this.currentTarget();
if (!target || !matchesPath(target.url, path)) return false;
return !matchesPath(target.fromUrl, path);
}
/** True while resolving a URL that stays inside `path`. */
isResolvingInside(path: string): boolean {
const target = this.currentTarget();
if (!target || !matchesPath(target.url, path)) return false;
return matchesPath(target.fromUrl, path);
}
}
function matchesPath(url: string | null, prefix: string): boolean {
if (!url) return false;
const path = pathOf(url);
return path === prefix || path.startsWith(`${prefix}/`);
}
function hasResolvers(state: RouterStateSnapshot): boolean {
let route: ActivatedRouteSnapshot | null = state.root;
while (route) {
if (Object.keys(route.routeConfig?.resolve ?? {}).length > 0) return true;
route = route.firstChild;
}
return false;
}
@@ -1,49 +0,0 @@
import { Injectable, signal, inject, computed } from '@angular/core';
import { Router, RouterEvent, ActivatedRoute } from '@angular/router';
import { toSignal } from '@angular/core/rxjs-interop';
import { ResolveEnd, ResolveStart } from '@angular/router';
import {
NavigationEnd,
NavigationError,
NavigationCancel,
} from '@angular/router';
@Injectable({ providedIn: 'root' })
export class ResolverStateService {
private readonly router = inject(Router);
readonly resolvingUrl = signal<string | null>(null);
readonly previousUrl = signal<string | null>(null);
readonly isResolving = computed(() => this.resolvingUrl() !== null);
constructor() {
this.router.events.subscribe((event) => {
if (event instanceof ResolveStart) {
this.previousUrl.set(this.router.url); // capture current before it changes
this.resolvingUrl.set(event.url);
}
if (
event instanceof NavigationEnd ||
event instanceof NavigationCancel ||
event instanceof NavigationError
) {
this.resolvingUrl.set(null);
}
});
}
isResolvingFromOutside(path: string) {
const from = this.previousUrl();
const to = this.resolvingUrl();
if (!to?.startsWith(path)) return false;
return !from?.startsWith(path); // came from outside
}
isResolvingInside(path: string) {
const from = this.previousUrl();
const to = this.resolvingUrl();
if (to?.startsWith(path) && from?.startsWith(path)) return true;
return false;
}
}
@@ -56,62 +56,13 @@
</mat-toolbar>
}
<main class="content" #contentScroller>
<main class="content" #contentScroller tabindex="-1">
<div class="main-content-body">
@if (resolverState.isResolvingFromOutside('/persons')) {
<app-loading
text="Personenliste wird geladen..."
[icon]="PERSONS_ICON"
[size]="200"
[diameter]="200" />
} @else if (resolverState.isResolvingFromOutside('/person')) {
<app-loading
text="Personendaten werden geladen..."
[icon]="PERSON_ICON"
[size]="200"
[diameter]="200" />
} @else if (resolverState.isResolvingFromOutside('/publications')) {
<app-loading
text="Publikationsdaten werden geladen..."
[icon]="PUBLICATION_ICON"
[size]="200"
[diameter]="200" />
} @else if (resolverState.isResolvingFromOutside('/projects')) {
<app-loading
text="Projektdaten werden geladen..."
[icon]="PROJECT_ICON"
[size]="200"
[diameter]="200" />
} @else if (resolverState.isResolvingFromOutside('/institutions')) {
<app-loading
text="Institutionen werden geladen..."
[icon]="INSTITUTION_ICON"
[size]="200"
[diameter]="200" />
} @else if (resolverState.isResolvingFromOutside('/patents')) {
<app-loading
text="Patente werden geladen..."
[icon]="PATENT_ICON"
[size]="200"
[diameter]="200" />
} @else if (resolverState.isResolvingFromOutside('/news')) {
<app-loading
text="Nachrichten werden geladen..."
[icon]="NEWS_ICON"
[size]="200"
[diameter]="200" />
} @else if (resolverState.isResolvingFromOutside('/topics')) {
<app-loading
text="Themen werden geladen..."
[icon]="TOPIC_ICON"
[size]="200"
[diameter]="200" />
} @else if (resolverState.isResolvingFromOutside('/hierarchy')) {
<app-loading
text="Hierarchie werden geladen..."
[icon]="HIERARCHY_ICON"
[size]="200"
[diameter]="200" />
@if (navigationState.skeleton(); as skeleton) {
<app-page-skeleton
[label]="skeleton.loadingText"
[icon]="skeleton.icon"
[variant]="skeleton.skeleton" />
} @else {
<ng-content></ng-content>
}
@@ -25,24 +25,16 @@ import { AppMenuComponent } from '../app-menu/app-menu.component';
import { MatTooltipModule } from '@angular/material/tooltip';
import { CredentialService } from '../../services/credential.service';
import { AppSearchbarComponent } from '../app-searchbar/app-searchbar.component';
import { ResolverStateService } from '../../services/resolver-state.service';
import { NavigationStateService } from '../../services/navigation-state.service';
import { NavigationFocusService } from '../../services/navigation-focus.service';
import { BackNavigationService } from '../../services/back-navigation.service';
import { PageTitleService } from '../../services/page-title.service';
import { RouteScrollService } from '../../services/route-scroll.service';
import { LoadingComponent } from '../loading/loading.component';
import { PageSkeletonComponent } from '../page-skeleton/page-skeleton.component';
import {
ARROW_BACK_ICON,
INSTITUTION_ICON,
MENU_ICON,
NEWS_ICON,
PATENT_ICON,
PERSONS_ICON,
PERSON_ICON,
PROJECT_ICON,
PUBLICATION_ICON,
SWITCH_ACCOUNT_ICON,
TOPIC_ICON,
HIERARCHY_ICON,
} from '../icons';
@Component({
@@ -56,7 +48,7 @@ import {
AppMenuComponent,
MatTooltipModule,
AppSearchbarComponent,
LoadingComponent,
PageSkeletonComponent,
],
templateUrl: './app-layout.component.html',
styleUrl: './app-layout.component.scss',
@@ -66,28 +58,21 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
readonly SWITCH_ACCOUNT_ICON = SWITCH_ACCOUNT_ICON;
readonly MENU_ICON = MENU_ICON;
readonly ARROW_BACK_ICON = ARROW_BACK_ICON;
readonly PERSONS_ICON = PERSONS_ICON;
readonly PERSON_ICON = PERSON_ICON;
readonly PUBLICATION_ICON = PUBLICATION_ICON;
readonly PROJECT_ICON = PROJECT_ICON;
readonly INSTITUTION_ICON = INSTITUTION_ICON;
readonly PATENT_ICON = PATENT_ICON;
readonly NEWS_ICON = NEWS_ICON;
readonly HIERARCHY_ICON = HIERARCHY_ICON;
readonly TOPIC_ICON = TOPIC_ICON;
@ViewChild(MatDrawer, { static: false })
drawer?: MatDrawer;
mediaQuery: MediaQueryList;
protected resolverState = inject(ResolverStateService);
protected navigationState = inject(NavigationStateService);
mediaQueryListener: () => void;
private readonly destroyRef = inject(DestroyRef);
private readonly backNavigation = inject(BackNavigationService);
private readonly scrollService = inject(RouteScrollService);
// Instantiated for its router subscription; keeps document.title in sync.
// Instantiated for their router subscriptions; keeps document.title in sync
// and moves focus to the new page heading after navigation.
private readonly pageTitle = inject(PageTitleService);
private readonly navigationFocus = inject(NavigationFocusService);
private readonly contentScroller =
viewChild<ElementRef<HTMLElement>>('contentScroller');
private readonly currentPath = signal('/');
@@ -31,6 +31,7 @@
<mat-divider />
@let pageValue = page();
<div class="card-search-results" [attr.aria-busy]="loading()">
<app-live-region [text]="resultAnnouncement()" />
@if (loading()) {
<div
class="loading-overlay"
@@ -1,4 +1,4 @@
import { Component, input, TemplateRef } from '@angular/core';
import { Component, computed, input, TemplateRef } from '@angular/core';
import { QueryParamInputComponent } from '../query-param-input/query-param-input.component';
import {
QueryParamSelectorComponent,
@@ -12,6 +12,7 @@ import {
FilterObserver,
SelectedFiltersComponent,
} from '../selected-filters/selected-filters.component';
import { LiveRegionComponent } from '../live-region/live-region.component';
export type Page = {
page: number;
@@ -30,6 +31,7 @@ export type Page = {
NgTemplateOutlet,
MatProgressSpinnerModule,
SelectedFiltersComponent,
LiveRegionComponent,
],
templateUrl: './card-search.component.html',
styleUrl: './card-search.component.scss',
@@ -55,4 +57,12 @@ export class CardSearchComponent {
sortingDirectionOptions = input<SelectorOption[]>();
sortingDirectionQueryParamKey = input<string>('sorting_order');
sortingDirectionLabel = input<string>('Sortierreihenfolge');
/** Announced to screen readers whenever a new result set is rendered. */
readonly resultAnnouncement = computed(() => {
if (this.loading()) return '';
const total = this.page().total ?? 0;
if (total === 0) return 'Keine Ergebnisse';
return total === 1 ? '1 Ergebnis' : `${total} Ergebnisse`;
});
}
@@ -0,0 +1,33 @@
import { Component, effect, input, signal } from '@angular/core';
/**
* Visually hidden live region. Screen readers announce text changes, while
* sighted users see the normal result count elsewhere on the page.
*
* The text is applied in the next frame so that the region is already part of
* the accessibility tree when its content changes. Screen readers then treat
* it as an update and announce it, including on the first render.
*/
@Component({
selector: 'app-live-region',
template: `<span
class="visually-hidden"
aria-live="polite"
aria-atomic="true"
>{{ announcement() }}</span
>`,
})
export class LiveRegionComponent {
readonly text = input('');
private readonly pending = signal('');
readonly announcement = this.pending.asReadonly();
constructor() {
effect((onCleanup) => {
const text = this.text();
const handle = requestAnimationFrame(() => this.pending.set(text));
onCleanup(() => cancelAnimationFrame(handle));
});
}
}
@@ -0,0 +1,316 @@
<div
class="page-skeleton"
[class.page-skeleton--compact]="compact()"
role="status"
[attr.aria-label]="compact() ? label() : null"
aria-busy="true">
@if (!compact()) {
<div class="page-skeleton__status">
<mat-icon aria-hidden="true">{{ icon() }}</mat-icon>
<span>{{ label() }}</span>
</div>
<div class="page-skeleton__header" aria-hidden="true">
<span class="sk-bar sk-bar--eyebrow"></span>
<span class="sk-bar sk-bar--title"></span>
<span class="sk-bar sk-bar--subtitle"></span>
</div>
}
<div class="page-skeleton__body" aria-hidden="true">
@switch (variant()) {
@case ('cards') {
<ng-container [ngTemplateOutlet]="filters" />
<ng-container [ngTemplateOutlet]="cards" />
}
@case ('cards-plain') {
<ng-container [ngTemplateOutlet]="cardsGrid" />
}
@case ('cards-sidebar') {
<ng-container [ngTemplateOutlet]="filters" />
<div class="sk-split">
<div class="sk-split__main">
<ng-container [ngTemplateOutlet]="cards" />
</div>
<div class="sk-panel sk-panel--sidebar">
<span class="sk-bar sk-bar--section-title"></span>
@for (row of [1, 2, 3, 4, 5, 6, 7]; track row) {
<span class="sk-bar sk-bar--filter"></span>
}
<span class="sk-bar sk-bar--button"></span>
</div>
</div>
}
@case ('table') {
<ng-container [ngTemplateOutlet]="filters" />
<ng-container [ngTemplateOutlet]="table" />
}
@case ('table-stats') {
<div class="sk-kpis">
@for (tile of [1, 2, 3]; track tile) {
<div class="sk-kpi">
<span class="sk-bar sk-bar--kpi-label"></span>
<span class="sk-bar sk-bar--kpi-value"></span>
</div>
}
</div>
<ng-container [ngTemplateOutlet]="filters" />
<ng-container [ngTemplateOutlet]="table" />
}
@case ('detail') {
<ng-container [ngTemplateOutlet]="hero" />
<ng-container [ngTemplateOutlet]="tabs" />
<div class="sk-detail">
<div class="sk-panel">
<span class="sk-bar sk-bar--section-title"></span>
@for (row of [1, 2, 3, 4, 5, 6]; track row) {
<span class="sk-bar"></span>
}
</div>
<div class="sk-panel">
<span class="sk-bar sk-bar--section-title"></span>
@for (row of [1, 2, 3, 4]; track row) {
<span class="sk-bar sk-bar--short"></span>
}
</div>
</div>
}
@case ('detail-table') {
<ng-container [ngTemplateOutlet]="hero" />
<ng-container [ngTemplateOutlet]="tabs" />
<div class="sk-detail">
<div class="sk-panel">
<span class="sk-bar sk-bar--section-title"></span>
<div class="sk-table sk-table--compact">
<div class="sk-table__row sk-table__row--head">
<span class="sk-bar"></span><span class="sk-bar"></span
><span class="sk-bar"></span>
</div>
@for (row of [1, 2, 3, 4, 5]; track row) {
<div class="sk-table__row">
<span class="sk-bar"></span><span class="sk-bar"></span
><span class="sk-bar"></span>
</div>
}
</div>
</div>
<div class="sk-panel">
<span class="sk-bar sk-bar--section-title"></span>
@for (row of [1, 2, 3]; track row) {
<span class="sk-bar sk-bar--short"></span>
}
</div>
</div>
}
@case ('detail-chart') {
<ng-container [ngTemplateOutlet]="hero" />
<ng-container [ngTemplateOutlet]="tabs" />
<div class="sk-detail">
<div class="sk-panel">
<span class="sk-bar sk-bar--section-title"></span>
<ng-container [ngTemplateOutlet]="chart" />
@for (row of [1, 2]; track row) {
<span class="sk-bar"></span>
}
</div>
<div class="sk-panel">
<span class="sk-bar sk-bar--section-title"></span>
@for (row of [1, 2, 3]; track row) {
<span class="sk-bar sk-bar--short"></span>
}
</div>
</div>
}
@case ('comparison') {
<div class="sk-chips">
@for (chip of [1, 2, 3]; track chip) {
<span class="sk-bar sk-bar--chip"></span>
}
</div>
<div class="sk-compare-tables">
@for (panel of [1, 2]; track panel) {
<div class="sk-panel">
<span class="sk-bar sk-bar--section-title"></span>
<div class="sk-table sk-table--compact sk-table--two-col">
<div class="sk-table__row sk-table__row--head">
<span class="sk-bar"></span><span class="sk-bar"></span>
</div>
@for (row of [1, 2, 3, 4]; track row) {
<div class="sk-table__row">
<span class="sk-bar"></span><span class="sk-bar"></span>
</div>
}
</div>
</div>
}
</div>
<div class="sk-chart-grid">
@for (panel of [1, 2]; track panel) {
<div class="sk-panel">
<span class="sk-bar sk-bar--section-title"></span>
<ng-container [ngTemplateOutlet]="chart" />
</div>
}
</div>
<div class="sk-panel">
<span class="sk-bar sk-bar--section-title"></span>
@for (row of [1, 2, 3]; track row) {
<span class="sk-bar"></span>
}
</div>
}
@case ('dashboard') {
<div class="sk-chips">
@for (chip of [1, 2, 3, 4]; track chip) {
<span class="sk-bar sk-bar--chip"></span>
}
</div>
<div class="sk-kpis sk-kpis--many">
@for (tile of [1, 2, 3, 4, 5, 6, 7, 8]; track tile) {
<div class="sk-kpi">
<span class="sk-bar sk-bar--kpi-label"></span>
<span class="sk-bar sk-bar--kpi-value"></span>
</div>
}
</div>
<div class="sk-chart-grid">
@for (panel of [1, 2, 3, 4]; track panel) {
<div class="sk-panel">
<span class="sk-bar sk-bar--section-title"></span>
<ng-container [ngTemplateOutlet]="chart" />
</div>
}
</div>
}
@case ('tree') {
<div class="sk-accordion">
@for (panel of [1, 2, 3]; track panel) {
<span class="sk-bar sk-bar--accordion"></span>
}
</div>
<div class="sk-panel sk-tree">
@for (node of [0, 1, 2, 3, 4, 5]; track node) {
<span
class="sk-tree__node"
[style.margin-left.px]="node * 22"></span>
}
</div>
}
@case ('form') {
<ng-container [ngTemplateOutlet]="tabs" />
<div class="sk-form">
@for (field of [1, 2, 3]; track field) {
<span class="sk-bar sk-bar--field"></span>
}
<span class="sk-bar sk-bar--button"></span>
</div>
<div class="sk-matrix">
@for (cell of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; track cell) {
<span class="sk-bar sk-bar--chip"></span>
}
</div>
}
@case ('graph') {
<div class="sk-graph">
<span class="sk-graph__node sk-graph__node--center"></span>
@for (node of nodes; track node.x) {
<span
class="sk-graph__node"
[style.left.%]="node.x"
[style.top.%]="node.y"></span>
}
</div>
<div class="sk-chips">
@for (chip of [1, 2, 3]; track chip) {
<span class="sk-bar sk-bar--chip"></span>
}
</div>
}
}
</div>
</div>
<!-- Shared blocks: these mirror the structure of the real page components. -->
<ng-template #filters>
<div class="sk-filters">
<span class="sk-bar sk-bar--search"></span>
<span class="sk-bar sk-bar--select"></span>
<span class="sk-bar sk-bar--select"></span>
</div>
<div class="sk-toolbar">
<span class="sk-bar sk-bar--toolbar"></span>
<span class="sk-bar sk-bar--select"></span>
</div>
</ng-template>
<ng-template #cards>
<ng-container [ngTemplateOutlet]="cardsGrid" />
<div class="sk-pagination">
<span class="sk-bar sk-bar--pagination"></span>
</div>
</ng-template>
<ng-template #cardsGrid>
<div class="sk-cards" [style.--sk-card-min-width.px]="cardMinWidth()">
@for (card of [1, 2, 3, 4, 5, 6]; track card) {
<div class="sk-card">
<span class="sk-bar sk-bar--card-title"></span>
<span class="sk-bar"></span>
<span class="sk-bar"></span>
<span class="sk-bar sk-bar--short"></span>
</div>
}
</div>
</ng-template>
<ng-template #table>
<div class="sk-table">
<div class="sk-table__row sk-table__row--head">
<span class="sk-bar"></span><span class="sk-bar"></span
><span class="sk-bar"></span><span class="sk-bar"></span>
</div>
@for (row of [1, 2, 3, 4, 5, 6, 7]; track row) {
<div class="sk-table__row">
<span class="sk-bar"></span><span class="sk-bar"></span
><span class="sk-bar"></span><span class="sk-bar"></span>
</div>
}
</div>
<div class="sk-pagination">
<span class="sk-bar sk-bar--pagination"></span>
</div>
</ng-template>
<ng-template #hero>
<div class="sk-hero">
<span class="sk-avatar"></span>
<div class="sk-hero__copy">
<span class="sk-bar sk-bar--title"></span>
<span class="sk-bar sk-bar--subtitle"></span>
<div class="sk-chips">
@for (chip of [1, 2, 3]; track chip) {
<span class="sk-bar sk-bar--chip"></span>
}
</div>
</div>
</div>
</ng-template>
<ng-template #tabs>
<div class="sk-tabs">
@for (tab of [1, 2, 3, 4]; track tab) {
<span class="sk-bar sk-bar--tab"></span>
}
</div>
</ng-template>
<ng-template #chart>
<div class="sk-chart">
<span class="sk-chart__axis"></span>
<div class="sk-chart__bars">
@for (height of [45, 68, 52, 88, 61, 76, 48, 70]; track $index) {
<span class="sk-chart__bar" [style.height.%]="height"></span>
}
</div>
</div>
</ng-template>
@@ -0,0 +1,522 @@
:host {
display: block;
width: 100%;
min-width: 0;
}
.page-skeleton {
display: flex;
flex-direction: column;
gap: 14px;
padding: clamp(8px, 1.4vw, 18px);
&--compact {
gap: 0;
padding: 0;
.page-skeleton__body {
margin-top: 0;
}
}
}
.page-skeleton__status {
display: flex;
align-items: center;
gap: 8px;
color: var(--sg-text-soft);
font-size: 13px;
mat-icon {
flex: none;
width: 18px;
height: 18px;
font-size: 18px;
}
}
.page-skeleton__header {
display: flex;
flex-direction: column;
gap: 8px;
}
.page-skeleton__body {
display: flex;
flex-direction: column;
gap: 14px;
margin-top: 4px;
}
/* Shimmer bars ------------------------------------------------------------ */
.sk-bar {
display: block;
flex: none;
height: 12px;
border-radius: 6px;
background: linear-gradient(
90deg,
var(--sg-skeleton-base) 25%,
var(--sg-skeleton-highlight) 50%,
var(--sg-skeleton-base) 75%
);
background-size: 600px 100%;
animation: page-skeleton-shimmer 1.6s infinite linear;
&--eyebrow {
width: 180px;
max-width: 40%;
height: 9px;
}
&--title {
width: 360px;
max-width: 60%;
height: 26px;
}
&--subtitle {
width: 520px;
max-width: 80%;
}
&--section-title {
width: 220px;
max-width: 50%;
height: 18px;
}
&--card-title {
width: 60%;
height: 16px;
}
&--short {
width: 45%;
}
&--search {
width: min(360px, 40%);
height: 36px;
border-radius: 18px;
}
&--select,
&--field {
width: 180px;
max-width: 30%;
height: 36px;
border-radius: 8px;
}
&--toolbar {
width: 220px;
max-width: 35%;
height: 14px;
}
&--filter {
width: 100%;
height: 14px;
}
&--button {
width: 140px;
height: 34px;
border-radius: 8px;
background: color-mix(in srgb, var(--sg-primary, #345) 25%, transparent);
}
&--chip {
width: 86px;
height: 24px;
border-radius: 12px;
}
&--tab {
width: 110px;
height: 30px;
}
&--accordion {
width: 100%;
height: 40px;
border-radius: 8px;
}
&--kpi-label {
width: 70%;
height: 9px;
}
&--kpi-value {
width: 50%;
height: 22px;
}
&--pagination {
width: 280px;
max-width: 60%;
height: 24px;
}
}
/* Search/filter/toolbar rows of list pages -------------------------------- */
.sk-filters,
.sk-toolbar {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12px;
}
.sk-toolbar {
justify-content: space-between;
}
.sk-chips {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.sk-pagination {
display: flex;
justify-content: flex-end;
}
/* Card grids -------------------------------------------------------------- */
.sk-cards {
display: grid;
grid-template-columns: repeat(
auto-fill,
minmax(var(--sk-card-min-width, 260px), 1fr)
);
gap: 16px;
}
.sk-card {
display: flex;
min-height: 130px;
flex-direction: column;
gap: 10px;
padding: 18px;
border: 1px solid var(--sg-border);
border-radius: 12px;
background: var(--sg-surface-muted);
}
/* Person list: grid plus filter sidebar ----------------------------------- */
.sk-split {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
gap: 20px;
&__main {
min-width: 0;
}
}
/* Tables ------------------------------------------------------------------ */
.sk-table {
display: flex;
flex-direction: column;
overflow: hidden;
border: 1px solid var(--sg-border);
border-radius: 12px;
background: var(--sg-surface-muted);
&--compact .sk-table__row {
grid-template-columns: 2fr 1fr 0.6fr;
padding: 10px 14px;
}
&--two-col .sk-table__row {
grid-template-columns: 1fr 2fr;
}
}
.sk-compare-tables {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
}
.sk-table__row {
display: grid;
grid-template-columns: 2fr 1fr 1fr 0.6fr;
gap: 16px;
padding: 14px 18px;
& + & {
border-top: 1px solid var(--sg-border);
}
&--head {
background: var(--sg-surface-soft);
}
}
/* Detail pages: hero, tabs, main + aside ---------------------------------- */
.sk-hero {
display: flex;
align-items: flex-start;
gap: 18px;
padding: 18px;
border: 1px solid var(--sg-border);
border-radius: 12px;
background: var(--sg-surface-muted);
&__copy {
display: flex;
flex: 1;
min-width: 0;
flex-direction: column;
gap: 10px;
}
}
.sk-avatar {
flex: none;
width: 64px;
height: 64px;
border-radius: 50%;
background: var(--sg-skeleton-base);
animation: page-skeleton-pulse 1.6s infinite ease-in-out;
}
.sk-tabs {
display: flex;
gap: 18px;
padding-bottom: 8px;
border-bottom: 1px solid var(--sg-border);
}
.sk-detail {
display: grid;
grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
gap: 20px;
}
.sk-panel {
display: flex;
flex-direction: column;
gap: 12px;
padding: 18px;
border: 1px solid var(--sg-border);
border-radius: 12px;
background: var(--sg-surface-muted);
.sk-table {
margin-top: 4px;
}
}
/* Dashboard: KPI tiles + chart panels ------------------------------------- */
.sk-kpis {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 12px;
&--many {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
}
.sk-kpi {
display: flex;
min-height: 78px;
flex-direction: column;
justify-content: center;
gap: 10px;
padding: 14px;
border: 1px solid var(--sg-border);
border-radius: 12px;
background: var(--sg-surface-muted);
}
.sk-chart-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
gap: 16px;
}
.sk-chart {
display: flex;
height: 170px;
align-items: flex-end;
gap: 10px;
padding: 12px 4px 0;
&__axis {
align-self: stretch;
width: 1px;
background: var(--sg-border);
}
&__bars {
display: flex;
height: 100%;
flex: 1;
align-items: flex-end;
justify-content: space-around;
gap: 8px;
border-bottom: 1px solid var(--sg-border);
}
&__bar {
width: min(32px, 8%);
border-radius: 4px 4px 0 0;
background: var(--sg-skeleton-base);
animation: page-skeleton-pulse 1.6s infinite ease-in-out;
}
}
/* Hierarchy tree ---------------------------------------------------------- */
.sk-accordion {
display: flex;
flex-direction: column;
gap: 8px;
}
.sk-tree {
gap: 14px;
&__node {
display: block;
width: min(320px, 70%);
height: 16px;
border-radius: 8px;
background: linear-gradient(
90deg,
var(--sg-skeleton-base) 25%,
var(--sg-skeleton-highlight) 50%,
var(--sg-skeleton-base) 75%
);
background-size: 600px 100%;
animation: page-skeleton-shimmer 1.6s infinite linear;
&::before {
display: inline-block;
width: 8px;
height: 8px;
margin-right: 10px;
border-radius: 2px;
background: var(--sg-border-strong);
content: '';
vertical-align: middle;
}
}
}
/* Keyword form and chip matrix -------------------------------------------- */
.sk-form {
display: flex;
flex-direction: column;
gap: 12px;
padding: 18px;
border: 1px solid var(--sg-border);
border-radius: 12px;
background: var(--sg-surface-muted);
}
.sk-matrix {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 10px;
padding: 18px;
border: 1px solid var(--sg-border);
border-radius: 12px;
background: var(--sg-surface-muted);
}
/* Collaboration network --------------------------------------------------- */
.sk-graph {
position: relative;
height: min(52vh, 420px);
min-height: 240px;
overflow: hidden;
border: 1px solid var(--sg-border);
border-radius: 12px;
background: var(--sg-surface-muted);
&__node {
position: absolute;
width: 18px;
height: 18px;
margin: -9px 0 0 -9px;
border-radius: 50%;
background: var(--sg-skeleton-base);
animation: page-skeleton-pulse 1.6s infinite ease-in-out;
&--center {
top: 50%;
left: 50%;
width: 30px;
height: 30px;
margin: -15px 0 0 -15px;
}
}
}
@keyframes page-skeleton-shimmer {
from {
background-position: -600px 0;
}
to {
background-position: 600px 0;
}
}
@keyframes page-skeleton-pulse {
0%,
100% {
opacity: 0.55;
}
50% {
opacity: 1;
}
}
@media (max-width: 900px) {
.sk-detail,
.sk-split {
grid-template-columns: 1fr;
}
.sk-kpis--many {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.sk-compare-tables {
grid-template-columns: 1fr;
}
.sk-matrix {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.sk-table:not(.sk-table--two-col) .sk-table__row {
grid-template-columns: 2fr 1fr 0.6fr;
.sk-bar:last-child {
display: none;
}
}
}
@media (prefers-reduced-motion: reduce) {
.sk-bar,
.sk-tree__node {
animation: none;
background: var(--sg-skeleton-base);
}
.sk-avatar,
.sk-chart__bar,
.sk-graph__node {
animation: none;
}
}
@@ -0,0 +1,38 @@
import { NgTemplateOutlet } from '@angular/common';
import { Component, input } from '@angular/core';
import { MatIconModule } from '@angular/material/icon';
import { PageSkeletonVariant } from '../../services/navigation-sections';
/** Fixed node positions for the network graph placeholder. */
const GRAPH_NODES = [
{ x: 18, y: 26 },
{ x: 38, y: 14 },
{ x: 73, y: 20 },
{ x: 85, y: 52 },
{ x: 62, y: 78 },
{ x: 26, y: 72 },
{ x: 10, y: 52 },
];
/**
* Generic page placeholder shown while route resolvers run. Its variants
* mirror the page layouts (card grids, tables, detail pages, dashboards,
* trees, forms and graphs) so the loaded page does not shift the layout.
*/
@Component({
selector: 'app-page-skeleton',
imports: [MatIconModule, NgTemplateOutlet],
templateUrl: './page-skeleton.component.html',
styleUrl: './page-skeleton.component.scss',
})
export class PageSkeletonComponent {
readonly label = input('Inhalte werden geladen …');
readonly icon = input('hourglass_empty');
readonly variant = input<PageSkeletonVariant>('table');
/** Render only the body, e.g. inside an existing page's results panel. */
readonly compact = input(false);
/** Minimum card width, so the placeholder grid matches the real grid. */
readonly cardMinWidth = input(260);
readonly nodes = GRAPH_NODES;
}
+21
View File
@@ -750,3 +750,24 @@ html.dark-theme {
flex-shrink: 0;
transition: transform 0.3s ease;
}
/* Screen-reader-only content (result announcements, see LiveRegionComponent). */
.visually-hidden {
position: absolute !important;
width: 1px !important;
height: 1px !important;
margin: -1px !important;
padding: 0 !important;
overflow: hidden !important;
clip: rect(0 0 0 0) !important;
clip-path: inset(50%) !important;
white-space: nowrap !important;
border: 0 !important;
}
/* Focus targets set by NavigationFocusService: no visible ring on the page
frame itself, the heading is announced by screen readers instead. */
main[tabindex='-1']:focus,
main [tabindex='-1']:focus {
outline: none;
}