fix: give Explore its own /explore route so PiP navigates back to voice correctly

The Explore page shared /channels/@me with Friends, differentiated by a
showExplore UI flag. When PiP navigated to a voice channel, the stale
flag caused MainContent to render text chat instead of the voice grid.
Replace the flag with a dedicated /explore route so the URL is the
single source of truth.
This commit is contained in:
Jannis Braun
2026-03-05 01:29:16 +01:00
parent b840d2f82b
commit b642989e6e
7 changed files with 25 additions and 23 deletions
@@ -1,4 +1,5 @@
import React, { useEffect, useRef, useState, useCallback } from 'react';
import { useLocation } from 'react-router-dom';
import { useServerStore } from '../../stores/serverStore';
import { useChatStore } from '../../stores/chatStore';
import { useUIStore } from '../../stores/uiStore';
@@ -30,7 +31,8 @@ export function MainContent() {
const isLiveKitConnected = useVoiceStore((s) => s.isLiveKitConnected);
const connectionError = useVoiceStore((s) => s.connectionError);
const showDms = useUIStore((s) => s.showDms);
const showExplore = useUIStore((s) => s.showExplore);
const location = useLocation();
const isExplorePage = location.pathname === '/explore';
const activeDmCall = useVoiceStore((s) => s.activeDmCall);
const outgoingCall = useVoiceStore((s) => s.outgoingCall);
const dmChannels = useServerStore((s) => s.dmChannels);
@@ -62,9 +64,9 @@ export function MainContent() {
const channel = channels.find(c => c.id === currentChannelId);
const isVoiceChannel = channel?.type === 'voice' || channel?.type === 'video';
if (showDms || showExplore || !currentServerId) {
if (showDms || isExplorePage || !currentServerId) {
if (!currentChannelId) {
if (showExplore) return <ExplorePage />;
if (isExplorePage) return <ExplorePage />;
return <FriendsPage />;
}