diff --git a/app/webapp/app/Controllers/Http/GameController.js b/app/webapp/app/Controllers/Http/GameController.js index f24fb3e..c22dd2c 100644 --- a/app/webapp/app/Controllers/Http/GameController.js +++ b/app/webapp/app/Controllers/Http/GameController.js @@ -6,12 +6,13 @@ class GameController { // /games async index({ inertia }) { - const pageTitle = "Last 1000 Games" + const pageTitle = "Last 1000 Games"; + const gamesQry = await Database.table('games') .distinct('game_id', 'map', 'gametype', - // 'stats', + 'stats', 'datestamp') .where('game_id', '<>', 0) .orderBy('game_id', 'desc') @@ -27,13 +28,14 @@ class GameController { } }, []); + // move the 0 score display logic here + return inertia.render('Games/Main', { pageTitle, games }, { edgeVar: 'server-variable' }) } // game/:game_id async game({ inertia, request }) { - const gameInfo = await Database.from('games') .distinct('game_id', 'map', @@ -43,9 +45,11 @@ class GameController { 'stats', 'datestamp') .where({ game_id: request.params.game_id }) + const pageTitle = { + name: gameInfo[0]['map'], + gametype: gameInfo[0]['gametype'] + } - - const pageTitle = gameInfo[0]['map'] return inertia.render('Games/Game', { pageTitle, gameInfo }, { edgeVar: 'server-variable' }) } diff --git a/app/webapp/resources/js/Components/FrameHeading/FrameHeading.js b/app/webapp/resources/js/Components/FrameHeading/FrameHeading.js index 2c4e4ea..f431ca0 100644 --- a/app/webapp/resources/js/Components/FrameHeading/FrameHeading.js +++ b/app/webapp/resources/js/Components/FrameHeading/FrameHeading.js @@ -7,6 +7,7 @@ const FrameHeading = (props) => {

{props.heading}

+ { props.gametype ? props.gametype : ''} ); diff --git a/app/webapp/resources/js/Pages/Games/Game.js b/app/webapp/resources/js/Pages/Games/Game.js index 82bee19..2a7a90d 100644 --- a/app/webapp/resources/js/Pages/Games/Game.js +++ b/app/webapp/resources/js/Pages/Games/Game.js @@ -41,7 +41,7 @@ const renderActiveShape = (props) => { /> - = 0 ? 1 : -1) * 12} y={ey} textAnchor={textAnchor} fill="#333">{`${value} points`} + = 0 ? 1 : -1) * 12} y={ey} textAnchor={textAnchor} fill="#333">{`${value}`} = 0 ? 1 : -1) * 12} y={ey} dy={18} textAnchor={textAnchor} fill="#999"> {`(${(percent * 100).toFixed(2)}%)`} @@ -63,7 +63,6 @@ export class TwoLevelPieChart extends PureComponent { }; render() { - console.log(this.state.data); return ( ); @@ -85,64 +85,86 @@ export class TwoLevelPieChart extends PureComponent { const PlayerRow = (player, index) => { + // dont show scoreless players + if (Number(player.stats.score) <= 0){return} - return
  • - -
    -
    -
    -
    -
    {player.player_name}
    -
    - Last Active: -
    -
    -
    -
    -
    - Total Score -
    -
    - {player.stats.score} - - { - (player.gametype == "CTFGame" || player.gametype == "SCtFGame") ? - : '' - } -
    - -
    -
    -
    + return
    +
    +
    +

    + {player.player_name} +

    +
    +
    +
    +
    +
    + Total Score +
    +
    + {player.stats.score} +
    -
    - - - +
    + { + (player.gametype == "CTFGame" || player.gametype == "SCtFGame") ? + : '' + }
    -
    - -
  • ; +
    +
    + Kills / Assists +
    +
    + {player.stats.kills} / {player.stats.assist} +
    +
    +
    +
    + MAs +
    +
    + {player.stats.totalMA} +
    +
    +
    +
    + Flag Grabs / Caps +
    +
    + {player.stats.flagGrabs} / {player.stats.flagCaps} +
    +
    +
    +
    + Flag Defends / Carrier Kills / Returns +
    +
    + {player.stats.flagDefends} / {player.stats.carrierKills} / {player.stats.flagReturns} +
    +
    + + + +; } export default function Game(props) { return ( - + -
    -
      - { props.gameInfo.map((game, index) => PlayerRow(game, index)) } -
    +
    + { props.gameInfo.map((game, index) => PlayerRow(game, index)) }
    - +{/*
    {JSON.stringify(props.gameInfo)}
    -
    +
    */}
    ) } diff --git a/app/webapp/resources/js/Pages/Games/Main.js b/app/webapp/resources/js/Pages/Games/Main.js index a339b09..ddfa4be 100644 --- a/app/webapp/resources/js/Pages/Games/Main.js +++ b/app/webapp/resources/js/Pages/Games/Main.js @@ -6,6 +6,9 @@ import Layout from '@/Shared/Layout' const GameRow = (game, index) => { + // TODO: move this into controller for faster render + if (Number(game.stats.score) === 0){return} + return
  • diff --git a/app/webapp/resources/js/Shared/Layout.js b/app/webapp/resources/js/Shared/Layout.js index a06ae0e..51e3997 100644 --- a/app/webapp/resources/js/Shared/Layout.js +++ b/app/webapp/resources/js/Shared/Layout.js @@ -3,7 +3,7 @@ import React, { useEffect } from 'react' import TopNav from '../Components/TopNav'; import FrameHeading from '../Components/FrameHeading' -export default function Layout({ title, children }) { +export default function Layout({ title, gametype, children }) { useEffect(() => { document.title = title; }, [title]) @@ -11,7 +11,7 @@ export default function Layout({ title, children }) { return ( <> - +
    { children }