Skip to content

Commit 1c3efd2

Browse files
committed
fix: unmute actions
1 parent 36cbd03 commit 1c3efd2

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

package/src/components/ChannelList/hooks/useChannelActionItems.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { useIsDirectChat } from './useIsDirectChat';
1212

1313
import { useTheme, useTranslationContext } from '../../../contexts';
1414
import type { TranslationContextValue } from '../../../contexts/translationContext/TranslationContext';
15-
import { Archive, IconProps, Mute, BlockUser, Delete } from '../../../icons';
15+
import { Archive, IconProps, Mute, BlockUser, Delete, Sound } from '../../../icons';
1616
import { ArrowBoxLeft } from '../../../icons/ArrowBoxLeft';
1717

1818
export type ChannelActionHandler = () => Promise<void> | void;
@@ -92,15 +92,18 @@ export const buildDefaultChannelActionItems: BuildDefaultChannelActionItems = (
9292
: muteActive
9393
? unmuteChannel
9494
: muteChannel,
95-
Icon: (props) => (
96-
<Mute
97-
width={20}
98-
height={20}
99-
{...props}
100-
stroke={undefined}
101-
fill={props.fill ?? props.stroke}
102-
/>
103-
),
95+
Icon: (props) =>
96+
muteActive ? (
97+
<Sound width={20} height={20} {...props} />
98+
) : (
99+
<Mute
100+
width={20}
101+
height={20}
102+
{...props}
103+
stroke={undefined}
104+
fill={props.fill ?? props.stroke}
105+
/>
106+
),
104107
id: 'mute',
105108
label: isDirectChat
106109
? muteActive

package/src/components/ChannelPreview/ChannelSwipableWrapper.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ import type { ChannelDetailsBottomSheetProps } from './ChannelDetailsBottomSheet
1010

1111
import { useTheme } from '../../contexts';
1212
import { useSwipeRegistryContext } from '../../contexts/swipeableContext/SwipeRegistryContext';
13-
import { Archive, MenuPointHorizontal, Mute } from '../../icons';
13+
import { Archive, MenuPointHorizontal, Mute, Sound } from '../../icons';
1414
import { GetChannelActionItems } from '../ChannelList/hooks/useChannelActionItems';
1515
import { useChannelActionItems } from '../ChannelList/hooks/useChannelActionItems';
1616
import { useChannelActionItemsById } from '../ChannelList/hooks/useChannelActionItemsById';
17+
import { useChannelMuteActive } from '../ChannelList/hooks/useChannelMuteActive';
1718
import { useIsDirectChat } from '../ChannelList/hooks/useIsDirectChat';
1819
import {
1920
BottomSheetModal,
@@ -53,15 +54,18 @@ export const ChannelSwipableWrapper = ({
5354
const styles = useStyles();
5455

5556
const isDirectChannel = useIsDirectChat(channel);
57+
const muteActive = useChannelMuteActive(channel);
5658

5759
const Icon = useCallback(
5860
() =>
5961
isDirectChannel ? (
6062
<Archive width={20} height={20} stroke={semantics.textOnAccent} />
63+
) : muteActive ? (
64+
<Sound width={20} height={20} stroke={semantics.textOnAccent} />
6165
) : (
6266
<Mute width={20} height={20} fill={semantics.textOnAccent} />
6367
),
64-
[isDirectChannel, semantics.textOnAccent],
68+
[isDirectChannel, muteActive, semantics.textOnAccent],
6569
);
6670

6771
const swipableActions = useMemo<SwipableActionItem[]>(() => {

package/src/components/Message/hooks/useMessageActions.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
Mute,
2626
Pin,
2727
Resend,
28+
Sound,
2829
ThreadReply,
2930
Unpin,
3031
UnreadIndicator,
@@ -338,7 +339,11 @@ export const useMessageActions = ({
338339
const muteUser: MessageActionType = {
339340
action: onMuteUser,
340341
actionType: 'muteUser',
341-
icon: <Mute fill={semantics.textSecondary} height={20} width={20} />,
342+
icon: isMuted ? (
343+
<Sound height={20} stroke={semantics.textSecondary} width={20} />
344+
) : (
345+
<Mute fill={semantics.textSecondary} height={20} width={20} />
346+
),
342347
title: isMuted ? t('Unmute User') : t('Mute User'),
343348
type: 'standard',
344349
};

0 commit comments

Comments
 (0)