make more mobile friendly
Browse files- assets/styles.css +39 -2
- graphs/leaderboard.py +63 -50
assets/styles.css
CHANGED
|
@@ -53,9 +53,8 @@
|
|
| 53 |
overflow: visible;
|
| 54 |
display: inline-flex !important;
|
| 55 |
align-items: center !important;
|
| 56 |
-
padding: 6px 12px !important;
|
| 57 |
font-size: 14px !important;
|
| 58 |
-
margin: 0 auto !important;
|
| 59 |
background-color: #AC482A !important; /* restore previous button color */
|
| 60 |
color: #FFFFFF !important;
|
| 61 |
border-radius: 5px !important;
|
|
@@ -293,6 +292,44 @@ button[id^="download-"]:focus {
|
|
| 293 |
color: #082030;
|
| 294 |
}
|
| 295 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
@media (max-width: 1150px) {
|
| 297 |
.responsive-main-content {
|
| 298 |
flex-direction: column !important;
|
|
|
|
| 53 |
overflow: visible;
|
| 54 |
display: inline-flex !important;
|
| 55 |
align-items: center !important;
|
| 56 |
+
/* padding: 6px 12px !important; */
|
| 57 |
font-size: 14px !important;
|
|
|
|
| 58 |
background-color: #AC482A !important; /* restore previous button color */
|
| 59 |
color: #FFFFFF !important;
|
| 60 |
border-radius: 5px !important;
|
|
|
|
| 292 |
color: #082030;
|
| 293 |
}
|
| 294 |
|
| 295 |
+
/* Leaderboard table column sizing to avoid % column getting squished */
|
| 296 |
+
.leaderboard-table th.rank-col { width: 6%; }
|
| 297 |
+
.leaderboard-table th.name-col { width: 30%; }
|
| 298 |
+
.leaderboard-table th.metadata-col { width: 40%; }
|
| 299 |
+
.leaderboard-table th.percent-col { width: 24%; }
|
| 300 |
+
|
| 301 |
+
/* Ensure body cells follow header widths and metadata wraps */
|
| 302 |
+
.leaderboard-table td.metadata-cell {
|
| 303 |
+
white-space: normal;
|
| 304 |
+
word-break: break-word;
|
| 305 |
+
vertical-align: middle;
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
.leaderboard-table td.percent-cell {
|
| 309 |
+
vertical-align: middle;
|
| 310 |
+
padding-top: 6px;
|
| 311 |
+
padding-bottom: 6px;
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
/* Make inner progress bar fill available cell width */
|
| 315 |
+
.leaderboard-table td.percent-cell > div {
|
| 316 |
+
width: 100% !important;
|
| 317 |
+
box-sizing: border-box;
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
/* On narrow screens, relax fixed layout so table can flow naturally */
|
| 321 |
+
@media (max-width: 720px) {
|
| 322 |
+
.leaderboard-table {
|
| 323 |
+
table-layout: auto !important;
|
| 324 |
+
}
|
| 325 |
+
.leaderboard-table th.rank-col,
|
| 326 |
+
.leaderboard-table th.name-col,
|
| 327 |
+
.leaderboard-table th.metadata-col,
|
| 328 |
+
.leaderboard-table th.percent-col {
|
| 329 |
+
width: auto !important;
|
| 330 |
+
}
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
@media (max-width: 1150px) {
|
| 334 |
.responsive-main-content {
|
| 335 |
flex-direction: column !important;
|
graphs/leaderboard.py
CHANGED
|
@@ -238,61 +238,74 @@ def render_table_content(
|
|
| 238 |
[
|
| 239 |
# Add download button above the table
|
| 240 |
df_to_download_link(download_df, filename),
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
"Rank",
|
| 248 |
-
style={
|
| 249 |
-
"backgroundColor": "#F0F0F0",
|
| 250 |
-
"textAlign": "left",
|
| 251 |
-
},
|
| 252 |
-
),
|
| 253 |
-
html.Th(
|
| 254 |
-
"Name",
|
| 255 |
-
style={
|
| 256 |
-
"backgroundColor": "#F0F0F0",
|
| 257 |
-
"textAlign": "left",
|
| 258 |
-
},
|
| 259 |
-
),
|
| 260 |
-
html.Th(
|
| 261 |
-
"Metadata",
|
| 262 |
-
style={
|
| 263 |
-
"backgroundColor": "#F0F0F0",
|
| 264 |
-
"textAlign": "left",
|
| 265 |
-
"marginRight": "10px",
|
| 266 |
-
},
|
| 267 |
-
),
|
| 268 |
-
html.Th(
|
| 269 |
-
"% of Total",
|
| 270 |
-
style={
|
| 271 |
-
"backgroundColor": "#F0F0F0",
|
| 272 |
-
"textAlign": "left",
|
| 273 |
-
},
|
| 274 |
-
),
|
| 275 |
-
]
|
| 276 |
-
)
|
| 277 |
-
),
|
| 278 |
-
html.Tbody(
|
| 279 |
-
[
|
| 280 |
html.Tr(
|
| 281 |
[
|
| 282 |
-
html.
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
),
|
| 289 |
]
|
| 290 |
)
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
),
|
| 297 |
]
|
| 298 |
)
|
|
|
|
| 238 |
[
|
| 239 |
# Add download button above the table
|
| 240 |
df_to_download_link(download_df, filename),
|
| 241 |
+
# Wrap the table in a horizontal scroll container so the table can be wide
|
| 242 |
+
html.Div(
|
| 243 |
+
# scroll wrapper
|
| 244 |
+
html.Table(
|
| 245 |
+
[
|
| 246 |
+
html.Thead(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
html.Tr(
|
| 248 |
[
|
| 249 |
+
html.Th(
|
| 250 |
+
"Rank",
|
| 251 |
+
className="rank-col",
|
| 252 |
+
style={
|
| 253 |
+
"backgroundColor": "#F0F0F0",
|
| 254 |
+
"textAlign": "left",
|
| 255 |
+
},
|
| 256 |
+
),
|
| 257 |
+
html.Th(
|
| 258 |
+
"Name",
|
| 259 |
+
className="name-col",
|
| 260 |
+
style={
|
| 261 |
+
"backgroundColor": "#F0F0F0",
|
| 262 |
+
"textAlign": "left",
|
| 263 |
+
},
|
| 264 |
+
),
|
| 265 |
+
html.Th(
|
| 266 |
+
"Metadata",
|
| 267 |
+
className="metadata-col",
|
| 268 |
+
style={
|
| 269 |
+
"backgroundColor": "#F0F0F0",
|
| 270 |
+
"textAlign": "left",
|
| 271 |
+
"marginRight": "10px",
|
| 272 |
+
},
|
| 273 |
+
),
|
| 274 |
+
html.Th(
|
| 275 |
+
"% of Total",
|
| 276 |
+
className="percent-col",
|
| 277 |
+
style={
|
| 278 |
+
"backgroundColor": "#F0F0F0",
|
| 279 |
+
"textAlign": "left",
|
| 280 |
+
},
|
| 281 |
),
|
| 282 |
]
|
| 283 |
)
|
| 284 |
+
),
|
| 285 |
+
html.Tbody(
|
| 286 |
+
[
|
| 287 |
+
html.Tr(
|
| 288 |
+
[
|
| 289 |
+
html.Td(idx + 1, style={"textAlign": "center"}),
|
| 290 |
+
html.Td(row["Name"], className="name-cell", style={"textAlign": "left"}),
|
| 291 |
+
html.Td(render_chips(row["Metadata"], chip_color), className="metadata-cell", style={"textAlign": "left", "whiteSpace": "normal", "wordBreak": "break-word"}),
|
| 292 |
+
html.Td(
|
| 293 |
+
progress_bar(row["% of total"], bar_color),
|
| 294 |
+
className="percent-cell",
|
| 295 |
+
style={"textAlign": "center", "minWidth": "180px", "padding": "8px"},
|
| 296 |
+
),
|
| 297 |
+
]
|
| 298 |
+
)
|
| 299 |
+
for idx, row in df.iterrows()
|
| 300 |
+
]
|
| 301 |
+
),
|
| 302 |
+
],
|
| 303 |
+
# allow the table to be wider than its container (minWidth prevents squish)
|
| 304 |
+
style={"borderCollapse": "collapse", "width": "100%", "minWidth": "980px", "tableLayout": "auto"},
|
| 305 |
+
className="leaderboard-table",
|
| 306 |
+
),
|
| 307 |
+
className="leaderboard-scroll-wrapper",
|
| 308 |
+
style={"overflowX": "auto", "-webkit-overflow-scrolling": "touch", "width": "100%"},
|
| 309 |
),
|
| 310 |
]
|
| 311 |
)
|