feat: add and close #104

This commit is contained in:
Xyphyn committed 2023-08-16 15:59:55 -07:00
1 parent b27a018bf3
commit db753ff6dc
2 files changed
+18 -10

No files matched your search

+18 -9
View File
@@ -73,14 +73,6 @@
communities = list.communities.map((c) => c.community) communities = list.communities.map((c) => c.community)
} }
const draft = getSessionStorage('postDraft')
if (draft && !edit) {
// @ts-ignore
draft.loading = false
// @ts-ignore
data = draft
}
}) })
onDestroy(() => { onDestroy(() => {
@@ -250,13 +242,30 @@
previewButton previewButton
/> />
<Checkbox bind:checked={data.nsfw}>NSFW</Checkbox> <Checkbox bind:checked={data.nsfw}>NSFW</Checkbox>
<div class="mt-auto" />
{#if !edit}
<Button
on:click={() => {
const draft = getSessionStorage('postDraft')
if (draft && !edit) {
// @ts-ignore
draft.loading = false
// @ts-ignore
data = draft
}
}}
size="lg"
disabled={!getSessionStorage('postDraft')}
>
Restore from draft
</Button>
{/if}
<Button <Button
submit submit
color="primary" color="primary"
loading={data.loading} loading={data.loading}
size="lg" size="lg"
disabled={data.loading} disabled={data.loading}
class={$$props.class}
> >
Submit Submit
</Button> </Button>
-1
View File
@@ -27,7 +27,6 @@
<PostForm <PostForm
passedCommunity={community} passedCommunity={community}
on:submit={(e) => goto(`/post/${e.detail.post.id}`)} on:submit={(e) => goto(`/post/${e.detail.post.id}`)}
class="mt-auto"
> >
<h1 class="text-2xl font-bold" slot="formtitle">Create Post</h1> <h1 class="text-2xl font-bold" slot="formtitle">Create Post</h1>
</PostForm> </PostForm>