Aggiunta Bootstrap 5.3.3 (CSS, JS, RTL, mappe) al progetto
Sono stati aggiunti tutti i file principali di Bootstrap 5.3.3, inclusi CSS, JavaScript (bundle, ESM, UMD, minificati), versioni RTL, utility, reboot, griglia e relative mappe delle sorgenti. Questi file abilitano un sistema di design moderno, responsive e accessibile, con supporto per layout LTR e RTL, debugging avanzato tramite source map e tutte le funzionalità di Bootstrap per lo sviluppo dell’interfaccia utente. Nessuna modifica ai file esistenti.
This commit is contained in:
170
TradingBot/Components/Pages/Settings.razor
Normal file
170
TradingBot/Components/Pages/Settings.razor
Normal file
@@ -0,0 +1,170 @@
|
||||
@page "/settings"
|
||||
@using TradingBot.Services
|
||||
@using TradingBot.Models
|
||||
@inject SettingsService SettingsService
|
||||
@implements IDisposable
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>Impostazioni - TradingBot</PageTitle>
|
||||
|
||||
<div class="settings-page">
|
||||
<div class="page-header">
|
||||
<h1>Impostazioni</h1>
|
||||
<p class="subtitle">Configura le impostazioni globali del trading bot</p>
|
||||
</div>
|
||||
|
||||
<div class="settings-section">
|
||||
<h2>Generale</h2>
|
||||
<div class="settings-group">
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label">Modalità Simulazione</div>
|
||||
<div class="setting-description">Utilizza dati simulati invece di dati reali di mercato</div>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" checked="@settings.SimulationMode" @onchange="(e) => UpdateSetting(nameof(AppSettings.SimulationMode), (bool)e.Value!)" disabled />
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label">Notifiche Desktop</div>
|
||||
<div class="setting-description">Ricevi notifiche per operazioni importanti</div>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" checked="@settings.DesktopNotifications" @onchange="(e) => UpdateSetting(nameof(AppSettings.DesktopNotifications), (bool)e.Value!)" />
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="settings-section">
|
||||
<h2>Trading</h2>
|
||||
<div class="settings-group">
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label">Auto-Start Bot</div>
|
||||
<div class="setting-description">Avvia automaticamente il bot all'apertura dell'applicazione</div>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" checked="@settings.AutoStartBot" @onchange="(e) => UpdateSetting(nameof(AppSettings.AutoStartBot), (bool)e.Value!)" />
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label">Conferma Operazioni Manuali</div>
|
||||
<div class="setting-description">Richiedi conferma prima di eseguire operazioni manuali</div>
|
||||
</div>
|
||||
<label class="toggle-switch">
|
||||
<input type="checkbox" checked="@settings.ConfirmManualTrades" @onchange="(e) => UpdateSetting(nameof(AppSettings.ConfirmManualTrades), (bool)e.Value!)" />
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="settings-section">
|
||||
<h2>Avanzate</h2>
|
||||
<div class="settings-group">
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label">Intervallo Aggiornamento</div>
|
||||
<div class="setting-description">Frequenza di aggiornamento dei dati di mercato</div>
|
||||
</div>
|
||||
<select class="setting-select" value="@settings.UpdateIntervalSeconds" @onchange="(e) => UpdateSetting(nameof(AppSettings.UpdateIntervalSeconds), int.Parse(e.Value!.ToString()!))">
|
||||
<option value="2">2 secondi</option>
|
||||
<option value="3">3 secondi</option>
|
||||
<option value="5">5 secondi</option>
|
||||
<option value="10">10 secondi</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label">Log Level</div>
|
||||
<div class="setting-description">Livello di dettaglio dei log di sistema</div>
|
||||
</div>
|
||||
<select class="setting-select" value="@settings.LogLevel" @onchange="(e) => UpdateSetting(nameof(AppSettings.LogLevel), e.Value!.ToString()!)">
|
||||
<option value="Error">Error</option>
|
||||
<option value="Warning">Warning</option>
|
||||
<option value="Info">Info</option>
|
||||
<option value="Debug">Debug</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="settings-actions">
|
||||
<button class="btn-secondary" @onclick="ResetToDefaults">
|
||||
<span class="bi bi-arrow-counterclockwise"></span>
|
||||
Reset Predefiniti
|
||||
</button>
|
||||
<button class="btn-primary" @onclick="SaveSettings">
|
||||
<span class="bi bi-check-lg"></span>
|
||||
Salva Modifiche
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (showNotification)
|
||||
{
|
||||
<div class="notification success">
|
||||
<span class="bi bi-check-circle-fill"></span>
|
||||
Impostazioni salvate con successo!
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private AppSettings settings = new();
|
||||
private bool showNotification = false;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
settings = SettingsService.GetSettings();
|
||||
SettingsService.OnSettingsChanged += HandleSettingsChanged;
|
||||
}
|
||||
|
||||
private void UpdateSetting<T>(string propertyName, T value)
|
||||
{
|
||||
SettingsService.UpdateSetting(propertyName, value);
|
||||
settings = SettingsService.GetSettings();
|
||||
ShowNotification();
|
||||
}
|
||||
|
||||
private void SaveSettings()
|
||||
{
|
||||
SettingsService.UpdateSettings(settings);
|
||||
ShowNotification();
|
||||
}
|
||||
|
||||
private void ResetToDefaults()
|
||||
{
|
||||
SettingsService.ResetToDefaults();
|
||||
settings = SettingsService.GetSettings();
|
||||
ShowNotification();
|
||||
}
|
||||
|
||||
private async void ShowNotification()
|
||||
{
|
||||
showNotification = true;
|
||||
StateHasChanged();
|
||||
await Task.Delay(3000);
|
||||
showNotification = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void HandleSettingsChanged()
|
||||
{
|
||||
settings = SettingsService.GetSettings();
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
SettingsService.OnSettingsChanged -= HandleSettingsChanged;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user