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 channel header presentation

Hampus186d14902791
diff --git a/fluxer_app/src/features/channel/components/ChannelHeader.module.css b/fluxer_app/src/features/channel/components/ChannelHeader.module.css
index 3d10b0b94..1bde2f05a 100644
--- a/fluxer_app/src/features/channel/components/ChannelHeader.module.css
+++ b/fluxer_app/src/features/channel/components/ChannelHeader.module.css
@@ -51,9 +51,9 @@
content: '';
position: absolute;
top: 0;
- right: 0;
+ inset-inline-end: 0;
bottom: -4.5rem;
- left: 0;
+ inset-inline-start: 0;
background: var(
--voice-header-gradient,
linear-gradient(to bottom, rgb(0 0 0 / 0.96) 0%, rgb(0 0 0 / 0.86) 42%, rgb(0 0 0 / 0.58) 72%, transparent 100%)
@@ -62,20 +62,6 @@
z-index: -1;
}
-@keyframes callBannerRing {
- 0% {
- transform: scale(0.9);
- opacity: 0.7;
- }
- 70% {
- transform: scale(1.15);
- opacity: 0;
- }
- 100% {
- opacity: 0;
- }
-}
-
@media (max-width: 767px) {
.headerContainer {
height: var(--layout-header-height-mobile);
@@ -92,7 +78,7 @@
}
.backButton {
- margin-right: var(--channel-header-back-button-gap);
+ margin-inline-end: var(--channel-header-back-button-gap);
flex-shrink: 0;
cursor: pointer;
-webkit-app-region: no-drag;
@@ -167,7 +153,7 @@
border: none;
background-color: transparent;
padding: 0;
- text-align: left;
+ text-align: start;
cursor: pointer;
-webkit-app-region: no-drag;
}
@@ -220,7 +206,7 @@
color: var(--channel-header-text-muted);
flex-shrink: 0;
position: relative;
- margin-left: var(--spacing-2);
+ margin-inline-start: var(--spacing-2);
}
:global(:where(html.window-focused, html.unfocused-fully-interactive):not(.window-focus-activation-guard))
@@ -230,7 +216,7 @@
}
.channelName {
- margin-left: var(--channel-header-name-gap);
+ margin-inline-start: var(--channel-header-name-gap);
min-width: 0;
flex-shrink: 1;
font-weight: 500;
@@ -242,7 +228,7 @@
}
.groupDmChannelName {
- margin-left: 0;
+ margin-inline-start: 0;
}
.dmNameWrapper {
@@ -255,7 +241,7 @@
}
.userTag {
- margin-left: 0.25rem;
+ margin-inline-start: 0.25rem;
}
.channelIcon {
@@ -266,7 +252,7 @@
}
.caretRight {
- margin-left: var(--channel-header-caret-gap);
+ margin-inline-start: var(--channel-header-caret-gap);
height: var(--channel-header-caret-size);
width: var(--channel-header-caret-size);
flex-shrink: 0;
@@ -283,7 +269,7 @@
}
.followButton {
- margin-left: var(--channel-header-name-gap);
+ margin-inline-start: var(--channel-header-name-gap);
flex-shrink: 0;
}
@@ -309,11 +295,11 @@
width: auto;
min-width: 0;
max-width: 100%;
- padding-right: var(--spacing-5);
+ padding-inline-end: var(--spacing-5);
cursor: pointer;
border: none;
background: transparent;
- text-align: left;
+ text-align: start;
font-size: 0.8125rem !important;
line-height: 1.125rem !important;
max-height: 1.125rem;
@@ -490,6 +476,6 @@
.unreadPinIndicator {
position: absolute;
bottom: 0.3rem;
- right: 0.35rem;
+ inset-inline-end: 0.35rem;
box-shadow: 0 0 0 0.08rem var(--channel-header-background);
}
diff --git a/fluxer_app/src/features/channel/components/ChannelHeader.tsx b/fluxer_app/src/features/channel/components/ChannelHeader.tsx
index 8d2bd9dc1..475de2d5b 100644
--- a/fluxer_app/src/features/channel/components/ChannelHeader.tsx
+++ b/fluxer_app/src/features/channel/components/ChannelHeader.tsx
@@ -13,6 +13,7 @@ import {
measureSkeletonWidthPx,
useSkeletonLayoutReport,
} from '@app/features/app/hooks/useSkeletonLayoutMemoryCapture';
+import RuntimeConfig from '@app/features/app/state/RuntimeConfig';
import {ChannelDetailsBottomSheet} from '@app/features/channel/components/bottomsheets/ChannelDetailsBottomSheet';
import {ChannelSearchBottomSheet} from '@app/features/channel/components/bottomsheets/ChannelSearchBottomSheet';
import styles from '@app/features/channel/components/ChannelHeader.module.css';
@@ -58,6 +59,7 @@ import {EditGroupModal} from '@app/features/channel/components/modals/EditGroupM
import type {Channel} from '@app/features/channel/models/Channel';
import * as ChannelUtils from '@app/features/channel/utils/ChannelUtils';
import {isGroupDmFull} from '@app/features/channel/utils/GroupDmUtils';
+import Guilds from '@app/features/guild/state/Guilds';
import {
ADD_TO_FAVORITES_DESCRIPTOR,
BACK_DESCRIPTOR,
@@ -100,6 +102,7 @@ import * as ToastCommands from '@app/features/ui/commands/ToastCommands';
import {StatusAwareAvatar} from '@app/features/ui/components/StatusAwareAvatar';
import FocusRing from '@app/features/ui/focus_ring/FocusRing';
import {useTextOverflow} from '@app/features/ui/hooks/useTextOverflow';
+import {ArrowLeftIcon, CaretRightIcon} from '@app/features/ui/icons/DirectionalIcons';
import ContextMenuState, {isContextMenuNodeTarget} from '@app/features/ui/state/ContextMenu';
import MobileLayout from '@app/features/ui/state/MobileLayout';
import PopoutState from '@app/features/ui/state/Popout';
@@ -116,8 +119,6 @@ import {ChannelTypes} from '@fluxer/constants/src/ChannelConstants';
import {RelationshipTypes} from '@fluxer/constants/src/UserConstants';
import {useLingui} from '@lingui/react/macro';
import {
- ArrowLeftIcon,
- CaretRightIcon,
EyeSlashIcon,
ListIcon,
MagnifyingGlassIcon,
@@ -246,12 +247,15 @@ export const ChannelHeader = observer(
const isGuildChannelNameOverflowing = useTextOverflow(guildChannelNameRef, {content: channelName});
const isBotDMRecipient = isDM && (recipient?.bot || recipient?.system);
const isFavorited = channel && !isPersonalNotes ? !!Favorites.getChannel(channel.id) : false;
- const channelDetailsLabel =
- isDM && directMessageName
- ? i18n._(OPEN_DIRECT_MESSAGE_DETAILS_FOR_DESCRIPTOR, {directMessageName})
- : isGroupDM && groupDMName
- ? i18n._(OPEN_GROUP_DETAILS_FOR_DESCRIPTOR, {groupDMName})
- : i18n._(OPEN_CHANNEL_DETAILS_FOR_DESCRIPTOR, {channelName});
+ const isVisitingGuild = channel?.guildId != null && Guilds.getGuild(channel.guildId)?.visiting === true;
+ let channelDetailsLabel: string;
+ if (isDM && directMessageName) {
+ channelDetailsLabel = i18n._(OPEN_DIRECT_MESSAGE_DETAILS_FOR_DESCRIPTOR, {directMessageName});
+ } else if (isGroupDM && groupDMName) {
+ channelDetailsLabel = i18n._(OPEN_GROUP_DETAILS_FOR_DESCRIPTOR, {groupDMName});
+ } else {
+ channelDetailsLabel = i18n._(OPEN_CHANNEL_DETAILS_FOR_DESCRIPTOR, {channelName});
+ }
const userProfileLabel = directMessageName
? i18n._(OPEN_PROFILE_FOR_DESCRIPTOR, {directMessageName})
: i18n._(OPEN_DIRECT_MESSAGE_PROFILE_DESCRIPTOR);
@@ -538,8 +542,11 @@ export const ChannelHeader = observer(
recipient &&
!isBotDMRecipient &&
Relationships.getRelationship(recipient.id)?.type === RelationshipTypes.FRIEND;
- const shouldShowCreateGroupButton = !!channel && !isMobile && !isPersonalNotes && isFriendDM && !isGroupDM;
- const shouldShowAddFriendsButton = !!channel && !isMobile && !isPersonalNotes && isGroupDM && !isGroupDMFull;
+ const dmPickerAvailable = RuntimeConfig.dmPickerAvailable;
+ const shouldShowCreateGroupButton =
+ dmPickerAvailable && !!channel && !isMobile && !isPersonalNotes && isFriendDM && !isGroupDM;
+ const shouldShowAddFriendsButton =
+ dmPickerAvailable && !!channel && !isMobile && !isPersonalNotes && isGroupDM && !isGroupDMFull;
const hasChannel = Boolean(channel) && !isPersonalNotes;
const hasCallableRecipients = hasChannel && (isDM || isGroupDM);
let desktopLeadingActionCount = 0;
@@ -595,6 +602,329 @@ export const ChannelHeader = observer(
},
`${channelId}|${channelType ?? ''}|${channelHasTopic}|${channel?.topic ?? ''}|${channelName}|${directMessageName}|${groupDMName}|${desktopLeadingActionCount}|${mobileActionCount}|${searchPanelOpen}|${isMembersToggleOpen}|${Accessibility.fontSize}|${Accessibility.zoomLevel}`,
);
+ const backButton = isMobile ? (
+ <FocusRing offset={-2} data-flx="channel.channel-header.focus-ring">
+ <button
+ type="button"
+ className={styles.backButton}
+ aria-label={i18n._(BACK_DESCRIPTOR)}
+ onClick={handleBackClick}
+ data-flx="channel.channel-header.back-button.back-click"
+ >
+ <ArrowLeftIcon
+ className={styles.backIconBold}
+ weight="bold"
+ data-flx="channel.channel-header.back-icon-bold"
+ />
+ </button>
+ </FocusRing>
+ ) : (
+ <FocusRing offset={-2} data-flx="channel.channel-header.focus-ring--2">
+ <button
+ type="button"
+ className={styles.backButtonDesktop}
+ aria-label={i18n._(SHOW_CHANNEL_LIST_DESCRIPTOR)}
+ onClick={handleBackClick}
+ data-flx="channel.channel-header.back-button-desktop.back-click"
+ >
+ <ListIcon className={styles.backIcon} data-flx="channel.channel-header.back-icon" />
+ </button>
+ </FocusRing>
+ );
+ let headerTitle: React.ReactNode = null;
+ if (leftContent) {
+ headerTitle = leftContent;
+ } else if (channel) {
+ if (isMobile) {
+ let mobileTitle: React.ReactNode;
+ if (isDM && recipient) {
+ mobileTitle = (
+ <>
+ <StatusAwareAvatar
+ user={recipient}
+ size={CHANNEL_HEADER_DM_AVATAR_SIZE_PX}
+ showOffline={true}
+ data-flx="channel.channel-header.status-aware-avatar"
+ />
+ <span className={styles.dmNameWrapper} data-flx="channel.channel-header.dm-name-wrapper">
+ <Tooltip
+ text={isDMNameOverflowing && directMessageName ? directMessageName : ''}
+ data-flx="channel.channel-header.tooltip"
+ >
+ <span ref={dmNameRef} className={styles.channelName} data-flx="channel.channel-header.channel-name">
+ {directMessageName}
+ </span>
+ </Tooltip>
+ {isBotDMRecipient && (
+ <UserTag
+ className={styles.userTag}
+ system={recipient.system}
+ data-flx="channel.channel-header.user-tag"
+ />
+ )}
+ </span>
+ <CaretRightIcon
+ className={styles.caretRight}
+ weight="bold"
+ data-flx="channel.channel-header.caret-right"
+ />
+ </>
+ );
+ } else if (isGroupDM) {
+ mobileTitle = (
+ <>
+ <GroupDMAvatar
+ channel={channel}
+ size={CHANNEL_HEADER_DM_AVATAR_SIZE_PX}
+ data-flx="channel.channel-header.group-dm-avatar"
+ />
+ <Tooltip
+ text={isGroupDMNameOverflowing && groupDMName ? groupDMName : ''}
+ data-flx="channel.channel-header.tooltip--2"
+ >
+ <span
+ ref={groupDMNameRef}
+ className={styles.channelName}
+ data-flx="channel.channel-header.channel-name--2"
+ >
+ {groupDMName}
+ </span>
+ </Tooltip>
+ <CaretRightIcon
+ className={styles.caretRight}
+ weight="bold"
+ data-flx="channel.channel-header.caret-right--2"
+ />
+ </>
+ );
+ } else {
+ mobileTitle = (
+ <>
+ {ChannelUtils.getIcon(channel, {className: styles.channelIcon}, e2eeIconOptions)}
+ <Tooltip
+ text={isGuildChannelNameOverflowing && channelName ? channelName : ''}
+ data-flx="channel.channel-header.tooltip--3"
+ >
+ <span
+ ref={guildChannelNameRef}
+ className={styles.channelName}
+ data-flx="channel.channel-header.channel-name--3"
+ >
+ {channelName}
+ </span>
+ </Tooltip>
+ <CaretRightIcon
+ className={styles.caretRight}
+ weight="bold"
+ data-flx="channel.channel-header.caret-right--3"
+ />
+ </>
+ );
+ }
+ headerTitle = (
+ <FocusRing offset={-2} data-flx="channel.channel-header.focus-ring--3">
+ <button
+ type="button"
+ className={styles.mobileButton}
+ aria-label={channelDetailsLabel}
+ aria-haspopup="dialog"
+ onClick={handleChannelDetailsClick}
+ data-flx="channel.channel-header.mobile-button.channel-details-click"
+ >
+ {mobileTitle}
+ </button>
+ </FocusRing>
+ );
+ } else if (isDM && recipient) {
+ headerTitle = (
+ <FocusRing offset={-2} data-flx="channel.channel-header.focus-ring--4">
+ <button
+ type="button"
+ className={styles.desktopButton}
+ aria-label={userProfileLabel}
+ onClick={handleOpenUserProfile}
+ onContextMenu={handleUserContextMenu}
+ data-flx="channel.channel-header.desktop-button.open-user-profile"
+ >
+ <StatusAwareAvatar
+ user={recipient}
+ size={CHANNEL_HEADER_DM_AVATAR_SIZE_PX}
+ showOffline={true}
+ data-flx="channel.channel-header.status-aware-avatar--2"
+ />
+ <span className={styles.dmNameWrapper} data-flx="channel.channel-header.dm-name-wrapper--2">
+ <Tooltip
+ text={isDMNameOverflowing ? directMessageName : ''}
+ data-flx="channel.channel-header.tooltip--4"
+ >
+ <span
+ ref={dmNameRef}
+ className={styles.channelName}
+ data-flx="channel.channel-header.channel-name--4"
+ >
+ {directMessageName}
+ </span>
+ </Tooltip>
+ {isBotDMRecipient && (
+ <UserTag
+ className={styles.userTag}
+ system={recipient.system}
+ data-flx="channel.channel-header.user-tag--2"
+ />
+ )}
+ </span>
+ </button>
+ </FocusRing>
+ );
+ } else if (isGroupDM) {
+ headerTitle = (
+ <FocusRing offset={-2} data-flx="channel.channel-header.focus-ring--5">
+ <div
+ className={styles.groupDmHeaderTrigger}
+ role="button"
+ aria-label={i18n._(EDIT_GROUP_DETAILS_DESCRIPTOR)}
+ tabIndex={0}
+ onClick={handleOpenEditGroup}
+ onContextMenu={handleUserContextMenu}
+ onKeyDown={(event) => {
+ if (isKeyboardActivationKey(event.key)) {
+ event.preventDefault();
+ handleOpenEditGroup();
+ }
+ }}
+ data-flx="channel.channel-header.group-dm-header-trigger.open-edit-group"
+ >
+ <div className={styles.groupDmHeaderInner} data-flx="channel.channel-header.group-dm-header-inner">
+ <GroupDMAvatar
+ channel={channel}
+ size={CHANNEL_HEADER_DM_AVATAR_SIZE_PX}
+ data-flx="channel.channel-header.group-dm-avatar--3"
+ />
+ <div className={styles.dmNameWrapper} data-flx="channel.channel-header.dm-name-wrapper--3">
+ <Tooltip
+ text={isGroupDMNameOverflowing && groupDMName ? groupDMName : ''}
+ data-flx="channel.channel-header.tooltip--6"
+ >
+ <span
+ ref={groupDMNameRef}
+ className={clsx(styles.channelName, styles.groupDmChannelName)}
+ data-flx="channel.channel-header.channel-name--6"
+ >
+ {groupDMName}
+ </span>
+ </Tooltip>
+ </div>
+ </div>
+ <PencilIcon
+ className={styles.groupDmEditIcon}
+ size={16}
+ weight="bold"
+ data-flx="channel.channel-header.group-dm-edit-icon"
+ />
+ </div>
+ </FocusRing>
+ );
+ } else if (isPersonalNotes) {
+ headerTitle = (
+ <div className={styles.avatarWrapper} data-flx="channel.channel-header.avatar-wrapper--2">
+ {ChannelUtils.getIcon(channel, {className: styles.channelIcon}, e2eeIconOptions)}
+ <Tooltip
+ text={isGuildChannelNameOverflowing && channelName ? channelName : ''}
+ data-flx="channel.channel-header.tooltip--7"
+ >
+ <span
+ ref={guildChannelNameRef}
+ className={styles.channelName}
+ data-flx="channel.channel-header.channel-name--7"
+ >
+ {channelName}
+ </span>
+ </Tooltip>
+ </div>
+ );
+ } else {
+ headerTitle = (
+ <div
+ role="group"
+ className={styles.channelInfoContainer}
+ onContextMenu={handleContextMenu}
+ data-flx="channel.channel-header.channel-info-container.context-menu"
+ >
+ {channel.isThread() && (
+ <ThreadParentCrumb
+ thread={channel}
+ iconClassName={styles.channelIcon}
+ data-flx="channel.channel-header.thread-parent-crumb"
+ />
+ )}
+ {ChannelUtils.getIcon(channel, {className: styles.channelIcon}, e2eeIconOptions)}
+ <Tooltip
+ text={isGuildChannelNameOverflowing && channelName ? channelName : ''}
+ data-flx="channel.channel-header.tooltip--8"
+ >
+ <span
+ ref={guildChannelNameRef}
+ className={styles.channelName}
+ data-flx="channel.channel-header.channel-name--8"
+ >
+ {channelName}
+ </span>
+ </Tooltip>
+ {!isMobile && (
+ <ChannelFollowButton
+ channel={channel}
+ className={styles.followButton}
+ data-flx="channel.channel-header.channel-follow-button"
+ />
+ )}
+ {channel.topic && (
+ <>
+ <span className={styles.topicDivider} data-flx="channel.channel-header.topic-divider">
+ •
+ </span>
+ <div className={styles.topicContainer} data-flx="channel.channel-header.topic-container">
+ <FocusRing offset={-2} data-flx="channel.channel-header.focus-ring--6">
+ <div
+ role="button"
+ ref={topicButtonRef}
+ className={clsx(
+ markupStyles.markup,
+ styles.topicButton,
+ isTopicOverflowing && styles.topicButtonOverflow,
+ )}
+ onClick={handleOpenChannelTopic}
+ onKeyDown={(e) => {
+ if (!isKeyboardActivationKey(e.key)) return;
+ e.preventDefault();
+ handleOpenChannelTopic();
+ }}
+ tabIndex={0}
+ data-flx="channel.channel-header.topic-button.push"
+ >
+ <SafeMarkdown
+ content={channel.topic}
+ options={{
+ context: MarkdownContext.RESTRICTED_INLINE_REPLY,
+ disableInteractions: true,
+ channelId: channel.id,
+ }}
+ data-flx="channel.channel-header.safe-markdown"
+ />
+ </div>
+ </FocusRing>
+ </div>
+ </>
+ )}
+ </div>
+ );
+ }
+ }
+ let memberListDescriptor = SHOW_MEMBERS_DESCRIPTOR;
+ if (!canFitMemberList) {
+ memberListDescriptor = MEMBERS_LIST_UNAVAILABLE_AT_THIS_SCREEN_WIDTH_DESCRIPTOR;
+ } else if (isMembersToggleOpen) {
+ memberListDescriptor = HIDE_MEMBERS_DESCRIPTOR;
+ }
return (
<>
<header
@@ -612,334 +942,9 @@ export const ChannelHeader = observer(
data-flx="channel.channel-header.header-container"
>
<div className={styles.headerLeftSection} data-flx="channel.channel-header.header-left-section">
- {isMobile ? (
- <FocusRing offset={-2} data-flx="channel.channel-header.focus-ring">
- <button
- type="button"
- className={styles.backButton}
- aria-label={i18n._(BACK_DESCRIPTOR)}
- onClick={handleBackClick}
- data-flx="channel.channel-header.back-button.back-click"
- >
- <ArrowLeftIcon
- className={styles.backIconBold}
- weight="bold"
- data-flx="channel.channel-header.back-icon-bold"
- />
- </button>
- </FocusRing>
- ) : (
- <FocusRing offset={-2} data-flx="channel.channel-header.focus-ring--2">
- <button
- type="button"
- className={styles.backButtonDesktop}
- aria-label={i18n._(SHOW_CHANNEL_LIST_DESCRIPTOR)}
- onClick={handleBackClick}
- data-flx="channel.channel-header.back-button-desktop.back-click"
- >
- <ListIcon className={styles.backIcon} data-flx="channel.channel-header.back-icon" />
- </button>
- </FocusRing>
- )}
+ {backButton}
<div className={styles.leftContentContainer} data-flx="channel.channel-header.left-content-container">
- {leftContent ? (
- leftContent
- ) : channel ? (
- isMobile ? (
- <FocusRing offset={-2} data-flx="channel.channel-header.focus-ring--3">
- <button
- type="button"
- className={styles.mobileButton}
- aria-label={channelDetailsLabel}
- aria-haspopup="dialog"
- onClick={handleChannelDetailsClick}
- data-flx="channel.channel-header.mobile-button.channel-details-click"
- >
- {isDM && recipient ? (
- <>
- <StatusAwareAvatar
- user={recipient}
- size={CHANNEL_HEADER_DM_AVATAR_SIZE_PX}
- showOffline={true}
- data-flx="channel.channel-header.status-aware-avatar"
- />
- <span className={styles.dmNameWrapper} data-flx="channel.channel-header.dm-name-wrapper">
- <Tooltip
- text={isDMNameOverflowing && directMessageName ? directMessageName : ''}
- data-flx="channel.channel-header.tooltip"
- >
- <span
- ref={dmNameRef}
- className={styles.channelName}
- data-flx="channel.channel-header.channel-name"
- >
- {directMessageName}
- </span>
- </Tooltip>
- {isBotDMRecipient && (
- <UserTag
- className={styles.userTag}
- system={recipient.system}
- data-flx="channel.channel-header.user-tag"
- />
- )}
- </span>
- <CaretRightIcon
- className={styles.caretRight}
- weight="bold"
- data-flx="channel.channel-header.caret-right"
- />
- </>
- ) : isGroupDM ? (
- <>
- <GroupDMAvatar
- channel={channel}
- size={CHANNEL_HEADER_DM_AVATAR_SIZE_PX}
- data-flx="channel.channel-header.group-dm-avatar"
- />
- <Tooltip
- text={isGroupDMNameOverflowing && groupDMName ? groupDMName : ''}
- data-flx="channel.channel-header.tooltip--2"
- >
- <span
- ref={groupDMNameRef}
- className={styles.channelName}
- data-flx="channel.channel-header.channel-name--2"
- >
- {groupDMName}
- </span>
- </Tooltip>
- <CaretRightIcon
- className={styles.caretRight}
- weight="bold"
- data-flx="channel.channel-header.caret-right--2"
- />
- </>
- ) : (
- <>
- {ChannelUtils.getIcon(channel, {className: styles.channelIcon}, e2eeIconOptions)}
- <Tooltip
- text={isGuildChannelNameOverflowing && channelName ? channelName : ''}
- data-flx="channel.channel-header.tooltip--3"
- >
- <span
- ref={guildChannelNameRef}
- className={styles.channelName}
- data-flx="channel.channel-header.channel-name--3"
- >
- {channelName}
- </span>
- </Tooltip>
- <CaretRightIcon
- className={styles.caretRight}
- weight="bold"
- data-flx="channel.channel-header.caret-right--3"
- />
- </>
- )}
- </button>
- </FocusRing>
- ) : isDM && recipient ? (
- <FocusRing offset={-2} data-flx="channel.channel-header.focus-ring--4">
- <button
- type="button"
- className={styles.desktopButton}
- aria-label={userProfileLabel}
- onClick={handleOpenUserProfile}
- onContextMenu={handleUserContextMenu}
- data-flx="channel.channel-header.desktop-button.open-user-profile"
- >
- <StatusAwareAvatar
- user={recipient}
- size={CHANNEL_HEADER_DM_AVATAR_SIZE_PX}
- showOffline={true}
- data-flx="channel.channel-header.status-aware-avatar--2"
- />
- <span className={styles.dmNameWrapper} data-flx="channel.channel-header.dm-name-wrapper--2">
- <Tooltip
- text={isDMNameOverflowing ? directMessageName : ''}
- data-flx="channel.channel-header.tooltip--4"
- >
- <span
- ref={dmNameRef}
- className={styles.channelName}
- data-flx="channel.channel-header.channel-name--4"
- >
- {directMessageName}
- </span>
- </Tooltip>
- {isBotDMRecipient && (
- <UserTag
- className={styles.userTag}
- system={recipient.system}
- data-flx="channel.channel-header.user-tag--2"
- />
- )}
- </span>
- </button>
- </FocusRing>
- ) : isGroupDM ? (
- isMobile ? (
- <div className={styles.avatarWrapper} data-flx="channel.channel-header.avatar-wrapper">
- <GroupDMAvatar
- channel={channel}
- size={CHANNEL_HEADER_DM_AVATAR_SIZE_PX}
- data-flx="channel.channel-header.group-dm-avatar--2"
- />
- <Tooltip
- text={isGroupDMNameOverflowing && groupDMName ? groupDMName : ''}
- data-flx="channel.channel-header.tooltip--5"
- >
- <span
- ref={groupDMNameRef}
- className={styles.channelName}
- data-flx="channel.channel-header.channel-name--5"
- >
- {groupDMName}
- </span>
- </Tooltip>
- </div>
- ) : (
- <FocusRing offset={-2} data-flx="channel.channel-header.focus-ring--5">
- <div
- className={styles.groupDmHeaderTrigger}
- role="button"
- aria-label={i18n._(EDIT_GROUP_DETAILS_DESCRIPTOR)}
- tabIndex={0}
- onClick={handleOpenEditGroup}
- onContextMenu={handleUserContextMenu}
- onKeyDown={(event) => {
- if (isKeyboardActivationKey(event.key)) {
- event.preventDefault();
- handleOpenEditGroup();
- }
- }}
- data-flx="channel.channel-header.group-dm-header-trigger.open-edit-group"
- >
- <div
- className={styles.groupDmHeaderInner}
- data-flx="channel.channel-header.group-dm-header-inner"
- >
- <GroupDMAvatar
- channel={channel}
- size={CHANNEL_HEADER_DM_AVATAR_SIZE_PX}
- data-flx="channel.channel-header.group-dm-avatar--3"
- />
- <div className={styles.dmNameWrapper} data-flx="channel.channel-header.dm-name-wrapper--3">
- <Tooltip
- text={isGroupDMNameOverflowing && groupDMName ? groupDMName : ''}
- data-flx="channel.channel-header.tooltip--6"
- >
- <span
- ref={groupDMNameRef}
- className={clsx(styles.channelName, styles.groupDmChannelName)}
- data-flx="channel.channel-header.channel-name--6"
- >
- {groupDMName}
- </span>
- </Tooltip>
- </div>
- </div>
- <PencilIcon
- className={styles.groupDmEditIcon}
- size={16}
- weight="bold"
- data-flx="channel.channel-header.group-dm-edit-icon"
- />
- </div>
- </FocusRing>
- )
- ) : isPersonalNotes ? (
- <div className={styles.avatarWrapper} data-flx="channel.channel-header.avatar-wrapper--2">
- {ChannelUtils.getIcon(channel, {className: styles.channelIcon}, e2eeIconOptions)}
- <Tooltip
- text={isGuildChannelNameOverflowing && channelName ? channelName : ''}
- data-flx="channel.channel-header.tooltip--7"
- >
- <span
- ref={guildChannelNameRef}
- className={styles.channelName}
- data-flx="channel.channel-header.channel-name--7"
- >
- {channelName}
- </span>
- </Tooltip>
- </div>
- ) : (
- <div
- role="group"
- className={styles.channelInfoContainer}
- onContextMenu={handleContextMenu}
- data-flx="channel.channel-header.channel-info-container.context-menu"
- >
- {channel.isThread() && (
- <ThreadParentCrumb
- thread={channel}
- iconClassName={styles.channelIcon}
- data-flx="channel.channel-header.thread-parent-crumb"
- />
- )}
- {ChannelUtils.getIcon(channel, {className: styles.channelIcon}, e2eeIconOptions)}
- <Tooltip
- text={isGuildChannelNameOverflowing && channelName ? channelName : ''}
- data-flx="channel.channel-header.tooltip--8"
- >
- <span
- ref={guildChannelNameRef}
- className={styles.channelName}
- data-flx="channel.channel-header.channel-name--8"
- >
- {channelName}
- </span>
- </Tooltip>
- {!isMobile && (
- <ChannelFollowButton
- channel={channel}
- className={styles.followButton}
- data-flx="channel.channel-header.channel-follow-button"
- />
- )}
- {channel.topic && (
- <>
- <span className={styles.topicDivider} data-flx="channel.channel-header.topic-divider">
- •
- </span>
- <div className={styles.topicContainer} data-flx="channel.channel-header.topic-container">
- <FocusRing offset={-2} data-flx="channel.channel-header.focus-ring--6">
- <div
- role="button"
- ref={topicButtonRef}
- className={clsx(
- markupStyles.markup,
- styles.topicButton,
- isTopicOverflowing && styles.topicButtonOverflow,
- )}
- onClick={handleOpenChannelTopic}
- onKeyDown={(e) => {
- if (!isKeyboardActivationKey(e.key)) return;
- e.preventDefault();
- handleOpenChannelTopic();
- }}
- tabIndex={0}
- data-flx="channel.channel-header.topic-button.push"
- >
- <SafeMarkdown
- content={channel.topic}
- options={{
- context: MarkdownContext.RESTRICTED_INLINE_REPLY,
- disableInteractions: true,
- channelId: channel.id,
- }}
- data-flx="channel.channel-header.safe-markdown"
- />
- </div>
- </FocusRing>
- </div>
- </>
- )}
- </div>
- )
- ) : null}
+ {headerTitle}
</div>
</div>
<div
@@ -1034,13 +1039,18 @@ export const ChannelHeader = observer(
</button>
</FocusRing>
)}
- {channel && isGuildChannel && !isMobile && !isPersonalNotes && !channel.isThread() && (
- <ChannelNotificationSettingsButton
- channel={channel}
- data-flx="channel.channel-header.channel-notification-settings-button"
- />
- )}
- {channel && !isMobile && channel.isThread() && (
+ {channel &&
+ isGuildChannel &&
+ !isMobile &&
+ !isPersonalNotes &&
+ !channel.isThread() &&
+ !isVisitingGuild && (
+ <ChannelNotificationSettingsButton
+ channel={channel}
+ data-flx="channel.channel-header.channel-notification-settings-button"
+ />
+ )}
+ {channel && !isMobile && channel.isThread() && !isVisitingGuild && (
<ThreadNotificationSettingsButton
thread={channel}
data-flx="channel.channel-header.thread-notification-settings-button"
@@ -1110,13 +1120,7 @@ export const ChannelHeader = observer(
<ChannelHeaderIcon
icon={UsersIcon}
isSelected={isMembersToggleOpen}
- label={
- !canFitMemberList
- ? i18n._(MEMBERS_LIST_UNAVAILABLE_AT_THIS_SCREEN_WIDTH_DESCRIPTOR)
- : isMembersToggleOpen
- ? i18n._(HIDE_MEMBERS_DESCRIPTOR)
- : i18n._(SHOW_MEMBERS_DESCRIPTOR)
- }
+ label={i18n._(memberListDescriptor)}
onClick={handleToggleMembers}
disabled={!canFitMemberList}
aria-pressed={isMembersToggleOpen}
@@ -1124,7 +1128,7 @@ export const ChannelHeader = observer(
data-flx="channel.channel-header.channel-header-icon.toggle-members"
/>
)}
- {!isMobile && channel && !channel.isThreadOnly() && (
+ {!isMobile && channel && !channel.isThreadOnly() && !isVisitingGuild && (
<FocusRing offset={-2} within data-flx="channel.channel-header.focus-ring--12">
<div
className={styles.messageSearchFocusWrapper}