mirror of
https://git.shipoclu.com/moon/plspace.git
synced 2026-08-13 02:42:30 +00:00
improved component composition and added tests.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
/** A full-page composer, reachable from the nav and from "Send Message". */
|
||||
import { session } from '$lib/stores/session.svelte'
|
||||
import { router } from '$lib/router.svelte'
|
||||
import { useAppServices } from '$lib/app-services'
|
||||
import Module from '$components/common/Module.svelte'
|
||||
import Composer from '$components/blog/Composer.svelte'
|
||||
|
||||
@@ -12,6 +11,7 @@
|
||||
|
||||
let { to }: Props = $props()
|
||||
|
||||
const { router, session } = useAppServices()
|
||||
const prefill = $derived(to ? `@${to.replace(/^@/, '')} ` : '')
|
||||
</script>
|
||||
|
||||
@@ -26,12 +26,15 @@
|
||||
|
||||
<div class="layout--single">
|
||||
<Module title={to ? 'New message' : 'New entry'}>
|
||||
<Composer
|
||||
initialText={prefill}
|
||||
placeholder={to ? 'Say something…' : 'What are you up to?'}
|
||||
submitLabel={to ? 'Send' : 'Post Entry'}
|
||||
onposted={(status) => router.go(`#/blog/${status.id}`)}
|
||||
/>
|
||||
{#key to}
|
||||
<Composer
|
||||
initialText={prefill}
|
||||
initialVisibility={to ? 'direct' : 'public'}
|
||||
placeholder={to ? 'Say something…' : 'What are you up to?'}
|
||||
submitLabel={to ? 'Send' : 'Post Entry'}
|
||||
onposted={(status) => router.go(`#/blog/${status.id}`)}
|
||||
/>
|
||||
{/key}
|
||||
</Module>
|
||||
|
||||
{#if !session.signedIn}
|
||||
|
||||
Reference in New Issue
Block a user