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:
210
TradingBot/Components/Layout/MainLayout.razor
Normal file
210
TradingBot/Components/Layout/MainLayout.razor
Normal file
@@ -0,0 +1,210 @@
|
||||
@inherits LayoutComponentBase
|
||||
@using TradingBot.Services
|
||||
@using TradingBot.Models
|
||||
@inject TradingBotService BotService
|
||||
@inject SettingsService SettingsService
|
||||
@inject NavigationManager Navigation
|
||||
@implements IDisposable
|
||||
|
||||
<div class="trading-bot-layout @(sidebarCollapsed ? "collapsed" : "expanded")">
|
||||
<!-- Modern Vertical Sidebar -->
|
||||
<aside class="modern-sidebar">
|
||||
<!-- Brand Section -->
|
||||
<div class="sidebar-brand">
|
||||
<div class="brand-container @(sidebarCollapsed ? "minimized" : "")">
|
||||
<div class="brand-logo">
|
||||
<span class="logo-icon bi bi-graph-up-arrow"></span>
|
||||
</div>
|
||||
@if (!sidebarCollapsed)
|
||||
{
|
||||
<div class="brand-info">
|
||||
<h1 class="brand-title">Trading<span class="accent">Bot</span></h1>
|
||||
<div class="status-badge @(isRunning ? "online" : "offline")">
|
||||
<span class="status-indicator"></span>
|
||||
<span class="status-text">@(isRunning ? "ATTIVO" : "OFFLINE")</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<button class="collapse-btn" @onclick="ToggleSidebar" title="@(sidebarCollapsed ? "Espandi" : "Minimizza")">
|
||||
<span class="bi bi-chevron-@(sidebarCollapsed ? "right" : "left")"></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Navigation Menu -->
|
||||
<nav class="sidebar-menu">
|
||||
<NavLink class="menu-item" href="/" Match="NavLinkMatch.All" title="Dashboard">
|
||||
<span class="item-icon bi bi-speedometer2"></span>
|
||||
@if (!sidebarCollapsed)
|
||||
{
|
||||
<span class="item-text">Dashboard</span>
|
||||
}
|
||||
</NavLink>
|
||||
|
||||
<NavLink class="menu-item" href="/strategies" title="Strategie">
|
||||
<span class="item-icon bi bi-diagram-3"></span>
|
||||
@if (!sidebarCollapsed)
|
||||
{
|
||||
<span class="item-text">Strategie</span>
|
||||
}
|
||||
</NavLink>
|
||||
|
||||
<NavLink class="menu-item" href="/assets" title="Asset">
|
||||
<span class="item-icon bi bi-coin"></span>
|
||||
@if (!sidebarCollapsed)
|
||||
{
|
||||
<span class="item-text">Asset</span>
|
||||
}
|
||||
</NavLink>
|
||||
|
||||
<NavLink class="menu-item" href="/trading" title="Trading">
|
||||
<span class="item-icon bi bi-graph-up-arrow"></span>
|
||||
@if (!sidebarCollapsed)
|
||||
{
|
||||
<span class="item-text">Trading</span>
|
||||
}
|
||||
</NavLink>
|
||||
|
||||
<NavLink class="menu-item" href="/market" title="Analisi Mercato">
|
||||
<span class="item-icon bi bi-bar-chart-line"></span>
|
||||
@if (!sidebarCollapsed)
|
||||
{
|
||||
<span class="item-text">Analisi Mercato</span>
|
||||
}
|
||||
</NavLink>
|
||||
|
||||
<NavLink class="menu-item" href="/statistics" title="Statistiche">
|
||||
<span class="item-icon bi bi-graph-up"></span>
|
||||
@if (!sidebarCollapsed)
|
||||
{
|
||||
<span class="item-text">Statistiche</span>
|
||||
}
|
||||
</NavLink>
|
||||
|
||||
<NavLink class="menu-item" href="/settings" title="Impostazioni">
|
||||
<span class="item-icon bi bi-gear"></span>
|
||||
@if (!sidebarCollapsed)
|
||||
{
|
||||
<span class="item-text">Impostazioni</span>
|
||||
}
|
||||
</NavLink>
|
||||
</nav>
|
||||
|
||||
<!-- Portfolio Summary (quando espanso) -->
|
||||
@if (!sidebarCollapsed)
|
||||
{
|
||||
<div class="sidebar-summary">
|
||||
<div class="summary-card">
|
||||
<div class="summary-row">
|
||||
<span class="summary-title">Portfolio</span>
|
||||
<span class="summary-amount">$@portfolioValue.ToString("N0")</span>
|
||||
</div>
|
||||
<div class="summary-row">
|
||||
<span class="summary-title">Profitto</span>
|
||||
<span class="summary-amount @(totalProfit >= 0 ? "profit" : "loss")">
|
||||
$@totalProfit.ToString("N2")
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</aside>
|
||||
|
||||
<!-- Main Content Area -->
|
||||
<div class="main-area">
|
||||
<!-- Top Header Bar -->
|
||||
<header class="content-header">
|
||||
<div class="header-left">
|
||||
<!-- Placeholder for page title -->
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<button class="header-btn notifications" title="Notifiche">
|
||||
<span class="bi bi-bell"></span>
|
||||
</button>
|
||||
<button class="header-btn bot-control @(isRunning ? "running" : "stopped")" @onclick="ToggleBot">
|
||||
<span class="bi bi-@(isRunning ? "pause" : "play")-circle-fill"></span>
|
||||
<span class="btn-label">@(isRunning ? "Stop" : "Avvia")</span>
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Page Content -->
|
||||
<main class="page-content">
|
||||
@Body
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private bool sidebarCollapsed = false;
|
||||
private bool isRunning => BotService.Status.IsRunning;
|
||||
private decimal portfolioValue = 0;
|
||||
private decimal totalProfit = 0;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
var settings = SettingsService.GetSettings();
|
||||
sidebarCollapsed = settings.SidebarCollapsed;
|
||||
|
||||
BotService.OnStatusChanged += HandleUpdate;
|
||||
BotService.OnPriceUpdated += HandlePriceUpdate;
|
||||
SettingsService.OnSettingsChanged += HandleSettingsChanged;
|
||||
|
||||
UpdateStats();
|
||||
|
||||
if (settings.AutoStartBot && !BotService.Status.IsRunning)
|
||||
{
|
||||
BotService.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleSidebar()
|
||||
{
|
||||
sidebarCollapsed = !sidebarCollapsed;
|
||||
SettingsService.UpdateSetting(nameof(AppSettings.SidebarCollapsed), sidebarCollapsed);
|
||||
StateHasChanged(); // Force immediate UI update
|
||||
Console.WriteLine($"Sidebar toggled: collapsed={sidebarCollapsed}"); // Debug log
|
||||
}
|
||||
|
||||
private void ToggleBot()
|
||||
{
|
||||
if (isRunning)
|
||||
BotService.Stop();
|
||||
else
|
||||
BotService.Start();
|
||||
}
|
||||
|
||||
private void UpdateStats()
|
||||
{
|
||||
portfolioValue = BotService.AssetConfigurations.Values.Sum(c =>
|
||||
c.CurrentBalance + (c.CurrentHoldings * (BotService.GetLatestPrice(c.Symbol)?.Price ?? 0)));
|
||||
|
||||
totalProfit = BotService.AssetConfigurations.Values.Sum(c => c.TotalProfit);
|
||||
}
|
||||
|
||||
private void HandleUpdate()
|
||||
{
|
||||
UpdateStats();
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void HandlePriceUpdate(string symbol, MarketPrice price)
|
||||
{
|
||||
UpdateStats();
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void HandleSettingsChanged()
|
||||
{
|
||||
var settings = SettingsService.GetSettings();
|
||||
sidebarCollapsed = settings.SidebarCollapsed;
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
BotService.OnStatusChanged -= HandleUpdate;
|
||||
BotService.OnPriceUpdated -= HandlePriceUpdate;
|
||||
SettingsService.OnSettingsChanged -= HandleSettingsChanged;
|
||||
}
|
||||
}
|
||||
468
TradingBot/Components/Layout/MainLayout.razor.css
Normal file
468
TradingBot/Components/Layout/MainLayout.razor.css
Normal file
@@ -0,0 +1,468 @@
|
||||
/* ==============================================
|
||||
TRADING BOT LAYOUT - Modern Vertical Sidebar
|
||||
Global Styles (usando ::deep per scoped CSS)
|
||||
============================================== */
|
||||
|
||||
/* Layout Container */
|
||||
::deep .trading-bot-layout {
|
||||
display: flex !important;
|
||||
min-height: 100vh !important;
|
||||
background: #0a0e27 !important;
|
||||
color: #e2e8f0 !important;
|
||||
position: relative !important;
|
||||
}
|
||||
|
||||
/* ==============================================
|
||||
MODERN SIDEBAR
|
||||
============================================== */
|
||||
|
||||
::deep .modern-sidebar {
|
||||
width: 280px !important;
|
||||
background: linear-gradient(180deg, #1a1f3a 0%, #0f1629 100%) !important;
|
||||
border-right: 1px solid rgba(99, 102, 241, 0.15) !important;
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
position: fixed !important;
|
||||
left: 0 !important;
|
||||
top: 0 !important;
|
||||
bottom: 0 !important;
|
||||
z-index: 1000 !important;
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
||||
box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2) !important;
|
||||
}
|
||||
|
||||
::deep .trading-bot-layout.collapsed .modern-sidebar {
|
||||
width: 80px !important;
|
||||
}
|
||||
|
||||
/* Brand Section */
|
||||
::deep .sidebar-brand {
|
||||
padding: 1.75rem 1.5rem !important;
|
||||
border-bottom: 1px solid rgba(99, 102, 241, 0.1) !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: space-between !important;
|
||||
gap: 1rem !important;
|
||||
}
|
||||
|
||||
::deep .trading-bot-layout.collapsed .sidebar-brand {
|
||||
padding: 1.5rem 0.75rem !important;
|
||||
justify-content: center !important;
|
||||
}
|
||||
|
||||
::deep .brand-container {
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
gap: 1rem !important;
|
||||
flex: 1 !important;
|
||||
min-width: 0 !important;
|
||||
}
|
||||
|
||||
::deep .brand-container.minimized {
|
||||
justify-content: center !important;
|
||||
flex: initial !important;
|
||||
}
|
||||
|
||||
::deep .brand-logo {
|
||||
width: 3.5rem !important;
|
||||
height: 3.5rem !important;
|
||||
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
|
||||
border-radius: 1rem !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: center !important;
|
||||
flex-shrink: 0 !important;
|
||||
box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3) !important;
|
||||
}
|
||||
|
||||
::deep .trading-bot-layout.collapsed .brand-logo {
|
||||
width: 3rem !important;
|
||||
height: 3rem !important;
|
||||
}
|
||||
|
||||
::deep .logo-icon {
|
||||
font-size: 1.75rem !important;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
::deep .brand-info {
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
gap: 0.5rem !important;
|
||||
min-width: 0 !important;
|
||||
}
|
||||
|
||||
::deep .brand-title {
|
||||
font-size: 1.5rem !important;
|
||||
font-weight: 700 !important;
|
||||
color: white !important;
|
||||
margin: 0 !important;
|
||||
line-height: 1 !important;
|
||||
}
|
||||
|
||||
::deep .brand-title .accent {
|
||||
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
|
||||
-webkit-background-clip: text !important;
|
||||
-webkit-text-fill-color: transparent !important;
|
||||
background-clip: text !important;
|
||||
}
|
||||
|
||||
::deep .status-badge {
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
gap: 0.5rem !important;
|
||||
padding: 0.25rem 0.75rem !important;
|
||||
background: rgba(71, 85, 105, 0.3) !important;
|
||||
border-radius: 1rem !important;
|
||||
width: fit-content !important;
|
||||
}
|
||||
|
||||
::deep .status-badge.online {
|
||||
background: rgba(16, 185, 129, 0.15) !important;
|
||||
}
|
||||
|
||||
::deep .status-indicator {
|
||||
width: 0.5rem !important;
|
||||
height: 0.5rem !important;
|
||||
border-radius: 50% !important;
|
||||
background: #64748b !important;
|
||||
}
|
||||
|
||||
::deep .status-badge.online .status-indicator {
|
||||
background: #10b981 !important;
|
||||
box-shadow: 0 0 8px rgba(16, 185, 129, 0.6) !important;
|
||||
animation: pulse-indicator 2s ease-in-out infinite !important;
|
||||
}
|
||||
|
||||
@keyframes pulse-indicator {
|
||||
0%, 100% { opacity: 1; transform: scale(1); }
|
||||
50% { opacity: 0.7; transform: scale(1.1); }
|
||||
}
|
||||
|
||||
::deep .status-text {
|
||||
font-size: 0.625rem !important;
|
||||
font-weight: 700 !important;
|
||||
text-transform: uppercase !important;
|
||||
letter-spacing: 0.05em !important;
|
||||
color: #64748b !important;
|
||||
}
|
||||
|
||||
::deep .status-badge.online .status-text {
|
||||
color: #10b981 !important;
|
||||
}
|
||||
|
||||
::deep .collapse-btn {
|
||||
width: 2.25rem !important;
|
||||
height: 2.25rem !important;
|
||||
border-radius: 0.625rem !important;
|
||||
border: none !important;
|
||||
background: rgba(99, 102, 241, 0.1) !important;
|
||||
color: #6366f1 !important;
|
||||
cursor: pointer !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
justify-content: center !important;
|
||||
transition: all 0.2s ease !important;
|
||||
font-size: 1rem !important;
|
||||
flex-shrink: 0 !important;
|
||||
}
|
||||
|
||||
::deep .collapse-btn:hover {
|
||||
background: rgba(99, 102, 241, 0.2) !important;
|
||||
transform: scale(1.05) !important;
|
||||
}
|
||||
|
||||
/* Navigation Menu */
|
||||
::deep .sidebar-menu {
|
||||
flex: 1 !important;
|
||||
padding: 1.5rem 0 !important;
|
||||
overflow-y: auto !important;
|
||||
overflow-x: hidden !important;
|
||||
}
|
||||
|
||||
::deep .menu-item {
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
gap: 1rem !important;
|
||||
padding: 1rem 1.5rem !important;
|
||||
color: #94a3b8 !important;
|
||||
text-decoration: none !important;
|
||||
transition: all 0.2s ease !important;
|
||||
border-left: 3px solid transparent !important;
|
||||
font-weight: 600 !important;
|
||||
font-size: 0.938rem !important;
|
||||
position: relative !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
::deep .trading-bot-layout.collapsed .menu-item {
|
||||
justify-content: center !important;
|
||||
padding: 1rem 0 !important;
|
||||
}
|
||||
|
||||
::deep .menu-item:hover {
|
||||
background: rgba(99, 102, 241, 0.08) !important;
|
||||
color: #cbd5e1 !important;
|
||||
border-left-color: rgba(99, 102, 241, 0.3) !important;
|
||||
}
|
||||
|
||||
::deep .menu-item.active {
|
||||
background: rgba(99, 102, 241, 0.12) !important;
|
||||
border-left-color: #6366f1 !important;
|
||||
color: #6366f1 !important;
|
||||
}
|
||||
|
||||
::deep .menu-item.active::before {
|
||||
content: '' !important;
|
||||
position: absolute !important;
|
||||
right: 0 !important;
|
||||
top: 50% !important;
|
||||
transform: translateY(-50%) !important;
|
||||
width: 3px !important;
|
||||
height: 60% !important;
|
||||
background: #6366f1 !important;
|
||||
border-radius: 3px 0 0 3px !important;
|
||||
}
|
||||
|
||||
::deep .item-icon {
|
||||
font-size: 1.375rem !important;
|
||||
flex-shrink: 0 !important;
|
||||
transition: transform 0.2s ease !important;
|
||||
}
|
||||
|
||||
::deep .menu-item:hover .item-icon {
|
||||
transform: scale(1.1) !important;
|
||||
}
|
||||
|
||||
::deep .item-text {
|
||||
white-space: nowrap !important;
|
||||
overflow: hidden !important;
|
||||
text-overflow: ellipsis !important;
|
||||
}
|
||||
|
||||
/* Portfolio Summary */
|
||||
::deep .sidebar-summary {
|
||||
padding: 1.5rem !important;
|
||||
border-top: 1px solid rgba(99, 102, 241, 0.1) !important;
|
||||
}
|
||||
|
||||
::deep .summary-card {
|
||||
padding: 1.25rem !important;
|
||||
background: rgba(99, 102, 241, 0.08) !important;
|
||||
border-radius: 0.75rem !important;
|
||||
border: 1px solid rgba(99, 102, 241, 0.1) !important;
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
gap: 0.875rem !important;
|
||||
}
|
||||
|
||||
::deep .summary-row {
|
||||
display: flex !important;
|
||||
justify-content: space-between !important;
|
||||
align-items: center !important;
|
||||
}
|
||||
|
||||
::deep .summary-title {
|
||||
font-size: 0.75rem !important;
|
||||
color: #64748b !important;
|
||||
font-weight: 600 !important;
|
||||
text-transform: uppercase !important;
|
||||
letter-spacing: 0.05em !important;
|
||||
}
|
||||
|
||||
::deep .summary-amount {
|
||||
font-size: 1rem !important;
|
||||
font-weight: 700 !important;
|
||||
color: white !important;
|
||||
font-family: 'Courier New', monospace !important;
|
||||
}
|
||||
|
||||
::deep .summary-amount.profit {
|
||||
color: #10b981 !important;
|
||||
}
|
||||
|
||||
::deep .summary-amount.loss {
|
||||
color: #ef4444 !important;
|
||||
}
|
||||
|
||||
/* ==============================================
|
||||
MAIN CONTENT AREA
|
||||
============================================== */
|
||||
|
||||
::deep .main-area {
|
||||
flex: 1 !important;
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
margin-left: 280px !important;
|
||||
transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
|
||||
min-height: 100vh !important;
|
||||
}
|
||||
|
||||
::deep .trading-bot-layout.collapsed .main-area {
|
||||
margin-left: 80px !important;
|
||||
}
|
||||
|
||||
/* Content Header */
|
||||
::deep .content-header {
|
||||
background: #0f1629 !important;
|
||||
border-bottom: 1px solid rgba(99, 102, 241, 0.1) !important;
|
||||
padding: 1.25rem 2rem !important;
|
||||
display: flex !important;
|
||||
justify-content: space-between !important;
|
||||
align-items: center !important;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15) !important;
|
||||
position: sticky !important;
|
||||
top: 0 !important;
|
||||
z-index: 100 !important;
|
||||
}
|
||||
|
||||
::deep .header-left {
|
||||
flex: 1 !important;
|
||||
}
|
||||
|
||||
::deep .header-right {
|
||||
display: flex !important;
|
||||
gap: 1rem !important;
|
||||
align-items: center !important;
|
||||
}
|
||||
|
||||
::deep .header-btn {
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
gap: 0.625rem !important;
|
||||
padding: 0.75rem 1.25rem !important;
|
||||
border-radius: 0.625rem !important;
|
||||
border: 1px solid #334155 !important;
|
||||
background: #1a1f3a !important;
|
||||
color: #cbd5e1 !important;
|
||||
cursor: pointer !important;
|
||||
transition: all 0.2s ease !important;
|
||||
font-size: 0.875rem !important;
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
|
||||
::deep .header-btn:hover {
|
||||
background: #1e293b !important;
|
||||
border-color: #475569 !important;
|
||||
transform: translateY(-1px) !important;
|
||||
}
|
||||
|
||||
::deep .header-btn.notifications {
|
||||
padding: 0.75rem !important;
|
||||
}
|
||||
|
||||
::deep .header-btn.notifications .bi {
|
||||
font-size: 1.125rem !important;
|
||||
}
|
||||
|
||||
::deep .header-btn.bot-control {
|
||||
padding: 0.75rem 1.5rem !important;
|
||||
}
|
||||
|
||||
::deep .header-btn.bot-control .bi {
|
||||
font-size: 1.125rem !important;
|
||||
}
|
||||
|
||||
::deep .header-btn.bot-control.running {
|
||||
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
|
||||
border-color: #6366f1 !important;
|
||||
color: white !important;
|
||||
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
|
||||
}
|
||||
|
||||
::deep .header-btn.bot-control.running:hover {
|
||||
box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4) !important;
|
||||
}
|
||||
|
||||
::deep .btn-label {
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
|
||||
/* Page Content */
|
||||
::deep .page-content {
|
||||
flex: 1 !important;
|
||||
padding: 2rem !important;
|
||||
overflow-y: auto !important;
|
||||
background: #0a0e27 !important;
|
||||
}
|
||||
|
||||
/* Scrollbar Styling */
|
||||
::deep .sidebar-menu::-webkit-scrollbar,
|
||||
::deep .page-content::-webkit-scrollbar {
|
||||
width: 0.375rem !important;
|
||||
}
|
||||
|
||||
::deep .sidebar-menu::-webkit-scrollbar-track,
|
||||
::deep .page-content::-webkit-scrollbar-track {
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
::deep .sidebar-menu::-webkit-scrollbar-thumb,
|
||||
::deep .page-content::-webkit-scrollbar-thumb {
|
||||
background: #334155 !important;
|
||||
border-radius: 0.25rem !important;
|
||||
}
|
||||
|
||||
::deep .sidebar-menu::-webkit-scrollbar-thumb:hover,
|
||||
::deep .page-content::-webkit-scrollbar-thumb:hover {
|
||||
background: #475569 !important;
|
||||
}
|
||||
|
||||
/* ==============================================
|
||||
RESPONSIVE DESIGN
|
||||
============================================== */
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
::deep .modern-sidebar {
|
||||
width: 260px !important;
|
||||
}
|
||||
|
||||
::deep .main-area {
|
||||
margin-left: 260px !important;
|
||||
}
|
||||
|
||||
::deep .trading-bot-layout.collapsed .modern-sidebar {
|
||||
width: 70px !important;
|
||||
}
|
||||
|
||||
::deep .trading-bot-layout.collapsed .main-area {
|
||||
margin-left: 70px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
::deep .modern-sidebar {
|
||||
transform: translateX(-100%) !important;
|
||||
width: 280px !important;
|
||||
}
|
||||
|
||||
::deep .trading-bot-layout.sidebar-open .modern-sidebar {
|
||||
transform: translateX(0) !important;
|
||||
}
|
||||
|
||||
::deep .main-area {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
|
||||
::deep .content-header {
|
||||
padding: 1rem 1.5rem !important;
|
||||
}
|
||||
|
||||
::deep .page-content {
|
||||
padding: 1.5rem !important;
|
||||
}
|
||||
|
||||
::deep .header-btn.bot-control .btn-label {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
::deep .page-content {
|
||||
padding: 1rem !important;
|
||||
}
|
||||
|
||||
::deep .sidebar-brand {
|
||||
padding: 1.5rem 1rem !important;
|
||||
}
|
||||
}
|
||||
31
TradingBot/Components/Layout/ReconnectModal.razor
Normal file
31
TradingBot/Components/Layout/ReconnectModal.razor
Normal file
@@ -0,0 +1,31 @@
|
||||
<script type="module" src="@Assets["Components/Layout/ReconnectModal.razor.js"]"></script>
|
||||
|
||||
<dialog id="components-reconnect-modal" data-nosnippet>
|
||||
<div class="components-reconnect-container">
|
||||
<div class="components-rejoining-animation" aria-hidden="true">
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
<p class="components-reconnect-first-attempt-visible">
|
||||
Rejoining the server...
|
||||
</p>
|
||||
<p class="components-reconnect-repeated-attempt-visible">
|
||||
Rejoin failed... trying again in <span id="components-seconds-to-next-attempt"></span> seconds.
|
||||
</p>
|
||||
<p class="components-reconnect-failed-visible">
|
||||
Failed to rejoin.<br />Please retry or reload the page.
|
||||
</p>
|
||||
<button id="components-reconnect-button" class="components-reconnect-failed-visible">
|
||||
Retry
|
||||
</button>
|
||||
<p class="components-pause-visible">
|
||||
The session has been paused by the server.
|
||||
</p>
|
||||
<button id="components-resume-button" class="components-pause-visible">
|
||||
Resume
|
||||
</button>
|
||||
<p class="components-resume-failed-visible">
|
||||
Failed to resume the session.<br />Please reload the page.
|
||||
</p>
|
||||
</div>
|
||||
</dialog>
|
||||
157
TradingBot/Components/Layout/ReconnectModal.razor.css
Normal file
157
TradingBot/Components/Layout/ReconnectModal.razor.css
Normal file
@@ -0,0 +1,157 @@
|
||||
.components-reconnect-first-attempt-visible,
|
||||
.components-reconnect-repeated-attempt-visible,
|
||||
.components-reconnect-failed-visible,
|
||||
.components-pause-visible,
|
||||
.components-resume-failed-visible,
|
||||
.components-rejoining-animation {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#components-reconnect-modal.components-reconnect-show .components-reconnect-first-attempt-visible,
|
||||
#components-reconnect-modal.components-reconnect-show .components-rejoining-animation,
|
||||
#components-reconnect-modal.components-reconnect-paused .components-pause-visible,
|
||||
#components-reconnect-modal.components-reconnect-resume-failed .components-resume-failed-visible,
|
||||
#components-reconnect-modal.components-reconnect-retrying,
|
||||
#components-reconnect-modal.components-reconnect-retrying .components-reconnect-repeated-attempt-visible,
|
||||
#components-reconnect-modal.components-reconnect-retrying .components-rejoining-animation,
|
||||
#components-reconnect-modal.components-reconnect-failed,
|
||||
#components-reconnect-modal.components-reconnect-failed .components-reconnect-failed-visible {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
#components-reconnect-modal {
|
||||
background-color: white;
|
||||
width: 20rem;
|
||||
margin: 20vh auto;
|
||||
padding: 2rem;
|
||||
border: 0;
|
||||
border-radius: 0.5rem;
|
||||
box-shadow: 0 3px 6px 2px rgba(0, 0, 0, 0.3);
|
||||
opacity: 0;
|
||||
transition: display 0.5s allow-discrete, overlay 0.5s allow-discrete;
|
||||
animation: components-reconnect-modal-fadeOutOpacity 0.5s both;
|
||||
&[open]
|
||||
|
||||
{
|
||||
animation: components-reconnect-modal-slideUp 1.5s cubic-bezier(.05, .89, .25, 1.02) 0.3s, components-reconnect-modal-fadeInOpacity 0.5s ease-in-out 0.3s;
|
||||
animation-fill-mode: both;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#components-reconnect-modal::backdrop {
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
animation: components-reconnect-modal-fadeInOpacity 0.5s ease-in-out;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@keyframes components-reconnect-modal-slideUp {
|
||||
0% {
|
||||
transform: translateY(30px) scale(0.95);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes components-reconnect-modal-fadeInOpacity {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes components-reconnect-modal-fadeOutOpacity {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.components-reconnect-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
#components-reconnect-modal p {
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#components-reconnect-modal button {
|
||||
border: 0;
|
||||
background-color: #6b9ed2;
|
||||
color: white;
|
||||
padding: 4px 24px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
#components-reconnect-modal button:hover {
|
||||
background-color: #3b6ea2;
|
||||
}
|
||||
|
||||
#components-reconnect-modal button:active {
|
||||
background-color: #6b9ed2;
|
||||
}
|
||||
|
||||
.components-rejoining-animation {
|
||||
position: relative;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.components-rejoining-animation div {
|
||||
position: absolute;
|
||||
border: 3px solid #0087ff;
|
||||
opacity: 1;
|
||||
border-radius: 50%;
|
||||
animation: components-rejoining-animation 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
|
||||
}
|
||||
|
||||
.components-rejoining-animation div:nth-child(2) {
|
||||
animation-delay: -0.5s;
|
||||
}
|
||||
|
||||
@keyframes components-rejoining-animation {
|
||||
0% {
|
||||
top: 40px;
|
||||
left: 40px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
4.9% {
|
||||
top: 40px;
|
||||
left: 40px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
5% {
|
||||
top: 40px;
|
||||
left: 40px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
63
TradingBot/Components/Layout/ReconnectModal.razor.js
Normal file
63
TradingBot/Components/Layout/ReconnectModal.razor.js
Normal file
@@ -0,0 +1,63 @@
|
||||
// Set up event handlers
|
||||
const reconnectModal = document.getElementById("components-reconnect-modal");
|
||||
reconnectModal.addEventListener("components-reconnect-state-changed", handleReconnectStateChanged);
|
||||
|
||||
const retryButton = document.getElementById("components-reconnect-button");
|
||||
retryButton.addEventListener("click", retry);
|
||||
|
||||
const resumeButton = document.getElementById("components-resume-button");
|
||||
resumeButton.addEventListener("click", resume);
|
||||
|
||||
function handleReconnectStateChanged(event) {
|
||||
if (event.detail.state === "show") {
|
||||
reconnectModal.showModal();
|
||||
} else if (event.detail.state === "hide") {
|
||||
reconnectModal.close();
|
||||
} else if (event.detail.state === "failed") {
|
||||
document.addEventListener("visibilitychange", retryWhenDocumentBecomesVisible);
|
||||
} else if (event.detail.state === "rejected") {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
async function retry() {
|
||||
document.removeEventListener("visibilitychange", retryWhenDocumentBecomesVisible);
|
||||
|
||||
try {
|
||||
// Reconnect will asynchronously return:
|
||||
// - true to mean success
|
||||
// - false to mean we reached the server, but it rejected the connection (e.g., unknown circuit ID)
|
||||
// - exception to mean we didn't reach the server (this can be sync or async)
|
||||
const successful = await Blazor.reconnect();
|
||||
if (!successful) {
|
||||
// We have been able to reach the server, but the circuit is no longer available.
|
||||
// We'll reload the page so the user can continue using the app as quickly as possible.
|
||||
const resumeSuccessful = await Blazor.resumeCircuit();
|
||||
if (!resumeSuccessful) {
|
||||
location.reload();
|
||||
} else {
|
||||
reconnectModal.close();
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
// We got an exception, server is currently unavailable
|
||||
document.addEventListener("visibilitychange", retryWhenDocumentBecomesVisible);
|
||||
}
|
||||
}
|
||||
|
||||
async function resume() {
|
||||
try {
|
||||
const successful = await Blazor.resumeCircuit();
|
||||
if (!successful) {
|
||||
location.reload();
|
||||
}
|
||||
} catch {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
async function retryWhenDocumentBecomesVisible() {
|
||||
if (document.visibilityState === "visible") {
|
||||
await retry();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user