From 2b8158f6664eb728d04f3034f20daf30119644e4 Mon Sep 17 00:00:00 2001 From: Xodrium <118943715+malloc62@users.noreply.github.com> Date: Fri, 10 Feb 2023 18:17:40 -0500 Subject: [PATCH] Overhauled post creation Made the menu significantly better and made it possible to upload files directly from the post page --- src/lib/components/Area.svelte | 2 + src/lib/components/Button.svelte | 27 ++++++++++ src/lib/components/FileUpload.svelte | 55 ++++++++++++++++++++ src/lib/components/Post.svelte | 56 +++++++-------------- src/lib/components/PostBody.svelte | 27 ++++++++++ src/lib/components/PostButton.svelte | 31 ++++++++++++ src/lib/util.js | 7 ++- src/routes/+layout.svelte | 4 +- src/routes/new_file/+page.svelte | 75 ---------------------------- src/routes/new_post/+page.svelte | 59 ++++++++++++++++++---- src/routes/post/[post]/+page.svelte | 1 + 11 files changed, 219 insertions(+), 125 deletions(-) create mode 100644 src/lib/components/Button.svelte create mode 100644 src/lib/components/FileUpload.svelte create mode 100644 src/lib/components/PostBody.svelte create mode 100644 src/lib/components/PostButton.svelte delete mode 100644 src/routes/new_file/+page.svelte diff --git a/src/lib/components/Area.svelte b/src/lib/components/Area.svelte index a12904c..a8aaf62 100644 --- a/src/lib/components/Area.svelte +++ b/src/lib/components/Area.svelte @@ -25,6 +25,8 @@ #main { min-height: 250px; + max-height: 500px; + overflow-y: scroll; } #main.tiny { diff --git a/src/lib/components/Button.svelte b/src/lib/components/Button.svelte new file mode 100644 index 0000000..40b5f31 --- /dev/null +++ b/src/lib/components/Button.svelte @@ -0,0 +1,27 @@ + + + + + \ No newline at end of file diff --git a/src/lib/components/FileUpload.svelte b/src/lib/components/FileUpload.svelte new file mode 100644 index 0000000..568613b --- /dev/null +++ b/src/lib/components/FileUpload.svelte @@ -0,0 +1,55 @@ + + + + +
\ No newline at end of file diff --git a/src/lib/components/Post.svelte b/src/lib/components/Post.svelte index 516d4e0..5952384 100644 --- a/src/lib/components/Post.svelte +++ b/src/lib/components/Post.svelte @@ -1,13 +1,11 @@ + + + + + {#each contentSplit as line} + {#if line && line.type == 'img'} +{line}
+ {/if} + {/each} + \ No newline at end of file diff --git a/src/lib/components/PostButton.svelte b/src/lib/components/PostButton.svelte new file mode 100644 index 0000000..73da573 --- /dev/null +++ b/src/lib/components/PostButton.svelte @@ -0,0 +1,31 @@ + + + + + + +- Upload File -
- -- {#if form?.success} - {#if form?.href} - {form?.success} - {:else} - {form?.success} - {/if} - {/if} - Create an image for the world to see. -
- \ No newline at end of file diff --git a/src/routes/new_post/+page.svelte b/src/routes/new_post/+page.svelte index 57f99e4..291d0f5 100644 --- a/src/routes/new_post/+page.svelte +++ b/src/routes/new_post/+page.svelte @@ -1,10 +1,30 @@Create Post
- +{#if form?.success} {#if form?.href} diff --git a/src/routes/post/[post]/+page.svelte b/src/routes/post/[post]/+page.svelte index 96e8adf..e047106 100644 --- a/src/routes/post/[post]/+page.svelte +++ b/src/routes/post/[post]/+page.svelte @@ -11,4 +11,5 @@ content={data.content} upvotes={data.upvotes} downvotes={data.downvotes} + id={data.id} > \ No newline at end of file