Skip to content

Commit

Permalink
simplify broadcast search and fix infinite scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Apr 21, 2023
1 parent 617b467 commit 426c8f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/controllers/RelayTour.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class RelayTour(env: Env, apiC: => Api, prismicC: => Prismic) extends Lila
env.relay.pager
.search(query, page)
.map: pager =>
Ok(html.relay.tour.search(pager, query))
Ok(html.relay.tour.index(Nil, pager, query))
case None =>
for
active <- (page == 1).??(env.relay.api.officialActive.get({}))
Expand Down
21 changes: 2 additions & 19 deletions app/views/relay/tour.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,6 @@ object tour:
)
}

def search(pager: Paginator[RelayTour.WithLastRound], query: String = "")(using Context) =
views.html.base.layout(
title = liveBroadcasts.txt(),
moreCss = cssTag("relay.index"),
moreJs = infiniteScrollTag
) {
main(cls := "relay-index page-menu")(
pageMenu("index"),
div(cls := "page-menu__content box")(
boxTop(
h1(liveBroadcasts()),
searchForm(query)
),
renderPager(pager, query)
)
)
}

def page(doc: io.prismic.Document, resolver: io.prismic.DocumentLinkResolver, active: String)(using
Context
) =
Expand Down Expand Up @@ -114,5 +96,6 @@ object tour:
st.section(cls := "infinite-scroll")(
pager.currentPageResults map { tr =>
renderWidget(tr, ongoing = _ => false)(cls := "paginated")
}
},
pagerNext(pager, routes.RelayTour.index(_, query).url)
)

0 comments on commit 426c8f6

Please sign in to comment.