This commit is contained in:
Will Hunt
2024-11-04 12:43:59 +00:00
parent d251af4e6d
commit c64c4e61d7
4 changed files with 13 additions and 17 deletions

View File

@@ -189,11 +189,13 @@ export const InCallView: FC<InCallViewProps> = ({
const reactionsIcons = useMemo( const reactionsIcons = useMemo(
() => () =>
shouldShowReactions ? Object.entries(reactions).map(([sender, { emoji }]) => ({ shouldShowReactions
sender, ? Object.entries(reactions).map(([sender, { emoji }]) => ({
emoji, sender,
startX: -Math.ceil(Math.random() * 50) - 25, emoji,
})) : [], startX: -Math.ceil(Math.random() * 50) - 25,
}))
: [],
[shouldShowReactions, reactions], [shouldShowReactions, reactions],
); );

View File

@@ -14,7 +14,9 @@ export function ReactionsAudioRenderer(): ReactNode {
const { reactions } = useReactions(); const { reactions } = useReactions();
const [shouldPlay] = useSetting(playReactionsSound); const [shouldPlay] = useSetting(playReactionsSound);
const expectedReactions = shouldPlay ? [...new Set([...Object.values(reactions)])] : []; const expectedReactions = shouldPlay
? [...new Set([...Object.values(reactions)])]
: [];
return ( return (
<> <>
{expectedReactions.map( {expectedReactions.map(

View File

@@ -23,15 +23,12 @@ export const PreferencesSettingsTab: FC = () => {
showHandRaisedTimerSetting, showHandRaisedTimerSetting,
); );
const [showReactions, setShowReactions] = useSetting( const [showReactions, setShowReactions] = useSetting(showReactionsSetting);
showReactionsSetting,
);
const [playReactionsSound, setPlayReactionSound] = useSetting( const [playReactionsSound, setPlayReactionSound] = useSetting(
playReactionsSoundSetting, playReactionsSoundSetting,
); );
const onChangeSetting = useCallback( const onChangeSetting = useCallback(
(e: ChangeEvent<HTMLInputElement>, fn: (value: boolean) => void) => { (e: ChangeEvent<HTMLInputElement>, fn: (value: boolean) => void) => {
fn(e.target.checked); fn(e.target.checked);
@@ -60,9 +57,7 @@ export const PreferencesSettingsTab: FC = () => {
<InputField <InputField
id="showReactions" id="showReactions"
label={t("settings.preferences_tab.reactions_show_label")} label={t("settings.preferences_tab.reactions_show_label")}
description={t( description={t("settings.preferences_tab.reactions_show_description")}
"settings.preferences_tab.reactions_show_description",
)}
type="checkbox" type="checkbox"
checked={showReactions} checked={showReactions}
onChange={(e) => onChangeSetting(e, setShowReactions)} onChange={(e) => onChangeSetting(e, setShowReactions)}

View File

@@ -90,10 +90,7 @@ export const showHandRaisedTimer = new Setting<boolean>(
false, false,
); );
export const showReactions = new Setting<boolean>( export const showReactions = new Setting<boolean>("reactions-show", true);
"reactions-show",
true,
);
export const playReactionsSound = new Setting<boolean>( export const playReactionsSound = new Setting<boolean>(
"reactions-play-sound", "reactions-play-sound",