Skip to content

Commit

Permalink
Add euro-2024 interactive to euros fixtures page
Browse files Browse the repository at this point in the history
  • Loading branch information
domlander committed Jun 12, 2024
1 parent 1bc8d57 commit c8948ec
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions sport/app/football/controllers/FixturesController.scala
Original file line number Diff line number Diff line change
@@ -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")
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit c8948ec

Please sign in to comment.