Compare commits

..

4 Commits

Author SHA1 Message Date
fe5c408d6b Merge branch 'new-user' 2024-02-06 09:21:43 -05:00
ebebe25c12 add new user 2024-02-06 09:21:38 -05:00
723c37d06b Merge branch 'search' 2024-02-05 15:29:32 -05:00
2200fc6884 add a search bar 2024-02-05 15:29:19 -05:00
3 changed files with 27 additions and 2 deletions

View File

@ -0,0 +1,8 @@
-- migrate:up
insert into bgg_user (username,neighbourhood) VALUES ('ck13','Hintonburg');
-- migrate:down
delete from bgg_user where username = 'ck13';

View File

@ -18,4 +18,5 @@ INSERT INTO "schema_migrations" (version) VALUES
('20240130205124'), ('20240130205124'),
('20240201201248'), ('20240201201248'),
('20240204153045'), ('20240204153045'),
('20240205142447'); ('20240205142447'),
('20240206141649');

View File

@ -3,10 +3,21 @@
<input type="checkbox" bind:checked={show_hidden} /> <input type="checkbox" bind:checked={show_hidden} />
<span> show hidden </span> <span> show hidden </span>
</label> </label>
<div class="field label prefix border">
<i>search</i>
<input type="text" bind:value={search_text} />
<label>Search</label>
</div>
</div> </div>
<div class="games"> <div class="games">
{#each games as game} {#each games.filter((game) => {
if (search_text.length < 3) return true;
const target = search_text.toLowerCase();
return game.name.toLowerCase().includes(target) || game.username
.toLowerCase()
.includes(target);
}) as game}
{#if show_hidden || !$games_hidden[[game.username, game.bgg_id].join('!')]} {#if show_hidden || !$games_hidden[[game.username, game.bgg_id].join('!')]}
<div <div
transition:slide={{ delay: 250, duration: 300 }} transition:slide={{ delay: 250, duration: 300 }}
@ -94,6 +105,8 @@
let show_hidden = false; let show_hidden = false;
let search_text = '';
// add filter // add filter
// add sort (user, game, price) // add sort (user, game, price)
@ -144,4 +157,7 @@
display: flex; display: flex;
flex-direction: row-reverse; flex-direction: row-reverse;
} }
.options > div {
margin-right: 1em;
}
</style> </style>