diff --git a/src/client/channel/components/ChannelPeople.tsx b/src/client/channel/components/ChannelPeople.tsx index b07261045..5310c6323 100644 --- a/src/client/channel/components/ChannelPeople.tsx +++ b/src/client/channel/components/ChannelPeople.tsx @@ -4,9 +4,9 @@ import type { ChannelController } from "../types"; import type { ChannelUser as User } from "../protocol"; import { listeningVoicePublications, roomPresentUserIds, roomActivityPeople, userProfile } from "../presentation"; import { ChannelUser } from "./ChannelUser"; -import { useEffect, useRef, useState } from "react"; +import { memo, useEffect, useRef, useState } from "react"; -export function ChannelPeople({ channel, roomId, active, onBack }: { channel: ChannelController; roomId: string; active: boolean; onBack(): void }) { +export const ChannelPeople = memo(function ChannelPeople({ channel, roomId, active, onBack }: { channel: ChannelController; roomId: string; active: boolean; onBack(): void }) { const { t } = useCopy(); const { state, self } = channel; const [directory, setDirectory] = useState<{ ids: string[]; next?: string | null }>({ ids: [] }); @@ -87,4 +87,4 @@ export function ChannelPeople({ channel, roomId, active, onBack }: { channel: Ch onClick={() => { void load(directory.next ?? undefined); }} />} ; -} +}); diff --git a/src/client/pages/ChannelPage.tsx b/src/client/pages/ChannelPage.tsx index bfa5d6072..3c6a118c4 100644 --- a/src/client/pages/ChannelPage.tsx +++ b/src/client/pages/ChannelPage.tsx @@ -84,6 +84,7 @@ export function ChannelRoomPage({ channel, selected, onSelect, appControl, layou const [watchRoomId, setWatchRoomId] = useState(null); const preparingShare = useRef(null); const { pane: mobilePane, navigate: setMobilePane, showInitialRooms, track } = useRoomPane(); + const returnToRoom = useCallback(() => setMobilePane("room"), [setMobilePane]); const selectRoom = useCallback((id: string) => { preparingShare.current = null; setPickerRoom(null); onSelect(id); setSourceView(null); setMobilePane("room", id); @@ -427,7 +428,7 @@ export function ChannelRoomPage({ channel, selected, onSelect, appControl, layou {canCreateRoom && setNewRoom("")} />} - {!sidebarsInline && mobilePane === "rooms" && setMobilePane("room")} />} + {!sidebarsInline && mobilePane === "rooms" && } {sidebarsInline && { if (!sharingView) toggleSharingView(); setMobilePane("room"); }} />} @@ -591,7 +592,7 @@ export function ChannelRoomPage({ channel, selected, onSelect, appControl, layou label={`${nameOfUser(publication.userId)} — ${nameOfRoom(publication.roomId)}`} />)}
- {layout !== "quick" && setMobilePane("room")} />} + {layout !== "quick" && }
0 ? () => setMobilePane("room") : undefined} + onBack={!roomToolOpen && !sidebarsInline && visibleScreens.length > 0 ? returnToRoom : undefined} interaction={channel.interactionsByRoom.get(roomId) ?? null} onSend={channel.sendMessage} onDiscardSend={channel.discardMessageRetry} floating={roomToolOpen} hidden={conversationHidden} />} voice={<>