From e783bf5a62d82fe09a157e4c60b88f37dfe72829 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Sun, 3 Mar 2024 13:06:46 -0500 Subject: [PATCH] add per-seller listing --- src/routes/AppTop.svelte | 4 + src/routes/sellers/+page.svelte | 91 ++++++++++++++++++++++ src/routes/sellers/Game.svelte | 121 +++++++++++++++++++++++++++++ src/routes/sellers/GameList.svelte | 62 +++++++++++++++ 4 files changed, 278 insertions(+) create mode 100644 src/routes/sellers/+page.svelte create mode 100644 src/routes/sellers/Game.svelte create mode 100644 src/routes/sellers/GameList.svelte diff --git a/src/routes/AppTop.svelte b/src/routes/AppTop.svelte index 79ec487..fd29c6c 100644 --- a/src/routes/AppTop.svelte +++ b/src/routes/AppTop.svelte @@ -28,6 +28,10 @@ list listing + + list + listing by sellers + shopping_cart cart diff --git a/src/routes/sellers/+page.svelte b/src/routes/sellers/+page.svelte new file mode 100644 index 0000000..0a6c2a8 --- /dev/null +++ b/src/routes/sellers/+page.svelte @@ -0,0 +1,91 @@ +
+ {#if $games.length == 0} +
+
+ + +
gathering games...
+
+
+ {:else} + {#each Object.keys($sellers).sort() as username (username)} +
+

+ + link + +

+ + {#if $sellers[username].neighbourhood} + ({$sellers[username].neighbourhood}) + {/if} + + + {nbr_games_for(username)} + +
+ + game.username === username)} /> + {/each} + {/if} +
+ + + + diff --git a/src/routes/sellers/Game.svelte b/src/routes/sellers/Game.svelte new file mode 100644 index 0000000..39236d4 --- /dev/null +++ b/src/routes/sellers/Game.svelte @@ -0,0 +1,121 @@ +
+
+
+ + +
+
+
+
+ {#if is_in_cart} + star + {/if} + + + {name} + +       + link +
+
+
+ {price ? '$' + price : ''} +
+
+ {notes} +
+
+ {#if updated_at} + {pretty_date(updated_at)} + {/if} +
+
+
+ +
+
+
+
+ + + + diff --git a/src/routes/sellers/GameList.svelte b/src/routes/sellers/GameList.svelte new file mode 100644 index 0000000..26705e1 --- /dev/null +++ b/src/routes/sellers/GameList.svelte @@ -0,0 +1,62 @@ +
+ {#each games as game} + toggle_visibility(game.id)} + on:toggle_cart={() => toggle_cart(game.id)} + {...game} + seller={sellers[game.username]} /> +
+ {/each} +
+ + + +