Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions IntelliTrader.Web/Views/Home/Dashboard.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,27 @@
</div>
</div>

<!-- Дополнительные настройки звука -->
<!-- Дополнительные настройки звука и фильтрации -->
<div class="row align-items-center mt-2 pt-2" style="border-top: 1px solid var(--card-border); font-size: 13px;">
<div class="col-md-5 d-flex align-items-center mb-2 mb-md-0">
<div class="col-md-4 d-flex align-items-center mb-2 mb-md-0">
<i class="fas fa-sliders-h mr-2" style="color: #7aa2f7;"></i>
<span class="mr-2" style="white-space: nowrap;">Громкость:</span>
<input type="range" id="soundVolumeSlider" min="0" max="1" step="0.05" value="0.5" style="flex-grow: 1; height: 4px; background: var(--bg-color); outline: none; transition: background 450ms ease-in-out; -webkit-appearance: none; cursor: pointer;" />
<span id="soundVolumeValue" class="ml-2" style="font-weight: bold; color: #7aa2f7; min-width: 40px; text-align: right;">50%</span>
</div>
<div class="col-md-5 d-flex align-items-center mb-2 mb-md-0">
<div class="col-md-4 d-flex align-items-center mb-2 mb-md-0">
<i class="fas fa-music mr-2" style="color: #bb9af3;"></i>
<span class="mr-2" style="white-space: nowrap;">Профиль звука:</span>
<span class="mr-2" style="white-space: nowrap;">Профиль:</span>
<select id="soundProfileSelect" class="form-control form-control-sm" style="background-color: var(--input-bg); color: var(--text-color); border: 1px solid var(--input-border); border-radius: 4px; height: 28px; padding: 2px 8px; font-size: 12px; width: auto;">
<option value="chime">Приятный звон (Chime)</option>
<option value="beep">Высокий писк (Beep)</option>
<option value="arcade">Ретро аркада (Arcade)</option>
</select>
</div>
<div class="col-md-2 text-md-right text-muted" style="font-size: 11px;">
Настройки звука
<div class="col-md-4 d-flex align-items-center mb-2 mb-md-0">
<i class="fas fa-filter mr-2" style="color: #e0af68;"></i>
<span class="mr-2" style="white-space: nowrap;">Мин. сумма (USDT):</span>
<input type="number" id="minTradeSizeInput" min="0" step="10" placeholder="0" style="background-color: var(--input-bg); color: var(--text-color); border: 1px solid var(--input-border); border-radius: 4px; height: 28px; padding: 2px 8px; font-size: 12px; width: 90px;" />
</div>
</div>
</div>
Expand All @@ -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";
Expand All @@ -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();

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}
});
Expand Down
115 changes: 108 additions & 7 deletions IntelliTrader.Web/Views/Home/Settings.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,41 @@
<button class="btn btn-info settings-btn" onclick="restartServices();" @if (Model.ReadOnlyMode) { <text>disabled</text> }>Restart Services</button>

<div class="configs mt-4" style="background-color: var(--card-bg) !important; border: 1px solid var(--border-color) !important; color: var(--text-color) !important; padding: 20px; border-radius: 4px; margin-top: 20px;">
<h2>Оформление</h2>
<div style="margin-bottom: 15px; display: flex; align-items: center;">
<label style="margin-right: 15px; margin-bottom: 0; font-weight: bold;">Тема оформления:</label>
<select id="settingsThemeSelect" class="form-control form-control-sm" style="width: auto; background-color: var(--input-bg); color: var(--text-color); border: 1px solid var(--input-border); border-radius: 4px;">
<option value="dark">Темная (по умолчанию)</option>
<option value="light">Светлая</option>
</select>
<h2>Оформление и Уведомления</h2>
<div class="row align-items-center mb-3">
<div class="col-md-6 d-flex align-items-center">
<label style="margin-right: 15px; margin-bottom: 0; font-weight: bold; white-space: nowrap;">Тема оформления:</label>
<select id="settingsThemeSelect" class="form-control form-control-sm" style="width: auto; background-color: var(--input-bg); color: var(--text-color); border: 1px solid var(--input-border); border-radius: 4px;">
<option value="dark">Темная (по умолчанию)</option>
<option value="light">Светлая</option>
</select>
</div>
<div class="col-md-6 d-flex align-items-center mt-2 mt-md-0">
<label style="margin-right: 15px; margin-bottom: 0; font-weight: bold; white-space: nowrap;">Звук уведомлений:</label>
<button id="settingsSoundToggleBtn" class="btn btn-sm btn-outline-success" style="font-weight: bold; border-color: #9ece6a; color: #9ece6a; background: transparent;">
<i class="fas fa-volume-up mr-1"></i> Звук: Вкл
</button>
</div>
</div>

<div class="row align-items-center mb-3 pt-2" style="border-top: 1px solid var(--border-color);">
<div class="col-md-4 d-flex align-items-center mb-2 mb-md-0">
<label style="margin-right: 15px; margin-bottom: 0; font-weight: bold; white-space: nowrap;">Громкость:</label>
<input type="range" id="settingsSoundVolumeSlider" min="0" max="1" step="0.05" value="0.5" style="flex-grow: 1; height: 4px; cursor: pointer;" />
<span id="settingsSoundVolumeValue" class="ml-2" style="font-weight: bold; color: #7aa2f7; min-width: 40px; text-align: right;">50%</span>
</div>
<div class="col-md-4 d-flex align-items-center mb-2 mb-md-0">
<label style="margin-right: 15px; margin-bottom: 0; font-weight: bold; white-space: nowrap;">Профиль звука:</label>
<select id="settingsSoundProfileSelect" class="form-control form-control-sm" style="width: auto; background-color: var(--input-bg); color: var(--text-color); border: 1px solid var(--input-border); border-radius: 4px;">
<option value="chime">Приятный звон (Chime)</option>
<option value="beep">Высокий писк (Beep)</option>
<option value="arcade">Ретро аркада (Arcade)</option>
</select>
</div>
<div class="col-md-4 d-flex align-items-center mb-2 mb-md-0">
<label style="margin-right: 15px; margin-bottom: 0; font-weight: bold; white-space: nowrap;">Мин. сумма (USDT):</label>
<input type="number" id="settingsMinTradeSizeInput" min="0" step="10" placeholder="0" class="form-control form-control-sm" style="width: 100px; background-color: var(--input-bg); color: var(--text-color); border: 1px solid var(--input-border); border-radius: 4px;" />
</div>
</div>
</div>

Expand Down Expand Up @@ -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 = '<i class="fas fa-volume-up mr-1"></i> Звук: Вкл';
settingsSoundToggleBtn.className = "btn btn-sm btn-outline-success";
settingsSoundToggleBtn.style.color = "#9ece6a";
settingsSoundToggleBtn.style.borderColor = "#9ece6a";
} else {
settingsSoundToggleBtn.innerHTML = '<i class="fas fa-volume-mute mr-1"></i> Звук: Выкл';
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);
});
}
});
</script>

Expand Down
2 changes: 1 addition & 1 deletion magda_agent_system/agent_tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down