From 6377b052ce993b46673ebdb1a10dcf2bdaf1431b Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Sun, 23 Jan 2022 04:30:41 -0800 Subject: [PATCH] Add sounds to tradebox --- api/management/commands/follow_invoices.py | 1 - api/models.py | 4 +-- frontend/src/components/TradeBox.js | 28 ++++++++++++++++-- frontend/static/assets/sounds/chat-open.mp3 | Bin 0 -> 92368 bytes .../static/assets/sounds/locked-invoice.mp3 | Bin 0 -> 92368 bytes frontend/static/assets/sounds/sucessful.mp3 | Bin 0 -> 64364 bytes frontend/static/assets/sounds/taker-found.mp3 | Bin 0 -> 111176 bytes 7 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 frontend/static/assets/sounds/chat-open.mp3 create mode 100644 frontend/static/assets/sounds/locked-invoice.mp3 create mode 100644 frontend/static/assets/sounds/sucessful.mp3 create mode 100644 frontend/static/assets/sounds/taker-found.mp3 diff --git a/api/management/commands/follow_invoices.py b/api/management/commands/follow_invoices.py index c88ee749..eaa36601 100644 --- a/api/management/commands/follow_invoices.py +++ b/api/management/commands/follow_invoices.py @@ -5,7 +5,6 @@ from api.models import LNPayment, Order from api.logics import Logics from django.utils import timezone -from datetime import timedelta from decouple import config from base64 import b64decode import time diff --git a/api/models.py b/api/models.py index 01ef8117..942d811a 100644 --- a/api/models.py +++ b/api/models.py @@ -19,7 +19,7 @@ BOND_SIZE = float(config('BOND_SIZE')) class Currency(models.Model): - currency_dict = json.load(open('./frontend/static/assets/currencies.json')) + currency_dict = json.load(open('frontend/static/assets/currencies.json')) currency_choices = [(int(val), label) for val, label in list(currency_dict.items())] currency = models.PositiveSmallIntegerField(choices=currency_choices, null=False, unique=True) @@ -175,7 +175,7 @@ class Order(models.Model): 8 : 60*int(config('INVOICE_AND_ESCROW_DURATION')), # 'Waiting only for buyer invoice' 9 : 60*60*int(config('FIAT_EXCHANGE_DURATION')), # 'Sending fiat - In chatroom' 10 : 60*60*int(config('FIAT_EXCHANGE_DURATION')), # 'Fiat sent - In chatroom' - 11 : 1*24*60*60, # 'In dispute' + 11 : 1*24*60*60, # 'In dispute' 12 : 0, # 'Collaboratively cancelled' 13 : 24*60*60, # 'Sending satoshis to buyer' 14 : 24*60*60, # 'Sucessful trade' diff --git a/frontend/src/components/TradeBox.js b/frontend/src/components/TradeBox.js index b132ebf4..1d7b90ac 100644 --- a/frontend/src/components/TradeBox.js +++ b/frontend/src/components/TradeBox.js @@ -44,6 +44,17 @@ export default class TradeBox extends Component { } } + Sound = ({soundFileName}) => ( + // Four filenames: "locked-invoice", "taker-found", "open-chat", "sucessful" +