2026-09-08 22:47:51 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import Inbox from "@assets/icons/inbox.svg?dataurl"
|
|
|
|
|
import AddCircle from "@assets/icons/add-circle.svg?dataurl"
|
|
|
|
|
import ChatRound from "@assets/icons/chat-round.svg?dataurl"
|
|
|
|
|
import Icon from "@lib/components/Icon.svelte"
|
|
|
|
|
import Link from "@lib/components/Link.svelte"
|
|
|
|
|
import Button from "@lib/components/Button.svelte"
|
2026-09-08 23:30:23 +00:00
|
|
|
import HomeSection from "@app/components/HomeSection.svelte"
|
2026-09-08 22:47:51 +00:00
|
|
|
import HomeInboxItem from "@app/components/HomeInboxItem.svelte"
|
2026-09-08 23:47:49 +00:00
|
|
|
import {inboxConversations} from "@app/inbox"
|
2026-09-08 22:47:51 +00:00
|
|
|
import {navigate} from "@app/modal"
|
2026-09-08 23:47:49 +00:00
|
|
|
import {allNotifications, setChecked} from "@app/notifications"
|
2026-09-08 22:47:51 +00:00
|
|
|
|
|
|
|
|
const conversations = $derived($inboxConversations.slice(0, 8))
|
|
|
|
|
|
|
|
|
|
const markAllRead = () => setChecked("*")
|
|
|
|
|
|
|
|
|
|
const startChat = () => navigate("/chat")
|
|
|
|
|
</script>
|
|
|
|
|
|
2026-09-08 23:30:23 +00:00
|
|
|
<HomeSection title="Inbox" icon={Inbox}>
|
|
|
|
|
{#snippet action()}
|
2026-09-08 23:47:49 +00:00
|
|
|
{#if $allNotifications.size > 0}
|
2026-09-08 22:47:51 +00:00
|
|
|
<Button class="button button-neutral button-xs" onclick={markAllRead}>Mark all read</Button>
|
|
|
|
|
{/if}
|
2026-09-08 23:30:23 +00:00
|
|
|
{/snippet}
|
2026-09-08 23:51:29 +00:00
|
|
|
{#if conversations.length > 0}
|
|
|
|
|
<div class="flex flex-col gap-3 px-4 pb-4">
|
|
|
|
|
{#each conversations as conversation (conversation.path)}
|
|
|
|
|
<HomeInboxItem {conversation} />
|
|
|
|
|
{/each}
|
|
|
|
|
</div>
|
|
|
|
|
{:else}
|
2026-09-08 23:30:23 +00:00
|
|
|
<div class="flex flex-col items-center gap-3 px-4 pb-8 text-center">
|
2026-09-08 23:51:29 +00:00
|
|
|
<p class="font-medium">You're all caught up</p>
|
2026-09-08 22:47:51 +00:00
|
|
|
<p class="max-w-md text-sm opacity-75">
|
2026-09-08 23:51:29 +00:00
|
|
|
The rooms, space chats and direct messages you belong to show what's unread here.
|
2026-09-08 22:47:51 +00:00
|
|
|
</p>
|
|
|
|
|
<div class="flex flex-wrap justify-center gap-2">
|
|
|
|
|
<Link href="/spaces" class="button button-primary button-sm">
|
|
|
|
|
<Icon icon={AddCircle} size={4} />
|
|
|
|
|
Add a space
|
|
|
|
|
</Link>
|
|
|
|
|
<Button class="button button-neutral button-sm" onclick={startChat}>
|
|
|
|
|
<Icon icon={ChatRound} size={4} />
|
|
|
|
|
Start a conversation
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
2026-09-08 23:30:23 +00:00
|
|
|
</HomeSection>
|