diff --git a/package.json b/package.json index 2387378..e29b348 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,7 @@ "devDependencies": { "@changesets/cli": "^2.27.1", "@playwright/test": "^1.28.1", - "@sveltejs/adapter-auto": "^3.0.0", - "@sveltejs/kit": "^2.0.0", + "@sveltejs/kit": "^2.5.0", "@sveltejs/vite-plugin-svelte": "^3.0.0", "@types/eslint": "8.56.0", "eslint": "^8.56.0", @@ -34,7 +33,6 @@ }, "type": "module", "dependencies": { - "@sveltejs/adapter-node": "^4.0.1", "@sveltejs/adapter-static": "^3.0.1", "@vincjo/datatables": "^1.14.4", "@yanick/updeep-remeda": "^2.2.0", diff --git a/src/lib/components/BggUser.svelte b/src/lib/components/BggUser.svelte new file mode 100644 index 0000000..655171f --- /dev/null +++ b/src/lib/components/BggUser.svelte @@ -0,0 +1,13 @@ +{username} + + + + diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 3dad5c6..9d64f03 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -15,7 +15,7 @@ const prefix = dev ? '/dev/' : '/db/'; - const games = readable([], async (set) => { + const games = readable([], (set) => { if (!browser) return () => {}; fetch(prefix + 'games.json') @@ -26,17 +26,18 @@ }); setContext('games', games); - const sellers = readable({}, async (set) => { + const sellers = readable({}, (set) => { if (!browser) return () => {}; - const sellers_list = await fetch(prefix + 'sellers.json').then((doc) => - doc.json(), - ); - set( - Object.fromEntries( - sellers_list.map((seller) => [seller.username, seller]), - ), - ); + const sellers_list = fetch(prefix + 'sellers.json') + .then((doc) => doc.json()) + .then((sellers_list) => + set( + Object.fromEntries( + sellers_list.map((seller) => [seller.username, seller]), + ), + ), + ); return () => {}; }); setContext('sellers', sellers); diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 8919ede..153cfce 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,7 +1,7 @@
@@ -27,7 +27,6 @@ const games = getContext('games'); const sellers = getContext('sellers'); - $: console.log($sellers); function pretty_date(date) { if (!date) return ''; diff --git a/src/routes/stats/+page.svelte b/src/routes/stats/+page.svelte new file mode 100644 index 0000000..d7f5499 --- /dev/null +++ b/src/routes/stats/+page.svelte @@ -0,0 +1,56 @@ +
+ +
+ +
+

Currently listing {nbr_games} games from {nbr_sellers} sellers.

+ + {#each Object.keys($sellers).sort() as username (username)} +
+ + + {#if $sellers[username].neighbourhood} + ({$sellers[username].neighbourhood}) + {/if} + + + {nbr_games_for(username)} + +
+ {/each} +
+ + + +