scraper
All checks were successful
Build and Deploy / Build & Push Image (push) Successful in 37s

This commit is contained in:
2026-03-16 20:44:47 -06:00
parent 91d2c327de
commit 37602fc78a
3 changed files with 58 additions and 28 deletions

View File

@@ -1,6 +1,8 @@
defmodule CobblemonUiWeb.DashboardLive do
use CobblemonUiWeb, :live_view
require Logger
import CobblemonUiWeb.PokemonComponents
import CobblemonUiWeb.BattleComponents
@@ -94,9 +96,6 @@ defmodule CobblemonUiWeb.DashboardLive do
{:noreply, assign(socket, view_mode: String.to_existing_atom(mode), selected_pokemon: nil)}
end
def handle_event("refresh", _params, socket) do
{:noreply, do_refresh(socket)}
end
@impl true
def handle_info(:tick, socket) do
@@ -106,8 +105,10 @@ defmodule CobblemonUiWeb.DashboardLive do
def handle_info(:scrape_tier_list, socket) do
lv = self()
Task.start(fn ->
CobblemonUi.TierListScraper.run()
send(lv, :reload_tier_list)
case CobblemonUi.TierListScraper.run() do
{:ok, _} -> send(lv, :reload_tier_list)
{:error, reason} -> Logger.error("[DashboardLive] Tier list scrape failed: #{inspect(reason)}")
end
end)
{:noreply, socket}
end
@@ -156,13 +157,6 @@ defmodule CobblemonUiWeb.DashboardLive do
<p class="text-sm text-base-content/50">Who are you?</p>
</div>
</div>
<button
id="refresh-btn"
phx-click="refresh"
class="btn btn-ghost btn-sm gap-2 hover:bg-base-300/50 transition-colors"
>
<.icon name="hero-arrow-path" class="size-4" /> Refresh
</button>
</div>
<div
@@ -211,13 +205,6 @@ defmodule CobblemonUiWeb.DashboardLive do
<p class="text-sm text-base-content/50">Player Data Explorer</p>
</div>
</div>
<button
id="refresh-btn"
phx-click="refresh"
class="btn btn-ghost btn-sm gap-2 hover:bg-base-300/50 transition-colors"
>
<.icon name="hero-arrow-path" class="size-4" /> Refresh
</button>
</div>
<%!-- Scrollable content --%>

View File

@@ -46,6 +46,17 @@ defmodule CobblemonUiWeb.PokemonComponents do
</div>
<div class="flex items-center gap-1 shrink-0">
<.tier_badge :if={@tier} tier={@tier} species={@pokemon.species} compact={@compact} />
<div
:if={!@tier}
title="Tier data not downloaded"
class={[
"inline-flex items-center justify-center font-black rounded leading-none shrink-0",
"bg-base-300/20 text-base-content/25 ring-1 ring-base-300/30",
if(@compact, do: "text-[9px] w-4 h-4", else: "text-[10px] w-5 h-5")
]}
>
?
</div>
<div :if={@pokemon.shiny} title="Shiny">
<.icon
name="hero-sparkles"
@@ -126,6 +137,13 @@ defmodule CobblemonUiWeb.PokemonComponents do
<h3 class="font-bold text-base-content capitalize text-lg flex items-center gap-2">
{@pokemon.species || "Unknown"}
<.tier_badge :if={@tier} tier={@tier} species={@pokemon.species} />
<span
:if={!@tier}
class="inline-flex items-center gap-1 text-xs text-base-content/30 font-normal italic"
title="Tier data not downloaded"
>
<.icon name="hero-arrow-down-tray" class="size-3" /> tier unavailable
</span>
<span :if={@pokemon.shiny} class="text-warning text-sm" title="Shiny">★</span>
</h3>
<p class="text-xs text-base-content/40">