From 507ea37f74799784b82b3e9b517656d4ebb5e1c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Gr=C3=BCnewald?= <10533763+dhalucario@users.noreply.github.com> Date: Tue, 19 Nov 2024 23:53:44 +0100 Subject: [PATCH] Migrate away from tailwind and move back to stores --- src/app.pcss | 18 --- src/lib/components/AppSettings.svelte | 88 --------------- src/lib/components/BackButton.svelte | 5 +- src/lib/components/Button.svelte | 30 +++++ src/lib/components/Chips.svelte | 58 ++++++++++ src/lib/components/GlobalSearch.svelte | 25 +++-- src/lib/components/Header.svelte | 45 +++++--- src/lib/components/ImageGrid.svelte | 39 ++++--- src/lib/components/LinkButton.svelte | 27 +++++ src/lib/components/PostMedia.svelte | 76 ++++++++++++- src/lib/components/index.js | 16 ++- src/lib/stores.js | 20 +++- src/lib/useSettings.svelte.js | 52 --------- src/routes/+layout.svelte | 60 ++++++++-- src/routes/+page.svelte | 49 +++++++-- src/routes/posts/[post_id]/+page.svelte | 121 +++++++++++---------- src/routes/settings/+page.svelte | 12 -- src/routes/settings/SettingsNav.svelte | 35 ++++++ src/routes/settings/blacklist/+page.svelte | 48 ++++++++ src/routes/settings/main/+page.svelte | 43 ++++++++ 20 files changed, 568 insertions(+), 299 deletions(-) delete mode 100644 src/app.pcss delete mode 100644 src/lib/components/AppSettings.svelte create mode 100644 src/lib/components/Button.svelte create mode 100644 src/lib/components/Chips.svelte create mode 100644 src/lib/components/LinkButton.svelte delete mode 100644 src/lib/useSettings.svelte.js delete mode 100644 src/routes/settings/+page.svelte create mode 100644 src/routes/settings/SettingsNav.svelte create mode 100644 src/routes/settings/blacklist/+page.svelte create mode 100644 src/routes/settings/main/+page.svelte diff --git a/src/app.pcss b/src/app.pcss deleted file mode 100644 index 41b59af..0000000 --- a/src/app.pcss +++ /dev/null @@ -1,18 +0,0 @@ -/* Write your global styles here, in PostCSS syntax */ -@tailwind base; -@tailwind components; -@tailwind utilities; - -* { - box-sizing: border-box; -} - -body { - margin: 0; - padding: 0; -} - -img { - width: 100%; - margin: 0 auto; -} diff --git a/src/lib/components/AppSettings.svelte b/src/lib/components/AppSettings.svelte deleted file mode 100644 index 7ce1332..0000000 --- a/src/lib/components/AppSettings.svelte +++ /dev/null @@ -1,88 +0,0 @@ - -
-

Settings

- -
\ No newline at end of file diff --git a/src/lib/components/BackButton.svelte b/src/lib/components/BackButton.svelte index 6c383b8..35230c5 100644 --- a/src/lib/components/BackButton.svelte +++ b/src/lib/components/BackButton.svelte @@ -2,6 +2,7 @@ import {faArrowLeft} from '@fortawesome/free-solid-svg-icons'; import {Fa} from 'svelte-fa'; import {onMount} from "svelte"; + import Button from "$lib/components/Button.svelte"; let { popCount = 1 } = $props(); let href = $state(); @@ -28,6 +29,6 @@ - + diff --git a/src/lib/components/Button.svelte b/src/lib/components/Button.svelte new file mode 100644 index 0000000..7624def --- /dev/null +++ b/src/lib/components/Button.svelte @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/src/lib/components/Chips.svelte b/src/lib/components/Chips.svelte new file mode 100644 index 0000000..50cb362 --- /dev/null +++ b/src/lib/components/Chips.svelte @@ -0,0 +1,58 @@ + + +
+
+ + +
+
+ {#if values} + {#each values as chip} +
+ +
+ {/each} + {/if} +
+
+ + \ No newline at end of file diff --git a/src/lib/components/GlobalSearch.svelte b/src/lib/components/GlobalSearch.svelte index b567125..e1e75b8 100644 --- a/src/lib/components/GlobalSearch.svelte +++ b/src/lib/components/GlobalSearch.svelte @@ -1,22 +1,29 @@ -
{ e.preventDefault(); - settings.lastSearch = searchString; + $lastSearch = searchString; loading.set(true); onsubmit?.(searchString, true); }}> - - -
\ No newline at end of file + + + + + \ No newline at end of file diff --git a/src/lib/components/Header.svelte b/src/lib/components/Header.svelte index 5c9c4ad..3d1a52b 100644 --- a/src/lib/components/Header.svelte +++ b/src/lib/components/Header.svelte @@ -1,20 +1,39 @@ -
- {#if back} - - {/if} - {#if showSearch} - { +
+
+ {#if back} + + {/if} + {#if showSearch} + { onsubmit?.(val, explicitRefresh); }} /> - {/if} - - - + {/if} +
+
+ + + +
+ + \ No newline at end of file diff --git a/src/lib/components/ImageGrid.svelte b/src/lib/components/ImageGrid.svelte index bc7f9f0..ac122fb 100644 --- a/src/lib/components/ImageGrid.svelte +++ b/src/lib/components/ImageGrid.svelte @@ -1,25 +1,36 @@ -
+
{#each posts as post} - { + { loading.set(true); }}> -
-
- {`Post -
-

{post.id} {post.file.ext} {post.rating}

-
-
+ {`Post +
{/each}
+ + \ No newline at end of file diff --git a/src/lib/components/LinkButton.svelte b/src/lib/components/LinkButton.svelte new file mode 100644 index 0000000..906dc58 --- /dev/null +++ b/src/lib/components/LinkButton.svelte @@ -0,0 +1,27 @@ + + + + {@render children?.()} + + + \ No newline at end of file diff --git a/src/lib/components/PostMedia.svelte b/src/lib/components/PostMedia.svelte index 9aa14a6..c2c2385 100644 --- a/src/lib/components/PostMedia.svelte +++ b/src/lib/components/PostMedia.svelte @@ -1,6 +1,7 @@ {#if post?.preview?.has} - {`Post + {`Post {:else} {#if ['webm', 'mp4'].includes(post.file.ext)}