HungryTorch commited on
Commit
6fbeb8c
verified
1 Parent(s): c9d0ebc

fix(primo): align and recolor navigation rail

Browse files
Files changed (2) hide show
  1. primo.css +3 -0
  2. render.py +11 -5
primo.css CHANGED
@@ -80,6 +80,9 @@ footer { display: none !important; }
80
  #pm-rail .pm-link.pm-active::before { opacity: 1; }
81
  .pm-link .pm-count { font: 400 12px/1 var(--font-mono); opacity: .75; }
82
  .pm-link .pm-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
 
 
 
83
 
84
  .pm-rail-foot { margin-top: auto; padding: 16px; border-top: 1px solid var(--sidebar-border); }
85
  #pm-rail .pm-foot-link {
 
80
  #pm-rail .pm-link.pm-active::before { opacity: 1; }
81
  .pm-link .pm-count { font: 400 12px/1 var(--font-mono); opacity: .75; }
82
  .pm-link .pm-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
83
+ /* Gradio colours <span>/<b> explicitly, which beats inheriting the link colour;
84
+ force the rail's inner text to take the link/brand colour instead. */
85
+ #pm-rail .pm-link .pm-label, #pm-rail .pm-link .pm-count, #pm-rail .pm-brand b { color: inherit !important; }
86
 
87
  .pm-rail-foot { margin-top: auto; padding: 16px; border-top: 1px solid var(--sidebar-border); }
88
  #pm-rail .pm-foot-link {
render.py CHANGED
@@ -33,7 +33,6 @@ from boards import (
33
  MODALITY_GROUP,
34
  Board,
35
  OpenBoard,
36
- featured,
37
  in_group,
38
  metric_label,
39
  open_in_group,
@@ -63,7 +62,9 @@ RIGHT_COLUMNS = frozenset({"Rank", "Patients"})
63
 
64
 
65
  # --------------------------------------------------------------------- rail
66
- def rail_html(boards: list[Board], active_slug: str | None, active_tab: str | None) -> str:
 
 
67
  """The left navigation: brand, one link per board grouped by facet, foot links.
68
 
69
  ``active_slug`` highlights the board a visitor is on; ``active_tab`` highlights
@@ -75,7 +76,7 @@ def rail_html(boards: list[Board], active_slug: str | None, active_tab: str | No
75
  if not cards and not opens:
76
  continue
77
  parts.append(
78
- f'<div class="pm-rail-group"><p class="pm-rail-label">{escape(group)}</p></div>'
79
  )
80
  for board in cards:
81
  cls = "pm-link pm-active" if board.slug == active_slug else "pm-link"
@@ -90,6 +91,7 @@ def rail_html(boards: list[Board], active_slug: str | None, active_tab: str | No
90
  f'<span class="pm-label">{escape(board.name)}</span>'
91
  '<span class="pm-badge pm-badge--quiet">open</span></a>'
92
  )
 
93
  parts.append('<div class="pm-rail-foot">')
94
  for tab, label in FOOT_LINKS:
95
  cls = "pm-foot-link pm-active" if tab == active_tab else "pm-foot-link"
@@ -180,7 +182,7 @@ def render_boards(boards: list[Board], df: pd.DataFrame, by_id: dict[str, dict])
180
  if not cards and not opens:
181
  continue
182
  note = escape(GROUP_NOTE.get(group, ""))
183
- counter = f' 路 +{len(opens)} open' if opens else ""
184
  out.append(
185
  '<div class="pm-group"><div class="pm-group-head">'
186
  f'<p class="pm-over">{escape(group)}</p>'
@@ -263,7 +265,11 @@ def _df_to_table(df: pd.DataFrame, bold_axis: int | None, empty: str) -> str:
263
 
264
  head = []
265
  for col in df.columns:
266
- align = ' style="text-align:right"' if col in score_cols or col in RIGHT_COLUMNS else ""
 
 
 
 
267
  head.append(f"<th{align}>{escape(str(col))}</th>")
268
  body = []
269
  for idx, row in df.iterrows():
 
33
  MODALITY_GROUP,
34
  Board,
35
  OpenBoard,
 
36
  in_group,
37
  metric_label,
38
  open_in_group,
 
62
 
63
 
64
  # --------------------------------------------------------------------- rail
65
+ def rail_html(
66
+ boards: list[Board], active_slug: str | None, active_tab: str | None
67
+ ) -> str:
68
  """The left navigation: brand, one link per board grouped by facet, foot links.
69
 
70
  ``active_slug`` highlights the board a visitor is on; ``active_tab`` highlights
 
76
  if not cards and not opens:
77
  continue
78
  parts.append(
79
+ f'<div class="pm-rail-group"><p class="pm-rail-label">{escape(group)}</p>'
80
  )
81
  for board in cards:
82
  cls = "pm-link pm-active" if board.slug == active_slug else "pm-link"
 
91
  f'<span class="pm-label">{escape(board.name)}</span>'
92
  '<span class="pm-badge pm-badge--quiet">open</span></a>'
93
  )
94
+ parts.append("</div>")
95
  parts.append('<div class="pm-rail-foot">')
96
  for tab, label in FOOT_LINKS:
97
  cls = "pm-foot-link pm-active" if tab == active_tab else "pm-foot-link"
 
182
  if not cards and not opens:
183
  continue
184
  note = escape(GROUP_NOTE.get(group, ""))
185
+ counter = f" 路 +{len(opens)} open" if opens else ""
186
  out.append(
187
  '<div class="pm-group"><div class="pm-group-head">'
188
  f'<p class="pm-over">{escape(group)}</p>'
 
265
 
266
  head = []
267
  for col in df.columns:
268
+ align = (
269
+ ' style="text-align:right"'
270
+ if col in score_cols or col in RIGHT_COLUMNS
271
+ else ""
272
+ )
273
  head.append(f"<th{align}>{escape(str(col))}</th>")
274
  body = []
275
  for idx, row in df.iterrows():