-
-
Notifications
You must be signed in to change notification settings - Fork 565
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: compose editor as a page (#804)
- Loading branch information
Showing
7 changed files
with
100 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<script setup lang="ts"> | ||
import { formatTimeAgo } from '@vueuse/core' | ||
const route = useRoute() | ||
const router = useRouter() | ||
let draftKey = $ref('home') | ||
const draftKeys = $computed(() => Object.keys(currentUserDrafts.value)) | ||
const nonEmptyDrafts = $computed(() => draftKeys | ||
.filter(i => i !== draftKey && !isEmptyDraft(currentUserDrafts.value[i])) | ||
.map(i => [i, currentUserDrafts.value[i]] as const), | ||
) | ||
watchEffect(() => { | ||
draftKey = route.query.draft?.toString() || 'home' | ||
}) | ||
onMounted(() => { | ||
clearEmptyDrafts() | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div flex="~ col" pt-6 h-screen> | ||
<div text-right h-8> | ||
<VDropdown v-if="nonEmptyDrafts.length" placement="bottom-end"> | ||
<button btn-text flex="inline center"> | ||
Drafts ({{ nonEmptyDrafts.length }}) <div i-ri:arrow-down-s-line /> | ||
</button> | ||
<template #popper="{ hide }"> | ||
<div flex="~ col"> | ||
<NuxtLink | ||
v-for="[key, draft] of nonEmptyDrafts" :key="key" | ||
border="b base" text-left py2 px4 hover:bg-active | ||
:replace="true" | ||
:to="`/compose?draft=${encodeURIComponent(key)}`" | ||
@click="hide()" | ||
> | ||
<div> | ||
<div flex="~ gap-1" items-center> | ||
Draft <code>{{ key }}</code> | ||
<span v-if="draft.lastUpdated" text-secondary text-sm> | ||
· {{ formatTimeAgo(new Date(draft.lastUpdated)) }} | ||
</span> | ||
</div> | ||
<div text-secondary> | ||
{{ htmlToText(draft.params.status).slice(0, 50) }} | ||
</div> | ||
</div> | ||
</NuxtLink> | ||
</div> | ||
</template> | ||
</VDropdown> | ||
</div> | ||
<div> | ||
<PublishWidget :key="draftKey" expanded class="min-h-100!" :draft-key="draftKey" /> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<PublishWidgetFull /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters