diff --git a/ProjectSourceCode/src/index.js b/ProjectSourceCode/src/index.js index 4bc8a8f..825ddc7 100644 --- a/ProjectSourceCode/src/index.js +++ b/ProjectSourceCode/src/index.js @@ -108,8 +108,9 @@ app.get('/league/:leagueID', [fetchLeaguesData, fetchLeagueScorerData], (req, re // Clubs Page Middleware const fetchClubsData = require('./resources/middleware/clubs-page/get-current-club-information'); +const fetchClubTopScorers = require('./resources/middleware/clubs-page/get-current-club-top-scorers'); -app.get('/club/:clubID', [fetchClubsData], (req, res) => { +app.get('/club/:clubID', [fetchClubsData, fetchClubTopScorers], (req, res) => { // Render the Handlebars view with league data res.render('pages/clubs-page', { clubID: req.params.clubID, @@ -117,8 +118,6 @@ app.get('/club/:clubID', [fetchClubsData], (req, res) => { }); }); - - // ***************************************************** // // ***************************************************** diff --git a/ProjectSourceCode/src/resources/css/club-pages/club-page.css b/ProjectSourceCode/src/resources/css/club-pages/club-page.css index 61433d8..abf0903 100644 --- a/ProjectSourceCode/src/resources/css/club-pages/club-page.css +++ b/ProjectSourceCode/src/resources/css/club-pages/club-page.css @@ -4,6 +4,30 @@ width: 100%; } +#club-page-body { + padding: 50px; +} + +#club-crest { + text-align: center; +} + +#club-area-flag-row { + text-align: center; +} + +#club-area-flag { + width : 150px; +} + +#club-players-container { + padding: 30px; +} + +#top-scorers-container { + padding : 30px +} + #club-information-container { height: 100px; width: fit-content; @@ -31,8 +55,9 @@ } #club-logo { - margin: 0px 30px; + margin: 0px 20px; transform: skewX(20deg); /* Skew the banner to create a triangular side */ + height: 80px; } #club-title { diff --git a/ProjectSourceCode/src/resources/css/league-pages/league-table.css b/ProjectSourceCode/src/resources/css/league-pages/league-table.css index 60f6ea2..6bf663a 100644 --- a/ProjectSourceCode/src/resources/css/league-pages/league-table.css +++ b/ProjectSourceCode/src/resources/css/league-pages/league-table.css @@ -29,7 +29,7 @@ } /* Table that holds all the standing information */ -#standings-table +#standings-table, .table { width: 100%; padding: 15px; @@ -43,7 +43,8 @@ /* Data in Row Style */ td { - padding: 5px; + padding: 15px; + } /* Every Odd Row in Table Style */ diff --git a/ProjectSourceCode/src/resources/middleware/clubs-page/get-current-club-top-scorers.js b/ProjectSourceCode/src/resources/middleware/clubs-page/get-current-club-top-scorers.js index 91caaad..5c2ea41 100644 --- a/ProjectSourceCode/src/resources/middleware/clubs-page/get-current-club-top-scorers.js +++ b/ProjectSourceCode/src/resources/middleware/clubs-page/get-current-club-top-scorers.js @@ -7,7 +7,7 @@ const fetchLeagueScorerData = async (req, res, next) => { const leagueID = req.params.leagueID; // Make GET request to the API endpoint using the league ID - const response = await axios.get(`http://api.football-data.org/v4/competitions/${leagueID}/scorers?season&limit=20`, { + const response = await axios.get(`http://api.football-data.org/v4/teams/${teamID}/scorers?limit=5`, { headers: { 'X-Auth-Token': '0aa1ed31245d4a36b1ef5a79150324b3', // Add your API key here }, @@ -19,17 +19,9 @@ const fetchLeagueScorerData = async (req, res, next) => { // Attach the data to res.locals res.locals.topScorers = { scorers: scorerData.scorers.map(player => ({ - player: { - player_id: player.player.id, - player_name: player.player.name, - }, - team: { - team_id: player.player.id, - team_name: player.team.name, - team_crest: player.team.crest, - }, - games_played: player.playedMatches, - goals: player.goals, + playerID: scorer.player.id, + playerName: scorer.player.name, + goals: scorer.numberOfGoals, })) }; diff --git a/ProjectSourceCode/src/views/pages/clubs-page.hbs b/ProjectSourceCode/src/views/pages/clubs-page.hbs index 9da8cba..290f23c 100644 --- a/ProjectSourceCode/src/views/pages/clubs-page.hbs +++ b/ProjectSourceCode/src/views/pages/clubs-page.hbs @@ -7,25 +7,11 @@
-
- -

- Club Flag - -
- -
-

-

-

-

-
-

Players

    - +
    @@ -49,14 +35,63 @@
    -

    Top Scorers

    +

    Information

      -
      +
      Name
      + + + + + + + + + + + + + + + + + + +
      + +
      + +
      + Club Address:
      + {{club.address}} +
      + Founded
      + {{club.founded}} +
      + Manager
      + Name : {{club.coach.name}}
      + Nationality : {{club.coach.nationality}}
      + DOB : {{club.coach.dateOfBirth}}
      + contract start : {{club.coach.contract.start}}
      + contract end : {{club.coach.contract.until}}
      +
      -

      Competitions

        -
        + + + + + + + + {{#each club.runningCompetitions}} + + + + {{/each}} + +
        Name
        {{name}}
        +
        diff --git a/ProjectSourceCode/src/views/pages/leagues-page.hbs b/ProjectSourceCode/src/views/pages/leagues-page.hbs index 74e4556..fab8b93 100644 --- a/ProjectSourceCode/src/views/pages/leagues-page.hbs +++ b/ProjectSourceCode/src/views/pages/leagues-page.hbs @@ -19,7 +19,7 @@
        - +
        #