feature/23-voice-room/poc #93

Merged
hodlbod merged 68 commits from feature/23-voice-room/poc into dev 2026-03-16 20:38:06 +00:00
Showing only changes of commit 1792dd157d - Show all commits
+5 -21
View File
@@ -1,29 +1,18 @@
<script lang="ts">
import {fly} from "svelte/transition"
import {ifLet} from "@welshman/lib"
import {displayRelayUrl} from "@welshman/util"
import Microphone from "@assets/icons/microphone.svg?dataurl"
import MicrophoneOff from "@assets/icons/microphone-off.svg?dataurl"
import PhoneRounded from "@assets/icons/phone-rounded.svg?dataurl"
import InfoCircle from "@assets/icons/info-circle.svg?dataurl"
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
import {displayRoom} from "@app/core/state"
import RoomDetail from "@app/components/RoomDetail.svelte"
import type {VoiceSession} from "@app/voice"
import {currentVoiceSession, leaveVoiceRoom, toggleMute} from "@app/voice"
import {pushModal} from "@app/util/modal"
const roomName = $derived(
$currentVoiceSession ? displayRoom($currentVoiceSession.url, $currentVoiceSession.h) : "",
)
const spaceName = $derived($currentVoiceSession ? displayRelayUrl($currentVoiceSession.url) : "")
const showRoomDetail = () => {
ifLet($currentVoiceSession, (session: VoiceSession) =>
pushModal(RoomDetail, {url: session.url, h: session.h}),
)
}
</script>
{#if $currentVoiceSession}
@@ -31,16 +20,11 @@
in:fly={{y: 60, duration: 350}}
out:fly={{y: 60, duration: 250}}
hodlbod marked this conversation as resolved Outdated
Outdated
Review

Don't do indirection like this, just call the actual function

Don't do indirection like this, just call the actual function
Outdated
Review

A stupid way to do this that I like would be ifLet($currentVoiceSession, ({url, h}) => pushModal(RoomDetail, {url, h})) but you don't have to do that

A stupid way to do this that I like would be `ifLet($currentVoiceSession, ({url, h}) => pushModal(RoomDetail, {url, h}))` but you don't have to do that
Outdated
Review

It is harder to read at first glance but ifLet brings warm feelings from better programming languages so it's done.

It is harder to read at first glance but `ifLet` brings warm feelings from better programming languages so it's done.
class="flex flex-col gap-2 rounded-box bg-base-100 p-3">
<div class="flex items-start justify-between gap-2">
<div class="min-w-0 flex flex-col gap-0.5">
<span class="text-sm font-semibold text-success">Voice Connected</span>
<span class="ellipsize text-xs opacity-70">
{roomName} / {spaceName}
</span>
</div>
<Button class="btn btn-sm btn-square btn-ghost shrink-0" onclick={showRoomDetail}>
<Icon icon={InfoCircle} size={4} />
</Button>
<div class="flex flex-col gap-0.5">
<span class="text-sm font-semibold text-success">Voice Connected</span>
hodlbod marked this conversation as resolved Outdated
Outdated
Review

$currentVoiceSession is better than get

$currentVoiceSession is better than `get`
<span class="ellipsize text-xs opacity-70">
{roomName} / {spaceName}
</span>
</div>
<div class="flex items-center gap-1">
<Button
3