Fix logo placement and iframe-resizer infinite-scroll on Spaces

#2
by linoyts HF Staff - opened
Files changed (1) hide show
  1. app.py +20 -18
app.py CHANGED
@@ -192,15 +192,14 @@ html, body { margin: 0 !important; padding: 0 !important; overflow: hidden !impo
192
  gradio-app { display: block !important; position: fixed !important; inset: 0 !important; }
193
  footer { display: none !important; }
194
 
195
- /* Header overlay β€” sits above the main split, doesn't take vertical space. */
196
- #header { position: absolute !important; top: 0 !important; left: 0 !important; right: 0 !important;
197
- z-index: 10 !important; display: flex !important; align-items: center !important;
198
- justify-content: space-between !important; padding: 8px 12px !important;
199
- gap: 8px !important; pointer-events: none !important; }
200
- #header > * { pointer-events: auto !important; }
201
- #logo, #logo img { height: 40px !important; width: auto !important; max-width: 40px !important;
202
- object-fit: contain !important; }
203
- #logo { background: transparent !important; border: 0 !important; padding: 0 !important; flex: 0 0 auto !important; }
204
  #pro-cta a { display: inline-block; padding: 6px 12px; border-radius: 999px;
205
  background: linear-gradient(90deg,#ff9500,#34c759); color: #111 !important;
206
  font-weight: 600; font-size: 13px; text-decoration: none; }
@@ -217,8 +216,10 @@ footer { display: none !important; }
217
  #login-modal p { margin: 0 0 16px 0; opacity: 0.8; font-size: 14px; }
218
 
219
  .gradio-container { height: 100% !important; max-width: 100% !important; width: 100% !important; margin: 0 !important; padding: 0 !important; overflow: hidden !important; min-height: 0 !important; }
220
- .gradio-container .main, .gradio-container .wrap, .gradio-container .contain { height: 100% !important; padding: 0 !important; margin: 0 !important; max-width: 100% !important; min-height: 0 !important; }
221
- #main-row { height: 100% !important; gap: 0 !important; margin: 0 !important; padding: 0 !important; flex-wrap: nowrap !important; min-height: 0 !important; }
 
 
222
  #left-col, #right-col { height: 100% !important; padding: 0 !important; margin: 0 !important; min-width: 0 !important; min-height: 0 !important; }
223
  #left-col > *, #right-col > * { border-radius: 0 !important; }
224
  #point-plot, #point-plot > div, #point-plot .js-plotly-plot, #point-plot .plot-container { height: 100% !important; width: 100% !important; }
@@ -298,16 +299,17 @@ with gr.Blocks(title="File Point Cloud", fill_height=True) as demo:
298
  skip_btn = gr.Button("Continue without logging in", variant="secondary", size="sm")
299
  skip_btn.click(lambda: gr.update(visible=False), outputs=[login_modal])
300
 
301
- # Header overlay: logo (top-left) + Pro CTA (top-right). Absolutely
302
- # positioned via CSS so it doesn't interfere with the 50/50 split below.
303
- with gr.Row(elem_id="header"):
 
304
  # height/width are set on the component itself (not just via CSS) so the
305
- # logo renders at 40Γ—40 from the first paint. Otherwise gr.Image briefly
306
- # shows at default size until the injected <style> block applies and
307
- # shrinks it β€” the "logo flashes big then becomes tiny" bug.
308
  gr.Image(
309
  value="logo.png", elem_id="logo", show_label=False, container=False,
310
- interactive=False, buttons=[], height=40, width=40,
311
  )
312
  # Pro CTA β€” hidden by default, shown on .load() if the user is logged in
313
  # but lacks Pro. For the placeholder it just links out to the upgrade page.
 
192
  gradio-app { display: block !important; position: fixed !important; inset: 0 !important; }
193
  footer { display: none !important; }
194
 
195
+ /* Header bar β€” fixed-height row sitting in normal flow above the main split. */
196
+ #header-bar { flex: 0 0 auto !important; display: flex !important; align-items: center !important;
197
+ justify-content: space-between !important; padding: 8px 16px !important;
198
+ gap: 12px !important; margin: 0 !important; min-height: 0 !important;
199
+ border-bottom: 1px solid rgba(255,255,255,0.06) !important; }
200
+ #logo { background: transparent !important; border: 0 !important; padding: 0 !important;
201
+ flex: 0 0 auto !important; min-width: 0 !important; }
202
+ #logo, #logo img { height: 48px !important; width: auto !important; object-fit: contain !important; }
 
203
  #pro-cta a { display: inline-block; padding: 6px 12px; border-radius: 999px;
204
  background: linear-gradient(90deg,#ff9500,#34c759); color: #111 !important;
205
  font-weight: 600; font-size: 13px; text-decoration: none; }
 
216
  #login-modal p { margin: 0 0 16px 0; opacity: 0.8; font-size: 14px; }
217
 
218
  .gradio-container { height: 100% !important; max-width: 100% !important; width: 100% !important; margin: 0 !important; padding: 0 !important; overflow: hidden !important; min-height: 0 !important; }
219
+ /* Make the immediate Gradio wrapper a flex column so #header-bar sits at the
220
+ top at its natural height and #main-row consumes the remaining space. */
221
+ .gradio-container .main, .gradio-container .wrap, .gradio-container .contain { height: 100% !important; padding: 0 !important; margin: 0 !important; max-width: 100% !important; min-height: 0 !important; display: flex !important; flex-direction: column !important; gap: 0 !important; }
222
+ #main-row { flex: 1 1 auto !important; height: auto !important; gap: 0 !important; margin: 0 !important; padding: 0 !important; flex-wrap: nowrap !important; min-height: 0 !important; }
223
  #left-col, #right-col { height: 100% !important; padding: 0 !important; margin: 0 !important; min-width: 0 !important; min-height: 0 !important; }
224
  #left-col > *, #right-col > * { border-radius: 0 !important; }
225
  #point-plot, #point-plot > div, #point-plot .js-plotly-plot, #point-plot .plot-container { height: 100% !important; width: 100% !important; }
 
299
  skip_btn = gr.Button("Continue without logging in", variant="secondary", size="sm")
300
  skip_btn.click(lambda: gr.update(visible=False), outputs=[login_modal])
301
 
302
+ # Header bar: logo (left) + Pro CTA (right). Sits in normal flow above the
303
+ # main split as a fixed-height row; the CSS makes the Gradio wrapper a
304
+ # flex column so #main-row gets the remaining height.
305
+ with gr.Row(elem_id="header-bar"):
306
  # height/width are set on the component itself (not just via CSS) so the
307
+ # logo renders at the final size from the first paint. Otherwise gr.Image
308
+ # briefly shows at default size until the injected <style> block applies
309
+ # β€” the "logo flashes big then becomes tiny" bug.
310
  gr.Image(
311
  value="logo.png", elem_id="logo", show_label=False, container=False,
312
+ interactive=False, buttons=[], height=48, width=48,
313
  )
314
  # Pro CTA β€” hidden by default, shown on .load() if the user is logged in
315
  # but lacks Pro. For the placeholder it just links out to the upgrade page.