improved component composition and added tests.

This commit is contained in:
Moon.eth
2026-07-29 10:30:28 +09:00
parent 95f9d73681
commit 264ae17a8d
39 changed files with 1811 additions and 147 deletions
+11 -8
View File
@@ -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}