+
Громкость:
50%
-
+
- Профиль звука:
+ Профиль:
-
@@ -59,6 +61,7 @@
const soundVolumeSlider = document.getElementById("soundVolumeSlider");
const soundVolumeValue = document.getElementById("soundVolumeValue");
const soundProfileSelect = document.getElementById("soundProfileSelect");
+ const minTradeSizeInput = document.getElementById("minTradeSizeInput");
const notificationContainer = document.getElementById("notificationContainer");
let isSoundEnabled = localStorage.getItem("realtime_sound_enabled") !== "false";
@@ -74,10 +77,17 @@
// Load sound profile with fallback to 'chime'
let soundProfile = localStorage.getItem("realtime_sound_profile") || "chime";
+ // Load min trade size with fallback to 0
+ let minTradeSize = parseFloat(localStorage.getItem("realtime_min_trade_size") || "0");
+ if (isNaN(minTradeSize) || minTradeSize < 0) minTradeSize = 0;
+
// Sync UI controls with values
soundVolumeSlider.value = soundVolume;
soundVolumeValue.textContent = Math.round(soundVolume * 100) + "%";
soundProfileSelect.value = soundProfile;
+ if (minTradeSizeInput) {
+ minTradeSizeInput.value = minTradeSize > 0 ? minTradeSize : "";
+ }
updateSoundButtonUI();
@@ -206,6 +216,16 @@
playNotificationSound();
});
+ // Min trade size threshold input handling
+ if (minTradeSizeInput) {
+ minTradeSizeInput.addEventListener("input", function () {
+ let val = parseFloat(minTradeSizeInput.value);
+ if (isNaN(val) || val < 0) val = 0;
+ minTradeSize = val;
+ localStorage.setItem("realtime_min_trade_size", val);
+ });
+ }
+
// Sound profile select handling
soundProfileSelect.addEventListener("change", function () {
soundProfile = soundProfileSelect.value;
@@ -332,8 +352,11 @@
knownTrades.add(tradeId);
if (!isFirstLoad) {
- hasNewTrade = true;
- showToastNotification(trade);
+ const tradeCost = (parseFloat(trade.Amount) || 0) * (parseFloat(trade.AveragePrice) || 0);
+ if (tradeCost >= minTradeSize) {
+ hasNewTrade = true;
+ showToastNotification(trade);
+ }
}
}
});
diff --git a/IntelliTrader.Web/Views/Home/Settings.cshtml b/IntelliTrader.Web/Views/Home/Settings.cshtml
index 88c654d..cba45d0 100644
--- a/IntelliTrader.Web/Views/Home/Settings.cshtml
+++ b/IntelliTrader.Web/Views/Home/Settings.cshtml
@@ -39,13 +39,41 @@
-
Оформление
-
-
-
+
Оформление и Уведомления
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 50%
+
+
+
+
+
+
+
+
+
@@ -87,6 +115,79 @@
}
});
}
+
+ // Realtime Notification Controls in Settings
+ const settingsSoundToggleBtn = document.getElementById("settingsSoundToggleBtn");
+ const settingsSoundVolumeSlider = document.getElementById("settingsSoundVolumeSlider");
+ const settingsSoundVolumeValue = document.getElementById("settingsSoundVolumeValue");
+ const settingsSoundProfileSelect = document.getElementById("settingsSoundProfileSelect");
+ const settingsMinTradeSizeInput = document.getElementById("settingsMinTradeSizeInput");
+
+ let isSoundEnabled = localStorage.getItem("realtime_sound_enabled") !== "false";
+ let soundVolume = parseFloat(localStorage.getItem("realtime_sound_volume") || "0.5");
+ if (isNaN(soundVolume)) soundVolume = 0.5;
+ let soundProfile = localStorage.getItem("realtime_sound_profile") || "chime";
+ let minTradeSize = parseFloat(localStorage.getItem("realtime_min_trade_size") || "0");
+ if (isNaN(minTradeSize) || minTradeSize < 0) minTradeSize = 0;
+
+ function updateSoundBtn() {
+ if (settingsSoundToggleBtn) {
+ if (isSoundEnabled) {
+ settingsSoundToggleBtn.innerHTML = '
Звук: Вкл';
+ settingsSoundToggleBtn.className = "btn btn-sm btn-outline-success";
+ settingsSoundToggleBtn.style.color = "#9ece6a";
+ settingsSoundToggleBtn.style.borderColor = "#9ece6a";
+ } else {
+ settingsSoundToggleBtn.innerHTML = '
Звук: Выкл';
+ settingsSoundToggleBtn.className = "btn btn-sm btn-outline-secondary";
+ settingsSoundToggleBtn.style.color = "#a9b1d6";
+ settingsSoundToggleBtn.style.borderColor = "#4a4a6a";
+ }
+ }
+ }
+
+ updateSoundBtn();
+ if (settingsSoundVolumeSlider) {
+ settingsSoundVolumeSlider.value = soundVolume;
+ settingsSoundVolumeValue.textContent = Math.round(soundVolume * 100) + "%";
+ }
+ if (settingsSoundProfileSelect) {
+ settingsSoundProfileSelect.value = soundProfile;
+ }
+ if (settingsMinTradeSizeInput) {
+ settingsMinTradeSizeInput.value = minTradeSize > 0 ? minTradeSize : "";
+ }
+
+ if (settingsSoundToggleBtn) {
+ settingsSoundToggleBtn.addEventListener("click", function() {
+ isSoundEnabled = !isSoundEnabled;
+ localStorage.setItem("realtime_sound_enabled", isSoundEnabled);
+ updateSoundBtn();
+ });
+ }
+
+ if (settingsSoundVolumeSlider) {
+ settingsSoundVolumeSlider.addEventListener("input", function() {
+ soundVolume = parseFloat(settingsSoundVolumeSlider.value);
+ settingsSoundVolumeValue.textContent = Math.round(soundVolume * 100) + "%";
+ localStorage.setItem("realtime_sound_volume", soundVolume);
+ });
+ }
+
+ if (settingsSoundProfileSelect) {
+ settingsSoundProfileSelect.addEventListener("change", function() {
+ soundProfile = settingsSoundProfileSelect.value;
+ localStorage.setItem("realtime_sound_profile", soundProfile);
+ });
+ }
+
+ if (settingsMinTradeSizeInput) {
+ settingsMinTradeSizeInput.addEventListener("input", function() {
+ let val = parseFloat(settingsMinTradeSizeInput.value);
+ if (isNaN(val) || val < 0) val = 0;
+ localStorage.setItem("realtime_min_trade_size", val);
+ });
+ }
});
diff --git a/magda_agent_system/agent_tasks.json b/magda_agent_system/agent_tasks.json
index 7d53bc6..8e8cadb 100644
--- a/magda_agent_system/agent_tasks.json
+++ b/magda_agent_system/agent_tasks.json
@@ -446,7 +446,7 @@
},
{
"id": "web-dashboard-custom-alerts",
- "status": "todo",
+ "status": "done",
"area": "web",
"risk": "low",
"title": "Add custom notification threshold settings on Dashboard",