From 1125924e9cb5cd8a1f4858f1426ac16929b6a48c Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Sat, 2 Jul 2022 07:38:26 -0700 Subject: [PATCH] Improve sound notification locations. Add chat message sent/receive sound effect --- frontend/src/components/EncryptedChat.js | 8 +++++--- frontend/src/components/TradeBox.js | 18 ++++++------------ frontend/static/assets/sounds/chat-open.mp3 | Bin 92368 -> 2088 bytes 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/frontend/src/components/EncryptedChat.js b/frontend/src/components/EncryptedChat.js index a203fe35..04788ceb 100644 --- a/frontend/src/components/EncryptedChat.js +++ b/frontend/src/components/EncryptedChat.js @@ -144,11 +144,13 @@ class Chat extends Component { } componentDidUpdate() { - - // Only fire the scroll when the reason for Update is a new message + + // Only fire the scroll and audio when the reason for Update is a new message if (this.state.scrollNow){ + const audio = new Audio(`/static/assets/sounds/chat-open.mp3`) + audio.play(); this.scrollToBottom(); - this.setState({scrollNow:false}) + this.setState({scrollNow:false}); } } diff --git a/frontend/src/components/TradeBox.js b/frontend/src/components/TradeBox.js index c9490fa4..fb268ceb 100644 --- a/frontend/src/components/TradeBox.js +++ b/frontend/src/components/TradeBox.js @@ -52,12 +52,6 @@ class TradeBox extends Component {