diff --git a/app/webapp/app/Controllers/Http/GameController.js b/app/webapp/app/Controllers/Http/GameController.js index 37f6b2f..1d747c5 100644 --- a/app/webapp/app/Controllers/Http/GameController.js +++ b/app/webapp/app/Controllers/Http/GameController.js @@ -1,6 +1,30 @@ 'use strict' +const Database = use('Database') + class GameController { + + async index({ inertia }) { + + const pageTitle = "Last 1000 Games" + const gamesQry = await Database.table('games') + .distinct('game_id', + 'map', + 'stats', + 'datestamp') + .where('game_id', '<>', 0) + .orderBy('game_id', 'desc') + .limit(1000) + + + // prep to combine objects for each game + let games = gamesQry + + + + return inertia.render('Games/Main', { pageTitle, games }, { edgeVar: 'server-variable' }) + } + } module.exports = GameController diff --git a/app/webapp/resources/js/Pages/Games/Main.js b/app/webapp/resources/js/Pages/Games/Main.js new file mode 100644 index 0000000..569e9ca --- /dev/null +++ b/app/webapp/resources/js/Pages/Games/Main.js @@ -0,0 +1,53 @@ +import React from 'react' +import { InertiaLink } from '@inertiajs/inertia-react' +import Layout from '@/Shared/Layout' + + + +const GameRow = (game, index) => { + + return