From 5a160dcf680a1b51e4a02c899cc20a34ab4db5dd Mon Sep 17 00:00:00 2001 From: sinedied Date: Wed, 15 May 2024 23:00:09 +0200 Subject: [PATCH] feat: add workshop search results (fixes #112) --- .../src/app/catalog/catalog.component.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/website/src/app/catalog/catalog.component.ts b/packages/website/src/app/catalog/catalog.component.ts index d5df1cb..968df03 100644 --- a/packages/website/src/app/catalog/catalog.component.ts +++ b/packages/website/src/app/catalog/catalog.component.ts @@ -17,6 +17,8 @@ import { ContentFilter, matchEntry } from './content-filter'; import { CardComponent } from './card.component'; import { BehaviorSubject, concat, debounceTime, distinctUntilChanged, map, Observable, take } from 'rxjs'; +const pageTitle = 'MOAW - All Workshops'; + @Component({ selector: 'app-catalog', standalone: true, @@ -50,7 +52,12 @@ import { BehaviorSubject, concat, debounceTime, distinctUntilChanged, map, Obser -
No workshops match your search criteria.
+
+ {{ workshopCount }} workshop{{ workshopCount === 1 ? '' : 's' }} + No workshops match your search criteria. +
0; const addToHistory = (text.length > 0 && !hasSearchQuery) || (text.length === 0 && hasSearchQuery); setQueryParams({ search: text.length > 0 ? text : undefined }, false, addToHistory); + this.updateTitle(text); } addTagFilter(tag: string) { @@ -177,4 +186,8 @@ export class CatalogComponent implements OnInit, OnDestroy { trackById(_index: number, workshop: ContentEntry) { return workshop.id; } + + private updateTitle(search: string) { + document.title = pageTitle + (search.length > 0 ? ` - Search: ${search}` : ''); + } }