Add a maintenance pause/resume switch and a proper user navbar
RoundConfig gets a paused flag toggled via new POST /admin/pause and /admin/resume endpoints (audit-logged, surfaced as a "Manutenzione" card in the admin Parametri view). Pausing only stops the *next* round from opening once the current one closes — rounds/service.py:open_new_round_if_needed still lets an in-progress round finish, draw, and pay out its winner normally. GET /rounds/current exposes lottery_paused so the user page shows a maintenance banner (even while logged out) instead of silently going idle. Also replaces the user dashboard's stacked account-bar card + bento-grid menu with a single sticky navbar (identity row + Deposito/Bet/Prelievo tabs), and moves the page content into a dedicated .app-shell container so the navbar itself can span full width.
This commit is contained in:
+76
-65
@@ -30,17 +30,12 @@
|
||||
font-family: 'Fira Sans', system-ui, sans-serif;
|
||||
background: var(--color-background);
|
||||
color: var(--color-foreground);
|
||||
max-width: 480px;
|
||||
margin: 0 auto;
|
||||
padding: 32px 20px 80px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.mono { font-family: 'Fira Code', monospace; }
|
||||
.app-shell { max-width: 480px; margin: 0 auto; padding: 24px 20px 80px; }
|
||||
|
||||
header { margin-bottom: 24px; }
|
||||
header h1 { font-size: 1.375rem; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
|
||||
header p { color: var(--color-muted-foreground); font-size: 0.9rem; margin: 4px 0 0; }
|
||||
.mono { font-family: 'Fira Code', monospace; }
|
||||
|
||||
.card {
|
||||
background: var(--color-surface);
|
||||
@@ -102,11 +97,37 @@
|
||||
}
|
||||
button.link:hover { filter: none; color: var(--color-foreground); }
|
||||
|
||||
.account-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
|
||||
.account-bar .name { font-weight: 600; }
|
||||
|
||||
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
||||
|
||||
/* --- sticky app navbar: identity row + section tabs, shown only when logged in --- */
|
||||
.app-navbar {
|
||||
position: sticky; top: 0; z-index: 20;
|
||||
background: color-mix(in srgb, var(--color-surface) 92%, transparent);
|
||||
backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
|
||||
border-bottom: 1px solid var(--color-border); margin-bottom: 20px;
|
||||
}
|
||||
.app-navbar-top {
|
||||
max-width: 480px; margin: 0 auto; padding: 12px 20px 8px;
|
||||
display: flex; align-items: center; justify-content: space-between; gap: 12px;
|
||||
}
|
||||
.app-navbar-top .brand { font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }
|
||||
.app-navbar-account { display: flex; align-items: center; gap: 10px; }
|
||||
.app-navbar-account .name { font-weight: 600; font-size: 0.85rem; }
|
||||
|
||||
.app-navbar-tabs { max-width: 480px; margin: 0 auto; padding: 0 12px; display: flex; }
|
||||
.app-navbar-tabs button.navbar-tab {
|
||||
flex: 1; width: auto; min-height: auto; margin-top: 0; padding: 8px 4px 10px;
|
||||
display: flex; flex-direction: column; align-items: center; gap: 3px;
|
||||
font-size: 0.72rem; font-weight: 600; font-family: inherit; cursor: pointer;
|
||||
background: none; color: var(--color-muted-foreground);
|
||||
border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
|
||||
transition: color 150ms, border-color 150ms;
|
||||
}
|
||||
.app-navbar-tabs button.navbar-tab .icon { width: 18px; height: 18px; }
|
||||
.app-navbar-tabs button.navbar-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
|
||||
.app-navbar-tabs button.navbar-tab:hover { filter: none; color: var(--color-foreground); }
|
||||
.app-navbar-tabs button.navbar-tab.active:hover { color: var(--color-primary); }
|
||||
|
||||
.address-box {
|
||||
display: flex; align-items: center; justify-content: space-between; gap: 8px;
|
||||
background: var(--color-background); border: 1px solid var(--color-border);
|
||||
@@ -118,20 +139,6 @@
|
||||
|
||||
.icon { width: 16px; height: 16px; flex-shrink: 0; }
|
||||
|
||||
nav.menu { display: flex; gap: 4px; margin-bottom: 16px; }
|
||||
nav.menu button.nav-item {
|
||||
flex: 1; width: auto; margin-top: 0; min-height: 56px; padding: 8px 4px;
|
||||
flex-direction: column; gap: 4px; font-size: 0.8rem; font-weight: 600;
|
||||
background: var(--color-surface); color: var(--color-muted-foreground);
|
||||
border: 1px solid var(--color-border); border-radius: 10px;
|
||||
}
|
||||
nav.menu button.nav-item .icon { width: 20px; height: 20px; }
|
||||
nav.menu button.nav-item.active {
|
||||
background: var(--color-primary); color: var(--color-on-primary); border-color: var(--color-primary);
|
||||
}
|
||||
nav.menu button.nav-item:hover { filter: none; border-color: var(--color-ring); }
|
||||
nav.menu button.nav-item.active:hover { filter: brightness(0.94); }
|
||||
|
||||
.dash-panel { display: none; }
|
||||
.dash-panel.active { display: block; }
|
||||
|
||||
@@ -220,25 +227,6 @@
|
||||
}
|
||||
.trust-pill .icon { width: 13px; height: 13px; color: var(--color-success); flex-shrink: 0; }
|
||||
|
||||
/* --- bento nav for the dashboard menu --- */
|
||||
nav.menu.bento {
|
||||
display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "deposit deposit" "bet withdraw";
|
||||
gap: 8px;
|
||||
}
|
||||
nav.menu.bento button.nav-item {
|
||||
width: 100%; align-items: flex-start; text-align: left; flex-direction: row; gap: 10px;
|
||||
min-height: 64px; padding: 12px 14px; border-radius: 14px;
|
||||
}
|
||||
nav.menu.bento button#nav-deposit { grid-area: deposit; }
|
||||
nav.menu.bento button#nav-bet { grid-area: bet; }
|
||||
nav.menu.bento button#nav-withdraw { grid-area: withdraw; }
|
||||
nav.menu.bento button.nav-item .icon { width: 20px; height: 20px; margin-top: 2px; }
|
||||
nav.menu.bento button.nav-item .nav-item-text { display: flex; flex-direction: column; gap: 2px; }
|
||||
nav.menu.bento button.nav-item .nav-item-title { font-size: 0.85rem; }
|
||||
nav.menu.bento button.nav-item .nav-item-hint {
|
||||
font-size: 0.7rem; font-weight: 400; color: inherit; opacity: 0.75;
|
||||
}
|
||||
|
||||
/* --- glowing card while a round is drawing --- */
|
||||
.card.drawing-glow {
|
||||
border-color: color-mix(in srgb, var(--color-primary) 55%, var(--color-border));
|
||||
@@ -284,6 +272,14 @@
|
||||
}
|
||||
.chain-block { color: var(--color-muted-foreground); white-space: nowrap; }
|
||||
|
||||
.maintenance-banner {
|
||||
display: flex; align-items: flex-start; gap: 8px;
|
||||
background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
|
||||
border: 1px solid color-mix(in srgb, var(--color-primary) 40%, transparent);
|
||||
color: var(--color-foreground); border-radius: var(--radius);
|
||||
padding: 12px 14px; font-size: 0.82rem; line-height: 1.4; margin-bottom: 16px;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
* { animation: none !important; transition: none !important; }
|
||||
}
|
||||
@@ -291,6 +287,32 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="app-navbar hidden" id="app-navbar" aria-label="Sezioni">
|
||||
<div class="app-navbar-top">
|
||||
<span class="brand">PLM Lottery</span>
|
||||
<div class="app-navbar-account">
|
||||
<span class="name" id="dash-username"></span>
|
||||
<button class="link" onclick="logout()">Esci</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="app-navbar-tabs">
|
||||
<button class="navbar-tab active" id="nav-deposit" onclick="switchPanel('deposit')">
|
||||
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="7" width="20" height="14" rx="2"/><path d="M16 21V5a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v16"/></svg>
|
||||
Deposito
|
||||
</button>
|
||||
<button class="navbar-tab" id="nav-bet" onclick="switchPanel('bet')">
|
||||
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="6" width="20" height="12" rx="2"/><path d="M6 12h.01M12 12h.01M18 12h.01"/></svg>
|
||||
Bet
|
||||
</button>
|
||||
<button class="navbar-tab" id="nav-withdraw" onclick="switchPanel('withdraw')">
|
||||
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 19V5M5 12l7-7 7 7"/></svg>
|
||||
Prelievo
|
||||
</button>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="app-shell">
|
||||
|
||||
<div class="chain-bar" id="chain-bar">
|
||||
<span class="chain-status-pill">
|
||||
<span class="status-dot" id="chain-status-dot"></span>
|
||||
@@ -299,6 +321,11 @@
|
||||
<span class="chain-block mono" id="chain-block">Blocco —</span>
|
||||
</div>
|
||||
|
||||
<div class="maintenance-banner hidden" id="maintenance-banner">
|
||||
<span>⚠️</span>
|
||||
<span>Manutenzione in programma: il round in corso viene completato regolarmente (vincitore incluso), ma il round successivo non si aprirà finché la manutenzione non sarà terminata.</span>
|
||||
</div>
|
||||
|
||||
<section id="landing-hero" class="hero">
|
||||
<h1>PLM Lottery</h1>
|
||||
<p class="lead">Deposita PLM, entra nel round con una quota fissa, e se viene estratto il tuo numero vinci il montepremi.</p>
|
||||
@@ -355,13 +382,6 @@
|
||||
|
||||
<section id="dashboard-section" class="hidden">
|
||||
|
||||
<div class="card">
|
||||
<div class="account-bar">
|
||||
<span class="name" id="dash-username"></span>
|
||||
<button class="link" onclick="logout()">Esci</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card" id="round-card">
|
||||
<div class="row-between" id="round-normal-row">
|
||||
<h2 id="round-title">Round —</h2>
|
||||
@@ -386,21 +406,6 @@
|
||||
<div class="hidden" id="draw-result"></div>
|
||||
</div>
|
||||
|
||||
<nav class="menu bento" aria-label="Sezioni">
|
||||
<button class="nav-item active" id="nav-deposit" onclick="switchPanel('deposit')">
|
||||
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="7" width="20" height="14" rx="2"/><path d="M16 21V5a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v16"/></svg>
|
||||
<span class="nav-item-text"><span class="nav-item-title">Deposito</span><span class="nav-item-hint">Indirizzo e saldo</span></span>
|
||||
</button>
|
||||
<button class="nav-item" id="nav-bet" onclick="switchPanel('bet')">
|
||||
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="6" width="20" height="12" rx="2"/><path d="M6 12h.01M12 12h.01M18 12h.01"/></svg>
|
||||
<span class="nav-item-text"><span class="nav-item-title">Bet</span><span class="nav-item-hint">Entra nel round</span></span>
|
||||
</button>
|
||||
<button class="nav-item" id="nav-withdraw" onclick="switchPanel('withdraw')">
|
||||
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 19V5M5 12l7-7 7 7"/></svg>
|
||||
<span class="nav-item-text"><span class="nav-item-title">Prelievo</span><span class="nav-item-hint">Verso indirizzo esterno</span></span>
|
||||
</button>
|
||||
</nav>
|
||||
|
||||
<div class="dash-panel active" id="panel-deposit">
|
||||
<div class="card">
|
||||
<h2>Saldo interno</h2>
|
||||
@@ -451,6 +456,8 @@
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="toast-container" aria-live="polite"></div>
|
||||
|
||||
<script>
|
||||
@@ -536,6 +543,8 @@ function updateChainStatusBar(data) {
|
||||
dot.className = 'status-dot status-' + statusKey;
|
||||
label.textContent = CHAIN_STATUS_LABELS[statusKey];
|
||||
block.textContent = 'Blocco ' + (data.chain_tip_height != null ? '#' + data.chain_tip_height : '—');
|
||||
|
||||
document.getElementById('maintenance-banner').classList.toggle('hidden', !data.lottery_paused);
|
||||
}
|
||||
|
||||
let chainOnlyInterval = null;
|
||||
@@ -669,6 +678,7 @@ function showDashboard() {
|
||||
stopChainOnlyPolling();
|
||||
document.getElementById('landing-hero').classList.add('hidden');
|
||||
document.getElementById('auth-section').classList.add('hidden');
|
||||
document.getElementById('app-navbar').classList.remove('hidden');
|
||||
document.getElementById('dashboard-section').classList.remove('hidden');
|
||||
document.getElementById('dash-username').textContent = username;
|
||||
document.getElementById('dash-address').textContent = address;
|
||||
@@ -732,6 +742,7 @@ function logout() {
|
||||
for (const key of Object.keys(drawStartedAt)) delete drawStartedAt[key];
|
||||
clearInterval(roundTimerInterval);
|
||||
clearTimeout(roundPollTimeout);
|
||||
document.getElementById('app-navbar').classList.add('hidden');
|
||||
document.getElementById('dashboard-section').classList.add('hidden');
|
||||
document.getElementById('auth-section').classList.remove('hidden');
|
||||
document.getElementById('landing-hero').classList.remove('hidden');
|
||||
|
||||
Reference in New Issue
Block a user