Persist best share glow, share animations, and UI polish

Backend:
- Persist best_diff as a high-water mark in kv store so it survives
  restarts and transient ckpool gaps
- Persist acked_best_diff so the "new best share" glow survives pool
  restarts and works across multiple new bests before dismissal
- Add POST /api/admin/ack-best and /api/admin/reset-ack-best endpoints

Frontend:
- Best share card: golden glow, shimmer, sparkles, "NEW BEST SHARE!"
  tag with previous value, "Nice" dismiss button
- Optimistic local override so Nice/test buttons respond instantly
  instead of waiting for next WebSocket push
- Fix shimmer sweep to go left-to-right (not start from middle)
- Share animations: reject (red flash + shake) suppresses accept;
  reject effect declared first so guard reads correct state
- Share tooltips show exact counts on hover
- Block reward tooltip shows full amount in satoshis
- Expected block uses 1h hashrate instead of 1m
- formatDuration uses full unit names; years always show 1 decimal
- formatWork always shows 2 decimal places
- Map chain "main" to "mainnet" in block height card
This commit is contained in:
satoshi
2026-05-12 21:56:02 +03:00
parent 467fe5e2ef
commit f1dc0a8a79
6 changed files with 392 additions and 30 deletions
+12
View File
@@ -41,6 +41,8 @@ func (s *Server) Handler() http.Handler {
mux.HandleFunc("GET /api/ws", s.handleWS)
mux.HandleFunc("GET /api/admin/debug-blocks", s.debugBlocks)
mux.HandleFunc("POST /api/admin/reset-latency", s.resetLatency)
mux.HandleFunc("POST /api/admin/ack-best", s.ackBest)
mux.HandleFunc("POST /api/admin/reset-ack-best", s.resetAckBest)
mux.HandleFunc("POST /api/accelerate", s.accelerate)
mux.HandleFunc("POST /api/accelerate/cancel", s.accelerateCancel)
mux.HandleFunc("POST /api/accelerate/max", s.accelerateMax)
@@ -220,3 +222,13 @@ func (s *Server) resetLatency(w http.ResponseWriter, _ *http.Request) {
s.Agg.ResetLatency()
writeJSON(w, http.StatusOK, map[string]any{"ok": true})
}
func (s *Server) ackBest(w http.ResponseWriter, _ *http.Request) {
s.Agg.AckBestDiff()
writeJSON(w, http.StatusOK, map[string]any{"ok": true})
}
func (s *Server) resetAckBest(w http.ResponseWriter, _ *http.Request) {
s.Agg.ResetAckedBestDiff()
writeJSON(w, http.StatusOK, map[string]any{"ok": true})
}