Jellyfish042 commited on
Commit
72aa518
·
1 Parent(s): be9fa5b

fix table display for small resolution screens

Browse files
Files changed (1) hide show
  1. app.py +20 -13
app.py CHANGED
@@ -269,11 +269,10 @@ def update_table(
269
  ],
270
  }
271
  )
272
- table_styles.append({"selector": "table", "props": [("border-collapse", "collapse"), ("border", f"1px solid var(--border-color-primary)")]})
273
- for i, w in enumerate(widths):
274
- table_styles.append(
275
- {
276
- "selector": f"th.col{i}, td.col{i}",
277
  "props": [
278
  ("min-width", f"{w}px"),
279
  ("max-width", f"{w}px"),
@@ -326,18 +325,26 @@ def update_table(
326
  ],
327
  }
328
  )
329
- table_styles.append(
330
- {
331
- "selector": "td:last-child:hover .cell-tooltip-trigger[data-tooltip]::after",
332
- "props": [
333
  ("left", "auto"),
334
  ("right", "0"),
335
  ("transform", "none"),
336
  ],
337
- }
338
- )
339
- styler = styler.set_table_styles(table_styles)
340
- return styler.to_html()
 
 
 
 
 
 
 
 
341
 
342
 
343
  def check_model_exists(model_id):
 
269
  ],
270
  }
271
  )
272
+ for i, w in enumerate(widths):
273
+ table_styles.append(
274
+ {
275
+ "selector": f"th.col{i}, td.col{i}",
 
276
  "props": [
277
  ("min-width", f"{w}px"),
278
  ("max-width", f"{w}px"),
 
325
  ],
326
  }
327
  )
328
+ table_styles.append(
329
+ {
330
+ "selector": "td:last-child:hover .cell-tooltip-trigger[data-tooltip]::after",
331
+ "props": [
332
  ("left", "auto"),
333
  ("right", "0"),
334
  ("transform", "none"),
335
  ],
336
+ }
337
+ )
338
+ styler = styler.set_table_styles(table_styles)
339
+ styler = styler.set_table_attributes(
340
+ 'style="border-collapse: collapse; border: 1px solid var(--border-color-primary); width: max-content !important; min-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important;"'
341
+ )
342
+ table_html = styler.to_html()
343
+ return (
344
+ '<div class="leaderboard-table-scroll" style="width: 100%; max-width: 100%; overflow-x: auto; padding-bottom: 4px;">'
345
+ f"{table_html}"
346
+ "</div>"
347
+ )
348
 
349
 
350
  def check_model_exists(model_id):