Add a dialog before joining voice rooms #109
Reference in New Issue
Block a user
Delete Branch "feature/join-voice-room-dialog"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
After using the voice rooms more since we removed the option for voice-only rooms I think you were right to suggest a dialog box before joining rooms. It felt far to clunky to have to join the voice call any time you just wanted to try to view room members, edit room settings, or just view the recent text chat.
This adds a dialog that allows the user to decline to join the call but still access the text part of the room along with associated settings and controls. It also acts as another confirmation step before turning on the user's microphone, and allows them to choose an audio input so they don't have to mess with the (generally terrible) browser controls for doing so. We should probably have controls to change your audio input and output from within the call as well, but I think this is enough for an MVP.
@@ -21,3 +26,2 @@const roomName = $derived($currentVoiceRoom ? displayRoom($currentVoiceRoom.url, $currentVoiceRoom.h) : "",const targetRoom = derived(This logic got more complex. Basically we need incorporate the room the user is currently viewing now.
Detailed explanation: now that you can join the text room without joining the voice call I needed to handle the case where you join voice room A, then view the text chat for voice room B, then disconnect from the call. In this case the
VoiceWidgetshould show a button to join the call for voice room B since that's the room you are currently viewing. It required some changes to state.ts which I'm not sure I'm happy with. More on that below.@@ -805,6 +809,25 @@ export const deriveOtherRooms = (url: string) =>},)export const parseDisplayedRoomParams = (params: Page["params"]): RoomRef | undefined => {I need a way to derive the room the user is currently viewing to handle the UX for
VoiceWidgetdisplayed above. Parsing it out of the page params seems safe enough but idk it feels like there should be a better way to do this. What do you think?@@ -29,3 +36,3 @@export type VoiceParticipant = {pubkey?: Pubkey; identity: string}export type VoiceState = "joining" | "connected" | "disconnected"export enum VoiceState {idk why I didn't make this an enum before.
@@ -26,0 +48,4 @@const openJoinDialog = async () => {const target = get(targetRoom)if (!target) returnJust use
$targetRoomhere, as long as you're in a svelte file you can avoid using get, even if you're not in a template@@ -808,0 +826,4 @@const inner = deriveRoom($p.url, $p.h)return inner.subscribe(set)},) as Readable<(RoomMeta & {url: string; id: string}) | undefined>I think parsing page parameters is fine, there's no way around it really. We could do this pretty simply in the component, though. Howabout just doing the same thing we do in h/page in VoiceWidget:
Nesting $derived/derived like that is gross but I think it makes sense here
@@ -36,2 +46,3 @@export const voiceState = writable<VoiceState>(VoiceState.Disconnected)export const currentVoiceRoom = writable<{url: string; h: string} | undefined>(undefined)export const currentVoiceRoom = writable<RoomRef | undefined>(undefined)Any reason we can't just use
Roomfrom core/state? Or maybe deriveRoom doesn't return that type.Yeah, I was able to do that.
67a6dc3febto0b04076baa