diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index be05df8..229b045 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -1,11 +1,14 @@ GitHub Copilot Instructions for This Repository -Basics: +Basics: These you need to really follow! - If you have any questions, always ask me first! - Use Svelte 5 runes exclusively - Declare reactive state with $state(); derive values with $derived(); run side-effect logic with $effect() etc. - When doing client-side loading, always implement placeholders and loaders, so the UI remains responsive and layout shifts are minimized. - Don't use placeholders and loaders for static data like heading etc. +- Never use supabse-js. I am using supabse-ssr and supabase client is located in: + - client: $props.data.supabse + - server: $locals.supabase Do not fall back to the legacy $: label syntax or Svelte 3/4 stores! This is important! diff --git a/package-lock.json b/package-lock.json index 914a67e..b278e00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "@supabase/ssr": "^0.6.1", "@supabase/supabase-js": "^2.50.0", "@sveltejs/adapter-node": "^5.2.12", + "@tanstack/svelte-query": "^5.83.0", "googleapis": "^150.0.1", "papaparse": "^5.5.3", "qrcode": "^1.5.4", @@ -1382,6 +1383,32 @@ "vite": "^5.2.0 || ^6" } }, + "node_modules/@tanstack/query-core": { + "version": "5.83.0", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.83.0.tgz", + "integrity": "sha512-0M8dA+amXUkyz5cVUm/B+zSk3xkQAcuXuz5/Q/LveT4ots2rBpPTZOzd7yJa2Utsf8D2Upl5KyjhHRY+9lB/XA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/svelte-query": { + "version": "5.83.0", + "resolved": "https://registry.npmjs.org/@tanstack/svelte-query/-/svelte-query-5.83.0.tgz", + "integrity": "sha512-8tNXhuoizntZXnAzo4yqUWgZZnklQkXGUNpb3YreW68DyCBhhrGbErnrODQs3fVc2ABcMvAHIki5uErbdzXH1A==", + "license": "MIT", + "dependencies": { + "@tanstack/query-core": "5.83.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "svelte": "^3.54.0 || ^4.0.0 || ^5.0.0" + } + }, "node_modules/@types/cookie": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", diff --git a/package.json b/package.json index b069470..4e9b0f9 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "@supabase/ssr": "^0.6.1", "@supabase/supabase-js": "^2.50.0", "@sveltejs/adapter-node": "^5.2.12", + "@tanstack/svelte-query": "^5.83.0", "googleapis": "^150.0.1", "papaparse": "^5.5.3", "qrcode": "^1.5.4", diff --git a/src/lib/helpers.ts b/src/lib/helpers.ts new file mode 100644 index 0000000..3aa64e5 --- /dev/null +++ b/src/lib/helpers.ts @@ -0,0 +1,9 @@ + + +export const reactiveQueryArgs = (cb: () => T) => { + const store = writable(); + $effect.pre(() => { + store.set(cb()); + }); + return store; +}; \ No newline at end of file diff --git a/src/routes/private/+layout.svelte b/src/routes/private/+layout.svelte index a35632b..2f63c7b 100644 --- a/src/routes/private/+layout.svelte +++ b/src/routes/private/+layout.svelte @@ -1,21 +1,34 @@ -