Skip to main content

Documentation 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.

The Dashboard Overview is the landing page of the Galactic Tournament application, accessible at the root route /. On load it makes a single API call to GET /api/dashboard and surfaces three widgets side-by-side: a species counter card, a top-3 ranking leaderboard, and a last-battle result panel. All widgets share the same loading and error lifecycle so the page either renders completely or shows a clear failure message.

API Endpoint

GET /api/dashboard
Base URL: https://galactic-tournament-app-production.up.railway.app The endpoint returns a single DashboardDTO object combining species statistics, ranking data, and the latest battle in one round-trip.

Data Model

export interface DashboardDTO {
  totalSpecies: number;
  top3Ranking: RankingResponse[];
  lastBattle: BattleResult;
}
totalSpecies
number
required
The total number of intergalactic species currently registered in the system.
top3Ranking
RankingResponse[]
required
An ordered array of the top three species by victory count, used to populate the ranking widget.
lastBattle
BattleResult
required
The most recently recorded battle, including both fighters and the declared winner.

Example API Response

{
  "totalSpecies": 42,
  "top3Ranking": [
    {
      "specieId": 7,
      "species": {
        "id": 7,
        "name": "Sayajin",
        "powerLevel": 9000,
        "specialAbility": "Super Sayajin Transformation",
        "createdAt": "2024-01-15T10:30:00"
      },
      "victories": 18
    },
    {
      "specieId": 3,
      "species": {
        "id": 3,
        "name": "Namekian",
        "powerLevel": 7500,
        "specialAbility": "Regeneration",
        "createdAt": "2024-01-10T09:00:00"
      },
      "victories": 14
    },
    {
      "specieId": 11,
      "species": {
        "id": 11,
        "name": "Arcosian",
        "powerLevel": 8800,
        "specialAbility": "Power Suppression",
        "createdAt": "2024-02-01T14:15:00"
      },
      "victories": 11
    }
  ],
  "lastBattle": {
    "id": 204,
    "fighterLeft": {
      "id": 7,
      "name": "Sayajin",
      "powerLevel": 9000,
      "specialAbility": "Super Sayajin Transformation",
      "createdAt": "2024-01-15T10:30:00"
    },
    "fighterRight": {
      "id": 11,
      "name": "Arcosian",
      "powerLevel": 8800,
      "specialAbility": "Power Suppression",
      "createdAt": "2024-02-01T14:15:00"
    },
    "winner": {
      "id": 7,
      "name": "Sayajin",
      "powerLevel": 9000,
      "specialAbility": "Super Sayajin Transformation",
      "createdAt": "2024-01-15T10:30:00"
    },
    "battleDate": "2024-06-12T21:45:00"
  }
}

Dashboard Widgets

Total Species Card

A compact card in the left column displays the totalSpecies value as a large headline number alongside a group icon. It provides a quick census of how many species have been registered across the galaxy at any given moment.

Top-3 Ranking

The ranking widget occupies the right column and iterates over top3Ranking. Each entry is displayed as a row with:
PositionMedalColour class
1st🥇text-yellow-500
2nd🥈text-gray-400
3rd🥉text-amber-600
Each row shows the species name, power level, and victory count. When top3Ranking is empty the widget renders a “No ranking data available” placeholder instead.
Medal labels and colour classes are resolved by the getMedalLabel(index) and getMedalClass(index) methods in OverviewComponent. Any index beyond 2 falls back to a generic #N label with text-gray-500.

Last Battle Result

A full-width panel below the two cards shows the most recent fight. Both fighters are displayed side-by-side with a central VS separator. After the result is available the winning fighter’s panel is highlighted in green (bg-green-50) and receives a WINNER badge, while the losing fighter keeps a neutral grey background. When lastBattle is null (no battles have been recorded yet) the panel renders a “No battles recorded yet” placeholder. The battle date is formatted using Angular’s DatePipe as dd/MM/yyyy HH:mm.

Loading & Error States

The OverviewComponent exposes two boolean flags driven by the DashboardService observable:
FlagInitial valueMeaning
loadingtrueA full-page spinner is shown while the HTTP request is in flight.
errorfalseWhen the request fails, an error banner replaces all widgets.
ngOnInit(): void {
  this.dashboardService.getDashboard().subscribe({
    next: (data) => {
      this.dashboard = data;
      this.loading = false;
    },
    error: () => {
      this.error = true;
      this.loading = false;
    },
  });
}
The dashboard widgets are only rendered when loading is false, error is false, and dashboard is non-null. There is no retry button — refreshing the browser page re-triggers the ngOnInit call.

Build docs developers (and LLMs) love