diff --git a/package.json b/package.json index 10b7619..24dbd51 100644 --- a/package.json +++ b/package.json @@ -67,8 +67,6 @@ "@fontsource/fira-mono": "^4.5.10", "@iconify-icons/line-md": "^1.2.23", "@iconify-icons/mdi": "^1.2.47", - "@leveluptuts/svelte-side-menu": "^1.0.5", - "@leveluptuts/svelte-toy": "^2.0.3", "@lucia-auth/adapter-mysql": "^1.1.1", "@lucia-auth/adapter-prisma": "^3.0.0", "@lukeed/uuid": "^2.0.1", @@ -85,6 +83,7 @@ "lucide-svelte": "^0.256.1", "open-props": "^1.5.10", "radix-svelte": "^0.8.0", + "svelte-french-toast": "^1.2.0", "svelte-lazy": "^1.2.1", "svelte-lazy-loader": "^1.0.0", "svelte-legos": "^0.2.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1aa16d1..e736e87 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,12 +17,6 @@ dependencies: '@iconify-icons/mdi': specifier: ^1.2.47 version: 1.2.47 - '@leveluptuts/svelte-side-menu': - specifier: ^1.0.5 - version: 1.0.5 - '@leveluptuts/svelte-toy': - specifier: ^2.0.3 - version: 2.0.3 '@lucia-auth/adapter-mysql': specifier: ^1.1.1 version: 1.1.1(lucia-auth@1.8.0) @@ -71,6 +65,9 @@ dependencies: radix-svelte: specifier: ^0.8.0 version: 0.8.0(svelte@4.1.1) + svelte-french-toast: + specifier: ^1.2.0 + version: 1.2.0(svelte@4.1.1) svelte-lazy: specifier: ^1.2.1 version: 1.2.1(svelte@4.1.1) @@ -1143,16 +1140,6 @@ packages: '@jridgewell/resolve-uri': 3.1.0 '@jridgewell/sourcemap-codec': 1.4.15 - /@leveluptuts/svelte-side-menu@1.0.5: - resolution: {integrity: sha512-czPmr0LEjVhr7qXYZtH4PrUrfHPYg9nS7ZHH+xDINKoajkERWlHlsBtdoJC5ZTMzGvdhLCLfF70q4xeMzJgS7w==} - dev: false - - /@leveluptuts/svelte-toy@2.0.3: - resolution: {integrity: sha512-A2pjSG4UQbWLffD3r3cC8zaNwtTmBoNJJ2TIlNzVtdlUXk1xrYtscMopB+N2ztHnfjlKWyIee4TEnF3OBVwIfQ==} - dependencies: - lodash.set: 4.3.2 - dev: false - /@lucia-auth/adapter-mysql@1.1.1(lucia-auth@1.8.0): resolution: {integrity: sha512-br+/OBDNJ+eRc6RrZnnC20ef+2VEMrXFxNYvsbryPw64ito7vg40STblpENdjJF0o4R10mjWTO43wQ+56jyXLA==} peerDependencies: @@ -2719,10 +2706,6 @@ packages: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} dev: true - /lodash.set@4.3.2: - resolution: {integrity: sha512-4hNPN5jlm/N/HLMCO43v8BXKq9Z7QdAGc/VGrRD61w8gN9g/6jF9A4L1pbUgBLCffi0w9VsXfTOij5x8iTyFvg==} - dev: false - /logform@2.5.1: resolution: {integrity: sha512-9FyqAm9o9NKKfiAKfZoYo9bGXXuwMkxQiQttkT4YjjVtQVIQtK6LmVtlxmCaFswo6N4AfEkHqZTV0taDtPotNg==} dependencies: @@ -3857,6 +3840,15 @@ packages: svelte: 4.1.1 dev: true + /svelte-french-toast@1.2.0(svelte@4.1.1): + resolution: {integrity: sha512-5PW+6RFX3xQPbR44CngYAP1Sd9oCq9P2FOox4FZffzJuZI2mHOB7q5gJBVnOiLF5y3moVGZ7u2bYt7+yPAgcEQ==} + peerDependencies: + svelte: ^3.57.0 || ^4.0.0 + dependencies: + svelte: 4.1.1 + svelte-writable-derived: 3.1.0(svelte@4.1.1) + dev: false + /svelte-hmr@0.15.2(svelte@4.1.1): resolution: {integrity: sha512-q/bAruCvFLwvNbeE1x3n37TYFb3mTBJ6TrCq6p2CoFbSTNhDE9oAtEfpy+wmc9So8AG0Tja+X0/mJzX9tSfvIg==} engines: {node: ^12.20 || ^14.13.1 || >= 16} @@ -3939,6 +3931,14 @@ packages: typescript: 5.1.6 dev: true + /svelte-writable-derived@3.1.0(svelte@4.1.1): + resolution: {integrity: sha512-cTvaVFNIJ036vSDIyPxJYivKC7ZLtcFOPm1Iq6qWBDo1fOHzfk6ZSbwaKrxhjgy52Rbl5IHzRcWgos6Zqn9/rg==} + peerDependencies: + svelte: ^3.2.1 || ^4.0.0-next.1 + dependencies: + svelte: 4.1.1 + dev: false + /svelte@4.1.1: resolution: {integrity: sha512-Enick5fPFISLoVy0MFK45cG+YlQt6upw8skEK9zzTpJnH1DqEv8xOZwizCGSo3Q6HZ7KrZTM0J18poF7aQg5zw==} engines: {node: '>=16'} diff --git a/src/app.d.ts b/src/app.d.ts index 77fc2c3..df527f0 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -10,7 +10,7 @@ type User = Omit; declare global { namespace App { interface PageData { - flash?: { type: 'success' | 'error'; message: string }; + flash?: { type: 'success' | 'error' | 'info'; message: string }; } interface Locals { auth: import('lucia').AuthRequest; diff --git a/src/lib/components/search/textSearch/index.svelte b/src/lib/components/search/textSearch/index.svelte index 7d53601..7e64830 100644 --- a/src/lib/components/search/textSearch/index.svelte +++ b/src/lib/components/search/textSearch/index.svelte @@ -19,6 +19,9 @@ import RemoveCollectionDialog from '../../dialog/RemoveCollectionDialog.svelte'; import RemoveWishlistDialog from '../../dialog/RemoveWishlistDialog.svelte'; import type { ListGameSchema, SearchSchema } from '$lib/zodValidation'; + import { Label } from '$components/ui/label'; + import { Input } from '$components/ui/input'; + import { Button } from '$components/ui/button'; interface RemoveGameEvent extends Event { detail: GameType | SavedGameType; @@ -147,22 +150,11 @@
{#if showButton} - + {/if}
diff --git a/src/lib/components/toast/Toast.svelte b/src/lib/components/toast/Toast.svelte index 53ca49f..1d07ef6 100644 --- a/src/lib/components/toast/Toast.svelte +++ b/src/lib/components/toast/Toast.svelte @@ -1,7 +1,7 @@ @@ -10,6 +10,8 @@
{#each $toast as toastData (toastData.id)}
toastData.dismissible && toast.remove(toastData.id)} on:keydown={() => toastData.dismissible && toast.remove(toastData.id)} diff --git a/src/lib/components/toast/toast.ts b/src/lib/components/toast/toast.ts index 5cd73a8..bfc4248 100644 --- a/src/lib/components/toast/toast.ts +++ b/src/lib/components/toast/toast.ts @@ -4,40 +4,40 @@ import { ToastType } from '$lib/types'; // Custom store const newToast = () => { - const { subscribe, update } = writable([]); + const { subscribe, update } = writable([]); - function send( - message: string, - { - duration = 2000, - type = ToastType.INFO, - autoDismiss = true, - dismissible = false, - showButton = false - } = {} - ) { - const id = Math.floor(Math.random() * 1000); + function send( + message: string, + { + duration = 2000, + type = ToastType.INFO, + autoDismiss = true, + dismissible = false, + showButton = false + } = {} + ) { + const id = Math.floor(Math.random() * 1000); - const newMessage: ToastData = { - id, - duration, - autoDismiss, - dismissible, - showButton, - type, - message - }; - update((store) => [...store, newMessage]); - } + const newMessage: ToastData = { + id, + duration, + autoDismiss, + dismissible, + showButton, + type, + message + }; + update((store) => [...store, newMessage]); + } - function remove(id: number) { - update((store) => { - const newStore = store.filter((item: ToastData) => item.id !== id); - return [...newStore]; - }); - } + function remove(id: number) { + update((store) => { + const newStore = store.filter((item: ToastData) => item.id !== id); + return [...newStore]; + }); + } - return { subscribe, send, remove }; + return { subscribe, send, remove }; }; export const toast = newToast(); diff --git a/src/lib/types.ts b/src/lib/types.ts index 3c39c38..a01ddf9 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -1,6 +1,8 @@ import { Prisma } from '@prisma/client'; import type { SvelteComponent } from 'svelte'; +export type Message = { status: 'error' | 'success' | 'warning' | 'info'; text: string }; + export const gameInclude = Prisma.validator()({ game: { select: { diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts index 3d1060f..74051e3 100644 --- a/src/routes/+layout.server.ts +++ b/src/routes/+layout.server.ts @@ -1,11 +1,9 @@ import { loadFlash } from 'sveltekit-flash-message/server'; import type { LayoutServerLoad } from './$types'; -export const load: LayoutServerLoad = async ({ url, locals }) => { +export const load: LayoutServerLoad = loadFlash(async ({ url, locals }) => { return { url: url.pathname, user: locals.user }; -}; - -// loadFlash( +}); diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index a77b3ea..e3f9c9b 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,11 +1,11 @@ + +
diff --git a/src/routes/collection/+page.svelte b/src/routes/collection/+page.svelte index bb86cf9..de74de5 100644 --- a/src/routes/collection/+page.svelte +++ b/src/routes/collection/+page.svelte @@ -5,6 +5,8 @@ import { superForm } from 'sveltekit-superforms/client'; import type { SuperValidated } from 'sveltekit-superforms'; import type { ModifyListGame } from '$lib/config/zod-schemas.js'; + import { onMount } from 'svelte'; + import toast from 'svelte-french-toast'; // import { collectionStore } from '$lib/stores/collectionStore'; // import type { GameType, SavedGameType } from '$lib/types'; // import { boredState } from '$lib/stores/boredState'; diff --git a/src/db/actions.ts b/src/server/actions.ts similarity index 100% rename from src/db/actions.ts rename to src/server/actions.ts diff --git a/src/db/roles.ts b/src/server/roles.ts similarity index 100% rename from src/db/roles.ts rename to src/server/roles.ts diff --git a/src/db/users.ts b/src/server/users.ts similarity index 100% rename from src/db/users.ts rename to src/server/users.ts diff --git a/svelte.config.js b/svelte.config.js index 686c089..23831f3 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -14,7 +14,7 @@ const config = { $assets: './src/assets', $components: './src/components', '$components/*': 'src/lib/components/*', - $db: './src/db', + $server: './src/server', $lib: './src/lib', $state: './src/state', $styles: './src/styles',