Skip to content

Commit

Permalink
preload broadcast image
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Mar 19, 2024
1 parent 153a44c commit 9fcbe2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions app/views/relay/show.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import lila.app.templating.Environment.{ *, given }
import lila.app.ui.ScalatagsTemplate.{ *, given }
import lila.common.Json.given
import lila.socket.SocketVersion
import lila.socket.SocketVersion.given

object show:

Expand Down Expand Up @@ -70,7 +69,9 @@ object show:
label(cls := "mselect__label"):
span(cls := "relay-tour__round-select__name")(rt.relay.name)
),
div(cls := "relay-tour__header__image")(img(alt := "loading..."))
div(cls := "relay-tour__header__image"):
rt.tour.image.map: imgId =>
img(src := views.html.relay.tour.thumbnail.url(imgId, _.Size.Large), alt := "loading...")
)
),
st.aside(cls := "relay-tour__side")(div(cls := "relay-tour__side__preload"))
Expand Down
5 changes: 3 additions & 2 deletions app/views/relay/tour.scala
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ object tour:
img(
cls := "relay-image",
widthA := size(RelayTour.thumbnail).width,
heightA := size(RelayTour.thumbnail).height
)(src := url(id, size))
heightA := size(RelayTour.thumbnail).height,
src := url(id, size)
)
def fallback = iconTag(licon.RadioTower)(cls := "relay-image--fallback")
def url(id: PicfitImage.Id, size: RelayTour.thumbnail.SizeSelector) =
RelayTour.thumbnail(picfitUrl, id, size)
Expand Down

0 comments on commit 9fcbe2f

Please sign in to comment.