Burnmydays Devin commited on
Commit
2685eca
·
1 Parent(s): 1497b0e

fix: slim 3-col mini board for Clock Your Signal tab (no overlap)

Browse files

Replace full 8-column board_html() in the narrow left column with
board_html_slim() — shows only # / operator / SNR / 10x DEV / Υ.
Inline grid layout so it can't fight the .moses-board CSS columns.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Files changed (1) hide show
  1. app.py +53 -2
app.py CHANGED
@@ -45,6 +45,57 @@ def _cost_str(m):
45
  SORT_LABELS = {"Υ yield": "yield", "SNR": "snr", "10x DEV": "dev10x",
46
  "velocity": "velocity", "leverage": "leverage", "$/1M": "avg_cost_1m"}
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  def board_html(extra=None, sort_key="yield"):
49
  ops = operators()
50
  # dedup: if `extra` is already persisted, replace it so it shows once + highlighted
@@ -304,7 +355,7 @@ def run_ingest(blob, name, request: gr.Request):
304
  comp_bar_html(m["composition"]),
305
  card_html(name,m,rank,len(rows),read),
306
  hits_html,
307
- board_html((name,m)))
308
 
309
  # ---------- interactive leaderboard helpers ----------
310
  def resort_board(label):
@@ -432,7 +483,7 @@ npx ccusage@latest codex --json
432
  placeholder='Paste ccusage JSON here\n\nor four numbers: input output cache_create cache_read\n\nExample: 1251211 11296121 128196310 2555179769')
433
  go = gr.Button("Clock My Signal", variant="primary", elem_id="compute-btn")
434
  gr.Markdown("### Your live board placement")
435
- ob = gr.HTML(board_html())
436
  gr.Markdown("### Greatest hits")
437
  hits = gr.HTML()
438
  with gr.Column(scale=6):
 
45
  SORT_LABELS = {"Υ yield": "yield", "SNR": "snr", "10x DEV": "dev10x",
46
  "velocity": "velocity", "leverage": "leverage", "$/1M": "avg_cost_1m"}
47
 
48
+ def board_html_slim(extra=None):
49
+ """3-column mini board for the Clock Your Signal tab (SNR · 10x DEV · Υ)."""
50
+ ops = operators()
51
+ rows = [(n, compute(*v)) for n, v in ops.items() if not (extra and n == extra[0])]
52
+ if extra: rows.append(extra)
53
+ ymax = max((m["yield"] for _, m in rows), default=1) or 1
54
+ rows.sort(key=lambda r: r[1]["yield"], reverse=True)
55
+ out = ['<div class="moses-board">']
56
+ out.append('<div style="display:grid;grid-template-columns:28px 1fr 0.55fr 0.55fr 1.1fr;'
57
+ 'align-items:center;gap:8px;padding:8px 10px;'
58
+ 'color:#C4923A;font-size:10px;letter-spacing:0.06em;text-transform:uppercase;'
59
+ 'border-bottom:1px solid #C4923A;">'
60
+ '<span>#</span><span>operator</span>'
61
+ '<span style="text-align:right">SNR</span>'
62
+ '<span style="text-align:right">10x DEV</span>'
63
+ '<span style="text-align:right">\u03a5 yield</span></div>')
64
+ for i, (n, m) in enumerate(rows, 1):
65
+ y = m["yield"]; you = extra and n == extra[0]
66
+ orders = _math.log10(ymax / y) if y > 0 else 99
67
+ barpct = max(2, 100 * (1 - orders / 5))
68
+ d = f"{m['dev10x']:.2f}" if m['dev10x'] is not None else "\u2014"
69
+ rank_cls = f"mb-rank-{i}" if i <= 3 else ""
70
+ rkey = rarity_class(m)[0]
71
+ if you:
72
+ cls = f"species-{rkey} you"
73
+ row_style = "background:rgba(196,146,58,0.10);color:#E8E0CF;"
74
+ elif i == 1:
75
+ cls = f"species-{rkey} rank1"
76
+ row_style = "background:rgba(196,146,58,0.12);color:#E8E0CF;"
77
+ else:
78
+ cls = f"species-{rkey}"
79
+ row_style = ""
80
+ ne = _html.escape(n)
81
+ est_mark = "<span class='mb-est' title='estimated'>*</span>" if m.get("cost_estimated") else ""
82
+ out.append(
83
+ f'<div class="mb-row {cls}" style="display:grid;grid-template-columns:28px 1fr 0.55fr 0.55fr 1.1fr;'
84
+ f'align-items:center;gap:8px;padding:7px 10px;border-bottom:1px solid #3A3324;'
85
+ f'font-size:11px;{row_style}">'
86
+ f'<span class="mb-rank {rank_cls}">{i}</span>'
87
+ f'<span><b style="color:#E8E0CF">{ne}{est_mark}</b></span>'
88
+ f'<span style="text-align:right;color:#8a7f68">{m["snr"]:.3f}</span>'
89
+ f'<span style="text-align:right;color:#8a7f68">{d}</span>'
90
+ f'<span class="mb-y" style="position:relative;display:flex;align-items:center;justify-content:flex-end;min-height:18px">'
91
+ f'<span class="mb-bar" style="width:{barpct:.0f}%"></span>'
92
+ f'<span class="mb-yval" style="position:relative;z-index:2;font-weight:700;font-size:11px;padding-right:3px">{y:,.0f}</span>'
93
+ f'</span></div>'
94
+ )
95
+ out.append('</div>')
96
+ out.append('<div class="mb-foot">\u03a5 bar is log-scaled \u00b7 volume can\'t buy rank</div>')
97
+ return "".join(out)
98
+
99
  def board_html(extra=None, sort_key="yield"):
100
  ops = operators()
101
  # dedup: if `extra` is already persisted, replace it so it shows once + highlighted
 
355
  comp_bar_html(m["composition"]),
356
  card_html(name,m,rank,len(rows),read),
357
  hits_html,
358
+ board_html_slim((name,m)))
359
 
360
  # ---------- interactive leaderboard helpers ----------
361
  def resort_board(label):
 
483
  placeholder='Paste ccusage JSON here\n\nor four numbers: input output cache_create cache_read\n\nExample: 1251211 11296121 128196310 2555179769')
484
  go = gr.Button("Clock My Signal", variant="primary", elem_id="compute-btn")
485
  gr.Markdown("### Your live board placement")
486
+ ob = gr.HTML(board_html_slim())
487
  gr.Markdown("### Greatest hits")
488
  hits = gr.HTML()
489
  with gr.Column(scale=6):