Hide recent media on now page if requests fail

This commit is contained in:
2024-05-24 20:30:42 +10:00
parent f4bbeea825
commit b894fe93fa
3 changed files with 22 additions and 18 deletions

View File

@@ -1,10 +1,12 @@
div class="grid grid-cols-4 gap-2" - if recently_played_music.count > 0
- recently_played_music.each do |album| h3 🎧 Recently listened to
a href="#{album[:href]}" div class="grid grid-cols-4 gap-2"
div - recently_played_music.each do |album|
img class="m-0 rounded transition-transform ease-out hover:scale-105" src="#{album[:image]}" a href="#{album[:href]}"
span class="inline-block text-sm" div
= album[:name] img class="m-0 rounded transition-transform ease-out hover:scale-105" src="#{album[:image]}"
br span class="inline-block text-sm"
span class="inline-block text-sm font-bold" = album[:name]
= album[:artist] br
span class="inline-block text-sm font-bold"
= album[:artist]

View File

@@ -1,8 +1,11 @@
table - if recently_played_games.count > 0
- recently_played_games.each do |game| h3 👾 Recently played on Steam
tr
td
= game[:name]
td table
= "(#{game[:playtime_forever]}hrs total)" - recently_played_games.each do |game|
tr
td
= game[:name]
td
= "(#{game[:playtime_forever]}hrs total)"

View File

@@ -7,7 +7,6 @@ module Main
include Deps["queries.posts.recently_played"] include Deps["queries.posts.recently_played"]
expose :recently_played_music do |recently_played_result| expose :recently_played_music do |recently_played_result|
# raise recently_played_result["data"].inspect
JSON.parse(recently_played_result)["data"].reject { |a| a["type"] != "albums" }.map do |album| JSON.parse(recently_played_result)["data"].reject { |a| a["type"] != "albums" }.map do |album|
{ {
artist: album["attributes"]["artistName"], artist: album["attributes"]["artistName"],