bgg-ottawa-sell-club/src/routes/+page.svelte

129 lines
3.9 KiB
Svelte
Raw Normal View History

2024-01-31 18:44:13 +00:00
<article>
2024-02-01 19:37:15 +00:00
<h1>Ottawa board games for sale and to trade</h1>
2024-01-31 18:22:14 +00:00
2024-02-01 19:37:15 +00:00
<p>
This is a list of games for sale or trade of people living in the Ottawa
region, taken from their profiles on
<a href="https://boardgamegeek.com">Board Game Geek</a>.
</p>
2024-02-01 15:04:14 +00:00
2024-02-01 19:37:15 +00:00
<p>
If you want to be added to the list of sellers, you can send me a
<a
target="_blank"
href="https://boardgamegeek.com/geekmail/compose?touser=yenzie">
BGG mail</a
>. All I need is your BGG username, and I'll be able to gather all your
games tagged <em>For Trade</em>. If there is a price mentioned in the
<em>Trading Notes</em>
of the game (that is, any number prefixed with a <em>$</em>), it'll be
assumed to be the asking price.
</p>
2024-02-01 15:48:49 +00:00
2024-02-01 19:37:15 +00:00
<p>
Have questions, suggestions, anything else? Discussion of this service
happens in the <a
href="https://boardgamegeek.com/thread/3238117/auto-generating-ottawa-specific-saletrade-page"
>Ottawa Guild</a
>.
</p>
2024-02-01 15:04:14 +00:00
2024-02-01 19:37:15 +00:00
<header>
<Search {handler} />
</header>
2024-01-31 18:22:14 +00:00
2024-02-01 19:37:15 +00:00
<table>
<thead>
2024-01-31 18:22:14 +00:00
<tr>
2024-02-01 19:37:15 +00:00
<Th {handler} orderBy="username">user</Th>
<Th {handler} orderBy="name">game</Th>
<th>notes</th>
<Th {handler} orderBy="price">price</Th>
2024-02-01 20:27:38 +00:00
<th>last updated</th>
2024-01-31 18:22:14 +00:00
</tr>
2024-02-01 19:37:15 +00:00
</thead>
<tbody>
{#each $rows as row}
<tr>
<td
><a
target="_blank"
href={`https://boardgamegeek.com/collection/user/${row.username}?trade=1&subtype=boardgame&ff=1`}
>{row.username}</a>
&nbsp;
<a
target="_blank"
href={`https://boardgamegeek.com/geekmail/compose?touser=${row.username}`}>
<i>email</i></a>
</td><td>
<div class="game-cell">
<a
class="game-desc"
target="_blank"
href={`https://boardgamegeek.com/boardgame/${row.bgg_id}`}>
{row.name}</a>
<a
target="_blank"
href={`https://boardgamegeek.com/boardgame/${row.bgg_id}`}>
<img src={row.thumbnail} height="60" /></a>
</div>
</td>
<td>{row.notes}</td>
<td>{row.price ?? ''}</td>
2024-02-01 20:27:38 +00:00
<td><small>{pretty_date(row.updated_at)}</small></td>
2024-02-01 19:37:15 +00:00
</tr>
{/each}
</tbody>
</table>
2024-01-31 18:44:13 +00:00
</article>
2024-01-31 18:22:14 +00:00
2024-02-01 19:37:15 +00:00
<script>
2024-02-01 15:04:14 +00:00
// TODO sort
// TODO hide games I'm not interested in
2024-01-31 18:22:14 +00:00
// TODO add cart
2024-02-01 15:04:14 +00:00
// TODO prettify via beercss
2024-02-01 15:48:49 +00:00
// TODO use https://github.com/dasDaniel/svelte-table#readme
2024-02-01 19:37:15 +00:00
import { DataHandler, Search, Th } from '@vincjo/datatables';
2024-01-31 18:22:14 +00:00
export let data;
2024-02-01 20:27:38 +00:00
function pretty_date(date) {
if (!date) return '';
return date.replace(/T.*/, '');
}
2024-02-01 19:37:15 +00:00
const handler = new DataHandler(data.games, { rowsPerPage: 500 });
const rows = handler.getRows();
2024-01-31 18:22:14 +00:00
</script>
2024-01-31 18:44:13 +00:00
2024-02-01 19:37:15 +00:00
<style>
2024-01-31 18:44:13 +00:00
:global(:root) {
--font-size-10: 1rem;
--font-size-11: 1.5rem;
--font-size-12: 1.75rem;
--font-size-13: 2rem;
--font-size-14: 2.25rem;
}
p {
font-size: var(--font-size-10);
2024-02-01 15:48:49 +00:00
max-width: 60em;
text-align: justify;
2024-01-31 18:44:13 +00:00
}
a {
color: var(--primary);
text-decoration: underline;
}
2024-02-01 19:37:15 +00:00
.game-cell {
display: flex;
}
.game-cell > * {
display: block;
}
.game-desc {
flex: 1;
}
td {
font-size: var(--font-size-10);
}
2024-01-31 18:44:13 +00:00
</style>