- {#if joinAbortController}
+ {#if isJoining}
{:else}
diff --git a/src/app/components/VoiceWidget.svelte b/src/app/components/VoiceWidget.svelte
index 11acfbb3..ae3f3eb5 100644
--- a/src/app/components/VoiceWidget.svelte
+++ b/src/app/components/VoiceWidget.svelte
@@ -4,43 +4,76 @@
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 PhoneCallingRounded from "@assets/icons/phone-calling-rounded.svg?dataurl"
+ import CloseCircle from "@assets/icons/close-circle.svg?dataurl"
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
import {displayRoom} from "@app/core/state"
- import {currentVoiceSession, leaveVoiceRoom, toggleMute} from "@app/voice"
+ import {
+ currentVoiceSession,
+ currentVoiceRoom,
+ voiceState,
+ leaveVoiceRoom,
+ toggleMute,
+ rejoinVoiceRoom,
+ cancelJoinVoiceRoom,
+ } from "@app/voice"
const roomName = $derived(
- $currentVoiceSession ? displayRoom($currentVoiceSession.url, $currentVoiceSession.h) : "",
+ $currentVoiceRoom ? displayRoom($currentVoiceRoom.url, $currentVoiceRoom.h) : "",
)
- const spaceName = $derived($currentVoiceSession ? displayRelayUrl($currentVoiceSession.url) : "")
+ const spaceName = $derived($currentVoiceRoom ? displayRelayUrl($currentVoiceRoom.url) : "")
-{#if $currentVoiceSession}
+{#if $currentVoiceRoom}
- Voice Connected
+ {#if $voiceState === "joining"}
+ Joining...
+ {:else if $voiceState === "connected"}
+ Voice Connected
+ {:else}
+ Disconnected
+ {/if}
{roomName} / {spaceName}
-
-
+ {#if $voiceState === "joining"}
+
+
+ {:else if $voiceState === "connected" && $currentVoiceSession}
+
+
+ {:else}
+
+ {/if}
{/if}
diff --git a/src/app/voice.ts b/src/app/voice.ts
index 3b2893df..40aa962c 100644
--- a/src/app/voice.ts
+++ b/src/app/voice.ts
@@ -28,8 +28,14 @@ export type Pubkey = string
export type VoiceParticipant = {pubkey?: Pubkey; identity: string}
+export type VoiceState = "joining" | "connected" | "disconnected"
+
export const currentVoiceSession = writable
(undefined)
+export const voiceState = writable("disconnected")
+
+export const currentVoiceRoom = writable<{url: string; h: string} | undefined>(undefined)
+
export const participantPubkeyMap = writable
- {#if $currentVoiceSession}
+ {#if isVoiceRoom || $voiceState === "joining" || $voiceState === "connected"}