Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

refactor(app): flatten DM and community channel view choices

Hampuseab42936d36c
diff --git a/fluxer_app/src/features/channel/components/channel_view/DMChannelView.tsx b/fluxer_app/src/features/channel/components/channel_view/DMChannelView.tsx
index e4907b7db..022374ff8 100644
--- a/fluxer_app/src/features/channel/components/channel_view/DMChannelView.tsx
+++ b/fluxer_app/src/features/channel/components/channel_view/DMChannelView.tsx
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {
+ AccountGateBarrier,
AccountLimitedBarrier,
BlockedUserBarrier,
SystemDmBarrier,
- UnclaimedDMBarrier,
} from '@app/features/channel/components/barriers/BarrierComponents';
import {ChannelChatLayout} from '@app/features/channel/components/ChannelChatLayout';
import {ChannelHeader} from '@app/features/channel/components/ChannelHeader';
@@ -44,6 +44,7 @@ import {Button} from '@app/features/ui/button/Button';
import MobileLayout from '@app/features/ui/state/MobileLayout';
import {isMobileExperienceEnabled} from '@app/features/ui/utils/MobileExperience';
import Users from '@app/features/user/state/Users';
+import {canPerform} from '@app/features/user/utils/AccountGates';
import * as NicknameUtils from '@app/features/user/utils/NicknameUtils';
import * as CallCommands from '@app/features/voice/commands/CallCommands';
import {DirectCallLobbyBottomSheet} from '@app/features/voice/components/bottomsheets/DirectCallLobbyBottomSheet';
@@ -61,12 +62,13 @@ import {
} from '@app/features/voice/state/CompactVoiceCallHeight';
import {VOICE_CALL_DESCRIPTOR} from '@app/features/voice/utils/VoiceMessageDescriptors';
import {useFluxerDocumentTitle} from '@app/features/window/hooks/useFluxerDocumentTitle';
+import {TierGatedActions} from '@fluxer/constants/src/AccountTierConstants';
import {ChannelTypes} from '@fluxer/constants/src/ChannelConstants';
import {Trans, useLingui} from '@lingui/react/macro';
import {ChatTeardropIcon, PhoneIcon} from '@phosphor-icons/react';
import {clsx} from 'clsx';
import {observer} from 'mobx-react-lite';
-import {useCallback, useEffect, useMemo, useRef, useState} from 'react';
+import {type ReactNode, useCallback, useEffect, useMemo, useRef, useState} from 'react';
interface DMChannelViewProps {
channelId: string;
@@ -78,7 +80,7 @@ export const DMChannelView = observer(({channelId}: DMChannelViewProps) => {
const recipientId = channel?.recipientIds?.[0];
const recipient = recipientId ? Users.getUser(recipientId) : null;
const isRecipientBlocked = recipientId ? Relationships.isBlocked(recipientId) : false;
- const isCurrentUserUnclaimed = !Users.currentUser?.isClaimed();
+ const directMessageGate = canPerform(Users.currentUser, TierGatedActions.DIRECT_MESSAGE);
const isCurrentUserLimited = Users.currentUser?.accountLimited === true;
const isSystemDm = channel ? ChannelUtils.isSystemDmChannel(channel) : false;
const isDM = channel?.type === ChannelTypes.DM;
@@ -327,206 +329,211 @@ export const DMChannelView = observer(({channelId}: DMChannelViewProps) => {
data-flx="channel.channel-view.dm-channel-view.call-controls--2"
/>
);
- return (
- <>
- <ChannelViewScaffold
- className={clsx(
- showCallBackground && styles.channelGridVoiceCallActive,
- showCompactVoiceView && isCompactCallExpanded && styles.channelGridVoiceCallExpanded,
- )}
- header={
- <div
- ref={voiceCallChromeRef}
- className={clsx(
- showCallBackground && styles.voiceActiveHeaderWrapper,
- showCompactVoiceView && styles.voiceActiveHeaderWrapperOverlay,
- showCompactVoiceView && isCompactCallExpanded && styles.voiceActiveHeaderWrapperExpanded,
- )}
- data-voice-call-header-pinned={isVoiceCallChromePinned ? 'true' : undefined}
- data-flx="channel.channel-view.dm-channel-view.voice-active-header-wrapper"
+ const channelGridClassName = clsx(
+ showCallBackground && styles.channelGridVoiceCallActive,
+ showCompactVoiceView && isCompactCallExpanded && styles.channelGridVoiceCallExpanded,
+ );
+ let callSurface: ReactNode = null;
+ if (callExistsAndOngoing && call && channel) {
+ if (isMobileExperience) {
+ callSurface = (
+ <div className={dmStyles.callBannerMobile} data-flx="channel.channel-view.dm-channel-view.div--3">
+ <div className={dmStyles.callBannerMobileLabel} data-flx="channel.channel-view.dm-channel-view.div--4">
+ {callStatusLabel}
+ </div>
+ {(controlsVariant !== 'inCall' || !callHeaderState.isDeviceInRoomForChannelCall) && mobileCallControls && (
+ <div className={dmStyles.callControlsMobile} data-flx="channel.channel-view.dm-channel-view.div--5">
+ {mobileCallControls}
+ </div>
+ )}
+ <Button
+ variant="secondary"
+ onClick={handleOpenCallSheet}
+ leftIcon={
+ <PhoneIcon
+ size={remFromPx(16)}
+ weight="fill"
+ data-flx="channel.channel-view.dm-channel-view.phone-icon"
+ />
+ }
+ data-flx="channel.channel-view.dm-channel-view.button.open-call-sheet"
>
- <ChannelHeader
+ {callSheetButtonLabel}
+ </Button>
+ </div>
+ );
+ } else if (showCompactVoiceView) {
+ callSurface = (
+ <ChannelCompactCallSurface
+ channel={channel}
+ isExpanded={isCompactCallExpanded}
+ onToggleExpanded={handleToggleCompactCallExpanded}
+ unreadCount={compactCallUnreadCount}
+ avatarFallback={
+ <CallParticipantsRow
+ call={call}
channel={channel}
- showMembersToggle={Boolean(isGroupDM)}
- showPins={!isSystemDm}
- onSearchSubmit={handleSearchSubmit}
- onSearchClose={handleSearchClose}
- isSearchResultsOpen={isSearchActive}
- forceVoiceCallStyle={showCallBackground}
- memberListDefaultHiddenForChannel={memberListDefaultHiddenForChannel}
- voiceCallHeaderSupplement={compactVoiceCallHeaderSupplement}
- onVoiceCallChromePinChange={setIsVoiceCallChromePinnedByHeader}
- data-flx="channel.channel-view.dm-channel-view.channel-header"
+ participantAvatarEntries={participantAvatarEntries}
+ className={dmStyles.compactCallParticipantsRow}
+ data-flx="channel.channel-view.dm-channel-view.call-participants-row"
/>
- {callExistsAndOngoing &&
- call &&
- channel &&
- (isMobileExperience ? (
- <div className={dmStyles.callBannerMobile} data-flx="channel.channel-view.dm-channel-view.div--3">
- <div
- className={dmStyles.callBannerMobileLabel}
- data-flx="channel.channel-view.dm-channel-view.div--4"
- >
- {callStatusLabel}
+ }
+ onFullscreenRequest={handleOpenVoiceCallFullscreenView}
+ reserveHeaderChrome={showCompactVoiceView}
+ data-flx="channel.channel-view.dm-channel-view.channel-compact-call-surface"
+ />
+ );
+ } else {
+ callSurface = (
+ <div
+ className={clsx(styles.compactCallWrapper, isResizingCompactCallBanner && styles.compactCallWrapperResizing)}
+ ref={compactCallContainerRef}
+ style={compactCallBannerWrapperStyle}
+ data-flx="channel.channel-view.dm-channel-view.compact-call-wrapper"
+ >
+ <div
+ className={clsx(dmStyles.callBanner, isCompactCallResizable && dmStyles.callBannerResizable)}
+ data-flx="channel.channel-view.dm-channel-view.div--6"
+ >
+ <div className={dmStyles.callBannerBody} data-flx="channel.channel-view.dm-channel-view.div--7">
+ <CallParticipantsRow
+ call={call}
+ channel={channel}
+ participantAvatarEntries={participantAvatarEntries}
+ data-flx="channel.channel-view.dm-channel-view.call-participants-row--2"
+ />
+ </div>
+ {voiceControlBarCallControls && (
+ <footer className={dmStyles.callControlBarSection} data-flx="channel.channel-view.dm-channel-view.footer">
+ <div className={dmStyles.callControlBarInner} data-flx="channel.channel-view.dm-channel-view.div--8">
+ <div className={dmStyles.callControls} data-flx="channel.channel-view.dm-channel-view.div--9">
+ {voiceControlBarCallControls}
</div>
- {(controlsVariant !== 'inCall' || !callHeaderState.isDeviceInRoomForChannelCall) &&
- mobileCallControls && (
- <div
- className={dmStyles.callControlsMobile}
- data-flx="channel.channel-view.dm-channel-view.div--5"
- >
- {mobileCallControls}
- </div>
- )}
- <Button
- variant="secondary"
- onClick={handleOpenCallSheet}
- leftIcon={
- <PhoneIcon
- size={remFromPx(16)}
- weight="fill"
- data-flx="channel.channel-view.dm-channel-view.phone-icon"
- />
- }
- data-flx="channel.channel-view.dm-channel-view.button.open-call-sheet"
- >
- {callSheetButtonLabel}
- </Button>
- </div>
- ) : showCompactVoiceView ? (
- <ChannelCompactCallSurface
- channel={channel}
- isExpanded={isCompactCallExpanded}
- onToggleExpanded={handleToggleCompactCallExpanded}
- unreadCount={compactCallUnreadCount}
- avatarFallback={
- <CallParticipantsRow
- call={call}
- channel={channel}
- participantAvatarEntries={participantAvatarEntries}
- className={dmStyles.compactCallParticipantsRow}
- data-flx="channel.channel-view.dm-channel-view.call-participants-row"
+ {currentChannelId && controlsVariant !== 'inCall' && (
+ <VoiceE2EEIndicator
+ guildId={null}
+ channelId={currentChannelId}
+ variant="call"
+ data-flx="channel.channel-view.dm-channel-view.voice-e2-ee-indicator"
/>
- }
- onFullscreenRequest={handleOpenVoiceCallFullscreenView}
- reserveHeaderChrome={showCompactVoiceView}
- data-flx="channel.channel-view.dm-channel-view.channel-compact-call-surface"
- />
- ) : (
- <div
- className={clsx(
- styles.compactCallWrapper,
- isResizingCompactCallBanner && styles.compactCallWrapperResizing,
- )}
- ref={compactCallContainerRef}
- style={compactCallBannerWrapperStyle}
- data-flx="channel.channel-view.dm-channel-view.compact-call-wrapper"
- >
- <div
- className={clsx(dmStyles.callBanner, isCompactCallResizable && dmStyles.callBannerResizable)}
- data-flx="channel.channel-view.dm-channel-view.div--6"
- >
- <div className={dmStyles.callBannerBody} data-flx="channel.channel-view.dm-channel-view.div--7">
- <CallParticipantsRow
- call={call}
- channel={channel}
- participantAvatarEntries={participantAvatarEntries}
- data-flx="channel.channel-view.dm-channel-view.call-participants-row--2"
- />
- </div>
- {voiceControlBarCallControls && (
- <footer
- className={dmStyles.callControlBarSection}
- data-flx="channel.channel-view.dm-channel-view.footer"
- >
- <div
- className={dmStyles.callControlBarInner}
- data-flx="channel.channel-view.dm-channel-view.div--8"
- >
- <div className={dmStyles.callControls} data-flx="channel.channel-view.dm-channel-view.div--9">
- {voiceControlBarCallControls}
- </div>
- {currentChannelId && controlsVariant !== 'inCall' && (
- <VoiceE2EEIndicator
- guildId={null}
- channelId={currentChannelId}
- variant="call"
- data-flx="channel.channel-view.dm-channel-view.voice-e2-ee-indicator"
- />
- )}
- </div>
- </footer>
- )}
- </div>
- {isCompactCallResizable && (
- <div
- className={dmStyles.compactCallResizeHandle}
- onPointerDown={handleCompactCallResizePointerDown}
- onKeyDown={handleCompactCallResizeKeyDown}
- role="separator"
- aria-orientation="horizontal"
- aria-label={i18n._(RESIZE_CALL_VIEW_DESCRIPTOR)}
- aria-valuemin={compactCallHeightMin}
- aria-valuemax={compactCallMaxHeight}
- aria-valuenow={compactCallBannerHeight ?? compactCallHeightMin}
- tabIndex={0}
- data-flx="channel.channel-view.dm-channel-view.separator.compact-call-resize-key-down"
- >
- <div
- className={dmStyles.compactCallResizePill}
- data-flx="channel.channel-view.dm-channel-view.div--10"
- />
- </div>
)}
</div>
- ))}
+ </footer>
+ )}
</div>
- }
- chatArea={
- <ChannelChatLayout
- messages={
- <Messages key={channel.id} channel={channel} data-flx="channel.channel-view.dm-channel-view.messages" />
- }
- textarea={
- isSystemDm ? (
- <SystemDmBarrier data-flx="channel.channel-view.dm-channel-view.system-dm-barrier" />
- ) : isDM && isRecipientBlocked && recipient ? (
- <BlockedUserBarrier
- userId={recipient.id}
- username={NicknameUtils.getNickname(recipient, null)}
- data-flx="channel.channel-view.dm-channel-view.blocked-user-barrier"
- />
- ) : isCurrentUserLimited && !isPersonalNotes ? (
- <AccountLimitedBarrier data-flx="channel.channel-view.dm-channel-view.account-limited-barrier" />
- ) : isCurrentUserUnclaimed && isDM && !isPersonalNotes && !isGroupDM ? (
- <UnclaimedDMBarrier data-flx="channel.channel-view.dm-channel-view.unclaimed-dm-barrier" />
- ) : (
- <ChannelTextarea
- channel={channel}
- inputSuppressed={isCompactCallChatSuppressed}
- data-flx="channel.channel-view.dm-channel-view.channel-textarea"
- />
- )
- }
- data-flx="channel.channel-view.dm-channel-view.channel-chat-layout"
- />
- }
- sidePanel={
- isSearchPanelVisible ? (
- <div className={styles.searchPanel} data-flx="channel.channel-view.dm-channel-view.search-panel">
- <ChannelSearchResults
- channel={channel}
- searchQuery={activeSearchQuery}
- searchSegments={activeSearchSegments}
- refreshKey={searchRefreshKey}
- onClose={() => searchState.setIsSearchActive(false)}
- data-flx="channel.channel-view.dm-channel-view.channel-search-results"
- />
+ {isCompactCallResizable && (
+ <div
+ className={dmStyles.compactCallResizeHandle}
+ onPointerDown={handleCompactCallResizePointerDown}
+ onKeyDown={handleCompactCallResizeKeyDown}
+ role="separator"
+ aria-orientation="horizontal"
+ aria-label={i18n._(RESIZE_CALL_VIEW_DESCRIPTOR)}
+ aria-valuemin={compactCallHeightMin}
+ aria-valuemax={compactCallMaxHeight}
+ aria-valuenow={compactCallBannerHeight ?? compactCallHeightMin}
+ tabIndex={0}
+ data-flx="channel.channel-view.dm-channel-view.separator.compact-call-resize-key-down"
+ >
+ <div className={dmStyles.compactCallResizePill} data-flx="channel.channel-view.dm-channel-view.div--10" />
</div>
- ) : shouldRenderMemberList ? (
- <ChannelMembers channel={channel} data-flx="channel.channel-view.dm-channel-view.channel-members" />
- ) : null
- }
+ )}
+ </div>
+ );
+ }
+ }
+ const channelHeader = (
+ <div
+ ref={voiceCallChromeRef}
+ className={clsx(
+ showCallBackground && styles.voiceActiveHeaderWrapper,
+ showCompactVoiceView && styles.voiceActiveHeaderWrapperOverlay,
+ showCompactVoiceView && isCompactCallExpanded && styles.voiceActiveHeaderWrapperExpanded,
+ )}
+ data-voice-call-header-pinned={isVoiceCallChromePinned ? 'true' : undefined}
+ data-flx="channel.channel-view.dm-channel-view.voice-active-header-wrapper"
+ >
+ <ChannelHeader
+ channel={channel}
+ showMembersToggle={Boolean(isGroupDM)}
+ showPins={!isSystemDm}
+ onSearchSubmit={handleSearchSubmit}
+ onSearchClose={handleSearchClose}
+ isSearchResultsOpen={isSearchActive}
+ forceVoiceCallStyle={showCallBackground}
+ memberListDefaultHiddenForChannel={memberListDefaultHiddenForChannel}
+ voiceCallHeaderSupplement={compactVoiceCallHeaderSupplement}
+ onVoiceCallChromePinChange={setIsVoiceCallChromePinnedByHeader}
+ data-flx="channel.channel-view.dm-channel-view.channel-header"
+ />
+ {callSurface}
+ </div>
+ );
+ const channelMessages = (
+ <Messages key={channel.id} channel={channel} data-flx="channel.channel-view.dm-channel-view.messages" />
+ );
+ let channelTextarea: ReactNode;
+ if (isSystemDm) {
+ channelTextarea = <SystemDmBarrier data-flx="channel.channel-view.dm-channel-view.system-dm-barrier" />;
+ } else if (isDM && isRecipientBlocked && recipient) {
+ channelTextarea = (
+ <BlockedUserBarrier
+ userId={recipient.id}
+ username={NicknameUtils.getNickname(recipient, null)}
+ data-flx="channel.channel-view.dm-channel-view.blocked-user-barrier"
+ />
+ );
+ } else if (isCurrentUserLimited && !isPersonalNotes) {
+ channelTextarea = <AccountLimitedBarrier data-flx="channel.channel-view.dm-channel-view.account-limited-barrier" />;
+ } else if (!directMessageGate.allowed && isDM) {
+ channelTextarea = (
+ <AccountGateBarrier
+ gate={directMessageGate}
+ data-flx="channel.channel-view.dm-channel-view.account-gate-barrier"
+ />
+ );
+ } else {
+ channelTextarea = (
+ <ChannelTextarea
+ channel={channel}
+ inputSuppressed={isCompactCallChatSuppressed}
+ data-flx="channel.channel-view.dm-channel-view.channel-textarea"
+ />
+ );
+ }
+ const channelChatArea = (
+ <ChannelChatLayout
+ messages={channelMessages}
+ textarea={channelTextarea}
+ data-flx="channel.channel-view.dm-channel-view.channel-chat-layout"
+ />
+ );
+ let sidePanel: ReactNode;
+ if (isSearchPanelVisible) {
+ sidePanel = (
+ <div className={styles.searchPanel} data-flx="channel.channel-view.dm-channel-view.search-panel">
+ <ChannelSearchResults
+ channel={channel}
+ searchQuery={activeSearchQuery}
+ searchSegments={activeSearchSegments}
+ refreshKey={searchRefreshKey}
+ onClose={() => searchState.setIsSearchActive(false)}
+ data-flx="channel.channel-view.dm-channel-view.channel-search-results"
+ />
+ </div>
+ );
+ } else if (shouldRenderMemberList) {
+ sidePanel = <ChannelMembers channel={channel} data-flx="channel.channel-view.dm-channel-view.channel-members" />;
+ } else {
+ sidePanel = null;
+ }
+ return (
+ <>
+ <ChannelViewScaffold
+ className={channelGridClassName}
+ header={channelHeader}
+ chatArea={channelChatArea}
+ sidePanel={sidePanel}
chatAreaInert={isCompactCallChatSuppressed}
data-flx="channel.channel-view.dm-channel-view.channel-grid-voice-call"
/>
diff --git a/fluxer_app/src/features/channel/components/channel_view/GuildChannelView.tsx b/fluxer_app/src/features/channel/components/channel_view/GuildChannelView.tsx
index deccac3d1..a61e7c7c4 100644
--- a/fluxer_app/src/features/channel/components/channel_view/GuildChannelView.tsx
+++ b/fluxer_app/src/features/channel/components/channel_view/GuildChannelView.tsx
@@ -1,13 +1,12 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {
+ AccountGateBarrier,
AccountLimitedBarrier,
AccountTooNewBarrier,
AnnouncementFollowBarrier,
NotMemberLongEnoughBarrier,
SendMessageDisabledBarrier,
- UnclaimedAccountBarrier,
- UnverifiedEmailBarrier,
} from '@app/features/channel/components/barriers/BarrierComponents';
import {ChannelChatLayout} from '@app/features/channel/components/ChannelChatLayout';
import {ChannelHeader} from '@app/features/channel/components/ChannelHeader';
@@ -43,6 +42,7 @@ import MobileLayout from '@app/features/ui/state/MobileLayout';
import {Tooltip} from '@app/features/ui/tooltip/Tooltip';
import {isPwaOnMobileOrTablet} from '@app/features/ui/utils/PwaUtils';
import Users from '@app/features/user/state/Users';
+import {canPerform} from '@app/features/user/utils/AccountGates';
import {CompactVoiceCallStreamHeaderInfo} from '@app/features/voice/components/CompactVoiceCallStreamHeaderInfo';
import {useVoiceCallFullscreenViewState} from '@app/features/voice/components/useVoiceCallAppFullscreen';
import {VoiceCallView} from '@app/features/voice/components/VoiceCallView';
@@ -58,11 +58,13 @@ import {
} from '@app/features/voice/utils/MobileVoiceTextChatHistory';
import {useFluxerDocumentTitle} from '@app/features/window/hooks/useFluxerDocumentTitle';
import Window from '@app/features/window/state/Window';
+import {AccountVerificationNeeds, TierGatedActions} from '@fluxer/constants/src/AccountTierConstants';
import {ChannelTypes, Permissions} from '@fluxer/constants/src/ChannelConstants';
import {msg} from '@lingui/core/macro';
import {useLingui} from '@lingui/react/macro';
import {clsx} from 'clsx';
import {observer} from 'mobx-react-lite';
+import type React from 'react';
import {useCallback, useEffect, useLayoutEffect, useRef} from 'react';
const JOIN_VOICE_CHANNEL_DESCRIPTOR = msg({
@@ -376,15 +378,24 @@ export const GuildChannelView = observer(({channelId, guildId}: GuildChannelView
);
};
const renderChatArea = (inputSuppressed = false) => {
+ if (guild?.visiting) return null;
if (DeveloperOptions.mockVerificationBarrier !== 'none' && !channel.isPrivate()) {
switch (DeveloperOptions.mockVerificationBarrier) {
- case 'unclaimed_account':
- return (
- <UnclaimedAccountBarrier data-flx="channel.channel-view.guild-channel-view.render-chat-area.unclaimed-account-barrier" />
+ case 'unclaimed_account': {
+ const gate = canPerform(null, TierGatedActions.MESSAGE);
+ return gate.allowed ? null : (
+ <AccountGateBarrier
+ gate={gate}
+ data-flx="channel.channel-view.guild-channel-view.render-chat-area.unclaimed-account-barrier"
+ />
);
+ }
case 'unverified_email':
return (
- <UnverifiedEmailBarrier data-flx="channel.channel-view.guild-channel-view.render-chat-area.unverified-email-barrier" />
+ <AccountGateBarrier
+ gate={{action: TierGatedActions.GUILD_VERIFICATION, need: AccountVerificationNeeds.CONFIRM_EMAIL}}
+ data-flx="channel.channel-view.guild-channel-view.render-chat-area.unverified-email-barrier"
+ />
);
case 'account_too_new':
return (
@@ -459,6 +470,29 @@ export const GuildChannelView = observer(({channelId, guildId}: GuildChannelView
</div>
);
}
+ let sidePanel: React.ReactNode = null;
+ if (isSearchPanelVisible) {
+ sidePanel = (
+ <div className={styles.searchPanel} data-flx="channel.channel-view.guild-channel-view.search-panel">
+ <ChannelSearchResults
+ channel={channel}
+ searchQuery={activeSearchQuery}
+ searchSegments={activeSearchSegments}
+ refreshKey={searchRefreshKey}
+ onClose={() => searchState.setIsSearchActive(false)}
+ data-flx="channel.channel-view.guild-channel-view.channel-search-results"
+ />
+ </div>
+ );
+ } else if (shouldRenderMemberList) {
+ sidePanel = (
+ <ChannelMembers
+ channel={channel}
+ guild={guild}
+ data-flx="channel.channel-view.guild-channel-view.channel-members--2"
+ />
+ );
+ }
return (
<ChannelViewScaffold
className={clsx(
@@ -522,26 +556,7 @@ export const GuildChannelView = observer(({channelId, guildId}: GuildChannelView
data-flx="channel.channel-view.guild-channel-view.channel-chat-layout"
/>
}
- sidePanel={
- isSearchPanelVisible ? (
- <div className={styles.searchPanel} data-flx="channel.channel-view.guild-channel-view.search-panel">
- <ChannelSearchResults
- channel={channel}
- searchQuery={activeSearchQuery}
- searchSegments={activeSearchSegments}
- refreshKey={searchRefreshKey}
- onClose={() => searchState.setIsSearchActive(false)}
- data-flx="channel.channel-view.guild-channel-view.channel-search-results"
- />
- </div>
- ) : shouldRenderMemberList ? (
- <ChannelMembers
- channel={channel}
- guild={guild}
- data-flx="channel.channel-view.guild-channel-view.channel-members--2"
- />
- ) : null
- }
+ sidePanel={sidePanel}
showMemberListDivider={shouldRenderMemberList && !isSearchActive}
chatAreaInert={isVoiceTextCallExpanded}
data-flx="channel.channel-view.guild-channel-view.channel-grid-voice-call"
@@ -550,6 +565,33 @@ export const GuildChannelView = observer(({channelId, guildId}: GuildChannelView
}
const shouldRenderMemberList = isMemberListVisible && !isMobileLayout && !isSearchActive && !threadPanelOpen;
const isThreadChannel = channel.isThread();
+ let sidePanel: React.ReactNode = null;
+ if (isSearchPanelVisible) {
+ sidePanel = (
+ <div className={styles.searchPanel} data-flx="channel.channel-view.guild-channel-view.search-panel--2">
+ <ChannelSearchResults
+ channel={channel}
+ searchQuery={activeSearchQuery}
+ searchSegments={activeSearchSegments}
+ refreshKey={searchRefreshKey}
+ onClose={() => searchState.setIsSearchActive(false)}
+ data-flx="channel.channel-view.guild-channel-view.channel-search-results--2"
+ />
+ </div>
+ );
+ } else if (shouldRenderMemberList && isThreadChannel) {
+ sidePanel = (
+ <ThreadMembersPanel thread={channel} data-flx="channel.channel-view.guild-channel-view.thread-members-panel" />
+ );
+ } else if (shouldRenderMemberList) {
+ sidePanel = (
+ <ChannelMembers
+ channel={channel}
+ guild={guild}
+ data-flx="channel.channel-view.guild-channel-view.channel-members"
+ />
+ );
+ }
const scaffold = (
<ChannelViewScaffold
header={
@@ -585,33 +627,7 @@ export const GuildChannelView = observer(({channelId, guildId}: GuildChannelView
data-flx="channel.channel-view.guild-channel-view.channel-chat-layout--2"
/>
}
- sidePanel={
- isSearchPanelVisible ? (
- <div className={styles.searchPanel} data-flx="channel.channel-view.guild-channel-view.search-panel--2">
- <ChannelSearchResults
- channel={channel}
- searchQuery={activeSearchQuery}
- searchSegments={activeSearchSegments}
- refreshKey={searchRefreshKey}
- onClose={() => searchState.setIsSearchActive(false)}
- data-flx="channel.channel-view.guild-channel-view.channel-search-results--2"
- />
- </div>
- ) : shouldRenderMemberList ? (
- isThreadChannel ? (
- <ThreadMembersPanel
- thread={channel}
- data-flx="channel.channel-view.guild-channel-view.thread-members-panel"
- />
- ) : (
- <ChannelMembers
- channel={channel}
- guild={guild}
- data-flx="channel.channel-view.guild-channel-view.channel-members"
- />
- )
- ) : null
- }
+ sidePanel={sidePanel}
showMemberListDivider={shouldRenderMemberList && !isSearchActive}
data-flx="channel.channel-view.guild-channel-view.channel-view-scaffold"
/>
diff --git a/fluxer_app/src/features/channel/components/channel_view/useCallHeaderState.ts b/fluxer_app/src/features/channel/components/channel_view/useCallHeaderState.ts
index 5572c7401..37f0299f3 100644
--- a/fluxer_app/src/features/channel/components/channel_view/useCallHeaderState.ts
+++ b/fluxer_app/src/features/channel/components/channel_view/useCallHeaderState.ts
@@ -41,17 +41,20 @@ export function useCallHeaderState(channel?: Channel | null): CallHeaderState {
const isDeviceInRoomForChannelCall = Boolean(matchesConnectionContext && MediaEngine.room);
const isDeviceConnectingToChannelCall =
matchesConnectionContext && (MediaEngine.connecting || (MediaEngine.connected && !isDeviceInRoomForChannelCall));
- const controlsVariant: CallHeaderControlsVariant = !callExistsAndOngoing
- ? 'hidden'
- : isDeviceInRoomForChannelCall
- ? 'inCall'
- : isRingingForCurrentUserOnThisDevice
- ? 'incoming'
- : isDeviceConnectingToChannelCall
- ? 'connecting'
- : isCurrentUserParticipantInCall
- ? 'inCall'
- : 'join';
+ let controlsVariant: CallHeaderControlsVariant;
+ if (!callExistsAndOngoing) {
+ controlsVariant = 'hidden';
+ } else if (isDeviceInRoomForChannelCall) {
+ controlsVariant = 'inCall';
+ } else if (isRingingForCurrentUserOnThisDevice) {
+ controlsVariant = 'incoming';
+ } else if (isDeviceConnectingToChannelCall) {
+ controlsVariant = 'connecting';
+ } else if (isCurrentUserParticipantInCall) {
+ controlsVariant = 'inCall';
+ } else {
+ controlsVariant = 'join';
+ }
return {
call,
callExistsAndOngoing,