feat: Rotating messages for empty channel

This commit is contained in:
April Hall 2025-02-08 23:52:30 -05:00
parent 9095251cb8
commit dd22a8d50e
Signed by: arithefirst
GPG Key ID: 4508A15C4DB91C5B
2 changed files with 27 additions and 5 deletions

View File

@ -0,0 +1,25 @@
<script>
import { blur } from 'svelte/transition';
const messages = [
'A wild empty channel appears! What will you do?',
'Be the hero this chat deserves. Or just type "hi".',
'Echo... Echo... Is anyone there?',
'Empty chat, press "F" to pay respects.',
'Get the party started by sending a message!',
"Go ahead, say something! I won't bite… much.",
'Hello? Is this thing on?',
'If a message is sent in an empty chat, does it make a sound?',
'Imagine crickets chirping… now stop them by sending a message!',
"Just type something, this isn't rocket science.",
'Silence is golden, but chatting is more fun!',
'Talk to me, Goose.',
'Your keyboard looks bored. Give it something to do.',
'Your words will be the first ever spoken here. No pressure.',
];
</script>
<div class="abs-center text-center text-muted-foreground" out:blur>
<h1 class="text-4xl" in:blur={{ delay: 100 }}>No messages yet!</h1>
<h2 class="mt-2 text-sm" in:blur={{ delay: 300 }}>{messages[Math.floor(Math.random() * messages.length)]}</h2>
</div>

View File

@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/state'; import { page } from '$app/state';
import EmptyChannel from '$lib/components/emptyChannel.svelte';
import Message from '$lib/components/message.svelte'; import Message from '$lib/components/message.svelte';
import MessageLengthDialog from '$lib/components/messageLengthDialog.svelte'; import MessageLengthDialog from '$lib/components/messageLengthDialog.svelte';
import { Button } from '$lib/components/ui/button/index'; import { Button } from '$lib/components/ui/button/index';
@ -11,7 +12,6 @@
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import type { PageData } from './$types'; import type { PageData } from './$types';
import { blur } from 'svelte/transition';
const { data }: { data: PageData } = $props(); const { data }: { data: PageData } = $props();
@ -73,10 +73,7 @@
{@render message(data.messages)} {@render message(data.messages)}
</div> </div>
{:else} {:else}
<div class="abs-center text-center text-muted-foreground" in:blur={{ delay: 100 }} out:blur> <EmptyChannel />
<h1 class="text-4xl">No messages yet!</h1>
<h2 class="mt-2 text-sm">Send a message to get the conversation started.</h2>
</div>
{/if} {/if}
</div> </div>
<form bind:this={formref} class="flex w-full gap-1" onsubmit={submit}> <form bind:this={formref} class="flex w-full gap-1" onsubmit={submit}>