package net.pterodactylus.rhynodge.filters.webpages.epicgames import kotlinx.html.body import kotlinx.html.div import kotlinx.html.dom.createHTMLDocument import kotlinx.html.dom.serialize import kotlinx.html.head import kotlinx.html.html import kotlinx.html.img import kotlinx.html.style import kotlinx.html.unsafe import net.pterodactylus.rhynodge.states.AbstractState import java.time.ZoneId import java.util.Comparator.comparing class FreeGamesState(val games: Set, private val triggered: Boolean = false, private val timezone: ZoneId = ZoneId.systemDefault()) : AbstractState(true) { override fun plainText() = games .sortedWith(comparing(FreeGame::startDate).thenBy(FreeGame::title)) .joinToString("\n") { game -> "${game.title}: ${"%tF % div("game") { div("game-image") { img(src = game.imageUrl) } div("game-title") { +game.title } div("game-start") { +"%tF %