refactor: unify voice user context menus into single VoiceUserContextMenu

Both the channel sidebar (VoiceChannel.tsx) and voice panel (VoiceUser.tsx)
now share one context menu with volume slider + conditional mod items,
eliminating duplicated portal/positioning/click-outside code from VoiceUser.
This commit is contained in:
Jannis Braun
2026-03-10 01:42:53 +01:00
parent f3b3c249ca
commit 3cef9cef32
3 changed files with 68 additions and 134 deletions
@@ -3,7 +3,7 @@ import { useVoiceStore } from '../../stores/voiceStore';
import { useSpaceStore, getChannelOrigin } from '../../stores/spaceStore';
import { useAuthStore } from '../../stores/authStore';
import { Avatar } from '../ui/Avatar';
import { VoiceModContextMenu } from './VoiceModContextMenu';
import { VoiceUserContextMenu } from './VoiceUserContextMenu';
const EMPTY_VOICE_USERS: string[] = [];
@@ -160,11 +160,12 @@ export function VoiceChannel({ channelId, channelName, onClick, locked }: VoiceC
{/* Voice moderation context menu (portalled to body) */}
{contextMenu && (
<VoiceModContextMenu
<VoiceUserContextMenu
targetUserId={contextMenu.userId}
channelId={channelId}
position={{ x: contextMenu.x, y: contextMenu.y }}
onClose={() => setContextMenu(null)}
isLocal={false}
/>
)}
</div>