feat(voice): jump to the call from the voice panel
The channel name under 'Voice Connected' was a plain div. Making it navigate needed more than an onClick: voiceStore never recorded which space the call was in, and spaceStore.channels only holds the space currently being viewed — so after navigating away the call's channel was unresolvable, which is also why the label degraded to a generic 'Voice Channel'. Capture space and channel name at join time (the only moment they are reliable) and use them for both the label and the jump. Covers space calls and DM calls.
This commit is contained in:
@@ -17,6 +17,15 @@ export interface ScreenShareConfig {
|
||||
interface VoiceState {
|
||||
voiceUsers: Map<string, string[]>; // channelId → userIds
|
||||
currentVoiceChannelId: string | null;
|
||||
/**
|
||||
* Space and name of the channel the call is in, captured at join time.
|
||||
* `channels` in spaceStore only holds the space the user is *viewing*, so
|
||||
* once they navigate elsewhere the call's channel is no longer resolvable
|
||||
* from it — these keep the voice panel able to name and link to the call.
|
||||
* Transient: intentionally absent from `partialize`.
|
||||
*/
|
||||
currentVoiceSpaceId: string | null;
|
||||
currentVoiceChannelName: string | null;
|
||||
isMuted: boolean;
|
||||
isDeafened: boolean;
|
||||
isCameraOn: boolean;
|
||||
@@ -85,7 +94,7 @@ interface VoiceState {
|
||||
setVoiceUsers: (channelId: string, userIds: string[]) => void;
|
||||
addVoiceUser: (channelId: string, userId: string) => void;
|
||||
removeVoiceUser: (channelId: string, userId: string) => void;
|
||||
setCurrentVoiceChannel: (channelId: string | null) => void;
|
||||
setCurrentVoiceChannel: (channelId: string | null, spaceId?: string | null, channelName?: string | null) => void;
|
||||
setParticipants: (participants: ParticipantInfo[]) => void;
|
||||
setSpeakingParticipants: (ids: Set<string>) => void;
|
||||
setConnectionError: (error: string | null) => void;
|
||||
@@ -158,6 +167,8 @@ export const useVoiceStore = create<VoiceState>()(
|
||||
(set, get) => ({
|
||||
voiceUsers: new Map(),
|
||||
currentVoiceChannelId: null,
|
||||
currentVoiceSpaceId: null,
|
||||
currentVoiceChannelName: null,
|
||||
isMuted: false,
|
||||
pttActive: false,
|
||||
isDeafened: false,
|
||||
@@ -349,8 +360,10 @@ export const useVoiceStore = create<VoiceState>()(
|
||||
});
|
||||
},
|
||||
|
||||
setCurrentVoiceChannel: (channelId) => set({
|
||||
setCurrentVoiceChannel: (channelId, spaceId = null, channelName = null) => set({
|
||||
currentVoiceChannelId: channelId,
|
||||
currentVoiceSpaceId: channelId ? spaceId : null,
|
||||
currentVoiceChannelName: channelId ? channelName : null,
|
||||
activeDmCall: null // Clear active DM call when joining a server channel
|
||||
}),
|
||||
|
||||
@@ -516,6 +529,8 @@ export const useVoiceStore = create<VoiceState>()(
|
||||
voiceUsers: new Map(),
|
||||
voiceUserStates: new Map(),
|
||||
currentVoiceChannelId: null,
|
||||
currentVoiceSpaceId: null,
|
||||
currentVoiceChannelName: null,
|
||||
participants: [],
|
||||
speakingParticipantIds: new Set(),
|
||||
speakingUserIds: new Set(),
|
||||
|
||||
Reference in New Issue
Block a user