Spaces:
Running
Running
Fix refresh alignment and tooltip locale issues
Browse files- Align refresh button with dropdown controls via CSS
- Inject script to clean ag-grid title attributes and hide CN tooltips
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- app.py +1 -1
- src/about.py +27 -0
app.py
CHANGED
|
@@ -186,7 +186,7 @@ with gr.Blocks(css=custom_css, title="PhotoBench-Protected Leaderboard") as demo
|
|
| 186 |
label="Sort by",
|
| 187 |
)
|
| 188 |
with gr.Column(scale=1):
|
| 189 |
-
refresh_btn = gr.Button("Refresh", variant="primary")
|
| 190 |
leaderboard_table = gr.DataFrame(
|
| 191 |
label="Top 30",
|
| 192 |
interactive=False,
|
|
|
|
| 186 |
label="Sort by",
|
| 187 |
)
|
| 188 |
with gr.Column(scale=1):
|
| 189 |
+
refresh_btn = gr.Button("Refresh", variant="primary", elem_classes=["refresh-btn"])
|
| 190 |
leaderboard_table = gr.DataFrame(
|
| 191 |
label="Top 30",
|
| 192 |
interactive=False,
|
src/about.py
CHANGED
|
@@ -22,6 +22,20 @@ NAVIGATION = """
|
|
| 22 |
</a>
|
| 23 |
</div>
|
| 24 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
"""
|
| 26 |
|
| 27 |
TITLE = """
|
|
@@ -290,4 +304,17 @@ input:focus, textarea:focus, select:focus {
|
|
| 290 |
.toggle-switch input[type="checkbox"]:checked::after {
|
| 291 |
transform: translateX(20px) !important;
|
| 292 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
"""
|
|
|
|
| 22 |
</a>
|
| 23 |
</div>
|
| 24 |
</div>
|
| 25 |
+
<script>
|
| 26 |
+
(function() {
|
| 27 |
+
function cleanTitles() {
|
| 28 |
+
document.querySelectorAll('.ag-header-cell, .ag-header-cell-label, .ag-header-cell-text, .ag-sort-indicator-container, .ag-header-cell-menu-button, .ag-header-icon').forEach(function(el) {
|
| 29 |
+
el.removeAttribute('title');
|
| 30 |
+
});
|
| 31 |
+
}
|
| 32 |
+
cleanTitles();
|
| 33 |
+
if (window.MutationObserver) {
|
| 34 |
+
var obs = new MutationObserver(cleanTitles);
|
| 35 |
+
obs.observe(document.body, { childList: true, subtree: true });
|
| 36 |
+
}
|
| 37 |
+
})();
|
| 38 |
+
</script>
|
| 39 |
"""
|
| 40 |
|
| 41 |
TITLE = """
|
|
|
|
| 304 |
.toggle-switch input[type="checkbox"]:checked::after {
|
| 305 |
transform: translateX(20px) !important;
|
| 306 |
}
|
| 307 |
+
|
| 308 |
+
/* Refresh button vertical alignment */
|
| 309 |
+
.refresh-btn {
|
| 310 |
+
margin-top: 30px !important;
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
/* Hide ag-grid header menu button and tooltips to prevent mixed CN/EN UI */
|
| 314 |
+
.ag-header-cell-menu-button {
|
| 315 |
+
display: none !important;
|
| 316 |
+
}
|
| 317 |
+
.ag-tooltip {
|
| 318 |
+
display: none !important;
|
| 319 |
+
}
|
| 320 |
"""
|