Files
rf4-spotter/apps/web/src/components/CatchList.astro
T

19 lines
1.0 KiB
Plaintext

---
import SourceBadge from "./SourceBadge.astro";
import { ago, kg, type Catch } from "../lib/api";
import TackleGlyph from "./TackleGlyph.astro";
const { catches } = Astro.props as { catches: Catch[] };
---
<div class="catch-list">
{catches.map(item => {
const timestamp = item.caught_at ?? item.reported_at;
return <article>
<div><strong>{item.fish}</strong><span class="tackle-label"><TackleGlyph name={item.bait} size={24}/><span>{item.bait ?? "Приманка не указана"}</span></span><SourceBadge source={item.source_system} href={item.source_url}/></div>
<div><strong>{kg(item.weight_g)}</strong><span>{item.player_name ?? "Анонимно"}</span><span>{item.caught_at ? "Время улова" : "Получено · время улова неизвестно"}</span><time datetime={timestamp}>{ago(timestamp)} · {new Date(timestamp).toLocaleString("ru-RU", { timeZone: "UTC" })} UTC</time></div>
</article>;
})}
</div>
<style>
time{margin-top:7px;color:var(--text-secondary);font-size:10px;font-weight:750}
</style>