From ffb3bdc407953ebbc1bdb4bfca0010ecb6ab9e7a Mon Sep 17 00:00:00 2001
From: tglide <26071571+TGlide@users.noreply.github.com>
Date: Thu, 2 Nov 2023 16:04:19 +0000
Subject: [PATCH 01/10] fix discord banner
---
src/lib/layouts/Main.svelte | 18 ++++++++++--------
src/routes/+layout.server.ts | 6 ++++++
src/routes/api/banner/+server.ts | 11 +++++++++++
src/routes/api/banner/constants.ts | 1 +
4 files changed, 28 insertions(+), 8 deletions(-)
create mode 100644 src/routes/api/banner/+server.ts
create mode 100644 src/routes/api/banner/constants.ts
diff --git a/src/lib/layouts/Main.svelte b/src/lib/layouts/Main.svelte
index 2ee1dac49e..c24bb0b35e 100644
--- a/src/lib/layouts/Main.svelte
+++ b/src/lib/layouts/Main.svelte
@@ -11,13 +11,13 @@
@@ -167,7 +169,7 @@
class:is-transparent={browser}
class:is-hidden={$isHeaderHidden}
>
- {#if $showTopBanner}
+ {#if showTopBanner}
@@ -179,7 +181,7 @@
diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts
index 189f71e2e1..8a12a50c85 100644
--- a/src/routes/+layout.server.ts
+++ b/src/routes/+layout.server.ts
@@ -1 +1,7 @@
+import { BANNER_KEY } from './api/banner/constants.js';
+
export const prerender = true;
+
+export const load = async ({ cookies }) => {
+ return { showBanner: cookies.get(BANNER_KEY) !== 'true' };
+};
diff --git a/src/routes/api/banner/+server.ts b/src/routes/api/banner/+server.ts
new file mode 100644
index 0000000000..0dc72f3114
--- /dev/null
+++ b/src/routes/api/banner/+server.ts
@@ -0,0 +1,11 @@
+import { BANNER_KEY } from './constants.js';
+
+export const POST = ({ cookies }) => {
+ cookies.set(BANNER_KEY, 'true', {
+ path: '/'
+ });
+
+ return new Response(null, {
+ status: 200
+ });
+};
diff --git a/src/routes/api/banner/constants.ts b/src/routes/api/banner/constants.ts
new file mode 100644
index 0000000000..41bf2f8e73
--- /dev/null
+++ b/src/routes/api/banner/constants.ts
@@ -0,0 +1 @@
+export const BANNER_KEY = 'discord-banner-00'; // Change key to force banner to show again
From 8d90c6fbc9e5b1db4a1f224f6da663e47136cad9 Mon Sep 17 00:00:00 2001
From: tglide <26071571+TGlide@users.noreply.github.com>
Date: Thu, 2 Nov 2023 16:09:52 +0000
Subject: [PATCH 02/10] fix deployment
---
src/routes/api/banner/+server.ts | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/routes/api/banner/+server.ts b/src/routes/api/banner/+server.ts
index 0dc72f3114..f6e08c9553 100644
--- a/src/routes/api/banner/+server.ts
+++ b/src/routes/api/banner/+server.ts
@@ -1,5 +1,9 @@
import { BANNER_KEY } from './constants.js';
+const isVercel = process.env.VERCEL === '1';
+
+export const prerender = isVercel;
+
export const POST = ({ cookies }) => {
cookies.set(BANNER_KEY, 'true', {
path: '/'
From 3ff101d7ac32dd5311fbe2aebd4879513f2c4099 Mon Sep 17 00:00:00 2001
From: tglide <26071571+TGlide@users.noreply.github.com>
Date: Thu, 2 Nov 2023 16:31:56 +0000
Subject: [PATCH 03/10] fix navbar FOUC
---
src/app.html | 2 ++
src/lib/layouts/Main.svelte | 3 +--
src/scss/7-components/_main-header.scss | 6 +++++-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/app.html b/src/app.html
index 8950633bb9..541e0bd8dc 100644
--- a/src/app.html
+++ b/src/app.html
@@ -35,6 +35,8 @@
}
}
}
+
+ document.body.dataset.jsEnabled = '';
%sveltekit.body%