signal-desktop/ts/components/conversation/SignalConversationMuteToggle.tsx
automated-signal d93f488cbb
Release Note Channel: Mute/Unmute UI, hide UI elements
Co-authored-by: yash-signal <yash@signal.org>
2025-02-07 09:47:11 -06:00

34 lines
877 B
TypeScript

// Copyright 2025 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import type { LocalizerType } from '../../types/I18N';
type Props = {
isMuted: boolean;
i18n: LocalizerType;
setMuteExpiration: (conversationId: string, muteExpiresAt: number) => unknown;
conversationId: string;
};
export function SignalConversationMuteToggle({
isMuted,
i18n,
setMuteExpiration,
conversationId,
}: Props): JSX.Element {
const onMuteToggleClicked = () => {
setMuteExpiration(conversationId, isMuted ? 0 : Number.MAX_SAFE_INTEGER);
};
return (
<div className="SignalConversationMuteToggle">
<button
onClick={onMuteToggleClicked}
type="button"
className="SignalConversationMuteToggle__text"
>
{isMuted ? i18n('icu:unmute') : i18n('icu:mute')}
</button>
</div>
);
}