Files
smartguide/webapp/src/app/modules/topics/topics.component.ts
T
genja cf9cf16a77
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/pr-dev Build queued...
feat(navigation): section-aware page skeletons and accessible navigation
2026-11-24 23:25:21 +01:00

61 lines
2.3 KiB
TypeScript

import { Component, computed, inject, input } from '@angular/core';
import {
CardSearchComponent,
Page,
} from '../../shared/ui/card-search/card-search.component';
import { AppTopicCardComponent } from '../../shared/ui/app-topic-card/app-topic-card.component';
import { SortDirection, TopicPageV2, TopicSortBy } from '../../api';
import { FilterObserver } from '../../shared/ui/selected-filters/selected-filters.component';
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 { NavigationStateService } from '../../shared/services/navigation-state.service';
@Component({
selector: 'app-topics',
imports: [CardSearchComponent, AppTopicCardComponent, PageContainerComponent],
templateUrl: './topics.component.html',
styleUrl: './topics.component.scss',
})
export class TopicsComponent {
topicPage = input.required<TopicPageV2>();
private readonly navigationState = inject(NavigationStateService);
readonly loading = computed(() =>
this.navigationState.isResolvingInside('/topics'),
);
observers: FilterObserver[] = [
{
id: 'query',
queryParamKey: topicQueryParamKeys.query,
icon: SEARCH_ICON,
removable: true,
},
];
readonly topicSearchQueryParamKey = topicQueryParamKeys.query;
readonly topicSortByQueryParamKey = topicQueryParamKeys.sortBy;
readonly topicSortingDirectionQueryParamKey =
topicQueryParamKeys.sortDirection;
page = computed<Page>(() => ({
page: this.topicPage().page || 0,
size: this.topicPage().size || 10,
total: this.topicPage().total || 0,
elements: this.topicPage().elements || [],
}));
sortingOptions: SelectorOption[] = [
{ value: TopicSortBy.DisplayName, display_name: 'Name' },
{ value: TopicSortBy.WorksCount, display_name: 'Anzahl Publikationen' },
{ value: TopicSortBy.CitedByCount, display_name: 'Anzahl Zitationen' },
];
sortingDirectionOptions: SelectorOption[] = [
{ value: SortDirection.Asc, display_name: 'Aufsteigend' },
{ value: SortDirection.Desc, display_name: 'Absteigend' },
];
}