techfreakworm commited on
Commit
3fab083
·
unverified ·
1 Parent(s): 1a16457

feat(ui): rewrite _CUSTOM_CSS for Topaz palette + drawer mechanics

Browse files
Files changed (1) hide show
  1. app.py +115 -35
app.py CHANGED
@@ -125,8 +125,7 @@ _bootstrap()
125
  # ---------------------------------------------------------------------------
126
 
127
  _CUSTOM_CSS = """
128
- /* Hide the top tab strip from view, but keep it in the DOM and clickable so
129
- the sidebar buttons can drive selection via programmatic click. */
130
  .aio-tabs > .tab-nav,
131
  .aio-tabs > div:first-child[role="tablist"],
132
  .aio-tabs > div:first-child:has([role="tab"]) {
@@ -139,45 +138,126 @@ _CUSTOM_CSS = """
139
  pointer-events: auto !important;
140
  }
141
 
142
- /* Sidebar nav buttons */
143
- .aio-mode-btn { width: 100%; text-align: left; margin: 2px 0; }
144
- .aio-mode-btn-active { background: rgba(110,168,254,0.15) !important; border-left: 3px solid #6ea8fe !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
 
146
- /* Sidebar headings */
147
- .aio-sidebar-heading { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.6; margin-top: 16px !important; margin-bottom: 4px !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
149
- /* Status banner */
150
- .status-card { padding: 14px 16px; border-radius: 10px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  .status-row { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
152
- .status-stage { font-weight: 600; }
153
- .status-meta { font-size: 12px; opacity: 0.75; }
154
- .status-bar { height: 6px; background: rgba(255,255,255,0.08); border-radius: 99px; overflow: hidden; }
155
- .status-fill { height: 100%; background: linear-gradient(90deg,#6ea8fe,#8de9fe); transition: width .3s; }
156
- .status-mem { font-size: 11px; opacity: 0.6; margin-top: 6px; font-family: ui-monospace, monospace; }
157
- .status-error { background: rgba(255,90,90,0.08); border-color: rgba(255,90,90,0.25); }
158
-
159
- /* Model status badge */
160
- .aio-model-badge { padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,0.04); font-size: 11.5px; font-family: ui-monospace, monospace; opacity: 0.85; }
161
-
162
- /* Responsive: tablet */
163
- @media (max-width: 1024px) {
164
- .aio-sidebar { min-width: 160px !important; }
165
- .aio-mode-btn { font-size: 13px !important; padding: 6px 10px !important; }
166
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
 
168
- /* Responsive: mobile — sidebar collapses to top, single column body */
169
- @media (max-width: 700px) {
170
- .aio-shell { flex-direction: column !important; }
171
- .aio-sidebar { width: 100% !important; min-width: unset !important; padding: 0 !important; }
172
- .aio-body { width: 100% !important; }
173
- .aio-mode-btn-row { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 6px !important; padding: 8px !important; }
174
- .aio-mode-btn { width: 100% !important; font-size: 12.5px !important; padding: 8px !important; text-align: center !important; margin: 0 !important; }
175
- .aio-sidebar-heading { font-size: 10px !important; margin: 12px 0 4px !important; padding: 0 8px !important; }
176
- .aio-model-badge { margin: 0 8px !important; word-break: break-word; white-space: normal !important; }
177
- /* sliders + side-by-side rows: stack vertically on mobile so each value
178
- gets its own width budget */
179
- .aio-body .form > div, .aio-body [class*="row"] > div { flex: 1 1 100% !important; min-width: 0 !important; }
180
  .aio-body [class*="row"] { flex-wrap: wrap !important; }
 
 
 
 
 
181
  }
182
  """
183
 
 
125
  # ---------------------------------------------------------------------------
126
 
127
  _CUSTOM_CSS = """
128
+ /* Hide Gradio's top tab strip sidebar drives selection. */
 
129
  .aio-tabs > .tab-nav,
130
  .aio-tabs > div:first-child[role="tablist"],
131
  .aio-tabs > div:first-child:has([role="tab"]) {
 
138
  pointer-events: auto !important;
139
  }
140
 
141
+ /* === Header === */
142
+ .aio-header {
143
+ display: flex;
144
+ align-items: center;
145
+ gap: 12px;
146
+ padding: 11px 18px;
147
+ border-bottom: 1px solid #262C35;
148
+ background: #12161B;
149
+ }
150
+ .aio-ham-toggle { display: none; } /* hidden checkbox drives drawer state */
151
+ .aio-ham-label {
152
+ width: 32px; height: 32px;
153
+ border: 1px solid #262C35;
154
+ border-radius: 5px;
155
+ color: #7C8693;
156
+ cursor: pointer;
157
+ display: flex; align-items: center; justify-content: center;
158
+ font-size: 18px; font-weight: 300;
159
+ user-select: none;
160
+ }
161
+ .aio-ham-label:hover { color: #E0A458; border-color: #E0A458; }
162
+ .aio-title {
163
+ font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
164
+ color: #E6E8EB;
165
+ }
166
+ .aio-title .accent { color: #E0A458; }
167
+ .aio-mode-tag {
168
+ margin-left: auto;
169
+ padding: 4px 9px;
170
+ font-family: 'IBM Plex Mono', ui-monospace, monospace;
171
+ font-size: 11px; font-weight: 500; letter-spacing: 0.04em;
172
+ color: #E0A458;
173
+ border: 1px solid #E0A458;
174
+ border-radius: 4px;
175
+ }
176
 
177
+ /* === Drawer === */
178
+ .aio-shell { position: relative; }
179
+ .aio-drawer {
180
+ width: 220px;
181
+ border-right: 1px solid #262C35;
182
+ background: #12161B;
183
+ padding: 14px 10px !important;
184
+ flex-shrink: 0;
185
+ transition: transform 0.2s ease, width 0.2s ease;
186
+ }
187
+ .aio-drawer-heading {
188
+ font-family: 'IBM Plex Mono', ui-monospace, monospace;
189
+ font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em;
190
+ color: #7C8693;
191
+ padding: 6px 8px 4px !important;
192
+ margin: 0 !important;
193
+ }
194
+
195
+ /* Mode buttons */
196
+ .aio-mode-btn { width: 100%; text-align: left; margin: 2px 0 !important; }
197
+ .aio-mode-btn-active {
198
+ background: #1A1F26 !important;
199
+ color: #E0A458 !important;
200
+ border-left: 3px solid #E0A458 !important;
201
+ }
202
 
203
+ /* Model status / settings panels */
204
+ .aio-model-badge {
205
+ padding: 9px 11px;
206
+ border-radius: 6px;
207
+ background: #1A1F26;
208
+ border: 1px solid #262C35;
209
+ font-size: 11.5px;
210
+ font-family: 'IBM Plex Mono', ui-monospace, monospace;
211
+ color: #7C8693;
212
+ }
213
+
214
+ /* === Status banner === */
215
+ .status-card {
216
+ padding: 12px 16px;
217
+ border-radius: 6px;
218
+ background: #1A1F26;
219
+ border: 1px solid #262C35;
220
+ }
221
  .status-row { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
222
+ .status-stage { font-weight: 600; color: #E0A458; }
223
+ .status-meta { font-size: 12px; color: #7C8693; font-family: 'IBM Plex Mono', monospace; }
224
+ .status-bar { height: 4px; background: #262C35; border-radius: 99px; overflow: hidden; }
225
+ .status-fill { height: 100%; background: #E0A458; transition: width .3s; }
226
+ .status-mem { font-size: 11px; color: #7C8693; margin-top: 6px; font-family: 'IBM Plex Mono', monospace; }
227
+ .status-error {
228
+ background: #3A1E20 !important;
229
+ border-color: #F4A6A8 !important;
230
+ color: #F4A6A8 !important;
 
 
 
 
 
231
  }
232
+ .status-error .status-stage { color: #F4A6A8; }
233
+
234
+ /* === Drawer toggle behavior at the desktop boundary === */
235
+ @media (max-width: 1023px) {
236
+ .aio-ham-label { display: flex; }
237
+ .aio-drawer {
238
+ position: absolute;
239
+ top: 0; left: 0; bottom: 0;
240
+ z-index: 10;
241
+ box-shadow: 4px 0 24px rgba(0,0,0,0.6);
242
+ transform: translateX(-100%);
243
+ max-width: 80vw;
244
+ }
245
+ /* checkbox at #aio-ham-toggle is the only sibling pattern Gradio
246
+ lets us reach without JS — when checked, slide drawer in. */
247
+ body:has(.aio-ham-toggle:checked) .aio-drawer { transform: translateX(0); }
248
+ body:has(.aio-ham-toggle:checked) .aio-shell::before {
249
+ content: ""; position: absolute; inset: 0;
250
+ background: rgba(0,0,0,0.55); z-index: 9;
251
+ }
252
 
253
+ /* Mobile sub-tweaks */
254
+ .aio-mode-btn { font-size: 13px !important; padding: 7px 10px !important; }
 
 
 
 
 
 
 
 
 
 
255
  .aio-body [class*="row"] { flex-wrap: wrap !important; }
256
+ .aio-body [class*="row"] > div { flex: 1 1 100% !important; min-width: 0 !important; }
257
+ }
258
+
259
+ @media (min-width: 1024px) {
260
+ .aio-ham-label { display: none; }
261
  }
262
  """
263