Streamline deriveRoom

This commit is contained in:
Jon Staab
2025-10-31 16:18:58 -07:00
parent 3978e32d5f
commit b1c68972c9
6 changed files with 34 additions and 22 deletions
+3 -6
View File
@@ -1,6 +1,7 @@
<script lang="ts">
import Hashtag from "@assets/icons/hashtag.svg?dataurl"
import Icon from "@lib/components/Icon.svelte"
import ImageIcon from "@lib/components/ImageIcon.svelte"
import RoomName from "@app/components/RoomName.svelte"
import {deriveRoom} from "@app/core/state"
@@ -14,13 +15,9 @@
const room = deriveRoom(url, h)
</script>
{#if $room?.picture}
{#if $room.picture}
{@const src = $room.picture}
{#if src.match("\.(png|svg)$") || src.match("image/(png|svg)")}
<Icon icon={src} />
{:else}
<img alt="Room icon" {src} class="h-6 w-6 rounded-lg" />
{/if}
<ImageIcon {src} alt="Room icon" />
{:else}
<Icon icon={Hashtag} />
{/if}