chrissoria commited on
Commit
43ebc64
·
1 Parent(s): 28fe50a

Force desktop layout with min-width and viewport meta tag modification

Browse files
Files changed (1) hide show
  1. app.py +36 -11
app.py CHANGED
@@ -1212,20 +1212,34 @@ custom_css = """
1212
  min-width: 150px !important;
1213
  }
1214
 
1215
- /* Scale down on mobile to show desktop layout */
 
 
 
 
 
 
1216
  @media screen and (max-width: 768px) {
1217
- .gradio-container {
1218
- zoom: 0.8;
1219
- -moz-transform: scale(0.8);
1220
- -moz-transform-origin: 0 0;
1221
  }
1222
- }
1223
 
1224
- @media screen and (max-width: 480px) {
1225
- .gradio-container {
1226
- zoom: 0.65;
1227
- -moz-transform: scale(0.65);
1228
- -moz-transform-origin: 0 0;
 
 
 
 
 
 
 
 
 
 
 
1229
  }
1230
  }
1231
 
@@ -1486,6 +1500,17 @@ custom_css = """
1486
 
1487
  custom_js = """
1488
  function() {
 
 
 
 
 
 
 
 
 
 
 
1489
  // Add click-to-expand functionality for the plot
1490
  document.addEventListener('click', function(e) {
1491
  const plot = e.target.closest('.expandable-plot');
 
1212
  min-width: 150px !important;
1213
  }
1214
 
1215
+ /* Force desktop layout on all screen sizes */
1216
+ .gradio-container, .main, .wrap, .contain, .app {
1217
+ min-width: 800px !important;
1218
+ width: 100% !important;
1219
+ }
1220
+
1221
+ /* Prevent Gradio's mobile responsive behavior */
1222
  @media screen and (max-width: 768px) {
1223
+ .gradio-container, .main, .wrap, .contain, .app {
1224
+ min-width: 800px !important;
 
 
1225
  }
 
1226
 
1227
+ /* Force rows to stay horizontal */
1228
+ .gradio-row, .row, .flex-row {
1229
+ flex-direction: row !important;
1230
+ flex-wrap: nowrap !important;
1231
+ }
1232
+
1233
+ /* Force columns to maintain width */
1234
+ .gradio-column, .column, .col {
1235
+ min-width: 300px !important;
1236
+ flex: 1 !important;
1237
+ }
1238
+
1239
+ /* Force radio buttons horizontal */
1240
+ [role="radiogroup"], .radio-group {
1241
+ flex-direction: row !important;
1242
+ flex-wrap: nowrap !important;
1243
  }
1244
  }
1245
 
 
1500
 
1501
  custom_js = """
1502
  function() {
1503
+ // Force desktop viewport on mobile
1504
+ var viewport = document.querySelector('meta[name="viewport"]');
1505
+ if (viewport) {
1506
+ viewport.setAttribute('content', 'width=900, initial-scale=0.4, maximum-scale=2.0, user-scalable=yes');
1507
+ } else {
1508
+ var meta = document.createElement('meta');
1509
+ meta.name = 'viewport';
1510
+ meta.content = 'width=900, initial-scale=0.4, maximum-scale=2.0, user-scalable=yes';
1511
+ document.head.appendChild(meta);
1512
+ }
1513
+
1514
  // Add click-to-expand functionality for the plot
1515
  document.addEventListener('click', function(e) {
1516
  const plot = e.target.closest('.expandable-plot');