The Rankings page, accessible atDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/HectorDNC/galactic-tournament-front/llms.txt
Use this file to discover all available pages before exploring further.
/battle-statistics, presents a complete leaderboard of every species ordered by their cumulative battle victories. It calls a single API endpoint on load and renders the response in a fully sortable Angular Material table. Each row carries a colour-coded position badge so the top three contenders are immediately distinguishable from the rest of the field.
API Endpoint
https://galactic-tournament-app-production.up.railway.app
The endpoint returns a RankingResponse[] array. The BattleStatisticsService fetches it with:
Data Model
Unique identifier of the species. Matches
Specie.id.The full species object used to display the name and other attributes in the table.
Total number of battles won. Rendered in the Victorias column with bold styling.
Example API Response
Ranking Table
TheRankingComponent binds the response to a MatTableDataSource and declares three columns:
| Column | Header | Description |
|---|---|---|
| position | Posición | Auto-incremented row index rendered as a coloured badge. Not sortable. |
| name | Especie | Species name sourced from element.species?.name. Sortable via mat-sort-header. |
| victories | Victorias | Victory count displayed in bold. Sortable via mat-sort-header. |
Position Badges
ThegetBadgeColor(position: number) method assigns a semantic colour variant to each position badge using the shared BadgeComponent:
| Position (0-based index) | Medal | Badge colour |
|---|---|---|
| 0 | 🥇 | warning (gold) |
| 1 | 🥈 | primary (silver) |
| 2 | 🥉 | info (bronze) |
| 3+ | — | light |
#1, #2, #3, etc., derived from the template’s let i = index expression.
Component Architecture
RankingComponent is declared as standalone: true and directly imports CommonModule, MatTableModule, MatSortModule, and the shared BadgeComponent. It is not registered in any NgModule and is loaded as a standalone route component.
Client-Side Sorting
The table uses Angular Material’sMatSort directive, wired via @ViewChild(MatSort):
The Posición column does not carry a
mat-sort-header directive and therefore cannot be used as a sort key. Position badges always reflect the original index in the response array.Loading & Empty States
| Condition | Behaviour |
|---|---|
loading = true | A “Cargando ranking…” message spans the full table width while the HTTP request is in flight. |
| Response received, zero rows | A “No hay datos disponibles.” message spans the full table width. |
| Response received, rows present | The full table renders with position badges, species names, and victory counts. |