From 23359b86ee1dbe509c42d014ab7bf7afd082c460 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Tue, 6 Feb 2024 15:40:47 -0500 Subject: [PATCH] add the stats and the menu --- src/lib/directives/clickOutside.js | 15 +++++++++ src/routes/+layout.svelte | 3 ++ src/routes/+page.svelte | 9 ------ src/routes/AppTop.svelte | 50 ++++++++++++++++++++++++++++++ src/routes/about/+page.svelte | 9 ------ src/routes/stats/+page.svelte | 14 +++------ 6 files changed, 72 insertions(+), 28 deletions(-) create mode 100644 src/lib/directives/clickOutside.js create mode 100644 src/routes/AppTop.svelte diff --git a/src/lib/directives/clickOutside.js b/src/lib/directives/clickOutside.js new file mode 100644 index 0000000..ccaa7de --- /dev/null +++ b/src/lib/directives/clickOutside.js @@ -0,0 +1,15 @@ +export default function clickOutside(node) { + const handleClick = (event) => { + if (node && !node.contains(event.target) && !event.defaultPrevented) { + node.dispatchEvent(new CustomEvent('click_outside', node)); + } + }; + + document.addEventListener('click', handleClick, true); + + return { + destroy() { + document.removeEventListener('click', handleClick, true); + }, + }; +} diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 9d64f03..285837c 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -2,16 +2,19 @@ Ottawa board games, trades and sales
+
+ + diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelte index fbe1276..624a567 100644 --- a/src/routes/about/+page.svelte +++ b/src/routes/about/+page.svelte @@ -1,12 +1,3 @@ -
- -
-

bgg.babyl.ca is an aggregation of board games for sale or diff --git a/src/routes/stats/+page.svelte b/src/routes/stats/+page.svelte index d7f5499..587ebb3 100644 --- a/src/routes/stats/+page.svelte +++ b/src/routes/stats/+page.svelte @@ -1,12 +1,3 @@ -

- -
-

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

@@ -27,7 +18,6 @@