--- import Layout from "../../layouts/Layout.astro"; import PageHero from "../../components/PageHero.astro"; import StatePanel from "../../components/StatePanel.astro"; import { ago, api, type DictionaryItem, type TackleCombination } from "../../lib/api"; const params = Astro.url.searchParams; const waterbody = params.get("waterbody") ?? ""; const fish = params.get("fish") ?? ""; const method = params.get("method") ?? ""; const role = params.get("role") ?? ""; const hours = [24, 72, 168].includes(Number(params.get("hours"))) ? Number(params.get("hours")) : 72; const query = new URLSearchParams({ hours: String(hours), min_samples: "3", min_players: "2", limit: "100" }); if (waterbody) query.set("waterbody", waterbody); if (fish) query.set("fish", fish); if (method) query.set("method", method); if (role) query.set("role", role); let combinations: TackleCombination[] = [], waters: DictionaryItem[] = [], fishes: DictionaryItem[] = [], unavailable = false; try { [combinations, waters, fishes] = await Promise.all([ api(`/api/v1/analytics/tackle?${query}`), api("/api/v1/waterbodies?limit=500"), api("/api/v1/fishes?limit=500"), ]); } catch { unavailable = true; } if (unavailable) { Astro.response.status = 503; Astro.response.headers.set("Retry-After", "60"); Astro.response.headers.set("Cache-Control", "no-store"); } const methodLabels: Record = { spinning: "Спиннинг", bottom: "Донная", float: "Поплавочная" }; const roleLabels: Record = { lure: "Приманка", bait: "Наживка", rig: "Сборка", rod: "Удилище", reel: "Катушка", line: "Леска", hook: "Крючок", float: "Поплавок", sinker: "Груз" }; ---
{(waterbody || fish || method || role || hours !== 72) && Сбросить}

Порог рекомендации: минимум 3 наблюдения от 2 независимых игроков. Это не рейтинг снасти и не гарантия улова.

{unavailable ? : combinations.length ?
{combinations.map(item => { const canonicalHref = item.rig_id ? `/tackle/rigs/${item.rig_id}` : item.tackle_item_id ? `/tackle/items/${item.tackle_item_id}` : null; return
{roleLabels[item.role] ?? item.role}{item.status === "recommendation" ? "Рекомендация" : "Недостаточно данных"}

{canonicalHref ? {item.value} : item.value}

Наблюдения
{item.catches}
Игроки
{item.unique_players}
Свежесть выборки
{item.freshness_score}%
Последнее
{ago(item.last_seen_at)}

{item.explanation}

})}
:
}