diff --git a/package.json b/package.json index 3c8fd984..15a7a23f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "photon-lemmy", - "version": "0.7.2", + "version": "0.7.3", "private": true, "scripts": { "dev": "vite dev", diff --git a/src/lib/components/lemmy/modal/ImageUploadModal.svelte b/src/lib/components/lemmy/modal/ImageUploadModal.svelte new file mode 100644 index 00000000..fc8690bf --- /dev/null +++ b/src/lib/components/lemmy/modal/ImageUploadModal.svelte @@ -0,0 +1,51 @@ + + + + Upload image + + + + Upload + + + diff --git a/src/lib/components/lemmy/post/PostForm.svelte b/src/lib/components/lemmy/post/PostForm.svelte index 2301e99a..8c152365 100644 --- a/src/lib/components/lemmy/post/PostForm.svelte +++ b/src/lib/components/lemmy/post/PostForm.svelte @@ -8,10 +8,11 @@ import Button from '$lib/components/input/Button.svelte' import { toast } from '$lib/components/ui/toasts/toasts.js' import SearchInput from '$lib/components/input/SearchInput.svelte' - import { Check, Icon } from 'svelte-hero-icons' + import { Check, Icon, Photo } from 'svelte-hero-icons' import { profile } from '$lib/auth.js' import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte' import { placeholders } from '$lib/util.js' + import Checkbox from '$lib/components/input/Checkbox.svelte' export let edit = false @@ -33,6 +34,7 @@ body: string image: FileList | null url: string | undefined + nsfw: boolean loading: boolean } = { community: null, @@ -40,6 +42,7 @@ body: '', image: null, url: undefined, + nsfw: false, loading: false, } @@ -104,6 +107,7 @@ body: data.body, url: data.url || undefined, post_id: editingPost.id, + nsfw: data.nsfw, }) if (!post) throw new Error('Failed to edit post') @@ -120,6 +124,7 @@ name: data.title, body: data.body, url: data.url, + nsfw: data.nsfw, }) if (!post) throw new Error('Failed to upload post') @@ -134,8 +139,22 @@ } let communitySearch = '' + + let uploadingImage = false +{#if uploadingImage} + {#await import('$lib/components/lemmy/modal/ImageUploadModal.svelte') then { default: UploadModal }} + { + if (e.detail) data.url = e.detail + uploadingImage = false + }} + /> + {/await} +{/if} + @@ -192,26 +211,29 @@ bind:value={data.title} placeholder={placeholders.get('post')} /> - + + + (uploadingImage = !uploadingImage)} + style="width: 46px !important; height: 42px; padding: 0;" + > + + + - - Image - - + NSFW diff --git a/src/lib/components/ui/modal/Modal.svelte b/src/lib/components/ui/modal/Modal.svelte index 8c4d5faa..4b9a9aba 100644 --- a/src/lib/components/ui/modal/Modal.svelte +++ b/src/lib/components/ui/modal/Modal.svelte @@ -22,11 +22,13 @@ flex flex-col items-center justify-center bg-black/50 backdrop-blur-sm box-borde > {}} transition:scale={{ start: 0.9, easing: expoOut }} - class="overflow-y-auto {$$props.class} rounded-xl max-w-full box-border" + class="overflow-y-auto {$$props.class} rounded-xl max-w-full box-border w-full" > - + {}} + >