diff --git a/public/static/css/game.css b/public/static/css/game.css index 9fc1105..28f2d7d 100644 --- a/public/static/css/game.css +++ b/public/static/css/game.css @@ -100,6 +100,9 @@ } @media screen and (max-width: 599px) { + #mapName { + display: none; + } #showGuessButtonContainer { position: absolute; left: 20px; diff --git a/public/static/css/mapguesser.css b/public/static/css/mapguesser.css index 957f803..6be0b44 100644 --- a/public/static/css/mapguesser.css +++ b/public/static/css/mapguesser.css @@ -98,7 +98,7 @@ sub { } svg.inline, img.inline { - display: inline-block; + display: inline; width: 1em; height: 1em; vertical-align: -0.15em; @@ -233,6 +233,19 @@ div.header>div.grid>:nth-child(2) { text-align: right; } +div.header>div.grid>:nth-child(2)>span { + padding-left: 6px; +} + +div.header>div.grid>:nth-child(2)>span>a:link, div.header>div.grid>:nth-child(2)>span>a:visited { + color: inherit; +} + +div.header>div.grid>:nth-child(2)>span:not(:last-child) { + border-right: solid white 1px; + padding-right: 6px; +} + div.main { padding: 6px 12px; } diff --git a/src/Controller/GameController.php b/src/Controller/GameController.php index 1664623..8a47d54 100644 --- a/src/Controller/GameController.php +++ b/src/Controller/GameController.php @@ -7,14 +7,18 @@ use MapGuesser\Util\Geo\Bounds; use MapGuesser\Response\HtmlContent; use MapGuesser\Response\JsonContent; use MapGuesser\Interfaces\Response\IContent; +use MapGuesser\Repository\MapRepository; class GameController { private IRequest $request; + private MapRepository $mapRepository; + public function __construct(IRequest $request) { $this->request = $request; + $this->mapRepository = new MapRepository(); } public function getGame(): IContent @@ -33,7 +37,9 @@ class GameController private function prepareGame(int $mapId) { - $bounds = $this->getMapBounds($mapId); + $map = $this->mapRepository->getById($mapId); + + $bounds = Bounds::createDirectly($map['bound_south_lat'], $map['bound_west_lng'], $map['bound_north_lat'], $map['bound_east_lng']); $session = $this->request->session(); @@ -45,19 +51,6 @@ class GameController ]); } - return ['mapId' => $mapId, 'bounds' => $bounds->toArray()]; - } - - private function getMapBounds(int $mapId): Bounds - { - $select = new Select(\Container::$dbConnection, 'maps'); - $select->columns(['bound_south_lat', 'bound_west_lng', 'bound_north_lat', 'bound_east_lng']); - $select->whereId($mapId); - - $map = $select->execute()->fetch(IResultSet::FETCH_ASSOC); - - $bounds = Bounds::createDirectly($map['bound_south_lat'], $map['bound_west_lng'], $map['bound_north_lat'], $map['bound_east_lng']); - - return $bounds; + return ['mapId' => $mapId, 'mapName' => $map['name'], 'bounds' => $bounds->toArray()]; } } diff --git a/src/Repository/MapRepository.php b/src/Repository/MapRepository.php new file mode 100644 index 0000000..7fef975 --- /dev/null +++ b/src/Repository/MapRepository.php @@ -0,0 +1,16 @@ +columns(['id', 'name', 'description', 'bound_south_lat', 'bound_west_lng', 'bound_north_lat', 'bound_east_lng']); + $select->whereId($mapId); + + return $select->execute()->fetch(IResultSet::FETCH_ASSOC); + } +} diff --git a/views/game.php b/views/game.php index bd10951..c242c57 100644 --- a/views/game.php +++ b/views/game.php @@ -8,7 +8,11 @@ MapGuesser -
Round: | Score:
++ = $mapName ?>Round Score +
diff --git a/views/templates/main_header.php b/views/templates/main_header.php index cd488cd..13d3a0a 100644 --- a/views/templates/main_header.php +++ b/views/templates/main_header.php @@ -10,7 +10,7 @@ - +