Disable header more menu in select mode

This commit is contained in:
Jamie Kyle 2024-01-04 12:15:46 -08:00 committed by GitHub
parent 0aad09682d
commit 66f97b1c25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 25 deletions

View file

@ -162,12 +162,14 @@
&:disabled { &:disabled {
cursor: default; cursor: default;
opacity: 0.5;
} }
&--show-disabled { &--show-disabled {
opacity: 0.5; opacity: 0.5;
} }
&:not(:disabled) {
@include light-theme { @include light-theme {
&:hover, &:hover,
&:focus { &:focus {
@ -197,6 +199,7 @@
border-color: $color-ultramarine-light; border-color: $color-ultramarine-light;
} }
} }
}
@mixin normal-button($icon, $size) { @mixin normal-button($icon, $size) {
&::before { &::before {

View file

@ -35,6 +35,7 @@ const commonProps = {
cannotLeaveBecauseYouAreLastAdmin: false, cannotLeaveBecauseYouAreLastAdmin: false,
showBackButton: false, showBackButton: false,
outgoingCallButtonStyle: OutgoingCallButtonStyle.Both, outgoingCallButtonStyle: OutgoingCallButtonStyle.Both,
isSelectMode: false,
i18n, i18n,

View file

@ -57,6 +57,7 @@ export type PropsDataType = {
isMissingMandatoryProfileSharing?: boolean; isMissingMandatoryProfileSharing?: boolean;
outgoingCallButtonStyle: OutgoingCallButtonStyle; outgoingCallButtonStyle: OutgoingCallButtonStyle;
isSMSOnly?: boolean; isSMSOnly?: boolean;
isSelectMode: boolean;
isSignalConversation?: boolean; isSignalConversation?: boolean;
theme: ThemeType; theme: ThemeType;
} & Pick< } & Pick<
@ -287,10 +288,14 @@ export class ConversationHeader extends React.Component<PropsType, StateType> {
} }
private renderMoreButton(triggerId: string): ReactNode { private renderMoreButton(triggerId: string): ReactNode {
const { i18n } = this.props; const { i18n, isSelectMode } = this.props;
return ( return (
<ContextMenuTrigger id={triggerId} ref={this.menuTriggerRef}> <ContextMenuTrigger
id={triggerId}
ref={this.menuTriggerRef}
disable={isSelectMode}
>
<button <button
type="button" type="button"
onClick={this.showMenuBound} onClick={this.showMenuBound}
@ -299,6 +304,7 @@ export class ConversationHeader extends React.Component<PropsType, StateType> {
'module-ConversationHeader__button--more' 'module-ConversationHeader__button--more'
)} )}
aria-label={i18n('icu:moreInfo')} aria-label={i18n('icu:moreInfo')}
disabled={isSelectMode}
/> />
</ContextMenuTrigger> </ContextMenuTrigger>
); );
@ -339,6 +345,7 @@ export class ConversationHeader extends React.Component<PropsType, StateType> {
onArchive, onArchive,
onMarkUnread, onMarkUnread,
toggleSelectMode, toggleSelectMode,
isSelectMode,
onMoveToInbox, onMoveToInbox,
pushPanelForConversation, pushPanelForConversation,
setDisappearingMessages, setDisappearingMessages,
@ -346,6 +353,11 @@ export class ConversationHeader extends React.Component<PropsType, StateType> {
setPinned, setPinned,
type, type,
} = this.props; } = this.props;
if (isSelectMode) {
return null;
}
const isRTL = i18n.getLocaleDirection() === 'rtl'; const isRTL = i18n.getLocaleDirection() === 'rtl';
const muteOptions = getMuteOptions(muteExpiresAt, i18n); const muteOptions = getMuteOptions(muteExpiresAt, i18n);

View file

@ -15,6 +15,7 @@ import {
getConversationByServiceIdSelector, getConversationByServiceIdSelector,
getConversationSelector, getConversationSelector,
getHasPanelOpen, getHasPanelOpen,
getSelectedMessageIds,
isMissingRequiredProfileSharing, isMissingRequiredProfileSharing,
} from '../selectors/conversations'; } from '../selectors/conversations';
import { CallMode } from '../../types/Calling'; import { CallMode } from '../../types/Calling';
@ -123,6 +124,9 @@ export function SmartConversationHeader({ id }: OwnProps): JSX.Element {
const cannotLeaveBecauseYouAreLastAdmin = const cannotLeaveBecauseYouAreLastAdmin =
getCannotLeaveBecauseYouAreLastAdmin(groupMemberships.memberships, isAdmin); getCannotLeaveBecauseYouAreLastAdmin(groupMemberships.memberships, isAdmin);
const selectedMessageIds = useSelector(getSelectedMessageIds);
const isSelectMode = selectedMessageIds != null;
return ( return (
<ConversationHeader <ConversationHeader
{...pick(conversation, [ {...pick(conversation, [
@ -175,6 +179,7 @@ export function SmartConversationHeader({ id }: OwnProps): JSX.Element {
setMuteExpiration={setMuteExpiration} setMuteExpiration={setMuteExpiration}
setPinned={setPinned} setPinned={setPinned}
theme={theme} theme={theme}
isSelectMode={isSelectMode}
toggleSelectMode={toggleSelectMode} toggleSelectMode={toggleSelectMode}
viewUserStories={viewUserStories} viewUserStories={viewUserStories}
/> />