tactics = $tactics; $this->teams = $teams; } /** * @param SessionHandle $session * @return ViewHttpResponse the home page view */ public function home(SessionHandle $session): ViewHttpResponse { $limitNbTactics = 5; $user = $session->getAccount()->getUser(); $lastTactics = $this->tactics->getLast($limitNbTactics, $user->getId()); $allTactics = $this->tactics->getAll($user->getId()); $name = $user->getName(); if ($this->teams != null) { $teams = $this->teams->getAll($user->getId()); } else { $teams = []; } return ViewHttpResponse::react("views/Home.tsx", [ "lastTactics" => $lastTactics, "allTactics" => $allTactics, "teams" => $teams, "username" => $name, ]); } /** * @return ViewHttpResponse account settings page */ public function settings(SessionHandle $session): ViewHttpResponse { return ViewHttpResponse::react("views/Settings.tsx", []); } public function disconnect(MutableSessionHandle $session): HttpResponse { $session->destroy(); return HttpResponse::redirect("/"); } }