-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: play sound on successful swaps (#536)
* feat: play sound on successful swaps closes #338 Update src/context/Global.tsx Co-authored-by: michael1011 <[email protected]> * fix: small es language fix --------- Co-authored-by: michael1011 <[email protected]> Co-authored-by: Kilian <[email protected]>
- Loading branch information
1 parent
a4169fe
commit caa861a
Showing
8 changed files
with
91 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useGlobalContext } from "../context/Global"; | ||
|
||
const AudioNotificationSetting = () => { | ||
const { | ||
audioNotification, | ||
setAudioNotification, | ||
t, | ||
playNotificationSound, | ||
} = useGlobalContext(); | ||
|
||
const toggleAudioNotification = (evt: MouseEvent) => { | ||
if (!audioNotification()) playNotificationSound(); | ||
setAudioNotification(!audioNotification()); | ||
evt.stopPropagation(); | ||
}; | ||
|
||
return ( | ||
<> | ||
<div | ||
class="audio toggle" | ||
title={t("enable_audio_tooltip")} | ||
onClick={toggleAudioNotification}> | ||
<span class={audioNotification() ? "active" : ""}> | ||
{t("on")} | ||
</span> | ||
<span class={!audioNotification() ? "active" : ""}> | ||
{t("off")} | ||
</span> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default AudioNotificationSetting; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,9 @@ | |
display: flex; | ||
align-items: center; | ||
} | ||
.toggle { | ||
margin-left: 15px; | ||
} | ||
} | ||
.setting { | ||
display: flex; | ||
|