design: tweak post page
This commit is contained in:
1 parent
ac504b8bce
commit
8e916f4ef1
1 file changed
+30
-25
@@ -2,8 +2,8 @@
|
|||||||
import { createEventDispatcher, onDestroy, onMount } from 'svelte'
|
import { createEventDispatcher, onDestroy, onMount } from 'svelte'
|
||||||
import { client } from '$lib/lemmy.js'
|
import { client } from '$lib/lemmy.js'
|
||||||
import type { Community, Post, PostView } from 'lemmy-js-client'
|
import type { Community, Post, PostView } from 'lemmy-js-client'
|
||||||
import { toast } from 'mono-svelte'
|
import { Switch, toast } from 'mono-svelte'
|
||||||
import { Check, Icon, Photo, BookOpen } from 'svelte-hero-icons'
|
import { Check, Icon, Photo, BookOpen, ArrowPath } from 'svelte-hero-icons'
|
||||||
import { profile } from '$lib/auth.js'
|
import { profile } from '$lib/auth.js'
|
||||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||||
import { placeholders, uploadImage } from '$lib/util.js'
|
import { placeholders, uploadImage } from '$lib/util.js'
|
||||||
@@ -293,32 +293,37 @@
|
|||||||
placeholder={placeholders.get('post')}
|
placeholder={placeholders.get('post')}
|
||||||
previewButton
|
previewButton
|
||||||
/>
|
/>
|
||||||
<Checkbox bind:checked={data.nsfw}>NSFW</Checkbox>
|
<Switch bind:checked={data.nsfw}>NSFW</Switch>
|
||||||
<div class="mt-auto" />
|
<div class="mt-auto" />
|
||||||
{#if !edit}
|
<div class="flex flex-row items-center gap-2">
|
||||||
<Button
|
<Button
|
||||||
on:click={() => {
|
submit
|
||||||
const draft = getSessionStorage('postDraft')
|
color="primary"
|
||||||
if (draft && !edit) {
|
loading={data.loading}
|
||||||
// @ts-ignore
|
|
||||||
draft.loading = false
|
|
||||||
// @ts-ignore
|
|
||||||
data = draft
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
size="lg"
|
size="lg"
|
||||||
disabled={!getSessionStorage('postDraft')}
|
disabled={data.loading}
|
||||||
|
class="flex-1"
|
||||||
>
|
>
|
||||||
Restore from draft
|
Submit
|
||||||
</Button>
|
</Button>
|
||||||
{/if}
|
|
||||||
<Button
|
{#if !edit}
|
||||||
submit
|
<Button
|
||||||
color="primary"
|
on:click={() => {
|
||||||
loading={data.loading}
|
toast({ content: 'Restored from draft' })
|
||||||
size="lg"
|
const draft = getSessionStorage('postDraft')
|
||||||
disabled={data.loading}
|
if (draft && !edit) {
|
||||||
>
|
// @ts-ignore
|
||||||
Submit
|
draft.loading = false
|
||||||
</Button>
|
// @ts-ignore
|
||||||
|
data = draft
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
size="square-lg"
|
||||||
|
disabled={!getSessionStorage('postDraft')}
|
||||||
|
>
|
||||||
|
<Icon src={ArrowPath} size="16" mini />
|
||||||
|
</Button>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
Reference in new issue
Block a user