From 00ce4d1ace4e4d7852f4563339d1c6e890e49a52 Mon Sep 17 00:00:00 2001 From: Sebastian Chitiva Date: Tue, 3 Nov 2026 12:35:30 -0500 Subject: [PATCH 1/9] feat: improve catalogue search with multi-field matching and clear controls Search now matches name, description, topics, language and author, requires every term to match, and ignores case and accents. Adds a result count, a clear button, Escape to clear, / to focus the input, an empty state, and persists the query across navigation. --- src/app/home/home.component.html | 33 ++++++++- src/app/home/home.component.scss | 7 ++ src/app/home/home.component.spec.ts | 110 ++++++++++++++++++++++++++++ src/app/home/home.component.ts | 94 ++++++++++++++++++++++-- 4 files changed, 235 insertions(+), 9 deletions(-) create mode 100644 src/app/home/home.component.scss diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index cda7a4e..89d3315 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -1,6 +1,6 @@
- Search an item by name: +
@@ -9,14 +9,24 @@
+
+ +
@@ -38,6 +48,20 @@
+
+ {{ searchStatus(filteredLength(items)) }} +
+ +
+ No repositories match “{{ search }}”. Try a different name, description or topic. + +
+
{ { name: 'newest', stargazers_count: 1, created_at: '2023-01-01T00:00:00Z', pushed_at: '2023-06-01T00:00:00Z' }, ] as unknown as Repository[]; + const SEARCH_REPOS = [ + { + name: 'mod-eluna', + description: 'Lua engine for AzerothCore', + topics: ['azerothcore-lua'], + language: 'C++', + owner: { login: 'azerothcore' }, + stargazers_count: 5, + created_at: '2020-01-01T00:00:00Z', + pushed_at: '2020-01-01T00:00:00Z', + }, + { + name: 'mod-transmog', + description: 'Transmogrification module', + topics: ['azerothcore-module'], + language: 'C++', + owner: { login: 'azerothcore' }, + stargazers_count: 50, + created_at: '2020-01-01T00:00:00Z', + pushed_at: '2020-01-01T00:00:00Z', + }, + { + name: 'Rápido', + description: 'Accents test', + topics: [], + language: 'Lua', + owner: { login: 'someone' }, + stargazers_count: 1, + created_at: '2020-01-01T00:00:00Z', + pushed_at: '2020-01-01T00:00:00Z', + }, + ] as unknown as Repository[]; + beforeEach(async () => { const MOCK_CONFIG: Config = { page: 0, @@ -153,4 +186,81 @@ describe('HomeComponent', () => { expect(sessionStorage.getItem('azerothcore.catalogue.page')).toBe('0'); expect(sessionStorage.getItem('azerothcore.catalogue.returnHash')).toBe('#/tab/test'); }); + + it('should match repositories by name, description, topic, language or author', () => { + component.search = 'transmogrification'; + expect(component.filteredLength(SEARCH_REPOS)).toBe(1); + + component.search = 'azerothcore-lua'; + expect(component.filteredLength(SEARCH_REPOS)).toBe(1); + + component.search = 'C++'; + expect(component.filteredLength(SEARCH_REPOS)).toBe(2); + + component.search = 'someone'; + expect(component.filteredLength(SEARCH_REPOS)).toBe(1); + }); + + it('should require every search term to match', () => { + component.search = 'module azerothcore'; + expect(component.filteredLength(SEARCH_REPOS)).toBe(1); + + component.search = 'eluna module'; + expect(component.filteredLength(SEARCH_REPOS)).toBe(0); + }); + + it('should ignore case and accents when searching', () => { + component.search = 'ELUNA'; + expect(component.filteredLength(SEARCH_REPOS)).toBe(1); + + component.search = 'rapido'; + expect(component.filteredLength(SEARCH_REPOS)).toBe(1); + }); + + it('should report how many results match', () => { + component.search = 'eluna'; + expect(component.searchStatus(1)).toBe('1 result for “eluna”'); + + component.search = 'nothing'; + expect(component.searchStatus(0)).toBe('No results for “nothing”'); + }); + + it('should save the search and reset the page when the query changes', () => { + component.page = 2; + + component.onSearchChange('eluna'); + + expect(component.page).toBe(0); + expect(sessionStorage.getItem('azerothcore.catalogue.search')).toBe('eluna'); + }); + + it('should clear the search and forget it', () => { + component.search = 'eluna'; + component.page = 2; + sessionStorage.setItem('azerothcore.catalogue.search', 'eluna'); + + component.clearSearch(); + + expect(component.search).toBe(''); + expect(component.page).toBe(0); + expect(sessionStorage.getItem('azerothcore.catalogue.search')).toBeNull(); + }); + + it('should restore the search from session storage', () => { + sessionStorage.setItem('azerothcore.catalogue.search', 'eluna'); + + const restoredFixture = TestBed.createComponent(HomeComponent); + + expect(restoredFixture.componentInstance.search).toBe('eluna'); + restoredFixture.destroy(); + }); + + it('should focus the search input when pressing /', () => { + const input = fixture.nativeElement.querySelector('#search-input') as HTMLInputElement; + spyOn(input, 'focus'); + + document.dispatchEvent(new KeyboardEvent('keydown', { key: '/' })); + + expect(input.focus).toHaveBeenCalled(); + }); }); diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index c9bd74e..db77864 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -1,5 +1,5 @@ import { Location } from '@angular/common'; -import { ChangeDetectorRef, Component } from '@angular/core'; +import { ChangeDetectorRef, Component, ElementRef, HostListener, ViewChild } from '@angular/core'; import { PageEvent } from '@angular/material/paginator'; import { MatTabChangeEvent } from '@angular/material/tabs'; import { faSearch, IconDefinition } from '@fortawesome/free-solid-svg-icons'; @@ -9,6 +9,7 @@ import { CatalogueService } from '../services/catalogue/catalogue.service'; const PAGE_STORAGE_KEY = 'azerothcore.catalogue.page'; const RETURN_HASH_STORAGE_KEY = 'azerothcore.catalogue.returnHash'; const SORT_STORAGE_KEY = 'azerothcore.catalogue.sort'; +const SEARCH_STORAGE_KEY = 'azerothcore.catalogue.search'; export type SortKey = 'stars' | 'updated' | 'created'; @@ -21,9 +22,12 @@ export const SORT_OPTIONS: { key: SortKey; label: string }[] = [ @Component({ selector: 'app-home', templateUrl: './home.component.html', + styleUrls: ['./home.component.scss'], standalone: false }) export class HomeComponent { + @ViewChild('searchInput') searchInput?: ElementRef; + constructor(public catalogueService: CatalogueService, public cdRef: ChangeDetectorRef, private location: Location) { window.parent.document.title = 'GitCatalogue'; this.saveRoute(); @@ -31,7 +35,7 @@ export class HomeComponent { page = this.readPage(); sort: SortKey = this.readSort(); - search: string; + search = this.readSearch(); readonly faSearch: IconDefinition = faSearch; readonly sortOptions = SORT_OPTIONS; @@ -65,6 +69,24 @@ export class HomeComponent { } catch (error) {} } + readSearch(): string { + try { + return sessionStorage.getItem(SEARCH_STORAGE_KEY) || ''; + } catch (error) { + return ''; + } + } + + private writeSearch(value: string): void { + try { + if (value) { + sessionStorage.setItem(SEARCH_STORAGE_KEY, value); + } else { + sessionStorage.removeItem(SEARCH_STORAGE_KEY); + } + } catch (error) {} + } + saveRoute(path?: string): void { try { const route = path || this.location.path() || '/home'; @@ -84,7 +106,35 @@ export class HomeComponent { } onSearchChange(value: string): void { + this.writeSearch(value); + this.resetPage(); + } + + clearSearch(): void { + if (!this.search) { + return; + } + this.search = ''; + this.writeSearch(''); this.resetPage(); + this.searchInput?.nativeElement.focus(); + } + + @HostListener('document:keydown', ['$event']) + onDocumentKeydown(event: KeyboardEvent): void { + if (event.key !== '/' || event.ctrlKey || event.metaKey || event.altKey) { + return; + } + + const target = event.target as HTMLElement | null; + const isTyping = + !!target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.tagName === 'SELECT' || target.isContentEditable); + if (isTyping) { + return; + } + + event.preventDefault(); + this.searchInput?.nativeElement.focus(); } onSortChange(value: SortKey): void { @@ -121,12 +171,46 @@ export class HomeComponent { return this.matchingItems(modules).length; } + searchStatus(count: number): string { + const query = this.search.trim(); + if (count === 0) { + return `No results for “${query}”`; + } + return `${count} ${count === 1 ? 'result' : 'results'} for “${query}”`; + } + private matchingItems(modules: Repository[]): Repository[] { - if (!this.search) { + const terms = this.terms; + if (terms.length === 0) { return modules; } - const search = this.search.toLowerCase(); - return modules.filter((item) => item.name.toLowerCase().indexOf(search) > -1); + return modules.filter((item) => this.matches(item, terms)); + } + + private matches(item: Repository, terms: string[]): boolean { + const haystack = this.searchableText(item); + return terms.every((term) => haystack.includes(term)); + } + + private get terms(): string[] { + return this.normalize(this.search || '') + .split(/\s+/) + .filter(Boolean); + } + + private searchableText(item: Repository): string { + return this.normalize( + [item.name, item.full_name, item.description, item.language, item.owner?.login, ...(item.topics || [])] + .filter(Boolean) + .join(' '), + ); + } + + private normalize(value: string): string { + return value + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, '') + .toLowerCase(); } private sortItems(modules: Repository[]): Repository[] { From 3cd57703d2f0a71656a393eae84b9c8ff48f2be7 Mon Sep 17 00:00:00 2001 From: Sebastian Chitiva Date: Tue, 3 Nov 2026 12:41:39 -0500 Subject: [PATCH 2/9] feat: refresh catalogue layout with search toolbar and repository cards Moves search and sort into a sticky toolbar, renders repositories as responsive cards with topic chips and metadata, and adds a dedicated empty state. Keeps the existing Angular Material tabs and paginator. --- src/app/home/home.component.html | 112 ++++++++-------- src/app/home/home.component.scss | 216 ++++++++++++++++++++++++++++++- src/app/home/home.component.ts | 4 + src/app/repo/repo.component.html | 38 ++++-- src/app/repo/repo.component.scss | 105 ++++++++++++++- src/app/repo/repo.component.ts | 4 +- 6 files changed, 403 insertions(+), 76 deletions(-) diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 89d3315..1522157 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -1,69 +1,61 @@ -
-
- - -
-
- - - -
- -
- +
- - - -
- -
-
-

Want to submit your repository? Check the instructions here

+
+ +
-
-
+ -
-
- - -
-
- {{ searchStatus(filteredLength(items)) }} -
+

Can't find a repository? Check how to add it.

-
- No repositories match “{{ search }}”. Try a different name, description or topic. - +
+ + +
+
+ {{ searchStatus(filteredLength(items)) }} + + {{ repositoryCount(filteredLength(items)) }} + +
-
+
+
+ +
No repositories found
+

Nothing matches “{{ search }}”. Try a different name, description or topic.

+ +
+
-
+ diff --git a/src/app/home/home.component.scss b/src/app/home/home.component.scss index b0fe1f2..c517f8d 100644 --- a/src/app/home/home.component.scss +++ b/src/app/home/home.component.scss @@ -1,7 +1,217 @@ -// Chrome and Edge render a native clear button for type="search"; -// the input group already has its own, so hide the native one. +:host { + display: block; +} + +.catalogue { + padding-bottom: 1.5rem; +} + +.catalogue-toolbar { + position: sticky; + top: 0; + z-index: 10; + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.75rem 1rem; + padding: 0.85rem 0; + margin-bottom: 0.25rem; + background: rgba(255, 255, 255, 0.96); + border-bottom: 1px solid #e5e7eb; + backdrop-filter: blur(8px); +} + +.catalogue-search { + flex: 1 1 320px; + min-width: 240px; +} + +.search-box { + position: relative; + + .search-icon { + position: absolute; + left: 0.9rem; + top: 50%; + transform: translateY(-50%); + color: #9aa5b1; + font-size: 0.9rem; + pointer-events: none; + } + + input { + width: 100%; + padding: 0.6rem 2.6rem 0.6rem 2.4rem; + border: 1px solid #d2d6dc; + border-radius: 999px; + background: #fff; + color: #1f2933; + font-size: 0.95rem; + transition: border-color 0.15s ease, box-shadow 0.15s ease; + + &::placeholder { + color: #9aa5b1; + } + + &:focus { + outline: none; + border-color: #007bff; + box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15); + } + } + + .search-clear { + position: absolute; + right: 0.55rem; + top: 50%; + transform: translateY(-50%); + display: flex; + align-items: center; + justify-content: center; + width: 1.6rem; + height: 1.6rem; + padding: 0; + border: 0; + border-radius: 50%; + background: transparent; + color: #6b7280; + font-size: 1.1rem; + line-height: 1; + cursor: pointer; + + &:hover { + background: #eef2f7; + color: #1f2933; + } + } + + .search-hint { + position: absolute; + right: 0.75rem; + top: 50%; + transform: translateY(-50%); + padding: 0.05rem 0.35rem; + border: 1px solid #d2d6dc; + border-radius: 0.25rem; + background: #f8fafc; + color: #9aa5b1; + font-family: inherit; + font-size: 0.7rem; + } +} + +.catalogue-sort { + display: flex; + align-items: center; + gap: 0.5rem; + + label { + margin: 0; + color: #6b7280; + font-size: 0.75rem; + font-weight: 600; + letter-spacing: 0.04em; + text-transform: uppercase; + } + + select { + padding: 0.45rem 1.75rem 0.45rem 0.65rem; + border: 1px solid #d2d6dc; + border-radius: 0.5rem; + background: #fff; + color: #1f2933; + font-size: 0.85rem; + cursor: pointer; + + &:focus { + outline: none; + border-color: #007bff; + box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15); + } + } +} + +.catalogue-hint { + margin: 0.75rem 0 0.25rem; + color: #6b7280; + font-size: 0.85rem; + + a { + color: #007bff; + } +} + +.results-bar { + display: flex; + align-items: center; + justify-content: space-between; + margin: 0.9rem 0 0.35rem; + color: #6b7280; + font-size: 0.85rem; +} + +.repo-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); + gap: 1rem; + margin: 0.75rem 0 0.25rem; +} + +.empty-state { + margin: 1.5rem 0; + padding: 3rem 1rem; + border: 1px dashed #d2d6dc; + border-radius: 0.75rem; + background: #fff; + color: #6b7280; + text-align: center; + + fa-icon { + color: #9aa5b1; + font-size: 1.75rem; + } + + h5 { + margin: 0.9rem 0 0.35rem; + color: #1f2933; + font-size: 1.05rem; + font-weight: 600; + } + + p { + margin: 0 0 1rem; + font-size: 0.9rem; + } +} + +mat-paginator { + margin-top: 0.75rem; + background: transparent; +} + +::ng-deep .catalogue-tabs .mat-mdc-tab-header { + border-bottom: 1px solid #e5e7eb; +} + +::ng-deep .catalogue-tabs .mat-mdc-tab .mdc-tab__text-label { + font-weight: 600; +} + input[type='search']::-webkit-search-cancel-button, -input[type='search']::-webkit-search-decoration { +input[type='search']::-webkit-search-decoration, +input[type='search']::-ms-clear { + display: none; -webkit-appearance: none; appearance: none; } + +@media (max-width: 575px) { + ::ng-deep .catalogue-tabs .mat-mdc-tab { + min-width: 0; + padding: 0 0.5rem; + } + + ::ng-deep .catalogue-tabs .mdc-tab__text-label { + font-size: 0.8rem; + } +} diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index db77864..88649bb 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -179,6 +179,10 @@ export class HomeComponent { return `${count} ${count === 1 ? 'result' : 'results'} for “${query}”`; } + repositoryCount(count: number): string { + return `${count} ${count === 1 ? 'repository' : 'repositories'}`; + } + private matchingItems(modules: Repository[]): Repository[] { const terms = this.terms; if (terms.length === 0) { diff --git a/src/app/repo/repo.component.html b/src/app/repo/repo.component.html index 3dd5c7c..2d38800 100644 --- a/src/app/repo/repo.component.html +++ b/src/app/repo/repo.component.html @@ -1,18 +1,30 @@ -
+
{{ fullName }} -
-

- {{ name }} -

- - {{ stars }} | Created {{ created | amTimeAgo }} - | Updated {{ updated | amTimeAgo }} - -

{{ description }}

+ +
+
+
{{ name }}
+ + + {{ stars }} + +
+ +

{{ description }}

+ +
+ {{ topic }} +
+ +
+ Updated {{ updated | amTimeAgo }} + Created {{ created | amTimeAgo }} +
-
+
diff --git a/src/app/repo/repo.component.scss b/src/app/repo/repo.component.scss index 9bd85b4..367e4e5 100644 --- a/src/app/repo/repo.component.scss +++ b/src/app/repo/repo.component.scss @@ -1,4 +1,103 @@ -.logo-small { - height: 80px; - width: 80px; +:host { + display: block; + height: 100%; +} + +.repo-card { + display: flex; + gap: 0.9rem; + height: 100%; + padding: 1rem; + background: #fff; + border: 1px solid #e5e7eb; + border-radius: 0.75rem; + transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease; + + &:hover { + border-color: #cfd8e3; + box-shadow: 0 0.5rem 1.25rem rgba(31, 41, 51, 0.08); + transform: translateY(-2px); + } +} + +.repo-icon { + flex: none; + width: 44px; + height: 44px; + border-radius: 10px; + object-fit: cover; + background: #f3f4f6; +} + +.repo-body { + flex: 1; + min-width: 0; +} + +.repo-head { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 0.75rem; + + h5 { + margin: 0; + font-size: 1rem; + font-weight: 600; + line-height: 1.3; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + a { + color: #1f2933; + text-decoration: none; + + &:hover { + color: #007bff; + text-decoration: underline; + } + } +} + +.repo-stars { + flex: none; + font-size: 0.8rem; + color: #6b7280; +} + +.repo-description { + margin: 0.35rem 0 0.6rem; + color: #4b5563; + font-size: 0.875rem; + line-height: 1.45; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; +} + +.repo-topics { + display: flex; + flex-wrap: wrap; + gap: 0.35rem; + margin-bottom: 0.6rem; + + .badge { + padding: 0.25rem 0.5rem; + border-radius: 999px; + background: #eef2f7; + color: #3e4c59; + font-size: 0.7rem; + font-weight: 500; + } +} + +.repo-meta { + display: flex; + flex-wrap: wrap; + gap: 0.75rem; + font-size: 0.75rem; + color: #6b7280; } diff --git a/src/app/repo/repo.component.ts b/src/app/repo/repo.component.ts index 33d9604..1a7599b 100644 --- a/src/app/repo/repo.component.ts +++ b/src/app/repo/repo.component.ts @@ -1,5 +1,5 @@ import { Component, Input } from '@angular/core'; -import { faStar, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { faClock, faStar, IconDefinition } from '@fortawesome/free-solid-svg-icons'; @Component({ selector: 'app-repo', @@ -15,6 +15,8 @@ export class RepoComponent { @Input() updated: Date; @Input() description: string; @Input() fullName: string; + @Input() topics: string[] = []; readonly faStar: IconDefinition = faStar; + readonly faClock: IconDefinition = faClock; } From e2b324712f03401d8dd97d71444eec2de65f7b30 Mon Sep 17 00:00:00 2001 From: Sebastian Chitiva Date: Tue, 3 Nov 2026 12:51:26 -0500 Subject: [PATCH 3/9] feat: refresh repository details page Adds a hero header with description and topics, a stats row, a styled README card with GitHub-like typography, and a sticky about sidebar with links and download actions. --- .../repo-details/repo-details.component.html | 184 ++++++--- .../repo-details/repo-details.component.scss | 365 +++++++++++++++++- .../repo-details/repo-details.component.ts | 4 + 3 files changed, 485 insertions(+), 68 deletions(-) diff --git a/src/app/repo-details/repo-details.component.html b/src/app/repo-details/repo-details.component.html index 179ad25..9b3c0a5 100644 --- a/src/app/repo-details/repo-details.component.html +++ b/src/app/repo-details/repo-details.component.html @@ -1,67 +1,129 @@ -   back to Catalogue +
+ + + Back to catalogue + -
-
- -
-

{{ data.repo.name }}

-

- by {{ data.repo.owner.login }} -

-
-
+ +
+ -
-
- - {{ data.readme | emojiFixup }} - -
-
-
- Download +
+
+

{{ data.repo.name }}

+ + by + {{ data.repo.owner.login }} + +
+ +

{{ data.repo.description }}

+ +
+ {{ topic }} +
+
+ + +
-

About this repo

-
    -
  • - Repo ID: {{ data.repo.id }} -
  • -
  • - Author: {{ data.repo.owner.login }} -
  • -
  • - Repo: - View on Github -
  • -
  • - Watchers: {{ data.repo.subscribers_count }} -
  • -
  • - Stars: {{ data.repo.stargazers_count }} -
  • -
  • - Forks: {{ data.repo.forks_count }} -
  • -
  • - Created: {{ data.repo.created_at | amTimeAgo }} -
  • -
  • - Last update: {{ data.repo.pushed_at | amTimeAgo }} -
  • -
  • - License: {{ data.repo.license.spdx_id }} -
  • -
+
+
+ {{ data.repo.stargazers_count }} + Stars +
+
+ {{ data.repo.forks_count }} + Forks
+
+ {{ data.repo.subscribers_count }} + Watchers +
+
+ {{ data.repo.open_issues_count }} + Open issues +
+
+ {{ data.repo.language }} + Language +
+
+ {{ data.repo.license.spdx_id }} + License +
+
+ +
+
+

README

+
+ + {{ data.readme | emojiFixup }} + +
+
+ +
-
+
diff --git a/src/app/repo-details/repo-details.component.scss b/src/app/repo-details/repo-details.component.scss index c9d7b3b..4dd7de1 100644 --- a/src/app/repo-details/repo-details.component.scss +++ b/src/app/repo-details/repo-details.component.scss @@ -1,11 +1,362 @@ -.logo { - width: 80px; - height: 80px; +:host { + display: block; } -#about { - background-color: #fff; - border: solid 2px #888; - padding: 25px; +.details { + max-width: 1180px; + margin: 0 auto; + padding: 1.25rem 0 3rem; } +.back-link { + display: inline-flex; + align-items: center; + gap: 0.35rem; + margin-bottom: 1rem; + color: #6b7280; + font-size: 0.85rem; + text-decoration: none; + + &:hover { + color: #007bff; + text-decoration: none; + } +} + +.repo-hero { + display: flex; + align-items: flex-start; + gap: 1.25rem; + padding: 1.5rem; + background: #fff; + border: 1px solid #e5e7eb; + border-radius: 1rem; +} + +.repo-hero-logo { + flex: none; + width: 72px; + height: 72px; + border-radius: 14px; + object-fit: cover; + background: #f3f4f6; +} + +.repo-hero-body { + flex: 1; + min-width: 0; +} + +.repo-hero-title { + display: flex; + flex-wrap: wrap; + align-items: baseline; + gap: 0.35rem 0.75rem; + + h1 { + margin: 0; + font-size: 1.6rem; + font-weight: 700; + line-height: 1.25; + word-break: break-word; + } +} + +.repo-hero-owner { + color: #6b7280; + font-size: 0.9rem; + + a { + color: #007bff; + text-decoration: none; + + &:hover { + text-decoration: underline; + } + } +} + +.repo-hero-description { + margin: 0.5rem 0 0; + color: #4b5563; + font-size: 0.95rem; + line-height: 1.5; +} + +.repo-topics { + display: flex; + flex-wrap: wrap; + gap: 0.35rem; + margin-top: 0.75rem; + + .badge { + padding: 0.25rem 0.55rem; + border-radius: 999px; + background: #eef2f7; + color: #3e4c59; + font-size: 0.72rem; + font-weight: 500; + } +} + +.repo-hero-actions { + display: flex; + flex: none; + flex-wrap: wrap; + gap: 0.5rem; + + .btn { + display: inline-flex; + align-items: center; + gap: 0.4rem; + } +} + +.stats { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); + gap: 0.75rem; + margin: 1rem 0; +} + +.stat { + padding: 0.75rem 1rem; + background: #fff; + border: 1px solid #e5e7eb; + border-radius: 0.75rem; +} + +.stat-value { + display: block; + color: #1f2933; + font-size: 1.15rem; + font-weight: 700; + line-height: 1.2; + word-break: break-word; +} + +.stat-label { + display: inline-flex; + align-items: center; + gap: 0.35rem; + margin-top: 0.15rem; + color: #6b7280; + font-size: 0.72rem; + font-weight: 600; + letter-spacing: 0.05em; + text-transform: uppercase; +} + +.details-layout { + display: grid; + grid-template-columns: minmax(0, 1fr) 330px; + gap: 1.25rem; + align-items: start; +} + +.card { + padding: 1.25rem 1.5rem; + background: #fff; + border: 1px solid #e5e7eb; + border-radius: 1rem; +} + +.section-title { + margin: 0 0 0.9rem; + color: #6b7280; + font-size: 0.75rem; + font-weight: 700; + letter-spacing: 0.08em; + text-transform: uppercase; +} + +.about-list { + display: grid; + gap: 0.55rem; + margin: 0 0 1rem; + + div { + display: flex; + justify-content: space-between; + gap: 1rem; + } + + dt { + margin: 0; + color: #6b7280; + font-size: 0.82rem; + font-weight: 500; + } + + dd { + margin: 0; + max-width: 62%; + color: #1f2933; + font-size: 0.82rem; + text-align: right; + word-break: break-word; + } + + a { + color: #007bff; + text-decoration: none; + + &:hover { + text-decoration: underline; + } + } +} + +// The README is rendered from HTML, so these rules need to pierce encapsulation. +:host ::ng-deep #readme-markdown { + color: #1f2933; + font-size: 0.95rem; + line-height: 1.65; + word-wrap: break-word; + + h1, + h2, + h3, + h4 { + margin: 1.5rem 0 0.6rem; + font-weight: 700; + line-height: 1.3; + } + + h1 { + padding-bottom: 0.4rem; + border-bottom: 1px solid #e5e7eb; + font-size: 1.55rem; + } + + h2 { + padding-bottom: 0.35rem; + border-bottom: 1px solid #e5e7eb; + font-size: 1.3rem; + } + + h3 { + font-size: 1.1rem; + } + + h4 { + font-size: 1rem; + } + + p { + margin: 0 0 0.9rem; + } + + ul, + ol { + margin: 0 0 0.9rem; + padding-left: 1.4rem; + } + + li { + margin-bottom: 0.25rem; + } + + a { + color: #007bff; + } + + strong { + font-weight: 600; + } + + img { + max-width: 100%; + height: auto; + border-radius: 0.5rem; + } + + code { + padding: 0.1rem 0.3rem; + border-radius: 0.25rem; + background: #f1f5f9; + color: #0f172a; + font-size: 0.85em; + } + + pre { + margin: 0 0 1rem; + padding: 0.9rem 1rem; + border-radius: 0.5rem; + background: #0f172a; + color: #e2e8f0; + overflow-x: auto; + + code { + padding: 0; + background: transparent; + color: inherit; + } + } + + blockquote { + margin: 0 0 1rem; + padding: 0.25rem 0 0.25rem 1rem; + border-left: 3px solid #d2d6dc; + color: #4b5563; + } + + table { + width: 100%; + margin: 0 0 1rem; + border-collapse: collapse; + font-size: 0.9rem; + + th, + td { + padding: 0.45rem 0.6rem; + border: 1px solid #e5e7eb; + } + + th { + background: #f8fafc; + text-align: left; + } + } + + hr { + margin: 1.5rem 0; + border: 0; + border-top: 1px solid #e5e7eb; + } +} + +@media (max-width: 991px) { + .details-layout { + grid-template-columns: minmax(0, 1fr); + } + + .repo-hero { + flex-wrap: wrap; + } + + .repo-hero-actions { + width: 100%; + } +} + +@media (min-width: 992px) { + .about-card { + position: sticky; + top: 1rem; + } +} + +@media (max-width: 575px) { + .repo-hero { + padding: 1.15rem; + } + + .repo-hero-title h1 { + font-size: 1.35rem; + } + + .card { + padding: 1rem; + } +} diff --git a/src/app/repo-details/repo-details.component.ts b/src/app/repo-details/repo-details.component.ts index a6ec8d0..fb18603 100644 --- a/src/app/repo-details/repo-details.component.ts +++ b/src/app/repo-details/repo-details.component.ts @@ -5,7 +5,9 @@ import { faBalanceScale, faCaretLeft, faClock, + faCode, faCodeBranch, + faExclamationCircle, faExternalLinkAlt, faEye, faGlobe, @@ -47,6 +49,8 @@ export class RepoDetailsComponent { readonly faClock = faClock; readonly faBalanceScale = faBalanceScale; readonly faSync = faSync; + readonly faCode = faCode; + readonly faExclamationCircle = faExclamationCircle; readonly returnHash = this.readReturnHash(); data$: Observable; From 938cd24b62d2e279f5850a4ba12d31033a4ec1f6 Mon Sep 17 00:00:00 2001 From: Sebastian Chitiva Date: Tue, 3 Nov 2026 18:53:22 -0500 Subject: [PATCH 4/9] feat: polish catalogue UX with advanced filters, motion and star tiers Adds the light editorial layout, filter panel with topics/language/min stars, query operators, skeleton loading, staggered row entrance, branded route transition, spinning star tiers and header animations. --- src/app/catalogue/catalogue.component.html | 8 + src/app/catalogue/catalogue.component.scss | 76 ++ src/app/catalogue/catalogue.component.ts | 53 +- src/app/home/home.component.html | 140 +++- src/app/home/home.component.scss | 687 +++++++++++++++--- src/app/home/home.component.spec.ts | 532 +++++++------- src/app/home/home.component.ts | 616 ++++++++++------ .../repo-details/repo-details.component.html | 261 +++---- .../repo-details/repo-details.component.scss | 322 +++++--- .../repo-details/repo-details.component.ts | 136 ++-- src/app/repo/repo.component.html | 42 +- src/app/repo/repo.component.scss | 264 +++++-- src/app/repo/repo.component.ts | 50 +- src/styles.scss | 2 +- 14 files changed, 2162 insertions(+), 1027 deletions(-) create mode 100644 src/app/catalogue/catalogue.component.scss diff --git a/src/app/catalogue/catalogue.component.html b/src/app/catalogue/catalogue.component.html index 5387317..3688200 100644 --- a/src/app/catalogue/catalogue.component.html +++ b/src/app/catalogue/catalogue.component.html @@ -1,3 +1,11 @@ + +
diff --git a/src/app/catalogue/catalogue.component.scss b/src/app/catalogue/catalogue.component.scss new file mode 100644 index 0000000..b0787b2 --- /dev/null +++ b/src/app/catalogue/catalogue.component.scss @@ -0,0 +1,76 @@ +.route-veil { + position: fixed; + inset: 0; + z-index: 9999; + display: flex; + align-items: center; + justify-content: center; + background: #0f1217; + color: #f6f7f9; + pointer-events: none; + animation: veil-sweep 0.85s cubic-bezier(0.76, 0, 0.24, 1) both; + will-change: transform; +} + +.route-veil-brand { + display: flex; + flex-direction: column; + align-items: center; + gap: 0.7rem; +} + +.route-veil-mark { + width: 46px; + height: 2px; + background: #b4232a; + transform-origin: center; + animation: veil-mark 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) 0.18s both; +} + +.route-veil-name { + font-size: 0.95rem; + font-weight: 700; + letter-spacing: 0.34em; + text-transform: uppercase; +} + +.route-veil-label { + color: rgba(246, 247, 249, 0.5); + font-size: 0.6rem; + letter-spacing: 0.44em; + text-transform: uppercase; +} + +@keyframes veil-sweep { + 0% { + transform: translateY(-100%); + } + + 30% { + transform: translateY(0); + } + + 62% { + transform: translateY(0); + } + + 100% { + transform: translateY(-100%); + } +} + +@keyframes veil-mark { + from { + transform: scaleX(0); + } + + to { + transform: scaleX(1); + } +} + +@media (prefers-reduced-motion: reduce) { + .route-veil { + display: none; + } +} diff --git a/src/app/catalogue/catalogue.component.ts b/src/app/catalogue/catalogue.component.ts index e65a37f..c387659 100644 --- a/src/app/catalogue/catalogue.component.ts +++ b/src/app/catalogue/catalogue.component.ts @@ -1,8 +1,57 @@ -import { Component } from '@angular/core'; +import { Component, OnDestroy } from '@angular/core'; +import { NavigationStart, Router } from '@angular/router'; +import { Subscription } from 'rxjs'; @Component({ selector: 'app-catalogue', templateUrl: './catalogue.component.html', + styleUrls: ['./catalogue.component.scss'], standalone: false }) -export class CatalogueComponent {} +export class CatalogueComponent implements OnDestroy { + veilVisible = false; + + private readonly subscription = new Subscription(); + private showTimer?: number; + private hideTimer?: number; + private readonly reduceMotion = + typeof window !== 'undefined' && !!window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; + + constructor(private readonly router: Router) { + document.body.classList.remove('catalogue-ready'); + + if (!this.reduceMotion) { + this.veilVisible = true; + this.hideTimer = window.setTimeout(() => this.finishTransition(), 900); + } else { + document.body.classList.add('catalogue-ready'); + } + + this.subscription.add( + this.router.events.subscribe((event) => { + if (!(event instanceof NavigationStart) || this.reduceMotion) { + return; + } + + window.clearTimeout(this.showTimer); + window.clearTimeout(this.hideTimer); + document.body.classList.remove('catalogue-ready'); + this.veilVisible = false; + this.showTimer = window.setTimeout(() => (this.veilVisible = true), 20); + this.hideTimer = window.setTimeout(() => this.finishTransition(), 900); + }), + ); + } + + ngOnDestroy(): void { + this.subscription.unsubscribe(); + window.clearTimeout(this.showTimer); + window.clearTimeout(this.hideTimer); + document.body.classList.remove('catalogue-ready'); + } + + private finishTransition(): void { + this.veilVisible = false; + document.body.classList.add('catalogue-ready'); + } +} diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 1522157..bf404d7 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -1,7 +1,10 @@ -
-
- -

{{ description }}

+ @if (description) { +

{{ description }}

+ } -
- {{ topic }} -
+ @if (topics?.length) { +
+ @for (topic of (topics || []).slice(0, 4); track topic) { + {{ topic }} + } +
+ }
- + @for (star of starList; track $index; let i = $index) { + + } {{ stars }} - {{ updated | amTimeAgo }} + @if (updated) { + {{ updated | amTimeAgo }} + }
From 0029bf5181fea3fa6498a68de8cdb2fa138afbda Mon Sep 17 00:00:00 2001 From: Helias Date: Wed, 4 Nov 2026 18:53:57 +0100 Subject: [PATCH 6/9] refactor: clean up catalogue templates and remove unused icons We prefer template literals over string concatenation and the built-in control flow over *ngFor, so this moves the remaining code to them. The how-to page loses the ?. on CONF because under @for it makes keyvalue type the values as unknown, which breaks the build. --- src/app/home/home.component.html | 33 ++++++++----------- src/app/howto/howto.component.html | 22 +++++++------ .../repo-details/repo-details.component.html | 8 ++--- .../repo-details/repo-details.component.ts | 10 ------ src/app/repo/repo.component.html | 4 +-- src/app/repo/repo.component.ts | 3 +- .../services/catalogue/catalogue.service.ts | 2 +- 7 files changed, 33 insertions(+), 49 deletions(-) diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index f79214d..525804f 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -26,8 +26,7 @@

Modules, tools and scripts
for your server.

- } - @if (!search) { + } @else { }
@@ -106,8 +105,7 @@

Modules, tools and scripts
for your server.

- } - @if (!topTopics(items).length) { + } @empty { No topics in this tab }
@@ -127,7 +125,7 @@

Modules, tools and scripts
for your server.

@@ -165,32 +163,27 @@

Modules, tools and scripts
for your server.

> }
- } - @if (filteredLength(items) === 0 && (search || activeFilterCount)) { + + + } @else if (search || activeFilterCount) {
No repositories found
@if (search) {

Nothing matches “{{ search }}”. Try a different name, description or topic.

- } - @if (!search) { + } @else {

No repositories match the selected filters.

}
} - - @if (filteredLength(items) > 0) { - - - }
} @else {
diff --git a/src/app/howto/howto.component.html b/src/app/howto/howto.component.html index 78c629a..090aa00 100644 --- a/src/app/howto/howto.component.html +++ b/src/app/howto/howto.component.html @@ -18,18 +18,20 @@

Step 1: Add GitHub Topics to Your Repository

Available Categories & Required Topics:
-
-
-
-
{{ tab.key }}
-

- Required topic: - {{ tab.value.topic }} -

- Organization: {{ tab.value.org || 'default-org' }} + @for (tab of catalogueService.CONF.tabs | keyvalue; track tab.key) { +
+
+
+
{{ tab.key }}
+

+ Required topic: + {{ tab.value.topic }} +

+ Organization: {{ tab.value.org || 'default-org' }} +
-
+ }
diff --git a/src/app/repo-details/repo-details.component.html b/src/app/repo-details/repo-details.component.html index c5dbe6c..29484cf 100644 --- a/src/app/repo-details/repo-details.component.html +++ b/src/app/repo-details/repo-details.component.html @@ -3,7 +3,7 @@ @@ -21,7 +21,7 @@

{{ data.repo.name }}

by - {{ data.repo.owner.login }} + {{ data.repo.owner.login }}
@@ -45,7 +45,7 @@

{{ data.repo.name }}

@@ -108,7 +108,7 @@

About

diff --git a/src/app/repo-details/repo-details.component.ts b/src/app/repo-details/repo-details.component.ts index 0f506b7..437dfbc 100644 --- a/src/app/repo-details/repo-details.component.ts +++ b/src/app/repo-details/repo-details.component.ts @@ -4,16 +4,11 @@ import { faGithub } from '@fortawesome/free-brands-svg-icons'; import { faBalanceScale, faCaretLeft, - faClock, faCode, faCodeBranch, faExclamationCircle, - faExternalLinkAlt, faEye, - faGlobe, faStar, - faUserCircle, - faSync, } from '@fortawesome/free-solid-svg-icons'; import { Observable } from 'rxjs'; import { pluck, tap } from 'rxjs/operators'; @@ -39,16 +34,11 @@ export class RepoDetailsComponent { } readonly faCaretLeft = faCaretLeft; - readonly faGlobe = faGlobe; - readonly faUserCircle = faUserCircle; readonly faGithub = faGithub; - readonly faExternalLinkAlt = faExternalLinkAlt; readonly faEye = faEye; readonly faStar = faStar; readonly faCodeBranch = faCodeBranch; - readonly faClock = faClock; readonly faBalanceScale = faBalanceScale; - readonly faSync = faSync; readonly faCode = faCode; readonly faExclamationCircle = faExclamationCircle; readonly returnHash = this.readReturnHash(); diff --git a/src/app/repo/repo.component.html b/src/app/repo/repo.component.html index a682809..a9ee520 100644 --- a/src/app/repo/repo.component.html +++ b/src/app/repo/repo.component.html @@ -1,7 +1,7 @@ - + { - const key = 'repo-' + id; + const key = `repo-${id}`; const item = localStorage.getItem(key); if (item && !this.expireMinutes(30, JSON.parse(item).timeDate)) { From 5015bcf14ac8275d56fa5dd5c9a60013c5d0dc1d Mon Sep 17 00:00:00 2001 From: Helias Date: Wed, 4 Nov 2026 19:07:12 +0100 Subject: [PATCH 7/9] feat: tighten the catalogue header and add pagination above the results The header took more vertical space than it needed, and on long lists you had to scroll to the bottom to change page. --- src/app/home/home.component.html | 40 +++++++++++++-------- src/app/home/home.component.scss | 60 ++++++++++++++++++++------------ 2 files changed, 63 insertions(+), 37 deletions(-) diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 525804f..4d208fe 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -1,8 +1,11 @@

AzerothCore · Catalogue

-

Modules, tools and scripts
for your server.

-

Browse everything the community maintains. Search by name, description or topic.

+

Modules, tools and scripts for your server.

+

+ Browse everything the community maintains. Search by name, description or topic. Can't find a repository? + Learn how to add it +

-

Can't find a repository? Learn how to add it

- @if (activeFilterCount) {
Active @@ -137,13 +138,29 @@

Modules, tools and scripts
for your server.

} + + + + +
{{ search ? searchStatus(filteredLength(items)) : repositoryCount(filteredLength(items)) }} - @if (search || activeFilterCount) { - - } +
+ @if (search || activeFilterCount) { + + } + @if (filteredLength(items) > 0) { + + } +
@if (filteredLength(items) > 0) { @@ -164,14 +181,7 @@

Modules, tools and scripts
for your server.

}
- - + } @else if (search || activeFilterCount) {
diff --git a/src/app/home/home.component.scss b/src/app/home/home.component.scss index 370e722..4ebd385 100644 --- a/src/app/home/home.component.scss +++ b/src/app/home/home.component.scss @@ -107,11 +107,21 @@ h1 { } .lede { - max-width: 34rem; margin: 1rem 0 0; color: #5f6b7a; font-size: 0.98rem; line-height: 1.6; + + a { + color: #14171c; + text-decoration: underline; + text-decoration-color: #c9cfd8; + text-underline-offset: 3px; + + &:hover { + text-decoration-color: #b4232a; + } + } } .search-row { @@ -290,24 +300,6 @@ h1 { } } -.submit-line { - margin: 1.1rem 0 0; - color: #8a94a3; - font-size: 0.82rem; - animation: rise 0.5s ease 0.06s both; - - a { - color: #14171c; - text-decoration: underline; - text-decoration-color: #c9cfd8; - text-underline-offset: 3px; - - &:hover { - text-decoration-color: #b4232a; - } - } -} - .active-filters { display: flex; flex-wrap: wrap; @@ -347,7 +339,7 @@ h1 { } .tabs-wrap { - margin-top: 2.5rem; + margin-top: 1.25rem; animation: rise 0.5s ease 0.12s both; } @@ -449,9 +441,34 @@ h1 { .results-head { display: flex; + flex-wrap: wrap; align-items: center; justify-content: space-between; - padding: 1.1rem 0 0.9rem; + gap: 0.25rem 1rem; + padding: 0.6rem 0; + + ::ng-deep mat-paginator { + .mat-mdc-paginator-container { + min-height: 0; + padding: 0; + } + + .mat-mdc-paginator-range-label { + margin: 0 0.5rem 0 0; + } + + .mat-mdc-icon-button { + --mat-icon-button-state-layer-size: 32px; + padding: 4px; + } + } +} + +.results-actions { + display: flex; + align-items: center; + gap: 1rem; + margin-left: auto; } .results-count { @@ -686,7 +703,6 @@ h1 { @media (prefers-reduced-motion: reduce) { .masthead, - .submit-line, .active-filters, .tabs-wrap { animation: none; From ed72ad1a1683d0f184bed7a39b6d93a5bf1bc691 Mon Sep 17 00:00:00 2001 From: Helias Date: Wed, 4 Nov 2026 19:07:12 +0100 Subject: [PATCH 8/9] fix: show README images that use relative paths Relative paths were resolved against the catalogue site, so those images never loaded. They now point at the file in the repository on its default branch. --- .../repo-details/repo-details.component.html | 4 +- .../repo-details.component.spec.ts | 102 ++++++++++++++++++ .../repo-details/repo-details.component.ts | 14 +++ 3 files changed, 118 insertions(+), 2 deletions(-) diff --git a/src/app/repo-details/repo-details.component.html b/src/app/repo-details/repo-details.component.html index 29484cf..6b0204b 100644 --- a/src/app/repo-details/repo-details.component.html +++ b/src/app/repo-details/repo-details.component.html @@ -88,8 +88,8 @@

{{ data.repo.name }}

README

-
- +
+ {{ data.readme | emojiFixup }}
diff --git a/src/app/repo-details/repo-details.component.spec.ts b/src/app/repo-details/repo-details.component.spec.ts index 9514a86..07ba323 100644 --- a/src/app/repo-details/repo-details.component.spec.ts +++ b/src/app/repo-details/repo-details.component.spec.ts @@ -1,10 +1,112 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { ActivatedRoute } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; +import { MarkdownComponent, MarkdownModule } from 'ngx-markdown'; +import { MomentModule } from 'ngx-moment'; +import { of } from 'rxjs'; +import { take } from 'rxjs/operators'; +import { Repository } from 'src/@types'; +import { EmojiFixupPipe } from '../pipes/emoji-fixup.pipe'; import { RepoDetailsComponent } from './repo-details.component'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; +describe('RepoDetailsComponent README images', () => { + const renderReadme = async (readme: string, defaultBranch = 'master'): Promise => { + const repo = { + id: 215361574, + name: 'mod-bg-twinpeaks', + full_name: 'Helias/mod-bg-twinpeaks', + description: 'Twin Peaks battleground', + html_url: 'https://github.com/Helias/mod-bg-twinpeaks', + default_branch: defaultBranch, + owner: { login: 'Helias' }, + stargazers_count: 31, + forks_count: 4, + subscribers_count: 2, + open_issues_count: 1, + created_at: '2019-10-15T00:00:00Z', + pushed_at: '2026-01-01T00:00:00Z', + topics: ['azerothcore-module'], + } as unknown as Repository; + + await TestBed.configureTestingModule({ + declarations: [RepoDetailsComponent, EmojiFixupPipe], + imports: [RouterTestingModule, FontAwesomeModule, MomentModule, MarkdownModule.forRoot()], + providers: [{ provide: ActivatedRoute, useValue: { data: of({ data: { repo, readme, logo: 'https://example.com/logo.png' } }) } }], + }).compileComponents(); + + const fixture = TestBed.createComponent(RepoDetailsComponent); + fixture.detectChanges(); + const markdown: MarkdownComponent = fixture.debugElement.query(By.directive(MarkdownComponent)).componentInstance; + await markdown.ready.pipe(take(1)).toPromise(); + return fixture.nativeElement.querySelector('#readme-markdown'); + }; + + const sources = (readme: HTMLElement): string[] => Array.from(readme.querySelectorAll('img')).map((img) => img.getAttribute('src')); + + const cases: { name: string; readme: string; want: string[] }[] = [ + { + name: 'a relative markdown image', + readme: '![icon](icon.png)', + want: ['https://github.com/Helias/mod-bg-twinpeaks/raw/master/icon.png'], + }, + { + name: 'a relative html image', + readme: 'Twin Peaks World Map', + want: ['https://github.com/Helias/mod-bg-twinpeaks/raw/master/images/TP-WorldMap.png'], + }, + { + name: 'a path starting with ./', + readme: '![map](./images/map.png)', + want: ['https://github.com/Helias/mod-bg-twinpeaks/raw/master/images/map.png'], + }, + { + name: 'a path starting with / as the repository root', + readme: '![map](/images/map.png)', + want: ['https://github.com/Helias/mod-bg-twinpeaks/raw/master/images/map.png'], + }, + { + name: 'every image in the README', + readme: '![one](one.png)\n\n![two](two.png)', + want: ['https://github.com/Helias/mod-bg-twinpeaks/raw/master/one.png', 'https://github.com/Helias/mod-bg-twinpeaks/raw/master/two.png'], + }, + { + name: 'nothing for an https url', + readme: '![shot](https://example.com/shot.png)', + want: ['https://example.com/shot.png'], + }, + { + name: 'nothing for a protocol-relative url', + readme: 'shot', + want: ['//cdn.example.com/shot.png'], + }, + { + name: 'nothing for a data url', + readme: 'dot', + want: ['data:image/gif;base64,R0lGODlhAQABAAAAACw='], + }, + ]; + + cases.forEach(({ name, readme, want }) => { + it(`should resolve ${name}`, async () => { + expect(sources(await renderReadme(readme))).toEqual(want); + }); + }); + + it('should resolve against the default branch of the repository', async () => { + expect(sources(await renderReadme('![icon](icon.png)', 'main'))).toEqual(['https://github.com/Helias/mod-bg-twinpeaks/raw/main/icon.png']); + }); + + it('should leave image examples inside code blocks untouched', async () => { + const readme = await renderReadme('```html\n\n```'); + + expect(readme.querySelector('code').textContent).toContain(''); + }); +}); + describe('RepoDetailsComponent', () => { let component: RepoDetailsComponent; let fixture: ComponentFixture; diff --git a/src/app/repo-details/repo-details.component.ts b/src/app/repo-details/repo-details.component.ts index 437dfbc..b33c7d2 100644 --- a/src/app/repo-details/repo-details.component.ts +++ b/src/app/repo-details/repo-details.component.ts @@ -12,9 +12,11 @@ import { } from '@fortawesome/free-solid-svg-icons'; import { Observable } from 'rxjs'; import { pluck, tap } from 'rxjs/operators'; +import { Repository } from 'src/@types'; import { RepoDetailsData } from '../services/resolvers/repo-details-resolver.service'; const RETURN_HASH_STORAGE_KEY = 'azerothcore.catalogue.returnHash'; +const ABSOLUTE_URL = /^([a-z][a-z\d+.-]*:|\/\/)/i; @Component({ selector: 'app-repo-details', @@ -45,6 +47,18 @@ export class RepoDetailsComponent { data$: Observable; + resolveReadmeImages(readme: HTMLElement, repo: Repository): void { + const base = `https://github.com/${repo.full_name}/raw/${repo.default_branch}/`; + + readme.querySelectorAll('img').forEach((img) => { + const src = img.getAttribute('src'); + if (src && !ABSOLUTE_URL.test(src)) { + // on GitHub a leading slash means the repository root, not the root of github.com + img.src = new URL(src.replace(/^\/+/, ''), base).href; + } + }); + } + private readReturnHash(): string { try { const returnHash = sessionStorage.getItem(RETURN_HASH_STORAGE_KEY); From 5c5380d0d5c781b4c5468f81da3e7792a3f44372 Mon Sep 17 00:00:00 2001 From: Helias Date: Wed, 4 Nov 2026 19:11:31 +0100 Subject: [PATCH 9/9] fix: remove the horizontal scrollbar inside the catalogue tabs The touch area of the smaller pagination buttons stuck out of the tab content and made it scroll sideways. --- e2e/app.spec.ts | 30 ++++++++++++++++++++++++++++++ src/app/home/home.component.scss | 2 ++ 2 files changed, 32 insertions(+) diff --git a/e2e/app.spec.ts b/e2e/app.spec.ts index 60e5416..75d6f1f 100644 --- a/e2e/app.spec.ts +++ b/e2e/app.spec.ts @@ -39,4 +39,34 @@ test.describe('Git Catalogue App', () => { expect(errors).toEqual([]); }); + + test('should not scroll the tab content sideways', async ({ page }) => { + const repository = { + id: 1, + name: 'mod-example', + full_name: 'azerothcore/mod-example', + description: 'Example module', + stargazers_count: 5, + created_at: '2024-01-01T00:00:00Z', + default_branch: 'master', + owner: { login: 'azerothcore' }, + html_url: 'https://github.com/azerothcore/mod-example', + forks_count: 0, + watchers_count: 0, + topics: ['azerothcore-module'], + }; + const config = await (await page.request.get('/assets/config.json')).json(); + const organizations: Record> = {}; + for (const { org, topic } of Object.values<{ org: string; topic: string }>(config.tabs)) { + organizations[org] = { ...organizations[org], [topic]: [repository] }; + } + // the paginators only render with results, and the CI fixture has none + await page.route('**/catalogue.json', (route) => route.fulfill({ json: { organizations } })); + + await page.goto('/'); + await expect(page.locator('a.repo-row').first()).toBeVisible(); + + const tabBody = page.locator('.mat-mdc-tab-body-active .mat-mdc-tab-body-content'); + expect(await tabBody.evaluate((el) => el.scrollWidth - el.clientWidth)).toBe(0); + }); }); \ No newline at end of file diff --git a/src/app/home/home.component.scss b/src/app/home/home.component.scss index 4ebd385..7fd0864 100644 --- a/src/app/home/home.component.scss +++ b/src/app/home/home.component.scss @@ -459,6 +459,8 @@ h1 { .mat-mdc-icon-button { --mat-icon-button-state-layer-size: 32px; + // the default 48px touch target sticks out of a 32px button and makes the tab body scroll sideways + --mat-icon-button-touch-target-display: none; padding: 4px; } }