diff --git a/sport/app/football/controllers/FixturesController.scala b/sport/app/football/controllers/FixturesController.scala index 54243324ddf..e4bc00be286 100644 --- a/sport/app/football/controllers/FixturesController.scala +++ b/sport/app/football/controllers/FixturesController.scala @@ -1,19 +1,25 @@ package football.controllers import common.Edition +import common.ImplicitControllerExecutionContext import feed.CompetitionsService import football.model._ import model._ +import model.content.InteractiveAtom +import contentapi.ContentApiClient import java.time.LocalDate import pa.FootballTeam import play.api.mvc.{Action, AnyContent, ControllerComponents} +import scala.concurrent.Future class FixturesController( val competitionsService: CompetitionsService, val controllerComponents: ControllerComponents, + val contentApiClient: ContentApiClient, )(implicit context: ApplicationContext) extends MatchListController - with CompetitionFixtureFilters { + with CompetitionFixtureFilters + with ImplicitControllerExecutionContext { private def fixtures(date: LocalDate): FixturesList = FixturesList(date, competitionsService.competitions) private val page = new FootballPage("football/fixtures", "football", "All fixtures") @@ -81,13 +87,33 @@ class FixturesController( private def renderTagFixtures(date: LocalDate, tag: String): Action[AnyContent] = getTagFixtures(date, tag) .map(result => - Action { implicit request => - renderMatchList( - result._1, - result._2, - filters, - None, - ) + Action.async { implicit request => + tag match { + case "euro-2024" => + val id = "/atom/interactive/interactives/2023/01/euros-2024/tables-euros-2024-header" + val edition = Edition(request) + contentApiClient + .getResponse(contentApiClient.item(id, edition)) + .map(_.interactive.map(InteractiveAtom.make(_))) + .map( + renderMatchList( + result._1, + result._2, + filters, + _, + ), + ) + case _ => + Future( + renderMatchList( + result._1, + result._2, + filters, + None, + ), + ) + } + }, ) .getOrElse(Action(NotFound))